@uni2c/graphqlapi4mp 1.0.7 → 1.0.9
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.cjs +15 -13
- package/dist/index.mjs +15 -13
- package/dist/processData.d.ts +13 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e){let t=(e,t)=>e+t&4294967295,n=(e,n,r,i,a,o)=>(n=t(t(n,e),t(i,o)),t(n<<a|n>>>32-a,r)),r=(e,t,r,i,a,o,s)=>n(t&r|~t&i,e,t,a,o,s),i=(e,t,r,i,a,o,s)=>n(t&i|r&~i,e,t,a,o,s),a=(e,t,r,i,a,o,s)=>n(t^r^i,e,t,a,o,s),o=(e,t,r,i,a,o,s)=>n(r^(t|~i),e,t,a,o,s),s=(e=>unescape(encodeURIComponent(e)))(e),c=s.length,l=[];for(let e=0;e<c;e++)l[e>>2]=(l[e>>2]||0)|s.charCodeAt(e)<<e%4*8;l[c>>2]=(l[c>>2]||0)|128<<c%4*8,l[((c+8>>6)+1)*16-2]=c*8;let u=1732584193,d=-271733879,f=-1732584194,p=271733878;for(let e=0;e<l.length;e+=16){let n=u,s=d,c=f,m=p;u=r(u,d,f,p,l[e]||0,7,-680876936),p=r(p,u,d,f,l[e+1]||0,12,-389564586),f=r(f,p,u,d,l[e+2]||0,17,606105819),d=r(d,f,p,u,l[e+3]||0,22,-1044525330),u=r(u,d,f,p,l[e+4]||0,7,-176418897),p=r(p,u,d,f,l[e+5]||0,12,1200080426),f=r(f,p,u,d,l[e+6]||0,17,-1473231341),d=r(d,f,p,u,l[e+7]||0,22,-45705983),u=r(u,d,f,p,l[e+8]||0,7,1770035416),p=r(p,u,d,f,l[e+9]||0,12,-1958414417),f=r(f,p,u,d,l[e+10]||0,17,-42063),d=r(d,f,p,u,l[e+11]||0,22,-1990404162),u=r(u,d,f,p,l[e+12]||0,7,1804603682),p=r(p,u,d,f,l[e+13]||0,12,-40341101),f=r(f,p,u,d,l[e+14]||0,17,-1502002290),d=r(d,f,p,u,l[e+15]||0,22,1236535329),u=i(u,d,f,p,l[e+1]||0,5,-165796510),p=i(p,u,d,f,l[e+6]||0,9,-1069501632),f=i(f,p,u,d,l[e+11]||0,14,643717713),d=i(d,f,p,u,l[e]||0,20,-373897302),u=i(u,d,f,p,l[e+5]||0,5,-701558691),p=i(p,u,d,f,l[e+10]||0,9,38016083),f=i(f,p,u,d,l[e+15]||0,14,-660478335),d=i(d,f,p,u,l[e+4]||0,20,-405537848),u=i(u,d,f,p,l[e+9]||0,5,568446438),p=i(p,u,d,f,l[e+14]||0,9,-1019803690),f=i(f,p,u,d,l[e+3]||0,14,-187363961),d=i(d,f,p,u,l[e+8]||0,20,1163531501),u=i(u,d,f,p,l[e+13]||0,5,-1444681467),p=i(p,u,d,f,l[e+2]||0,9,-51403784),f=i(f,p,u,d,l[e+7]||0,14,1735328473),d=i(d,f,p,u,l[e+12]||0,20,-1926607734),u=a(u,d,f,p,l[e+5]||0,4,-378558),p=a(p,u,d,f,l[e+8]||0,11,-2022574463),f=a(f,p,u,d,l[e+11]||0,16,1839030562),d=a(d,f,p,u,l[e+14]||0,23,-35309556),u=a(u,d,f,p,l[e+1]||0,4,-1530992060),p=a(p,u,d,f,l[e+4]||0,11,1272893353),f=a(f,p,u,d,l[e+7]||0,16,-155497632),d=a(d,f,p,u,l[e+10]||0,23,-1094730640),u=a(u,d,f,p,l[e+13]||0,4,681279174),p=a(p,u,d,f,l[e]||0,11,-358537222),f=a(f,p,u,d,l[e+3]||0,16,-722521979),d=a(d,f,p,u,l[e+6]||0,23,76029189),u=a(u,d,f,p,l[e+9]||0,4,-640364487),p=a(p,u,d,f,l[e+12]||0,11,-421815835),f=a(f,p,u,d,l[e+15]||0,16,530742520),d=a(d,f,p,u,l[e+2]||0,23,-995338651),u=o(u,d,f,p,l[e]||0,6,-198630844),p=o(p,u,d,f,l[e+7]||0,10,1126891415),f=o(f,p,u,d,l[e+14]||0,15,-1416354905),d=o(d,f,p,u,l[e+5]||0,21,-57434055),u=o(u,d,f,p,l[e+12]||0,6,1700485571),p=o(p,u,d,f,l[e+3]||0,10,-1894986606),f=o(f,p,u,d,l[e+10]||0,15,-1051523),d=o(d,f,p,u,l[e+1]||0,21,-2054922799),u=o(u,d,f,p,l[e+8]||0,6,1873313359),p=o(p,u,d,f,l[e+15]||0,10,-30611744),f=o(f,p,u,d,l[e+6]||0,15,-1560198380),d=o(d,f,p,u,l[e+13]||0,21,1309151649),u=o(u,d,f,p,l[e+4]||0,6,-145523070),p=o(p,u,d,f,l[e+11]||0,10,-1120210379),f=o(f,p,u,d,l[e+2]||0,15,718787259),d=o(d,f,p,u,l[e+9]||0,21,-343485551),u=t(u,n),d=t(d,s),f=t(f,c),p=t(p,m)}let m=e=>{let t=``;for(let n=0;n<4;n++)t+=`0${(e>>>n*8&255).toString(16)}`.slice(-2);return t};return m(u)+m(d)+m(f)+m(p)}
|
|
2
2
|
/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
|
|
3
|
-
function t(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}const n=e=>e?`"${e}" `:``;function r(e,t=``){if(typeof e!=`number`)throw TypeError(n(t)+`expected number, got `+typeof e);if(!Number.isSafeInteger(e)||e<0)throw RangeError(n(t)+`expected integer >= 0, got `+e);return e}function i(e,i,a=``){if(t(e)&&(i===void 0||e.length===i))return e;i!==void 0&&r(i,`length`);let o=t(e),s=i===void 0?``:` of length ${i}`,c=o?`length=${e.length}`:`type=${typeof e}`,l=n(a)+`expected Uint8Array`+s+`, got `+c;throw o?RangeError(l):TypeError(l)}function a(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function o(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const s=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function c(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function l(e){for(let t=0;t<e.length;t++)e[t]=c(e[t]);return e}const u=s?e=>e:l;function d(e,t){return!e.byteLength||!t.byteLength?!1:e.buffer===t.buffer&&e.byteOffset<t.byteOffset+t.byteLength&&t.byteOffset<e.byteOffset+e.byteLength}function f(e,t){if(d(e,t)&&e.byteOffset<t.byteOffset)throw Error(`complex overlap of input and output is not supported`)}const p=(e,n)=>{function r(r,...a){if(i(r,void 0,`key`),e.nonceLength!==void 0){let t=a[0];i(t,e.varSizeNonce?void 0:e.nonceLength,`nonce`)}let o=e.tagLength,s=e.nonceLength===void 0?0:1;if(!e.withAAD){for(let e=s;e<a.length;e++)if(t(a[e]))throw Error(`AAD not supported`)}e.withAAD&&a[s]!==void 0&&i(a[s],void 0,`AAD`);let c=n(r,...a),l=(e,t)=>{if(t!==void 0){if(e!==2)throw Error(`cipher output not supported`);i(t,void 0,`output`)}},u=!1;return{encrypt(e,t){if(u)throw Error(`cannot encrypt() twice with same key + nonce`);return u=!0,i(e,void 0,`data`),l(c.encrypt.length,t),c.encrypt(e,t)},decrypt(e,t){if(i(e,void 0,`data`),o&&e.length<o)throw Error(`"ciphertext" expected length >= tagLength=`+o);return l(c.decrypt.length,t),c.decrypt(e,t)}}}return Object.assign(r,e),r};function m(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(i(t,e,`output`),n&&!h(t))throw Error(`invalid output, must be aligned`);return t}function h(e){return e.byteOffset%4==0}function g(e){return Uint8Array.from(i(e))}function _(e){if(![16,24,32].includes(e.length))throw Error(`"aes key" expected Uint8Array of length 16/24/32, got length=`+e.length)}function v(e){return e<<1^283&-(e>>7)}function y(e,t){let n=0;for(;t>0;t>>=1)n^=e&-(t&1),e=v(e);return n}const b=(()=>{let e=new Uint8Array(256);for(let t=0,n=1;t<256;t++,n^=v(n))e[t]=n;let t=new Uint8Array(256);t[0]=99;for(let n=0;n<255;n++){let r=e[255-n];r|=r<<8,t[e[n]]=(r^r>>4^r>>5^r>>6^r>>7^99)&255}return o(e),t})(),x=b.map((e,t)=>b.indexOf(t)),S=e=>e<<24|e>>>8,C=e=>e<<8|e>>>24;function w(e,t){if(e.length!==256)throw Error(`wrong sbox length`);let n=new Uint32Array(256).map((n,r)=>t(e[r])),r=n.map(C),i=r.map(C),a=i.map(C),o=new Uint32Array(65536),s=new Uint32Array(65536),c=new Uint16Array(65536);for(let t=0;t<256;t++)for(let l=0;l<256;l++){let u=t*256+l;o[u]=n[t]^r[l],s[u]=i[t]^a[l],c[u]=e[t]<<8|e[l]}return{sbox:e,sbox2:c,T0:n,T1:r,T2:i,T3:a,T01:o,T23:s}}const T=w(b,e=>y(e,3)<<24|e<<16|e<<8|y(e,2)),E=w(x,e=>y(e,11)<<24|y(e,13)<<16|y(e,9)<<8|y(e,14)),ee=(()=>{let e=new Uint8Array(16);for(let t=0,n=1;t<16;t++,n=v(n))e[t]=n;return e})();function D(e){i(e);let t=e.length;_(e);let{sbox2:n}=T,r=[];(!s||!h(e))&&r.push(e=g(e));let c=u(a(e)),l=c.length,d=e=>k(n,e,e,e,e),f=new Uint32Array(t+28);f.set(c);for(let e=l;e<f.length;e++){let t=f[e-1];e%l===0?t=d(S(t))^ee[e/l-1]:l>6&&e%l===4&&(t=d(t)),f[e]=f[e-l]^t}return o(...r),f}function te(e){let t=D(e),n=t.slice(),r=t.length,{sbox2:i}=T,{T0:a,T1:s,T2:c,T3:l}=E;for(let e=0;e<r;e+=4)for(let i=0;i<4;i++)n[e+i]=t[r-e-4+i];o(t);for(let e=4;e<r-4;e++){let t=n[e],r=k(i,t,t,t,t);n[e]=a[r&255]^s[r>>>8&255]^c[r>>>16&255]^l[r>>>24]}return n}function O(e,t,n,r,i,a){return e[n<<8&65280|r>>>8&255]^t[i>>>8&65280|a>>>24&255]}function k(e,t,n,r,i){return e[t&255|n&65280]|e[r>>>16&255|i>>>16&65280]<<16}function ne(e,t,n,r,i){let{sbox2:a,T01:o,T23:s}=T,c=0;t^=e[c++],n^=e[c++],r^=e[c++],i^=e[c++];let l=e.length/4-2;for(let a=0;a<l;a++){let a=e[c++]^O(o,s,t,n,r,i),l=e[c++]^O(o,s,n,r,i,t),u=e[c++]^O(o,s,r,i,t,n),d=e[c++]^O(o,s,i,t,n,r);t=a,n=l,r=u,i=d}return{s0:e[c++]^k(a,t,n,r,i),s1:e[c++]^k(a,n,r,i,t),s2:e[c++]^k(a,r,i,t,n),s3:e[c++]^k(a,i,t,n,r)}}function re(e,t,n,r,i){let{sbox2:a,T01:o,T23:s}=E,c=0;t^=e[c++],n^=e[c++],r^=e[c++],i^=e[c++];let l=e.length/4-2;for(let a=0;a<l;a++){let a=e[c++]^O(o,s,t,i,r,n),l=e[c++]^O(o,s,n,t,i,r),u=e[c++]^O(o,s,r,n,t,i),d=e[c++]^O(o,s,i,r,n,t);t=a,n=l,r=u,i=d}return{s0:e[c++]^k(a,t,i,r,n),s1:e[c++]^k(a,n,t,i,r),s2:e[c++]^k(a,r,n,t,i),s3:e[c++]^k(a,i,r,n,t)}}function ie(e,t){if(i(e),e.length%16!=0)throw Error(`ciphertext must be multiple of 16`);t!==void 0&&(m(e.length,t),f(e,t))}function ae(e,t,n){i(e);let r=e.length,a=r%16;if(!t&&a!==0)throw Error(`plaintext must be multiple of 16`);if(t){let e=16-a;e||=16,r+=e}return n!==void 0&&(m(r,n),f(e,n)),r}function oe(e,t,n){n===void 0&&(n=new Uint8Array(t)),(!s||!h(e))&&(e=g(e));let r=a(n);return{b:e,o:r,out:n}}function se(e,t){if(!t)return e;let n=e.length;if(n===0)throw Error(`pkcs7: empty ciphertext not allowed`);let r=e[n-1],i=1;i&=r-1>>>31^1,i&=16-r>>>31^1;for(let t=0;t<16;t++){let a=t-r>>>31,o=+((e[n-1-t]^r)===0);i&=o|a^1}if(!i)throw Error(`aes: bad decrypt`);return e.subarray(0,n-r)}function ce(e){let t=new Uint8Array(16),n=a(t);t.set(e);let r=16-e.length;for(let e=16-r;e<16;e++)t[e]=r;return n}const le=p({blockSize:16,nonceLength:16},function(e,t,n={}){let r=!n.disablePadding;return{encrypt(n,i){let c=ae(n,r,i),l=D(e),{b:d,o:f,out:p}=oe(n,c,i),m=a(d);u(m);let _=t,v=[l];(!s||!h(_))&&v.push(_=g(_));let y=a(_);u(y);let b=y[0],x=y[1],S=y[2],C=y[3],w=0;for(;w+4<=m.length;)b^=m[w+0],x^=m[w+1],S^=m[w+2],C^=m[w+3],{s0:b,s1:x,s2:S,s3:C}=ne(l,b,x,S,C),f[w++]=b,f[w++]=x,f[w++]=S,f[w++]=C;if(r){let e=ce(n.subarray(w*4));u(e),b^=e[0],x^=e[1],S^=e[2],C^=e[3],{s0:b,s1:x,s2:S,s3:C}=ne(l,b,x,S,C),f[w++]=b,f[w++]=x,f[w++]=S,f[w++]=C,o(e)}return u(f),o(...v),d!==n&&o(d),p},decrypt(n,i){ie(n,i);let c=te(e);i===void 0&&(i=new Uint8Array(n.length));let l=t,d=[c];(!s||!h(l))&&d.push(l=g(l));let f=a(l);u(f),(!s||!h(n))&&d.push(n=g(n));let p=a(n),m=a(i);u(p);let _=f[0],v=f[1],y=f[2],b=f[3];for(let e=0;e+4<=p.length;){let t=_,n=v,r=y,i=b;_=p[e+0],v=p[e+1],y=p[e+2],b=p[e+3];let{s0:a,s1:o,s2:s,s3:l}=re(c,_,v,y,b);m[e++]=a^t,m[e++]=o^n,m[e++]=s^r,m[e++]=l^i}return u(m),o(...d),se(i,r)}}});var ue=`0123456789abcdefghijklmnopqrstuvwxyz`;function A(e){return ue.charAt(e)}function de(e,t){return e&t}function
|
|
4
|
-
\r \xA0\u2028\u2029`;for(
|
|
5
|
-
\r \xA0\u2028\u2029`;for(
|
|
6
|
-
`;break;default:r+=` `}return r},e.prototype.isASCII=function(e,t){for(var n=e;n<t;++n){var r=this.get(n);if(r<32||r>176)return!1}return!0},e.prototype.parseStringISO=function(e,t){for(var n=``,r=e;r<t;++r)n+=String.fromCharCode(this.get(r));return n},e.prototype.parseStringUTF=function(e,t){for(var n=``,r=e;r<t;){var i=this.get(r++);n+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((i&31)<<6|this.get(r++)&63):String.fromCharCode((i&15)<<12|(this.get(r++)&63)<<6|this.get(r++)&63)}return n},e.prototype.parseStringBMP=function(e,t){for(var n=``,r,i,a=e;a<t;)r=this.get(a++),i=this.get(a++),n+=String.fromCharCode(r<<8|i);return n},e.prototype.parseTime=function(e,t,n){var r=this.parseStringISO(e,t),i=(n?
|
|
7
|
-
`}r&&(n-=256);for(var s=new
|
|
8
|
-
`,a=``,o=e+1;o<t;++o){for(var s=this.get(o),c=o==t-1?r:0,l=7;l>=c;--l)a+=s>>l&1?`1`:`0`;if(a.length>n)return i+
|
|
9
|
-
`;n/=2,r>n&&(t=e+n);for(var a=e;a<t;++a)i+=this.hexByte(this.get(a));return r>n&&(i+=
|
|
10
|
-
`,this.sub!==null){e+=` `;for(var n=0,r=this.sub.length;n<r;++n)t+=this.sub[n].toPrettyString(e)}return t},e.prototype.posStart=function(){return this.stream.pos},e.prototype.posContent=function(){return this.stream.pos+this.header},e.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},e.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},e.decodeLength=function(e){var t=e.get(),n=t&127;if(n==t)return n;if(n>6)throw Error(`Length over 48 bits not supported at position `+(e.pos-1));if(n===0)return null;t=0;for(var r=0;r<n;++r)t=t*256+e.get();return t},e.prototype.getHexStringValue=function(){var e=this.toHexString(),t=this.header*2,n=this.length*2;return e.substr(t,n)},e.decode=function(t){var n=t instanceof Ce?t:new Ce(t,0),r=new Ce(n),i=new Te(n),a=e.decodeLength(n),o=n.pos,s=o-r.pos,c=null,l=function(){var t=[];if(a!==null){for(var r=o+a;n.pos<r;)t[t.length]=e.decode(n);if(n.pos!=r)throw Error(`Content size is not correct for container starting at offset `+o)}else try{for(;;){var i=e.decode(n);if(i.tag.isEOC())break;t[t.length]=i}a=o-n.pos}catch(e){throw Error(`Exception while decoding undefined length content: `+e)}return t};if(i.tagConstructed)c=l();else if(i.isUniversal()&&(i.tagNumber==3||i.tagNumber==4))try{if(i.tagNumber==3&&n.get()!=0)throw Error(`BIT STRINGs with unused bits cannot encapsulate.`);c=l();for(var u=0;u<c.length;++u)if(c[u].tag.isEOC())throw Error(`EOC is not supposed to be actual content.`)}catch{c=null}if(c===null){if(a===null)throw Error(`We can't skip over an invalid tag with undefined length at offset `+o);n.pos=o+Math.abs(a)}return new e(r,s,a,i,c)},e}(),Te=function(){function e(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=!!(t&32),this.tagNumber=t&31,this.tagNumber==31){var n=new L;do t=e.get(),n.mulAdd(128,t&127);while(t&128);this.tagNumber=n.simplify()}}return e.prototype.isUniversal=function(){return this.tagClass===0},e.prototype.isEOC=function(){return this.tagClass===0&&this.tagNumber===0},e}(),z,Ee=!0,B=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],De=(1<<26)/B[B.length-1],V=function(){function e(e,t,n){e!=null&&(typeof e==`number`?this.fromNumber(e,t,n):t==null&&typeof e!=`string`?this.fromString(e,256):this.fromString(e,t))}return e.prototype.toString=function(e){if(this.s<0)return`-`+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var n=(1<<t)-1,r,i=!1,a=``,o=this.t,s=this.DB-o*this.DB%t;if(o-->0)for(s<this.DB&&(r=this[o]>>s)>0&&(i=!0,a=A(r));o>=0;)s<t?(r=(this[o]&(1<<s)-1)<<t-s,r|=this[--o]>>(s+=this.DB-t)):(r=this[o]>>(s-=t)&n,s<=0&&(s+=this.DB,--o)),r>0&&(i=!0),i&&(a+=A(r));return i?a:`0`},e.prototype.negate=function(){var t=H();return e.ZERO.subTo(this,t),t},e.prototype.abs=function(){return this.s<0?this.negate():this},e.prototype.compareTo=function(e){var t=this.s-e.s;if(t!=0)return t;var n=this.t;if(t=n-e.t,t!=0)return this.s<0?-t:t;for(;--n>=0;)if((t=this[n]-e[n])!=0)return t;return 0},e.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+q(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=H();return this.abs().divRemTo(t,null,n),this.s<0&&n.compareTo(e.ZERO)>0&&t.subTo(n,n),n},e.prototype.modPowInt=function(e,t){var n=e<256||t.isEven()?new ke(t):new Ae(t);return this.exp(e,n)},e.prototype.clone=function(){var e=H();return this.copyTo(e),e},e.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else if(this.t==1)return this[0];else if(this.t==0)return 0;return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},e.prototype.byteValue=function(){return this.t==0?this.s:this[0]<<24>>24},e.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},e.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},e.prototype.toByteArray=function(){var e=this.t,t=[];t[0]=this.s;var n=this.DB-e*this.DB%8,r,i=0;if(e-->0)for(n<this.DB&&(r=this[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this[e]&(1<<n)-1)<<8-n,r|=this[--e]>>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),r&128&&(r|=-256),i==0&&(this.s&128)!=(r&128)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},e.prototype.equals=function(e){return this.compareTo(e)==0},e.prototype.min=function(e){return this.compareTo(e)<0?this:e},e.prototype.max=function(e){return this.compareTo(e)>0?this:e},e.prototype.and=function(e){var t=H();return this.bitwiseTo(e,de,t),t},e.prototype.or=function(e){var t=H();return this.bitwiseTo(e,j,t),t},e.prototype.xor=function(e){var t=H();return this.bitwiseTo(e,fe,t),t},e.prototype.andNot=function(e){var t=H();return this.bitwiseTo(e,pe,t),t},e.prototype.not=function(){for(var e=H(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},e.prototype.shiftLeft=function(e){var t=H();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=H();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},e.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+me(this[e]);return this.s<0?this.t*this.DB:-1},e.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,n=0;n<this.t;++n)e+=he(this[n]^t);return e},e.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:!!(this[t]&1<<e%this.DB)},e.prototype.setBit=function(e){return this.changeBit(e,j)},e.prototype.clearBit=function(e){return this.changeBit(e,pe)},e.prototype.flipBit=function(e){return this.changeBit(e,fe)},e.prototype.add=function(e){var t=H();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=H();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=H();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=H();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=H();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=H(),n=H();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n=e.bitLength(),r,i=K(1),a;if(n<=0)return i;r=n<18?1:n<48?3:n<144?4:n<768?5:6,a=n<8?new ke(t):t.isEven()?new je(t):new Ae(t);var o=[],s=3,c=r-1,l=(1<<r)-1;if(o[1]=a.convert(this),r>1){var u=H();for(a.sqrTo(o[1],u);s<=l;)o[s]=H(),a.mulTo(u,o[s-2],o[s]),s+=2}var d=e.t-1,f,p=!0,m=H(),h;for(n=q(e[d])-1;d>=0;){for(n>=c?f=e[d]>>n-c&l:(f=(e[d]&(1<<n+1)-1)<<c-n,d>0&&(f|=e[d-1]>>this.DB+n-c)),s=r;!(f&1);)f>>=1,--s;if((n-=s)<0&&(n+=this.DB,--d),p)o[f].copyTo(i),p=!1;else{for(;s>1;)a.sqrTo(i,m),a.sqrTo(m,i),s-=2;s>0?a.sqrTo(i,m):(h=i,i=m,m=h),a.mulTo(m,o[f],i)}for(;d>=0&&!(e[d]&1<<n);)a.sqrTo(i,m),h=i,i=m,m=h,--n<0&&(n=this.DB-1,--d)}return a.revert(i)},e.prototype.modInverse=function(t){var n=t.isEven();if(this.isEven()&&n||t.signum()==0)return e.ZERO;for(var r=t.clone(),i=this.clone(),a=K(1),o=K(0),s=K(0),c=K(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),n?((!a.isEven()||!o.isEven())&&(a.addTo(this,a),o.subTo(t,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),n?((!s.isEven()||!c.isEven())&&(s.addTo(this,s),c.subTo(t,c)),s.rShiftTo(1,s)):c.isEven()||c.subTo(t,c),c.rShiftTo(1,c);r.compareTo(i)>=0?(r.subTo(i,r),n&&a.subTo(s,a),o.subTo(c,o)):(i.subTo(r,i),n&&s.subTo(a,s),c.subTo(o,c))}if(i.compareTo(e.ONE)!=0)return e.ZERO;if(c.compareTo(t)>=0)return c.subtract(t);if(c.signum()<0)c.addTo(t,c);else return c;return c.signum()<0?c.add(t):c},e.prototype.pow=function(e){return this.exp(e,new Oe)},e.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(t.compareTo(n)<0){var r=t;t=n,n=r}var i=t.getLowestSetBit(),a=n.getLowestSetBit();if(a<0)return t;for(i<a&&(a=i),a>0&&(t.rShiftTo(a,t),n.rShiftTo(a,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return a>0&&n.lShiftTo(a,n),n},e.prototype.isProbablePrime=function(e){var t,n=this.abs();if(n.t==1&&n[0]<=B[B.length-1]){for(t=0;t<B.length;++t)if(n[0]==B[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<B.length;){for(var r=B[t],i=t+1;i<B.length&&r<De;)r*=B[i++];for(r=n.modInt(r);t<i;)if(r%B[t++]==0)return!1}return n.millerRabin(e)},e.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},e.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},e.prototype.fromString=function(t,n){var r;if(n==16)r=4;else if(n==8)r=3;else if(n==256)r=8;else if(n==2)r=1;else if(n==32)r=5;else if(n==4)r=2;else{this.fromRadix(t,n);return}this.t=0,this.s=0;for(var i=t.length,a=!1,o=0;--i>=0;){var s=r==8?t[i]&255:Fe(t,i);if(s<0){t.charAt(i)==`-`&&(a=!0);continue}a=!1,o==0?this[this.t++]=s:o+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,o+=r,o>=this.DB&&(o-=this.DB)}r==8&&t[0]&128&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),a&&e.ZERO.subTo(this,this)},e.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},e.prototype.dlShiftTo=function(e,t){for(var n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},e.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},e.prototype.lShiftTo=function(e,t){for(var n=e%this.DB,r=this.DB-n,i=(1<<r)-1,a=Math.floor(e/this.DB),o=this.s<<n&this.DM,s=this.t-1;s>=0;--s)t[s+a+1]=this[s]>>r|o,o=(this[s]&i)<<n;for(var s=a-1;s>=0;--s)t[s]=0;t[a]=o,t.t=this.t+a+1,t.s=this.s,t.clamp()},e.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t){t.t=0;return}var r=e%this.DB,i=this.DB-r,a=(1<<r)-1;t[0]=this[n]>>r;for(var o=n+1;o<this.t;++o)t[o-n-1]|=(this[o]&a)<<i,t[o-n]=this[o]>>r;r>0&&(t[this.t-n-1]|=(this.s&a)<<i),t.t=this.t-n,t.clamp()},e.prototype.subTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()},e.prototype.multiplyTo=function(t,n){var r=this.abs(),i=t.abs(),a=r.t;for(n.t=a+i.t;--a>=0;)n[a]=0;for(a=0;a<i.t;++a)n[a+r.t]=r.am(0,i[a],n,a,0,r.t);n.s=0,n.clamp(),this.s!=t.s&&e.ZERO.subTo(n,n)},e.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},e.prototype.divRemTo=function(t,n,r){var i=t.abs();if(!(i.t<=0)){var a=this.abs();if(a.t<i.t){n?.fromInt(0),r!=null&&this.copyTo(r);return}r??=H();var o=H(),s=this.s,c=t.s,l=this.DB-q(i[i.t-1]);l>0?(i.lShiftTo(l,o),a.lShiftTo(l,r)):(i.copyTo(o),a.copyTo(r));var u=o.t,d=o[u-1];if(d!=0){var f=d*(1<<this.F1)+(u>1?o[u-2]>>this.F2:0),p=this.FV/f,m=(1<<this.F1)/f,h=1<<this.F2,g=r.t,_=g-u,v=n??H();for(o.dlShiftTo(_,v),r.compareTo(v)>=0&&(r[r.t++]=1,r.subTo(v,r)),e.ONE.dlShiftTo(u,v),v.subTo(o,o);o.t<u;)o[o.t++]=0;for(;--_>=0;){var y=r[--g]==d?this.DM:Math.floor(r[g]*p+(r[g-1]+h)*m);if((r[g]+=o.am(0,y,r,_,0,u))<y)for(o.dlShiftTo(_,v),r.subTo(v,r);r[g]<--y;)r.subTo(v,r)}n!=null&&(r.drShiftTo(u,n),s!=c&&e.ZERO.subTo(n,n)),r.t=u,r.clamp(),l>0&&r.rShiftTo(l,r),s<0&&e.ZERO.subTo(r,r)}}},e.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(!(e&1))return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t},e.prototype.isEven=function(){return(this.t>0?this[0]&1:this.s)==0},e.prototype.exp=function(t,n){if(t>4294967295||t<1)return e.ONE;var r=H(),i=H(),a=n.convert(this),o=q(t)-1;for(a.copyTo(r);--o>=0;)if(n.sqrTo(r,i),(t&1<<o)>0)n.mulTo(i,a,r);else{var s=r;r=i,i=s}return n.revert(r)},e.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},e.prototype.toRadix=function(e){if(e??=10,this.signum()==0||e<2||e>36)return`0`;var t=this.chunkSize(e),n=e**+t,r=K(n),i=H(),a=H(),o=``;for(this.divRemTo(r,i,a);i.signum()>0;)o=(n+a.intValue()).toString(e).substr(1)+o,i.divRemTo(r,i,a);return a.intValue().toString(e)+o},e.prototype.fromRadix=function(t,n){this.fromInt(0),n??=10;for(var r=this.chunkSize(n),i=n**+r,a=!1,o=0,s=0,c=0;c<t.length;++c){var l=Fe(t,c);if(l<0){t.charAt(c)==`-`&&this.signum()==0&&(a=!0);continue}s=n*s+l,++o>=r&&(this.dMultiply(i),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(n**+o),this.dAddOffset(s,0)),a&&e.ZERO.subTo(this,this)},e.prototype.fromNumber=function(t,n,r){if(typeof n==`number`){if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),j,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this)}else{var i=[],a=t&7;i.length=(t>>3)+1,n.nextBytes(i),a>0?i[0]&=(1<<a)-1:i[0]=0,this.fromString(i,256)}},e.prototype.bitwiseTo=function(e,t,n){var r,i,a=Math.min(e.t,this.t);for(r=0;r<a;++r)n[r]=t(this[r],e[r]);if(e.t<this.t){for(i=e.s&this.DM,r=a;r<this.t;++r)n[r]=t(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=a;r<e.t;++r)n[r]=t(i,e[r]);n.t=e.t}n.s=t(this.s,e.s),n.clamp()},e.prototype.changeBit=function(t,n){var r=e.ONE.shiftLeft(t);return this.bitwiseTo(r,n,r),r},e.prototype.addTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]+e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r+=e[n],t[n++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()},e.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},e.prototype.dAddOffset=function(e,t){if(e!=0){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},e.prototype.multiplyLowerTo=function(e,t,n){var r=Math.min(this.t+e.t,t);for(n.s=0,n.t=r;r>0;)n[--r]=0;for(var i=n.t-this.t;r<i;++r)n[r+this.t]=this.am(0,e[r],n,r,0,this.t);for(var i=Math.min(e.t,t);r<i;++r)this.am(0,e[r],n,r,0,t-r);n.clamp()},e.prototype.multiplyUpperTo=function(e,t,n){--t;var r=n.t=this.t+e.t-t;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)n[this.t+r-t]=this.am(t-r,e[r],n,0,0,this.t+r-t);n.clamp(),n.drShiftTo(1,n)},e.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0){if(t==0)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e}return n},e.prototype.millerRabin=function(t){var n=this.subtract(e.ONE),r=n.getLowestSetBit();if(r<=0)return!1;var i=n.shiftRight(r);t=t+1>>1,t>B.length&&(t=B.length);for(var a=H(),o=0;o<t;++o){a.fromInt(B[Math.floor(Math.random()*B.length)]);var s=a.modPow(i,this);if(s.compareTo(e.ONE)!=0&&s.compareTo(n)!=0){for(var c=1;c++<r&&s.compareTo(n)!=0;)if(s=s.modPowInt(2,this),s.compareTo(e.ONE)==0)return!1;if(s.compareTo(n)!=0)return!1}}return!0},e.prototype.square=function(){var e=H();return this.squareTo(e),e},e.prototype.gcda=function(e,t){var n=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(n.compareTo(r)<0){var i=n;n=r,r=i}var a=n.getLowestSetBit(),o=r.getLowestSetBit();if(o<0){t(n);return}a<o&&(o=a),o>0&&(n.rShiftTo(o,n),r.rShiftTo(o,r));var s=function(){(a=n.getLowestSetBit())>0&&n.rShiftTo(a,n),(a=r.getLowestSetBit())>0&&r.rShiftTo(a,r),n.compareTo(r)>=0?(n.subTo(r,n),n.rShiftTo(1,n)):(r.subTo(n,r),r.rShiftTo(1,r)),n.signum()>0?setTimeout(s,0):(o>0&&r.lShiftTo(o,r),setTimeout(function(){t(r)},0))};setTimeout(s,10)},e.prototype.fromNumberAsync=function(t,n,r,i){if(typeof n==`number`){if(t<2)this.fromInt(1);else{this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),j,this),this.isEven()&&this.dAddOffset(1,0);var a=this,o=function(){a.dAddOffset(2,0),a.bitLength()>t&&a.subTo(e.ONE.shiftLeft(t-1),a),a.isProbablePrime(n)?setTimeout(function(){i()},0):setTimeout(o,0)};setTimeout(o,0)}}else{var s=[],c=t&7;s.length=(t>>3)+1,n.nextBytes(s),c>0?s[0]&=(1<<c)-1:s[0]=0,this.fromString(s,256)}},e}(),Oe=function(){function e(){}return e.prototype.convert=function(e){return e},e.prototype.revert=function(e){return e},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},e.prototype.sqrTo=function(e,t){e.squareTo(t)},e}(),ke=function(){function e(e){this.m=e}return e.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),Ae=function(){function e(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return e.prototype.convert=function(e){var t=H();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(V.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=H();return e.copyTo(t),this.reduce(t),t},e.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=e[t]&32767,r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),je=function(){function e(e){this.m=e,this.r2=H(),this.q3=H(),V.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return e.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=H();return e.copyTo(t),this.reduce(t),t},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}();function H(){return new V(null)}function U(e,t){return new V(e,t)}var Me=typeof navigator<`u`;Me&&Ee&&navigator.appName==`Microsoft Internet Explorer`?(V.prototype.am=function(e,t,n,r,i,a){for(var o=t&32767,s=t>>15;--a>=0;){var c=this[e]&32767,l=this[e++]>>15,u=s*c+l*o;c=o*c+((u&32767)<<15)+n[r]+(i&1073741823),i=(c>>>30)+(u>>>15)+s*l+(i>>>30),n[r++]=c&1073741823}return i},z=30):Me&&Ee&&navigator.appName!=`Netscape`?(V.prototype.am=function(e,t,n,r,i,a){for(;--a>=0;){var o=t*this[e++]+n[r]+i;i=Math.floor(o/67108864),n[r++]=o&67108863}return i},z=26):(V.prototype.am=function(e,t,n,r,i,a){for(var o=t&16383,s=t>>14;--a>=0;){var c=this[e]&16383,l=this[e++]>>14,u=s*c+l*o;c=o*c+((u&16383)<<14)+n[r]+i,i=(c>>28)+(u>>14)+s*l,n[r++]=c&268435455}return i},z=28),V.prototype.DB=z,V.prototype.DM=(1<<z)-1,V.prototype.DV=1<<z;var Ne=52;V.prototype.FV=2**Ne,V.prototype.F1=Ne-z,V.prototype.F2=2*z-Ne;for(var Pe=[],W=48,G=0;G<=9;++G)Pe[W++]=G;for(W=97,G=10;G<36;++G)Pe[W++]=G;for(W=65,G=10;G<36;++G)Pe[W++]=G;function Fe(e,t){return Pe[e.charCodeAt(t)]??-1}function K(e){var t=H();return t.fromInt(e),t}function q(e){var t=1,n;return(n=e>>>16)!=0&&(e=n,t+=16),(n=e>>8)!=0&&(e=n,t+=8),(n=e>>4)!=0&&(e=n,t+=4),(n=e>>2)!=0&&(e=n,t+=2),(n=e>>1)!=0&&(e=n,t+=1),t}V.ZERO=K(0),V.ONE=K(1);var Ie=function(){function e(){this.i=0,this.j=0,this.S=[]}return e.prototype.init=function(e){for(var t=0,n,r;t<256;++t)this.S[t]=t;for(n=0,t=0;t<256;++t)n=n+this.S[t]+e[t%e.length]&255,r=this.S[t],this.S[t]=this.S[n],this.S[n]=r;this.i=0,this.j=0},e.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]},e}();function Le(){return new Ie}var Re,J=null,Y;J??(J=[],Y=0);function ze(){if(Re==null){for(Re=Le();Y<256;){var e=Math.floor(65536*Math.random());J[Y++]=e&255}for(Re.init(J),Y=0;Y<J.length;++Y)J[Y]=0;Y=0}return Re.next()}var Be=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=ze()},e}();function Ve(e,t){if(t<e.length+22)return console.error(`Message too long for RSA`),null;for(var n=t-e.length-6,r=``,i=0;i<n;i+=2)r+=`ff`;return U(`0001`+r+`00`+e,16)}function He(e,t){if(t<e.length+11)return console.error(`Message too long for RSA`),null;for(var n=[],r=e.length-1;r>=0&&t>0;){var i=e.charCodeAt(r--);i<128?n[--t]=i:i>127&&i<2048?(n[--t]=i&63|128,n[--t]=i>>6|192):(n[--t]=i&63|128,n[--t]=i>>6&63|128,n[--t]=i>>12|224)}n[--t]=0;for(var a=new Be,o=[];t>2;){for(o[0]=0;o[0]==0;)a.nextBytes(o);n[--t]=o[0]}return n[--t]=2,n[--t]=0,new V(n)}var Ue=function(){function e(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return e.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},e.prototype.doPrivate=function(e){if(this.p==null||this.q==null)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),n=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(n)<0;)t=t.add(this.p);return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},e.prototype.setPublic=function(e,t){e!=null&&t!=null&&e.length>0&&t.length>0?(this.n=U(e,16),this.e=parseInt(t,16)):console.error(`Invalid RSA public key`)},e.prototype.encrypt=function(e){var t=this.n.bitLength()+7>>3,n=He(e,t);if(n==null)return null;var r=this.doPublic(n);if(r==null)return null;for(var i=r.toString(16),a=i.length,o=0;o<t*2-a;o++)i=`0`+i;return i},e.prototype.setPrivate=function(e,t,n){e!=null&&t!=null&&e.length>0&&t.length>0?(this.n=U(e,16),this.e=parseInt(t,16),this.d=U(n,16)):console.error(`Invalid RSA private key`)},e.prototype.setPrivateEx=function(e,t,n,r,i,a,o,s){e!=null&&t!=null&&e.length>0&&t.length>0?(this.n=U(e,16),this.e=parseInt(t,16),this.d=U(n,16),this.p=U(r,16),this.q=U(i,16),this.dmp1=U(a,16),this.dmq1=U(o,16),this.coeff=U(s,16)):console.error(`Invalid RSA private key`)},e.prototype.generate=function(e,t){var n=new Be,r=e>>1;this.e=parseInt(t,16);for(var i=new V(t,16);;){for(;this.p=new V(e-r,1,n),!(this.p.subtract(V.ONE).gcd(i).compareTo(V.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new V(r,1,n),!(this.q.subtract(V.ONE).gcd(i).compareTo(V.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var a=this.p;this.p=this.q,this.q=a}var o=this.p.subtract(V.ONE),s=this.q.subtract(V.ONE),c=o.multiply(s);if(c.gcd(i).compareTo(V.ONE)==0){this.n=this.p.multiply(this.q),this.d=i.modInverse(c),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(s),this.coeff=this.q.modInverse(this.p);break}}},e.prototype.decrypt=function(e){var t=U(e,16),n=this.doPrivate(t);return n==null?null:We(n,this.n.bitLength()+7>>3)},e.prototype.generateAsync=function(e,t,n){var r=new Be,i=e>>1;this.e=parseInt(t,16);var a=new V(t,16),o=this,s=function(){var t=function(){if(o.p.compareTo(o.q)<=0){var e=o.p;o.p=o.q,o.q=e}var t=o.p.subtract(V.ONE),r=o.q.subtract(V.ONE),i=t.multiply(r);i.gcd(a).compareTo(V.ONE)==0?(o.n=o.p.multiply(o.q),o.d=a.modInverse(i),o.dmp1=o.d.mod(t),o.dmq1=o.d.mod(r),o.coeff=o.q.modInverse(o.p),setTimeout(function(){n()},0)):setTimeout(s,0)},c=function(){o.q=H(),o.q.fromNumberAsync(i,1,r,function(){o.q.subtract(V.ONE).gcda(a,function(e){e.compareTo(V.ONE)==0&&o.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(c,0)})})},l=function(){o.p=H(),o.p.fromNumberAsync(e-i,1,r,function(){o.p.subtract(V.ONE).gcda(a,function(e){e.compareTo(V.ONE)==0&&o.p.isProbablePrime(10)?setTimeout(c,0):setTimeout(l,0)})})};setTimeout(l,0)};setTimeout(s,0)},e.prototype.sign=function(e,t,n){var r=Ve(qe(n)+t(e).toString(),this.n.bitLength()/4);if(r==null)return null;var i=this.doPrivate(r);if(i==null)return null;var a=i.toString(16);return a.length&1?`0`+a:a},e.prototype.verify=function(e,t,n){var r=U(t,16),i=this.doPublic(r);return i==null?null:Je(i.toString(16).replace(/^1f+00/,``))==n(e).toString()},e.prototype.encryptLong=function(e){var t=this,n=``,r=(this.n.bitLength()+7>>3)-11;return this.setSplitChn(e,r).forEach(function(e){n+=t.encrypt(e)}),n},e.prototype.decryptLong=function(e){var t=``,n=this.n.bitLength()+7>>3,r=n*2;if(e.length>r){for(var i=e.match(RegExp(`.{1,`+r+`}`,`g`))||[],a=[],o=0;o<i.length;o++){var s=U(i[o],16),c=this.doPrivate(s);if(c==null)return null;a.push(c)}t=Ge(a,n)}else t=this.decrypt(e);return t},e.prototype.setSplitChn=function(e,t,n){n===void 0&&(n=[]);for(var r=e.split(``),i=0,a=0;a<r.length;a++){var o=r[a].charCodeAt(0);if(i+=o<=127?1:o<=2047?2:o<=65535?3:4,i>t){var s=e.substring(0,a);return n.push(s),this.setSplitChn(e.substring(a),t,n)}}return n.push(e),n},e}();function We(e,t){for(var n=e.toByteArray(),r=0;r<n.length&&n[r]==0;)++r;if(n.length-r!=t-1||n[r]!=2)return null;for(++r;n[r]!=0;)if(++r>=n.length)return null;for(var i=``;++r<n.length;){var a=n[r]&255;a<128?i+=String.fromCharCode(a):a>191&&a<224?(i+=String.fromCharCode((a&31)<<6|n[r+1]&63),++r):(i+=String.fromCharCode((a&15)<<12|(n[r+1]&63)<<6|n[r+2]&63),r+=2)}return i}function Ge(e,t){for(var n=[],r=0;r<e.length;r++){for(var i=e[r].toByteArray(),a=0;a<i.length&&i[a]==0;)++a;if(i.length-a!=t-1||i[a]!=2)return null;for(++a;i[a]!=0;)if(++a>=i.length)return null;n=n.concat(i.slice(a+1))}for(var o=n,s=-1,c=``;++s<o.length;){var l=o[s]&255;l<128?c+=String.fromCharCode(l):l>191&&l<224?(c+=String.fromCharCode((l&31)<<6|o[s+1]&63),++s):(c+=String.fromCharCode((l&15)<<12|(o[s+1]&63)<<6|o[s+2]&63),s+=2)}return c}var Ke={md2:`3020300c06082a864886f70d020205000410`,md5:`3020300c06082a864886f70d020505000410`,sha1:`3021300906052b0e03021a05000414`,sha224:`302d300d06096086480165030402040500041c`,sha256:`3031300d060960864801650304020105000420`,sha384:`3041300d060960864801650304020205000430`,sha512:`3051300d060960864801650304020305000440`,ripemd160:`3021300906052b2403020105000414`};function qe(e){return Ke[e]||``}function Je(e){for(var t in Ke)if(Ke.hasOwnProperty(t)){var n=Ke[t],r=n.length;if(e.substr(0,r)==n)return e.substr(r)}return e}
|
|
3
|
+
function t(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}const n=e=>e?`"${e}" `:``;function r(e,t=``){if(typeof e!=`number`)throw TypeError(n(t)+`expected number, got `+typeof e);if(!Number.isSafeInteger(e)||e<0)throw RangeError(n(t)+`expected integer >= 0, got `+e);return e}function i(e,i,a=``){if(t(e)&&(i===void 0||e.length===i))return e;i!==void 0&&r(i,`length`);let o=t(e),s=i===void 0?``:` of length ${i}`,c=o?`length=${e.length}`:`type=${typeof e}`,l=n(a)+`expected Uint8Array`+s+`, got `+c;throw o?RangeError(l):TypeError(l)}function a(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function o(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const s=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function c(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function l(e){for(let t=0;t<e.length;t++)e[t]=c(e[t]);return e}const u=s?e=>e:l;function d(e,t){return!e.byteLength||!t.byteLength?!1:e.buffer===t.buffer&&e.byteOffset<t.byteOffset+t.byteLength&&t.byteOffset<e.byteOffset+e.byteLength}function f(e,t){if(d(e,t)&&e.byteOffset<t.byteOffset)throw Error(`complex overlap of input and output is not supported`)}const p=(e,n)=>{function r(r,...a){if(i(r,void 0,`key`),e.nonceLength!==void 0){let t=a[0];i(t,e.varSizeNonce?void 0:e.nonceLength,`nonce`)}let o=e.tagLength,s=e.nonceLength===void 0?0:1;if(!e.withAAD){for(let e=s;e<a.length;e++)if(t(a[e]))throw Error(`AAD not supported`)}e.withAAD&&a[s]!==void 0&&i(a[s],void 0,`AAD`);let c=n(r,...a),l=(e,t)=>{if(t!==void 0){if(e!==2)throw Error(`cipher output not supported`);i(t,void 0,`output`)}},u=!1;return{encrypt(e,t){if(u)throw Error(`cannot encrypt() twice with same key + nonce`);return u=!0,i(e,void 0,`data`),l(c.encrypt.length,t),c.encrypt(e,t)},decrypt(e,t){if(i(e,void 0,`data`),o&&e.length<o)throw Error(`"ciphertext" expected length >= tagLength=`+o);return l(c.decrypt.length,t),c.decrypt(e,t)}}}return Object.assign(r,e),r};function m(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(i(t,e,`output`),n&&!h(t))throw Error(`invalid output, must be aligned`);return t}function h(e){return e.byteOffset%4==0}function g(e){return Uint8Array.from(i(e))}function _(e){if(![16,24,32].includes(e.length))throw Error(`"aes key" expected Uint8Array of length 16/24/32, got length=`+e.length)}function v(e){return e<<1^283&-(e>>7)}function y(e,t){let n=0;for(;t>0;t>>=1)n^=e&-(t&1),e=v(e);return n}const b=(()=>{let e=new Uint8Array(256);for(let t=0,n=1;t<256;t++,n^=v(n))e[t]=n;let t=new Uint8Array(256);t[0]=99;for(let n=0;n<255;n++){let r=e[255-n];r|=r<<8,t[e[n]]=(r^r>>4^r>>5^r>>6^r>>7^99)&255}return o(e),t})(),x=b.map((e,t)=>b.indexOf(t)),S=e=>e<<24|e>>>8,C=e=>e<<8|e>>>24;function w(e,t){if(e.length!==256)throw Error(`wrong sbox length`);let n=new Uint32Array(256).map((n,r)=>t(e[r])),r=n.map(C),i=r.map(C),a=i.map(C),o=new Uint32Array(65536),s=new Uint32Array(65536),c=new Uint16Array(65536);for(let t=0;t<256;t++)for(let l=0;l<256;l++){let u=t*256+l;o[u]=n[t]^r[l],s[u]=i[t]^a[l],c[u]=e[t]<<8|e[l]}return{sbox:e,sbox2:c,T0:n,T1:r,T2:i,T3:a,T01:o,T23:s}}const T=w(b,e=>y(e,3)<<24|e<<16|e<<8|y(e,2)),E=w(x,e=>y(e,11)<<24|y(e,13)<<16|y(e,9)<<8|y(e,14)),ee=(()=>{let e=new Uint8Array(16);for(let t=0,n=1;t<16;t++,n=v(n))e[t]=n;return e})();function D(e){i(e);let t=e.length;_(e);let{sbox2:n}=T,r=[];(!s||!h(e))&&r.push(e=g(e));let c=u(a(e)),l=c.length,d=e=>k(n,e,e,e,e),f=new Uint32Array(t+28);f.set(c);for(let e=l;e<f.length;e++){let t=f[e-1];e%l===0?t=d(S(t))^ee[e/l-1]:l>6&&e%l===4&&(t=d(t)),f[e]=f[e-l]^t}return o(...r),f}function te(e){let t=D(e),n=t.slice(),r=t.length,{sbox2:i}=T,{T0:a,T1:s,T2:c,T3:l}=E;for(let e=0;e<r;e+=4)for(let i=0;i<4;i++)n[e+i]=t[r-e-4+i];o(t);for(let e=4;e<r-4;e++){let t=n[e],r=k(i,t,t,t,t);n[e]=a[r&255]^s[r>>>8&255]^c[r>>>16&255]^l[r>>>24]}return n}function O(e,t,n,r,i,a){return e[n<<8&65280|r>>>8&255]^t[i>>>8&65280|a>>>24&255]}function k(e,t,n,r,i){return e[t&255|n&65280]|e[r>>>16&255|i>>>16&65280]<<16}function ne(e,t,n,r,i){let{sbox2:a,T01:o,T23:s}=T,c=0;t^=e[c++],n^=e[c++],r^=e[c++],i^=e[c++];let l=e.length/4-2;for(let a=0;a<l;a++){let a=e[c++]^O(o,s,t,n,r,i),l=e[c++]^O(o,s,n,r,i,t),u=e[c++]^O(o,s,r,i,t,n),d=e[c++]^O(o,s,i,t,n,r);t=a,n=l,r=u,i=d}return{s0:e[c++]^k(a,t,n,r,i),s1:e[c++]^k(a,n,r,i,t),s2:e[c++]^k(a,r,i,t,n),s3:e[c++]^k(a,i,t,n,r)}}function re(e,t,n,r,i){let{sbox2:a,T01:o,T23:s}=E,c=0;t^=e[c++],n^=e[c++],r^=e[c++],i^=e[c++];let l=e.length/4-2;for(let a=0;a<l;a++){let a=e[c++]^O(o,s,t,i,r,n),l=e[c++]^O(o,s,n,t,i,r),u=e[c++]^O(o,s,r,n,t,i),d=e[c++]^O(o,s,i,r,n,t);t=a,n=l,r=u,i=d}return{s0:e[c++]^k(a,t,i,r,n),s1:e[c++]^k(a,n,t,i,r),s2:e[c++]^k(a,r,n,t,i),s3:e[c++]^k(a,i,r,n,t)}}function ie(e,t){if(i(e),e.length%16!=0)throw Error(`ciphertext must be multiple of 16`);t!==void 0&&(m(e.length,t),f(e,t))}function ae(e,t,n){i(e);let r=e.length,a=r%16;if(!t&&a!==0)throw Error(`plaintext must be multiple of 16`);if(t){let e=16-a;e||=16,r+=e}return n!==void 0&&(m(r,n),f(e,n)),r}function oe(e,t,n){n===void 0&&(n=new Uint8Array(t)),(!s||!h(e))&&(e=g(e));let r=a(n);return{b:e,o:r,out:n}}function se(e,t){if(!t)return e;let n=e.length;if(n===0)throw Error(`pkcs7: empty ciphertext not allowed`);let r=e[n-1],i=1;i&=r-1>>>31^1,i&=16-r>>>31^1;for(let t=0;t<16;t++){let a=t-r>>>31,o=+((e[n-1-t]^r)===0);i&=o|a^1}if(!i)throw Error(`aes: bad decrypt`);return e.subarray(0,n-r)}function ce(e){let t=new Uint8Array(16),n=a(t);t.set(e);let r=16-e.length;for(let e=16-r;e<16;e++)t[e]=r;return n}const le=p({blockSize:16,nonceLength:16},function(e,t,n={}){let r=!n.disablePadding;return{encrypt(n,i){let c=ae(n,r,i),l=D(e),{b:d,o:f,out:p}=oe(n,c,i),m=a(d);u(m);let _=t,v=[l];(!s||!h(_))&&v.push(_=g(_));let y=a(_);u(y);let b=y[0],x=y[1],S=y[2],C=y[3],w=0;for(;w+4<=m.length;)b^=m[w+0],x^=m[w+1],S^=m[w+2],C^=m[w+3],{s0:b,s1:x,s2:S,s3:C}=ne(l,b,x,S,C),f[w++]=b,f[w++]=x,f[w++]=S,f[w++]=C;if(r){let e=ce(n.subarray(w*4));u(e),b^=e[0],x^=e[1],S^=e[2],C^=e[3],{s0:b,s1:x,s2:S,s3:C}=ne(l,b,x,S,C),f[w++]=b,f[w++]=x,f[w++]=S,f[w++]=C,o(e)}return u(f),o(...v),d!==n&&o(d),p},decrypt(n,i){ie(n,i);let c=te(e);i===void 0&&(i=new Uint8Array(n.length));let l=t,d=[c];(!s||!h(l))&&d.push(l=g(l));let f=a(l);u(f),(!s||!h(n))&&d.push(n=g(n));let p=a(n),m=a(i);u(p);let _=f[0],v=f[1],y=f[2],b=f[3];for(let e=0;e+4<=p.length;){let t=_,n=v,r=y,i=b;_=p[e+0],v=p[e+1],y=p[e+2],b=p[e+3];let{s0:a,s1:o,s2:s,s3:l}=re(c,_,v,y,b);m[e++]=a^t,m[e++]=o^n,m[e++]=s^r,m[e++]=l^i}return u(m),o(...d),se(i,r)}}});var ue=`0123456789abcdefghijklmnopqrstuvwxyz`;function A(e){return ue.charAt(e)}function de(e,t){return e&t}function fe(e,t){return e|t}function pe(e,t){return e^t}function me(e,t){return e&~t}function he(e){if(e==0)return-1;var t=0;return e&65535||(e>>=16,t+=16),e&255||(e>>=8,t+=8),e&15||(e>>=4,t+=4),e&3||(e>>=2,t+=2),e&1||++t,t}function ge(e){for(var t=0;e!=0;)e&=e-1,++t;return t}var j=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,_e=`=`;function M(e){var t,n,r=``;for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=j.charAt(n>>6)+j.charAt(n&63);for(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=j.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=j.charAt(n>>2)+j.charAt((n&3)<<4));(r.length&3)>0;)r+=_e;return r}function ve(e){var t=``,n,r=0,i=0;for(n=0;n<e.length&&e.charAt(n)!=_e;++n){var a=j.indexOf(e.charAt(n));a<0||(r==0?(t+=A(a>>2),i=a&3,r=1):r==1?(t+=A(i<<2|a>>4),i=a&15,r=2):r==2?(t+=A(i),t+=A(a>>2),i=a&3,r=3):(t+=A(i<<2|a>>4),t+=A(a&15),r=0))}return r==1&&(t+=A(i<<2)),t}var N,ye={decode:function(e){var t;if(N===void 0){var n=`0123456789ABCDEF`,r=` \f
|
|
4
|
+
\r \xA0\u2028\u2029`;for(N={},t=0;t<16;++t)N[n.charAt(t)]=t;for(n=n.toLowerCase(),t=10;t<16;++t)N[n.charAt(t)]=t;for(t=0;t<r.length;++t)N[r.charAt(t)]=-1}var i=[],a=0,o=0;for(t=0;t<e.length;++t){var s=e.charAt(t);if(s==`=`)break;if(s=N[s],s!=-1){if(s===void 0)throw Error(`Illegal character at offset `+t);a|=s,++o>=2?(i[i.length]=a,a=0,o=0):a<<=4}}if(o)throw Error(`Hex encoding incomplete: 4 bits missing`);return i}},P,be={decode:function(e){var t;if(P===void 0){var n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,r=`= \f
|
|
5
|
+
\r \xA0\u2028\u2029`;for(P=Object.create(null),t=0;t<64;++t)P[n.charAt(t)]=t;for(P[`-`]=62,P._=63,t=0;t<r.length;++t)P[r.charAt(t)]=-1}var i=[],a=0,o=0;for(t=0;t<e.length;++t){var s=e.charAt(t);if(s==`=`)break;if(s=P[s],s!=-1){if(s===void 0)throw Error(`Illegal character at offset `+t);a|=s,++o>=4?(i[i.length]=a>>16,i[i.length]=a>>8&255,i[i.length]=a&255,a=0,o=0):a<<=6}}switch(o){case 1:throw Error(`Base64 encoding incomplete: at least 2 bits missing`);case 2:i[i.length]=a>>10;break;case 3:i[i.length]=a>>16,i[i.length]=a>>8&255}return i},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=be.re.exec(e);if(t){if(t[1])e=t[1];else if(t[2])e=t[2];else throw Error(`RegExp out of sync`)}return be.decode(e)}},F=0x9184e72a000,I=function(){function e(e){this.buf=[+e||0]}return e.prototype.mulAdd=function(e,t){for(var n=this.buf,r=n.length,i=0,a;i<r;++i)a=n[i]*e+t,a<F?t=0:(t=0|a/F,a-=t*F),n[i]=a;t>0&&(n[i]=t)},e.prototype.sub=function(e){for(var t=this.buf,n=t.length,r=0,i;r<n;++r)i=t[r]-e,i<0?(i+=F,e=1):e=0,t[r]=i;for(;t[t.length-1]===0;)t.pop()},e.prototype.toString=function(e){if((e||10)!=10)throw Error(`only base 10 is supported`);for(var t=this.buf,n=t[t.length-1].toString(),r=t.length-2;r>=0;--r)n+=(F+t[r]).toString().substring(1);return n},e.prototype.valueOf=function(){for(var e=this.buf,t=0,n=e.length-1;n>=0;--n)t=t*F+e[n];return t},e.prototype.simplify=function(){var e=this.buf;return e.length==1?e[0]:this},e}(),xe=`…`,Se=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,Ce=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function L(e,t){return e.length>t&&(e=e.substring(0,t)+xe),e}var we=function(){function e(t,n){this.hexDigits=`0123456789ABCDEF`,t instanceof e?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=n)}return e.prototype.get=function(e){if(e===void 0&&(e=this.pos++),e>=this.enc.length)throw Error(`Requesting byte offset `+e+` on a stream of length `+this.enc.length);return typeof this.enc==`string`?this.enc.charCodeAt(e):this.enc[e]},e.prototype.hexByte=function(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(e&15)},e.prototype.hexDump=function(e,t,n){for(var r=``,i=e;i<t;++i)if(r+=this.hexByte(this.get(i)),n!==!0)switch(i&15){case 7:r+=` `;break;case 15:r+=`
|
|
6
|
+
`;break;default:r+=` `}return r},e.prototype.isASCII=function(e,t){for(var n=e;n<t;++n){var r=this.get(n);if(r<32||r>176)return!1}return!0},e.prototype.parseStringISO=function(e,t){for(var n=``,r=e;r<t;++r)n+=String.fromCharCode(this.get(r));return n},e.prototype.parseStringUTF=function(e,t){for(var n=``,r=e;r<t;){var i=this.get(r++);n+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((i&31)<<6|this.get(r++)&63):String.fromCharCode((i&15)<<12|(this.get(r++)&63)<<6|this.get(r++)&63)}return n},e.prototype.parseStringBMP=function(e,t){for(var n=``,r,i,a=e;a<t;)r=this.get(a++),i=this.get(a++),n+=String.fromCharCode(r<<8|i);return n},e.prototype.parseTime=function(e,t,n){var r=this.parseStringISO(e,t),i=(n?Se:Ce).exec(r);return i?(n&&(i[1]=+i[1],i[1]+=+i[1]<70?2e3:1900),r=i[1]+`-`+i[2]+`-`+i[3]+` `+i[4],i[5]&&(r+=`:`+i[5],i[6]&&(r+=`:`+i[6],i[7]&&(r+=`.`+i[7]))),i[8]&&(r+=` UTC`,i[8]!=`Z`&&(r+=i[8],i[9]&&(r+=`:`+i[9]))),r):`Unrecognized time: `+r},e.prototype.parseInteger=function(e,t){for(var n=this.get(e),r=n>127,i=r?255:0,a,o=``;n==i&&++e<t;)n=this.get(e);if(a=t-e,a===0)return r?-1:0;if(a>4){for(o=n,a<<=3;!((+o^i)&128);)o<<=1,--a;o=`(`+a+` bit)
|
|
7
|
+
`}r&&(n-=256);for(var s=new I(n),c=e+1;c<t;++c)s.mulAdd(256,this.get(c));return o+s.toString()},e.prototype.parseBitString=function(e,t,n){for(var r=this.get(e),i=`(`+((t-e-1<<3)-r)+` bit)
|
|
8
|
+
`,a=``,o=e+1;o<t;++o){for(var s=this.get(o),c=o==t-1?r:0,l=7;l>=c;--l)a+=s>>l&1?`1`:`0`;if(a.length>n)return i+L(a,n)}return i+a},e.prototype.parseOctetString=function(e,t,n){if(this.isASCII(e,t))return L(this.parseStringISO(e,t),n);var r=t-e,i=`(`+r+` byte)
|
|
9
|
+
`;n/=2,r>n&&(t=e+n);for(var a=e;a<t;++a)i+=this.hexByte(this.get(a));return r>n&&(i+=xe),i},e.prototype.parseOID=function(e,t,n){for(var r=``,i=new I,a=0,o=e;o<t;++o){var s=this.get(o);if(i.mulAdd(128,s&127),a+=7,!(s&128)){if(r===``){if(i=i.simplify(),i instanceof I)i.sub(80),r=`2.`+i.toString();else{var c=i<80?i<40?0:1:2;r=c+`.`+(i-c*40)}}else r+=`.`+i.toString();if(r.length>n)return L(r,n);i=new I,a=0}}return a>0&&(r+=`.incomplete`),r},e}(),Te=function(){function e(e,t,n,r,i){if(!(r instanceof Ee))throw Error(`Invalid tag value.`);this.stream=e,this.header=t,this.length=n,this.tag=r,this.sub=i}return e.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return`EOC`;case 1:return`BOOLEAN`;case 2:return`INTEGER`;case 3:return`BIT_STRING`;case 4:return`OCTET_STRING`;case 5:return`NULL`;case 6:return`OBJECT_IDENTIFIER`;case 7:return`ObjectDescriptor`;case 8:return`EXTERNAL`;case 9:return`REAL`;case 10:return`ENUMERATED`;case 11:return`EMBEDDED_PDV`;case 12:return`UTF8String`;case 16:return`SEQUENCE`;case 17:return`SET`;case 18:return`NumericString`;case 19:return`PrintableString`;case 20:return`TeletexString`;case 21:return`VideotexString`;case 22:return`IA5String`;case 23:return`UTCTime`;case 24:return`GeneralizedTime`;case 25:return`GraphicString`;case 26:return`VisibleString`;case 27:return`GeneralString`;case 28:return`UniversalString`;case 30:return`BMPString`}return`Universal_`+this.tag.tagNumber.toString();case 1:return`Application_`+this.tag.tagNumber.toString();case 2:return`[`+this.tag.tagNumber.toString()+`]`;case 3:return`Private_`+this.tag.tagNumber.toString()}},e.prototype.content=function(e){if(this.tag===void 0)return null;e===void 0&&(e=1/0);var t=this.posContent(),n=Math.abs(this.length);if(!this.tag.isUniversal())return this.sub===null?this.stream.parseOctetString(t,t+n,e):`(`+this.sub.length+` elem)`;switch(this.tag.tagNumber){case 1:return this.stream.get(t)===0?`false`:`true`;case 2:return this.stream.parseInteger(t,t+n);case 3:return this.sub?`(`+this.sub.length+` elem)`:this.stream.parseBitString(t,t+n,e);case 4:return this.sub?`(`+this.sub.length+` elem)`:this.stream.parseOctetString(t,t+n,e);case 6:return this.stream.parseOID(t,t+n,e);case 16:case 17:return this.sub===null?`(no elem)`:`(`+this.sub.length+` elem)`;case 12:return L(this.stream.parseStringUTF(t,t+n),e);case 18:case 19:case 20:case 21:case 22:case 26:return L(this.stream.parseStringISO(t,t+n),e);case 30:return L(this.stream.parseStringBMP(t,t+n),e);case 23:case 24:return this.stream.parseTime(t,t+n,this.tag.tagNumber==23)}return null},e.prototype.toString=function(){return this.typeName()+`@`+this.stream.pos+`[header:`+this.header+`,length:`+this.length+`,sub:`+(this.sub===null?`null`:this.sub.length)+`]`},e.prototype.toPrettyString=function(e){e===void 0&&(e=``);var t=e+this.typeName()+` @`+this.stream.pos;if(this.length>=0&&(t+=`+`),t+=this.length,this.tag.tagConstructed?t+=` (constructed)`:this.tag.isUniversal()&&(this.tag.tagNumber==3||this.tag.tagNumber==4)&&this.sub!==null&&(t+=` (encapsulates)`),t+=`
|
|
10
|
+
`,this.sub!==null){e+=` `;for(var n=0,r=this.sub.length;n<r;++n)t+=this.sub[n].toPrettyString(e)}return t},e.prototype.posStart=function(){return this.stream.pos},e.prototype.posContent=function(){return this.stream.pos+this.header},e.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},e.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},e.decodeLength=function(e){var t=e.get(),n=t&127;if(n==t)return n;if(n>6)throw Error(`Length over 48 bits not supported at position `+(e.pos-1));if(n===0)return null;t=0;for(var r=0;r<n;++r)t=t*256+e.get();return t},e.prototype.getHexStringValue=function(){var e=this.toHexString(),t=this.header*2,n=this.length*2;return e.substr(t,n)},e.decode=function(t){var n=t instanceof we?t:new we(t,0),r=new we(n),i=new Ee(n),a=e.decodeLength(n),o=n.pos,s=o-r.pos,c=null,l=function(){var t=[];if(a!==null){for(var r=o+a;n.pos<r;)t[t.length]=e.decode(n);if(n.pos!=r)throw Error(`Content size is not correct for container starting at offset `+o)}else try{for(;;){var i=e.decode(n);if(i.tag.isEOC())break;t[t.length]=i}a=o-n.pos}catch(e){throw Error(`Exception while decoding undefined length content: `+e)}return t};if(i.tagConstructed)c=l();else if(i.isUniversal()&&(i.tagNumber==3||i.tagNumber==4))try{if(i.tagNumber==3&&n.get()!=0)throw Error(`BIT STRINGs with unused bits cannot encapsulate.`);c=l();for(var u=0;u<c.length;++u)if(c[u].tag.isEOC())throw Error(`EOC is not supposed to be actual content.`)}catch{c=null}if(c===null){if(a===null)throw Error(`We can't skip over an invalid tag with undefined length at offset `+o);n.pos=o+Math.abs(a)}return new e(r,s,a,i,c)},e}(),Ee=function(){function e(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=!!(t&32),this.tagNumber=t&31,this.tagNumber==31){var n=new I;do t=e.get(),n.mulAdd(128,t&127);while(t&128);this.tagNumber=n.simplify()}}return e.prototype.isUniversal=function(){return this.tagClass===0},e.prototype.isEOC=function(){return this.tagClass===0&&this.tagNumber===0},e}(),R,De=!0,z=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Oe=(1<<26)/z[z.length-1],B=function(){function e(e,t,n){e!=null&&(typeof e==`number`?this.fromNumber(e,t,n):t==null&&typeof e!=`string`?this.fromString(e,256):this.fromString(e,t))}return e.prototype.toString=function(e){if(this.s<0)return`-`+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var n=(1<<t)-1,r,i=!1,a=``,o=this.t,s=this.DB-o*this.DB%t;if(o-->0)for(s<this.DB&&(r=this[o]>>s)>0&&(i=!0,a=A(r));o>=0;)s<t?(r=(this[o]&(1<<s)-1)<<t-s,r|=this[--o]>>(s+=this.DB-t)):(r=this[o]>>(s-=t)&n,s<=0&&(s+=this.DB,--o)),r>0&&(i=!0),i&&(a+=A(r));return i?a:`0`},e.prototype.negate=function(){var t=V();return e.ZERO.subTo(this,t),t},e.prototype.abs=function(){return this.s<0?this.negate():this},e.prototype.compareTo=function(e){var t=this.s-e.s;if(t!=0)return t;var n=this.t;if(t=n-e.t,t!=0)return this.s<0?-t:t;for(;--n>=0;)if((t=this[n]-e[n])!=0)return t;return 0},e.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+q(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=V();return this.abs().divRemTo(t,null,n),this.s<0&&n.compareTo(e.ZERO)>0&&t.subTo(n,n),n},e.prototype.modPowInt=function(e,t){var n=e<256||t.isEven()?new Ae(t):new je(t);return this.exp(e,n)},e.prototype.clone=function(){var e=V();return this.copyTo(e),e},e.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else if(this.t==1)return this[0];else if(this.t==0)return 0;return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},e.prototype.byteValue=function(){return this.t==0?this.s:this[0]<<24>>24},e.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},e.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},e.prototype.toByteArray=function(){var e=this.t,t=[];t[0]=this.s;var n=this.DB-e*this.DB%8,r,i=0;if(e-->0)for(n<this.DB&&(r=this[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this[e]&(1<<n)-1)<<8-n,r|=this[--e]>>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),r&128&&(r|=-256),i==0&&(this.s&128)!=(r&128)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},e.prototype.equals=function(e){return this.compareTo(e)==0},e.prototype.min=function(e){return this.compareTo(e)<0?this:e},e.prototype.max=function(e){return this.compareTo(e)>0?this:e},e.prototype.and=function(e){var t=V();return this.bitwiseTo(e,de,t),t},e.prototype.or=function(e){var t=V();return this.bitwiseTo(e,fe,t),t},e.prototype.xor=function(e){var t=V();return this.bitwiseTo(e,pe,t),t},e.prototype.andNot=function(e){var t=V();return this.bitwiseTo(e,me,t),t},e.prototype.not=function(){for(var e=V(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},e.prototype.shiftLeft=function(e){var t=V();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=V();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},e.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+he(this[e]);return this.s<0?this.t*this.DB:-1},e.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,n=0;n<this.t;++n)e+=ge(this[n]^t);return e},e.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:!!(this[t]&1<<e%this.DB)},e.prototype.setBit=function(e){return this.changeBit(e,fe)},e.prototype.clearBit=function(e){return this.changeBit(e,me)},e.prototype.flipBit=function(e){return this.changeBit(e,pe)},e.prototype.add=function(e){var t=V();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=V();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=V();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=V();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=V();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=V(),n=V();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n=e.bitLength(),r,i=K(1),a;if(n<=0)return i;r=n<18?1:n<48?3:n<144?4:n<768?5:6,a=n<8?new Ae(t):t.isEven()?new Me(t):new je(t);var o=[],s=3,c=r-1,l=(1<<r)-1;if(o[1]=a.convert(this),r>1){var u=V();for(a.sqrTo(o[1],u);s<=l;)o[s]=V(),a.mulTo(u,o[s-2],o[s]),s+=2}var d=e.t-1,f,p=!0,m=V(),h;for(n=q(e[d])-1;d>=0;){for(n>=c?f=e[d]>>n-c&l:(f=(e[d]&(1<<n+1)-1)<<c-n,d>0&&(f|=e[d-1]>>this.DB+n-c)),s=r;!(f&1);)f>>=1,--s;if((n-=s)<0&&(n+=this.DB,--d),p)o[f].copyTo(i),p=!1;else{for(;s>1;)a.sqrTo(i,m),a.sqrTo(m,i),s-=2;s>0?a.sqrTo(i,m):(h=i,i=m,m=h),a.mulTo(m,o[f],i)}for(;d>=0&&!(e[d]&1<<n);)a.sqrTo(i,m),h=i,i=m,m=h,--n<0&&(n=this.DB-1,--d)}return a.revert(i)},e.prototype.modInverse=function(t){var n=t.isEven();if(this.isEven()&&n||t.signum()==0)return e.ZERO;for(var r=t.clone(),i=this.clone(),a=K(1),o=K(0),s=K(0),c=K(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),n?((!a.isEven()||!o.isEven())&&(a.addTo(this,a),o.subTo(t,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),n?((!s.isEven()||!c.isEven())&&(s.addTo(this,s),c.subTo(t,c)),s.rShiftTo(1,s)):c.isEven()||c.subTo(t,c),c.rShiftTo(1,c);r.compareTo(i)>=0?(r.subTo(i,r),n&&a.subTo(s,a),o.subTo(c,o)):(i.subTo(r,i),n&&s.subTo(a,s),c.subTo(o,c))}if(i.compareTo(e.ONE)!=0)return e.ZERO;if(c.compareTo(t)>=0)return c.subtract(t);if(c.signum()<0)c.addTo(t,c);else return c;return c.signum()<0?c.add(t):c},e.prototype.pow=function(e){return this.exp(e,new ke)},e.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(t.compareTo(n)<0){var r=t;t=n,n=r}var i=t.getLowestSetBit(),a=n.getLowestSetBit();if(a<0)return t;for(i<a&&(a=i),a>0&&(t.rShiftTo(a,t),n.rShiftTo(a,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return a>0&&n.lShiftTo(a,n),n},e.prototype.isProbablePrime=function(e){var t,n=this.abs();if(n.t==1&&n[0]<=z[z.length-1]){for(t=0;t<z.length;++t)if(n[0]==z[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<z.length;){for(var r=z[t],i=t+1;i<z.length&&r<Oe;)r*=z[i++];for(r=n.modInt(r);t<i;)if(r%z[t++]==0)return!1}return n.millerRabin(e)},e.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},e.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},e.prototype.fromString=function(t,n){var r;if(n==16)r=4;else if(n==8)r=3;else if(n==256)r=8;else if(n==2)r=1;else if(n==32)r=5;else if(n==4)r=2;else{this.fromRadix(t,n);return}this.t=0,this.s=0;for(var i=t.length,a=!1,o=0;--i>=0;){var s=r==8?t[i]&255:Fe(t,i);if(s<0){t.charAt(i)==`-`&&(a=!0);continue}a=!1,o==0?this[this.t++]=s:o+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,o+=r,o>=this.DB&&(o-=this.DB)}r==8&&t[0]&128&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),a&&e.ZERO.subTo(this,this)},e.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},e.prototype.dlShiftTo=function(e,t){for(var n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},e.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},e.prototype.lShiftTo=function(e,t){for(var n=e%this.DB,r=this.DB-n,i=(1<<r)-1,a=Math.floor(e/this.DB),o=this.s<<n&this.DM,s=this.t-1;s>=0;--s)t[s+a+1]=this[s]>>r|o,o=(this[s]&i)<<n;for(var s=a-1;s>=0;--s)t[s]=0;t[a]=o,t.t=this.t+a+1,t.s=this.s,t.clamp()},e.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t){t.t=0;return}var r=e%this.DB,i=this.DB-r,a=(1<<r)-1;t[0]=this[n]>>r;for(var o=n+1;o<this.t;++o)t[o-n-1]|=(this[o]&a)<<i,t[o-n]=this[o]>>r;r>0&&(t[this.t-n-1]|=(this.s&a)<<i),t.t=this.t-n,t.clamp()},e.prototype.subTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()},e.prototype.multiplyTo=function(t,n){var r=this.abs(),i=t.abs(),a=r.t;for(n.t=a+i.t;--a>=0;)n[a]=0;for(a=0;a<i.t;++a)n[a+r.t]=r.am(0,i[a],n,a,0,r.t);n.s=0,n.clamp(),this.s!=t.s&&e.ZERO.subTo(n,n)},e.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},e.prototype.divRemTo=function(t,n,r){var i=t.abs();if(!(i.t<=0)){var a=this.abs();if(a.t<i.t){n?.fromInt(0),r!=null&&this.copyTo(r);return}r??=V();var o=V(),s=this.s,c=t.s,l=this.DB-q(i[i.t-1]);l>0?(i.lShiftTo(l,o),a.lShiftTo(l,r)):(i.copyTo(o),a.copyTo(r));var u=o.t,d=o[u-1];if(d!=0){var f=d*(1<<this.F1)+(u>1?o[u-2]>>this.F2:0),p=this.FV/f,m=(1<<this.F1)/f,h=1<<this.F2,g=r.t,_=g-u,v=n??V();for(o.dlShiftTo(_,v),r.compareTo(v)>=0&&(r[r.t++]=1,r.subTo(v,r)),e.ONE.dlShiftTo(u,v),v.subTo(o,o);o.t<u;)o[o.t++]=0;for(;--_>=0;){var y=r[--g]==d?this.DM:Math.floor(r[g]*p+(r[g-1]+h)*m);if((r[g]+=o.am(0,y,r,_,0,u))<y)for(o.dlShiftTo(_,v),r.subTo(v,r);r[g]<--y;)r.subTo(v,r)}n!=null&&(r.drShiftTo(u,n),s!=c&&e.ZERO.subTo(n,n)),r.t=u,r.clamp(),l>0&&r.rShiftTo(l,r),s<0&&e.ZERO.subTo(r,r)}}},e.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(!(e&1))return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t},e.prototype.isEven=function(){return(this.t>0?this[0]&1:this.s)==0},e.prototype.exp=function(t,n){if(t>4294967295||t<1)return e.ONE;var r=V(),i=V(),a=n.convert(this),o=q(t)-1;for(a.copyTo(r);--o>=0;)if(n.sqrTo(r,i),(t&1<<o)>0)n.mulTo(i,a,r);else{var s=r;r=i,i=s}return n.revert(r)},e.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},e.prototype.toRadix=function(e){if(e??=10,this.signum()==0||e<2||e>36)return`0`;var t=this.chunkSize(e),n=e**+t,r=K(n),i=V(),a=V(),o=``;for(this.divRemTo(r,i,a);i.signum()>0;)o=(n+a.intValue()).toString(e).substr(1)+o,i.divRemTo(r,i,a);return a.intValue().toString(e)+o},e.prototype.fromRadix=function(t,n){this.fromInt(0),n??=10;for(var r=this.chunkSize(n),i=n**+r,a=!1,o=0,s=0,c=0;c<t.length;++c){var l=Fe(t,c);if(l<0){t.charAt(c)==`-`&&this.signum()==0&&(a=!0);continue}s=n*s+l,++o>=r&&(this.dMultiply(i),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(n**+o),this.dAddOffset(s,0)),a&&e.ZERO.subTo(this,this)},e.prototype.fromNumber=function(t,n,r){if(typeof n==`number`){if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),fe,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this)}else{var i=[],a=t&7;i.length=(t>>3)+1,n.nextBytes(i),a>0?i[0]&=(1<<a)-1:i[0]=0,this.fromString(i,256)}},e.prototype.bitwiseTo=function(e,t,n){var r,i,a=Math.min(e.t,this.t);for(r=0;r<a;++r)n[r]=t(this[r],e[r]);if(e.t<this.t){for(i=e.s&this.DM,r=a;r<this.t;++r)n[r]=t(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=a;r<e.t;++r)n[r]=t(i,e[r]);n.t=e.t}n.s=t(this.s,e.s),n.clamp()},e.prototype.changeBit=function(t,n){var r=e.ONE.shiftLeft(t);return this.bitwiseTo(r,n,r),r},e.prototype.addTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]+e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r+=e[n],t[n++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()},e.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},e.prototype.dAddOffset=function(e,t){if(e!=0){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},e.prototype.multiplyLowerTo=function(e,t,n){var r=Math.min(this.t+e.t,t);for(n.s=0,n.t=r;r>0;)n[--r]=0;for(var i=n.t-this.t;r<i;++r)n[r+this.t]=this.am(0,e[r],n,r,0,this.t);for(var i=Math.min(e.t,t);r<i;++r)this.am(0,e[r],n,r,0,t-r);n.clamp()},e.prototype.multiplyUpperTo=function(e,t,n){--t;var r=n.t=this.t+e.t-t;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)n[this.t+r-t]=this.am(t-r,e[r],n,0,0,this.t+r-t);n.clamp(),n.drShiftTo(1,n)},e.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0){if(t==0)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e}return n},e.prototype.millerRabin=function(t){var n=this.subtract(e.ONE),r=n.getLowestSetBit();if(r<=0)return!1;var i=n.shiftRight(r);t=t+1>>1,t>z.length&&(t=z.length);for(var a=V(),o=0;o<t;++o){a.fromInt(z[Math.floor(Math.random()*z.length)]);var s=a.modPow(i,this);if(s.compareTo(e.ONE)!=0&&s.compareTo(n)!=0){for(var c=1;c++<r&&s.compareTo(n)!=0;)if(s=s.modPowInt(2,this),s.compareTo(e.ONE)==0)return!1;if(s.compareTo(n)!=0)return!1}}return!0},e.prototype.square=function(){var e=V();return this.squareTo(e),e},e.prototype.gcda=function(e,t){var n=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(n.compareTo(r)<0){var i=n;n=r,r=i}var a=n.getLowestSetBit(),o=r.getLowestSetBit();if(o<0){t(n);return}a<o&&(o=a),o>0&&(n.rShiftTo(o,n),r.rShiftTo(o,r));var s=function(){(a=n.getLowestSetBit())>0&&n.rShiftTo(a,n),(a=r.getLowestSetBit())>0&&r.rShiftTo(a,r),n.compareTo(r)>=0?(n.subTo(r,n),n.rShiftTo(1,n)):(r.subTo(n,r),r.rShiftTo(1,r)),n.signum()>0?setTimeout(s,0):(o>0&&r.lShiftTo(o,r),setTimeout(function(){t(r)},0))};setTimeout(s,10)},e.prototype.fromNumberAsync=function(t,n,r,i){if(typeof n==`number`){if(t<2)this.fromInt(1);else{this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),fe,this),this.isEven()&&this.dAddOffset(1,0);var a=this,o=function(){a.dAddOffset(2,0),a.bitLength()>t&&a.subTo(e.ONE.shiftLeft(t-1),a),a.isProbablePrime(n)?setTimeout(function(){i()},0):setTimeout(o,0)};setTimeout(o,0)}}else{var s=[],c=t&7;s.length=(t>>3)+1,n.nextBytes(s),c>0?s[0]&=(1<<c)-1:s[0]=0,this.fromString(s,256)}},e}(),ke=function(){function e(){}return e.prototype.convert=function(e){return e},e.prototype.revert=function(e){return e},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},e.prototype.sqrTo=function(e,t){e.squareTo(t)},e}(),Ae=function(){function e(e){this.m=e}return e.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),je=function(){function e(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return e.prototype.convert=function(e){var t=V();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(B.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=V();return e.copyTo(t),this.reduce(t),t},e.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=e[t]&32767,r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),Me=function(){function e(e){this.m=e,this.r2=V(),this.q3=V(),B.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return e.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=V();return e.copyTo(t),this.reduce(t),t},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}();function V(){return new B(null)}function H(e,t){return new B(e,t)}var Ne=typeof navigator<`u`;Ne&&De&&navigator.appName==`Microsoft Internet Explorer`?(B.prototype.am=function(e,t,n,r,i,a){for(var o=t&32767,s=t>>15;--a>=0;){var c=this[e]&32767,l=this[e++]>>15,u=s*c+l*o;c=o*c+((u&32767)<<15)+n[r]+(i&1073741823),i=(c>>>30)+(u>>>15)+s*l+(i>>>30),n[r++]=c&1073741823}return i},R=30):Ne&&De&&navigator.appName!=`Netscape`?(B.prototype.am=function(e,t,n,r,i,a){for(;--a>=0;){var o=t*this[e++]+n[r]+i;i=Math.floor(o/67108864),n[r++]=o&67108863}return i},R=26):(B.prototype.am=function(e,t,n,r,i,a){for(var o=t&16383,s=t>>14;--a>=0;){var c=this[e]&16383,l=this[e++]>>14,u=s*c+l*o;c=o*c+((u&16383)<<14)+n[r]+i,i=(c>>28)+(u>>14)+s*l,n[r++]=c&268435455}return i},R=28),B.prototype.DB=R,B.prototype.DM=(1<<R)-1,B.prototype.DV=1<<R;var Pe=52;B.prototype.FV=2**Pe,B.prototype.F1=Pe-R,B.prototype.F2=2*R-Pe;for(var U=[],W=48,G=0;G<=9;++G)U[W++]=G;for(W=97,G=10;G<36;++G)U[W++]=G;for(W=65,G=10;G<36;++G)U[W++]=G;function Fe(e,t){return U[e.charCodeAt(t)]??-1}function K(e){var t=V();return t.fromInt(e),t}function q(e){var t=1,n;return(n=e>>>16)!=0&&(e=n,t+=16),(n=e>>8)!=0&&(e=n,t+=8),(n=e>>4)!=0&&(e=n,t+=4),(n=e>>2)!=0&&(e=n,t+=2),(n=e>>1)!=0&&(e=n,t+=1),t}B.ZERO=K(0),B.ONE=K(1);var Ie=function(){function e(){this.i=0,this.j=0,this.S=[]}return e.prototype.init=function(e){for(var t=0,n,r;t<256;++t)this.S[t]=t;for(n=0,t=0;t<256;++t)n=n+this.S[t]+e[t%e.length]&255,r=this.S[t],this.S[t]=this.S[n],this.S[n]=r;this.i=0,this.j=0},e.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]},e}();function Le(){return new Ie}var Re,J=null,Y;J??(J=[],Y=0);function ze(){if(Re==null){for(Re=Le();Y<256;){var e=Math.floor(65536*Math.random());J[Y++]=e&255}for(Re.init(J),Y=0;Y<J.length;++Y)J[Y]=0;Y=0}return Re.next()}var Be=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=ze()},e}();function Ve(e,t){if(t<e.length+22)return console.error(`Message too long for RSA`),null;for(var n=t-e.length-6,r=``,i=0;i<n;i+=2)r+=`ff`;return H(`0001`+r+`00`+e,16)}function He(e,t){if(t<e.length+11)return console.error(`Message too long for RSA`),null;for(var n=[],r=e.length-1;r>=0&&t>0;){var i=e.charCodeAt(r--);i<128?n[--t]=i:i>127&&i<2048?(n[--t]=i&63|128,n[--t]=i>>6|192):(n[--t]=i&63|128,n[--t]=i>>6&63|128,n[--t]=i>>12|224)}n[--t]=0;for(var a=new Be,o=[];t>2;){for(o[0]=0;o[0]==0;)a.nextBytes(o);n[--t]=o[0]}return n[--t]=2,n[--t]=0,new B(n)}var Ue=function(){function e(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return e.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},e.prototype.doPrivate=function(e){if(this.p==null||this.q==null)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),n=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(n)<0;)t=t.add(this.p);return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},e.prototype.setPublic=function(e,t){e!=null&&t!=null&&e.length>0&&t.length>0?(this.n=H(e,16),this.e=parseInt(t,16)):console.error(`Invalid RSA public key`)},e.prototype.encrypt=function(e){var t=this.n.bitLength()+7>>3,n=He(e,t);if(n==null)return null;var r=this.doPublic(n);if(r==null)return null;for(var i=r.toString(16),a=i.length,o=0;o<t*2-a;o++)i=`0`+i;return i},e.prototype.setPrivate=function(e,t,n){e!=null&&t!=null&&e.length>0&&t.length>0?(this.n=H(e,16),this.e=parseInt(t,16),this.d=H(n,16)):console.error(`Invalid RSA private key`)},e.prototype.setPrivateEx=function(e,t,n,r,i,a,o,s){e!=null&&t!=null&&e.length>0&&t.length>0?(this.n=H(e,16),this.e=parseInt(t,16),this.d=H(n,16),this.p=H(r,16),this.q=H(i,16),this.dmp1=H(a,16),this.dmq1=H(o,16),this.coeff=H(s,16)):console.error(`Invalid RSA private key`)},e.prototype.generate=function(e,t){var n=new Be,r=e>>1;this.e=parseInt(t,16);for(var i=new B(t,16);;){for(;this.p=new B(e-r,1,n),!(this.p.subtract(B.ONE).gcd(i).compareTo(B.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new B(r,1,n),!(this.q.subtract(B.ONE).gcd(i).compareTo(B.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var a=this.p;this.p=this.q,this.q=a}var o=this.p.subtract(B.ONE),s=this.q.subtract(B.ONE),c=o.multiply(s);if(c.gcd(i).compareTo(B.ONE)==0){this.n=this.p.multiply(this.q),this.d=i.modInverse(c),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(s),this.coeff=this.q.modInverse(this.p);break}}},e.prototype.decrypt=function(e){var t=H(e,16),n=this.doPrivate(t);return n==null?null:We(n,this.n.bitLength()+7>>3)},e.prototype.generateAsync=function(e,t,n){var r=new Be,i=e>>1;this.e=parseInt(t,16);var a=new B(t,16),o=this,s=function(){var t=function(){if(o.p.compareTo(o.q)<=0){var e=o.p;o.p=o.q,o.q=e}var t=o.p.subtract(B.ONE),r=o.q.subtract(B.ONE),i=t.multiply(r);i.gcd(a).compareTo(B.ONE)==0?(o.n=o.p.multiply(o.q),o.d=a.modInverse(i),o.dmp1=o.d.mod(t),o.dmq1=o.d.mod(r),o.coeff=o.q.modInverse(o.p),setTimeout(function(){n()},0)):setTimeout(s,0)},c=function(){o.q=V(),o.q.fromNumberAsync(i,1,r,function(){o.q.subtract(B.ONE).gcda(a,function(e){e.compareTo(B.ONE)==0&&o.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(c,0)})})},l=function(){o.p=V(),o.p.fromNumberAsync(e-i,1,r,function(){o.p.subtract(B.ONE).gcda(a,function(e){e.compareTo(B.ONE)==0&&o.p.isProbablePrime(10)?setTimeout(c,0):setTimeout(l,0)})})};setTimeout(l,0)};setTimeout(s,0)},e.prototype.sign=function(e,t,n){var r=Ve(qe(n)+t(e).toString(),this.n.bitLength()/4);if(r==null)return null;var i=this.doPrivate(r);if(i==null)return null;var a=i.toString(16);return a.length&1?`0`+a:a},e.prototype.verify=function(e,t,n){var r=H(t,16),i=this.doPublic(r);return i==null?null:Je(i.toString(16).replace(/^1f+00/,``))==n(e).toString()},e.prototype.encryptLong=function(e){var t=this,n=``,r=(this.n.bitLength()+7>>3)-11;return this.setSplitChn(e,r).forEach(function(e){n+=t.encrypt(e)}),n},e.prototype.decryptLong=function(e){var t=``,n=this.n.bitLength()+7>>3,r=n*2;if(e.length>r){for(var i=e.match(RegExp(`.{1,`+r+`}`,`g`))||[],a=[],o=0;o<i.length;o++){var s=H(i[o],16),c=this.doPrivate(s);if(c==null)return null;a.push(c)}t=Ge(a,n)}else t=this.decrypt(e);return t},e.prototype.setSplitChn=function(e,t,n){n===void 0&&(n=[]);for(var r=e.split(``),i=0,a=0;a<r.length;a++){var o=r[a].charCodeAt(0);if(i+=o<=127?1:o<=2047?2:o<=65535?3:4,i>t){var s=e.substring(0,a);return n.push(s),this.setSplitChn(e.substring(a),t,n)}}return n.push(e),n},e}();function We(e,t){for(var n=e.toByteArray(),r=0;r<n.length&&n[r]==0;)++r;if(n.length-r!=t-1||n[r]!=2)return null;for(++r;n[r]!=0;)if(++r>=n.length)return null;for(var i=``;++r<n.length;){var a=n[r]&255;a<128?i+=String.fromCharCode(a):a>191&&a<224?(i+=String.fromCharCode((a&31)<<6|n[r+1]&63),++r):(i+=String.fromCharCode((a&15)<<12|(n[r+1]&63)<<6|n[r+2]&63),r+=2)}return i}function Ge(e,t){for(var n=[],r=0;r<e.length;r++){for(var i=e[r].toByteArray(),a=0;a<i.length&&i[a]==0;)++a;if(i.length-a!=t-1||i[a]!=2)return null;for(++a;i[a]!=0;)if(++a>=i.length)return null;n=n.concat(i.slice(a+1))}for(var o=n,s=-1,c=``;++s<o.length;){var l=o[s]&255;l<128?c+=String.fromCharCode(l):l>191&&l<224?(c+=String.fromCharCode((l&31)<<6|o[s+1]&63),++s):(c+=String.fromCharCode((l&15)<<12|(o[s+1]&63)<<6|o[s+2]&63),s+=2)}return c}var Ke={md2:`3020300c06082a864886f70d020205000410`,md5:`3020300c06082a864886f70d020505000410`,sha1:`3021300906052b0e03021a05000414`,sha224:`302d300d06096086480165030402040500041c`,sha256:`3031300d060960864801650304020105000420`,sha384:`3041300d060960864801650304020205000430`,sha512:`3051300d060960864801650304020305000440`,ripemd160:`3021300906052b2403020105000414`};function qe(e){return Ke[e]||``}function Je(e){for(var t in Ke)if(Ke.hasOwnProperty(t)){var n=Ke[t],r=n.length;if(e.substr(0,r)==n)return e.substr(r)}return e}
|
|
11
11
|
/*!
|
|
12
12
|
Copyright (c) 2011, Yahoo! Inc. All rights reserved.
|
|
13
13
|
Code licensed under the BSD License:
|
|
@@ -23,13 +23,15 @@ var X={};X.lang={extend:function(e,t,n){if(!t||!e)throw Error(`YAHOO.lang.extend
|
|
|
23
23
|
* @since jsrsasign 2.1
|
|
24
24
|
* @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
|
|
25
25
|
*/
|
|
26
|
-
var Z={};(Z.asn1===void 0||!Z.asn1)&&(Z.asn1={}),Z.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t=`0`+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if(t.substr(0,1)!=`-`)t.length%2==1?t=`0`+t:t.match(/^[0-7]/)||(t=`00`+t);else{var n=t.substr(1).length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var r=``,i=0;i<n;i++)r+=`f`;t=new V(r,16).xor(e).add(V.ONE).toString(16).replace(/^-/,``)}return t},this.getPEMStringFromHex=function(e,t){return hextopem(e,t)},this.newObject=function(e){var t=Z.asn1,n=t.DERBoolean,r=t.DERInteger,i=t.DERBitString,a=t.DEROctetString,o=t.DERNull,s=t.DERObjectIdentifier,c=t.DEREnumerated,l=t.DERUTF8String,u=t.DERNumericString,d=t.DERPrintableString,f=t.DERTeletexString,p=t.DERIA5String,m=t.DERUTCTime,h=t.DERGeneralizedTime,g=t.DERSequence,_=t.DERSet,v=t.DERTaggedObject,y=t.ASN1Util.newObject,b=Object.keys(e);if(b.length!=1)throw`key of param shall be only one.`;var x=b[0];if(`:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:`.indexOf(`:`+x+`:`)==-1)throw`undefined key: `+x;if(x==`bool`)return new n(e[x]);if(x==`int`)return new r(e[x]);if(x==`bitstr`)return new i(e[x]);if(x==`octstr`)return new a(e[x]);if(x==`null`)return new o(e[x]);if(x==`oid`)return new s(e[x]);if(x==`enum`)return new c(e[x]);if(x==`utf8str`)return new l(e[x]);if(x==`numstr`)return new u(e[x]);if(x==`prnstr`)return new d(e[x]);if(x==`telstr`)return new f(e[x]);if(x==`ia5str`)return new p(e[x]);if(x==`utctime`)return new m(e[x]);if(x==`gentime`)return new h(e[x]);if(x==`seq`){for(var S=e[x],C=[],w=0;w<S.length;w++){var T=y(S[w]);C.push(T)}return new g({array:C})}if(x==`set`){for(var S=e[x],C=[],w=0;w<S.length;w++){var T=y(S[w]);C.push(T)}return new _({array:C})}if(x==`tag`){var E=e[x];if(Object.prototype.toString.call(E)===`[object Array]`&&E.length==3){var ee=y(E[2]);return new v({tag:E[0],explicit:E[1],obj:ee})}var D={};if(E.explicit!==void 0&&(D.explicit=E.explicit),E.tag!==void 0&&(D.tag=E.tag),E.obj===void 0)throw`obj shall be specified for 'tag'.`;return D.obj=y(E.obj),new v(D)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},Z.asn1.ASN1Util.oidHexToInt=function(e){for(var t=``,n=parseInt(e.substr(0,2),16),r=Math.floor(n/40),i=n%40,t=r+`.`+i,a=``,o=2;o<e.length;o+=2){var s=(`00000000`+parseInt(e.substr(o,2),16).toString(2)).slice(-8);if(a+=s.substr(1,7),s.substr(0,1)==`0`){var c=new V(a,2);t=t+`.`+c.toString(10),a=``}}return t},Z.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return t.length==1&&(t=`0`+t),t},n=function(e){var n=``,r=new V(e,10).toString(2),i=7-r.length%7;i==7&&(i=0);for(var a=``,o=0;o<i;o++)a+=`0`;r=a+r;for(var o=0;o<r.length-1;o+=7){var s=r.substr(o,7);o!=r.length-7&&(s=`1`+s),n+=t(parseInt(s,2))}return n};if(!e.match(/^[0-9.]+$/))throw`malformed oid string: `+e;var r=``,i=e.split(`.`),a=parseInt(i[0])*40+parseInt(i[1]);r+=t(a),i.splice(0,2);for(var o=0;o<i.length;o++)r+=n(i[o]);return r},Z.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(this.hV===void 0||this.hV==null)throw`this.hV is null or undefined.`;if(this.hV.length%2==1)throw`value hex must be even length: n=0,v=`+this.hV;var e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t=`0`+t),e<128)return t;var n=t.length/2;if(n>15)throw`ASN.1 length too long to represent by 8x: n = `+e.toString(16);return(128+n).toString(16)+t},this.getEncodedHex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return``}},Z.asn1.DERAbstractString=function(e){Z.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(this.s)},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(typeof e==`string`?this.setString(e):e.str===void 0?e.hex!==void 0&&this.setStringHex(e.hex):this.setString(e.str))},X.lang.extend(Z.asn1.DERAbstractString,Z.asn1.ASN1Object),Z.asn1.DERAbstractTime=function(e){Z.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){return utc=e.getTime()+e.getTimezoneOffset()*6e4,new Date(utc)},this.formatDate=function(e,t,n){var r=this.zeroPadding,i=this.localDateToUTC(e),a=String(i.getFullYear());t==`utc`&&(a=a.substr(2,2));var o=r(String(i.getMonth()+1),2),s=r(String(i.getDate()),2),c=r(String(i.getHours()),2),l=r(String(i.getMinutes()),2),u=r(String(i.getSeconds()),2),d=a+o+s+c+l+u;if(n===!0){var f=i.getMilliseconds();if(f!=0){var p=r(String(f),3);p=p.replace(/[0]+$/,``),d=d+`.`+p}}return d+`Z`},this.zeroPadding=function(e,t){return e.length>=t?e:Array(t-e.length+1).join(`0`)+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(e)},this.setByDateValue=function(e,t,n,r,i,a){var o=new Date(Date.UTC(e,t-1,n,r,i,a,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},X.lang.extend(Z.asn1.DERAbstractTime,Z.asn1.ASN1Object),Z.asn1.DERAbstractStructured=function(e){Z.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=[],e!==void 0&&e.array!==void 0&&(this.asn1Array=e.array)},X.lang.extend(Z.asn1.DERAbstractStructured,Z.asn1.ASN1Object),Z.asn1.DERBoolean=function(){Z.asn1.DERBoolean.superclass.constructor.call(this),this.hT=`01`,this.hTLV=`0101ff`},X.lang.extend(Z.asn1.DERBoolean,Z.asn1.ASN1Object),Z.asn1.DERInteger=function(e){Z.asn1.DERInteger.superclass.constructor.call(this),this.hT=`02`,this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=Z.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new V(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(e.bigint===void 0?e.int===void 0?typeof e==`number`?this.setByInteger(e):e.hex!==void 0&&this.setValueHex(e.hex):this.setByInteger(e.int):this.setByBigInteger(e.bigint))},X.lang.extend(Z.asn1.DERInteger,Z.asn1.ASN1Object),Z.asn1.DERBitString=function(e){e!==void 0&&e.obj!==void 0&&(e.hex=`00`+Z.asn1.ASN1Util.newObject(e.obj).getEncodedHex()),Z.asn1.DERBitString.superclass.constructor.call(this),this.hT=`03`,this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw`unused bits shall be from 0 to 7: u = `+e;var n=`0`+e;this.hTLV=null,this.isModified=!0,this.hV=n+t},this.setByBinaryString=function(e){e=e.replace(/0+$/,``);var t=8-e.length%8;t==8&&(t=0);for(var n=0;n<=t;n++)e+=`0`;for(var r=``,n=0;n<e.length-1;n+=8){var i=e.substr(n,8),a=parseInt(i,2).toString(16);a.length==1&&(a=`0`+a),r+=a}this.hTLV=null,this.isModified=!0,this.hV=`0`+t+r},this.setByBooleanArray=function(e){for(var t=``,n=0;n<e.length;n++)e[n]==1?t+=`1`:t+=`0`;this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=!1;return t},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(typeof e==`string`&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):e.hex===void 0?e.bin===void 0?e.array!==void 0&&this.setByBooleanArray(e.array):this.setByBinaryString(e.bin):this.setHexValueIncludingUnusedBits(e.hex))},X.lang.extend(Z.asn1.DERBitString,Z.asn1.ASN1Object),Z.asn1.DEROctetString=function(e){e!==void 0&&e.obj!==void 0&&(e.hex=Z.asn1.ASN1Util.newObject(e.obj).getEncodedHex()),Z.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT=`04`},X.lang.extend(Z.asn1.DEROctetString,Z.asn1.DERAbstractString),Z.asn1.DERNull=function(){Z.asn1.DERNull.superclass.constructor.call(this),this.hT=`05`,this.hTLV=`0500`},X.lang.extend(Z.asn1.DERNull,Z.asn1.ASN1Object),Z.asn1.DERObjectIdentifier=function(e){var t=function(e){var t=e.toString(16);return t.length==1&&(t=`0`+t),t},n=function(e){var n=``,r=new V(e,10).toString(2),i=7-r.length%7;i==7&&(i=0);for(var a=``,o=0;o<i;o++)a+=`0`;r=a+r;for(var o=0;o<r.length-1;o+=7){var s=r.substr(o,7);o!=r.length-7&&(s=`1`+s),n+=t(parseInt(s,2))}return n};Z.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT=`06`,this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){if(!e.match(/^[0-9.]+$/))throw`malformed oid string: `+e;var r=``,i=e.split(`.`),a=parseInt(i[0])*40+parseInt(i[1]);r+=t(a),i.splice(0,2);for(var o=0;o<i.length;o++)r+=n(i[o]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(e){var t=Z.asn1.x509.OID.name2oid(e);if(t!==``)this.setValueOidString(t);else throw`DERObjectIdentifier oidName undefined: `+e},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(typeof e==`string`?e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e):e.oid===void 0?e.hex===void 0?e.name!==void 0&&this.setValueName(e.name):this.setValueHex(e.hex):this.setValueOidString(e.oid))},X.lang.extend(Z.asn1.DERObjectIdentifier,Z.asn1.ASN1Object),Z.asn1.DEREnumerated=function(e){Z.asn1.DEREnumerated.superclass.constructor.call(this),this.hT=`0a`,this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=Z.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new V(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(e.int===void 0?typeof e==`number`?this.setByInteger(e):e.hex!==void 0&&this.setValueHex(e.hex):this.setByInteger(e.int))},X.lang.extend(Z.asn1.DEREnumerated,Z.asn1.ASN1Object),Z.asn1.DERUTF8String=function(e){Z.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT=`0c`},X.lang.extend(Z.asn1.DERUTF8String,Z.asn1.DERAbstractString),Z.asn1.DERNumericString=function(e){Z.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT=`12`},X.lang.extend(Z.asn1.DERNumericString,Z.asn1.DERAbstractString),Z.asn1.DERPrintableString=function(e){Z.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT=`13`},X.lang.extend(Z.asn1.DERPrintableString,Z.asn1.DERAbstractString),Z.asn1.DERTeletexString=function(e){Z.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT=`14`},X.lang.extend(Z.asn1.DERTeletexString,Z.asn1.DERAbstractString),Z.asn1.DERIA5String=function(e){Z.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT=`16`},X.lang.extend(Z.asn1.DERIA5String,Z.asn1.DERAbstractString),Z.asn1.DERUTCTime=function(e){Z.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT=`17`,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,`utc`),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,`utc`),this.hV=stohex(this.s)),this.hV},e!==void 0&&(e.str===void 0?typeof e==`string`&&e.match(/^[0-9]{12}Z$/)?this.setString(e):e.hex===void 0?e.date!==void 0&&this.setByDate(e.date):this.setStringHex(e.hex):this.setString(e.str))},X.lang.extend(Z.asn1.DERUTCTime,Z.asn1.DERAbstractTime),Z.asn1.DERGeneralizedTime=function(e){Z.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT=`18`,this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,`gen`,this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,`gen`,this.withMillis),this.hV=stohex(this.s)),this.hV},e!==void 0&&(e.str===void 0?typeof e==`string`&&e.match(/^[0-9]{14}Z$/)?this.setString(e):e.hex===void 0?e.date!==void 0&&this.setByDate(e.date):this.setStringHex(e.hex):this.setString(e.str),e.millis===!0&&(this.withMillis=!0))},X.lang.extend(Z.asn1.DERGeneralizedTime,Z.asn1.DERAbstractTime),Z.asn1.DERSequence=function(e){Z.asn1.DERSequence.superclass.constructor.call(this,e),this.hT=`30`,this.getFreshValueHex=function(){for(var e=``,t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e+=n.getEncodedHex()}return this.hV=e,this.hV}},X.lang.extend(Z.asn1.DERSequence,Z.asn1.DERAbstractStructured),Z.asn1.DERSet=function(e){Z.asn1.DERSet.superclass.constructor.call(this,e),this.hT=`31`,this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=[],t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e.push(n.getEncodedHex())}return this.sortFlag==1&&e.sort(),this.hV=e.join(``),this.hV},e!==void 0&&e.sortflag!==void 0&&e.sortflag==0&&(this.sortFlag=!1)},X.lang.extend(Z.asn1.DERSet,Z.asn1.DERAbstractStructured),Z.asn1.DERTaggedObject=function(e){Z.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT=`a0`,this.hV=``,this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,n){this.hT=t,this.isExplicit=e,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(e.tag!==void 0&&(this.hT=e.tag),e.explicit!==void 0&&(this.isExplicit=e.explicit),e.obj!==void 0&&(this.asn1Object=e.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},X.lang.extend(Z.asn1.DERTaggedObject,Z.asn1.ASN1Object);var Ye=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Xe=function(e){Ye(t,e);function t(n){var r=e.call(this)||this;return n&&(typeof n==`string`?r.parseKey(n):(t.hasPrivateKeyProperty(n)||t.hasPublicKeyProperty(n))&&r.parsePropertiesFrom(n)),r}return t.prototype.parseKey=function(e){try{var t=0,n=0,r=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(e)?ve.decode(e):ye.unarmor(e),i=we.decode(r);if(i.sub.length===3&&(i=i.sub[2].sub[0]),i.sub.length===9){t=i.sub[1].getHexStringValue(),this.n=U(t,16),n=i.sub[2].getHexStringValue(),this.e=parseInt(n,16);var a=i.sub[3].getHexStringValue();this.d=U(a,16);var o=i.sub[4].getHexStringValue();this.p=U(o,16);var s=i.sub[5].getHexStringValue();this.q=U(s,16);var c=i.sub[6].getHexStringValue();this.dmp1=U(c,16);var l=i.sub[7].getHexStringValue();this.dmq1=U(l,16);var u=i.sub[8].getHexStringValue();this.coeff=U(u,16)}else if(i.sub.length===2){var d=i.sub[1].sub[0];t=d.sub[0].getHexStringValue(),this.n=U(t,16),n=d.sub[1].getHexStringValue(),this.e=parseInt(n,16)}else return!1;return!0}catch{return!1}},t.prototype.getPrivateBaseKey=function(){var e={array:[new Z.asn1.DERInteger({int:0}),new Z.asn1.DERInteger({bigint:this.n}),new Z.asn1.DERInteger({int:this.e}),new Z.asn1.DERInteger({bigint:this.d}),new Z.asn1.DERInteger({bigint:this.p}),new Z.asn1.DERInteger({bigint:this.q}),new Z.asn1.DERInteger({bigint:this.dmp1}),new Z.asn1.DERInteger({bigint:this.dmq1}),new Z.asn1.DERInteger({bigint:this.coeff})]};return new Z.asn1.DERSequence(e).getEncodedHex()},t.prototype.getPrivateBaseKeyB64=function(){return N(this.getPrivateBaseKey())},t.prototype.getPublicBaseKey=function(){var e=new Z.asn1.DERSequence({array:[new Z.asn1.DERObjectIdentifier({oid:`1.2.840.113549.1.1.1`}),new Z.asn1.DERNull]}),t=new Z.asn1.DERSequence({array:[new Z.asn1.DERInteger({bigint:this.n}),new Z.asn1.DERInteger({int:this.e})]}),n=new Z.asn1.DERBitString({hex:`00`+t.getEncodedHex()});return new Z.asn1.DERSequence({array:[e,n]}).getEncodedHex()},t.prototype.getPublicBaseKeyB64=function(){return N(this.getPublicBaseKey())},t.wordwrap=function(e,t){if(t||=64,!e)return e;var n=`(.{1,`+t+`})( +|$
|
|
26
|
+
var Z={};(Z.asn1===void 0||!Z.asn1)&&(Z.asn1={}),Z.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t=`0`+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if(t.substr(0,1)!=`-`)t.length%2==1?t=`0`+t:t.match(/^[0-7]/)||(t=`00`+t);else{var n=t.substr(1).length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var r=``,i=0;i<n;i++)r+=`f`;t=new B(r,16).xor(e).add(B.ONE).toString(16).replace(/^-/,``)}return t},this.getPEMStringFromHex=function(e,t){return hextopem(e,t)},this.newObject=function(e){var t=Z.asn1,n=t.DERBoolean,r=t.DERInteger,i=t.DERBitString,a=t.DEROctetString,o=t.DERNull,s=t.DERObjectIdentifier,c=t.DEREnumerated,l=t.DERUTF8String,u=t.DERNumericString,d=t.DERPrintableString,f=t.DERTeletexString,p=t.DERIA5String,m=t.DERUTCTime,h=t.DERGeneralizedTime,g=t.DERSequence,_=t.DERSet,v=t.DERTaggedObject,y=t.ASN1Util.newObject,b=Object.keys(e);if(b.length!=1)throw`key of param shall be only one.`;var x=b[0];if(`:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:`.indexOf(`:`+x+`:`)==-1)throw`undefined key: `+x;if(x==`bool`)return new n(e[x]);if(x==`int`)return new r(e[x]);if(x==`bitstr`)return new i(e[x]);if(x==`octstr`)return new a(e[x]);if(x==`null`)return new o(e[x]);if(x==`oid`)return new s(e[x]);if(x==`enum`)return new c(e[x]);if(x==`utf8str`)return new l(e[x]);if(x==`numstr`)return new u(e[x]);if(x==`prnstr`)return new d(e[x]);if(x==`telstr`)return new f(e[x]);if(x==`ia5str`)return new p(e[x]);if(x==`utctime`)return new m(e[x]);if(x==`gentime`)return new h(e[x]);if(x==`seq`){for(var S=e[x],C=[],w=0;w<S.length;w++){var T=y(S[w]);C.push(T)}return new g({array:C})}if(x==`set`){for(var S=e[x],C=[],w=0;w<S.length;w++){var T=y(S[w]);C.push(T)}return new _({array:C})}if(x==`tag`){var E=e[x];if(Object.prototype.toString.call(E)===`[object Array]`&&E.length==3){var ee=y(E[2]);return new v({tag:E[0],explicit:E[1],obj:ee})}var D={};if(E.explicit!==void 0&&(D.explicit=E.explicit),E.tag!==void 0&&(D.tag=E.tag),E.obj===void 0)throw`obj shall be specified for 'tag'.`;return D.obj=y(E.obj),new v(D)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},Z.asn1.ASN1Util.oidHexToInt=function(e){for(var t=``,n=parseInt(e.substr(0,2),16),r=Math.floor(n/40),i=n%40,t=r+`.`+i,a=``,o=2;o<e.length;o+=2){var s=(`00000000`+parseInt(e.substr(o,2),16).toString(2)).slice(-8);if(a+=s.substr(1,7),s.substr(0,1)==`0`){var c=new B(a,2);t=t+`.`+c.toString(10),a=``}}return t},Z.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return t.length==1&&(t=`0`+t),t},n=function(e){var n=``,r=new B(e,10).toString(2),i=7-r.length%7;i==7&&(i=0);for(var a=``,o=0;o<i;o++)a+=`0`;r=a+r;for(var o=0;o<r.length-1;o+=7){var s=r.substr(o,7);o!=r.length-7&&(s=`1`+s),n+=t(parseInt(s,2))}return n};if(!e.match(/^[0-9.]+$/))throw`malformed oid string: `+e;var r=``,i=e.split(`.`),a=parseInt(i[0])*40+parseInt(i[1]);r+=t(a),i.splice(0,2);for(var o=0;o<i.length;o++)r+=n(i[o]);return r},Z.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(this.hV===void 0||this.hV==null)throw`this.hV is null or undefined.`;if(this.hV.length%2==1)throw`value hex must be even length: n=0,v=`+this.hV;var e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t=`0`+t),e<128)return t;var n=t.length/2;if(n>15)throw`ASN.1 length too long to represent by 8x: n = `+e.toString(16);return(128+n).toString(16)+t},this.getEncodedHex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return``}},Z.asn1.DERAbstractString=function(e){Z.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(this.s)},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(typeof e==`string`?this.setString(e):e.str===void 0?e.hex!==void 0&&this.setStringHex(e.hex):this.setString(e.str))},X.lang.extend(Z.asn1.DERAbstractString,Z.asn1.ASN1Object),Z.asn1.DERAbstractTime=function(e){Z.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){return utc=e.getTime()+e.getTimezoneOffset()*6e4,new Date(utc)},this.formatDate=function(e,t,n){var r=this.zeroPadding,i=this.localDateToUTC(e),a=String(i.getFullYear());t==`utc`&&(a=a.substr(2,2));var o=r(String(i.getMonth()+1),2),s=r(String(i.getDate()),2),c=r(String(i.getHours()),2),l=r(String(i.getMinutes()),2),u=r(String(i.getSeconds()),2),d=a+o+s+c+l+u;if(n===!0){var f=i.getMilliseconds();if(f!=0){var p=r(String(f),3);p=p.replace(/[0]+$/,``),d=d+`.`+p}}return d+`Z`},this.zeroPadding=function(e,t){return e.length>=t?e:Array(t-e.length+1).join(`0`)+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(e)},this.setByDateValue=function(e,t,n,r,i,a){var o=new Date(Date.UTC(e,t-1,n,r,i,a,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},X.lang.extend(Z.asn1.DERAbstractTime,Z.asn1.ASN1Object),Z.asn1.DERAbstractStructured=function(e){Z.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=[],e!==void 0&&e.array!==void 0&&(this.asn1Array=e.array)},X.lang.extend(Z.asn1.DERAbstractStructured,Z.asn1.ASN1Object),Z.asn1.DERBoolean=function(){Z.asn1.DERBoolean.superclass.constructor.call(this),this.hT=`01`,this.hTLV=`0101ff`},X.lang.extend(Z.asn1.DERBoolean,Z.asn1.ASN1Object),Z.asn1.DERInteger=function(e){Z.asn1.DERInteger.superclass.constructor.call(this),this.hT=`02`,this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=Z.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new B(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(e.bigint===void 0?e.int===void 0?typeof e==`number`?this.setByInteger(e):e.hex!==void 0&&this.setValueHex(e.hex):this.setByInteger(e.int):this.setByBigInteger(e.bigint))},X.lang.extend(Z.asn1.DERInteger,Z.asn1.ASN1Object),Z.asn1.DERBitString=function(e){e!==void 0&&e.obj!==void 0&&(e.hex=`00`+Z.asn1.ASN1Util.newObject(e.obj).getEncodedHex()),Z.asn1.DERBitString.superclass.constructor.call(this),this.hT=`03`,this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw`unused bits shall be from 0 to 7: u = `+e;var n=`0`+e;this.hTLV=null,this.isModified=!0,this.hV=n+t},this.setByBinaryString=function(e){e=e.replace(/0+$/,``);var t=8-e.length%8;t==8&&(t=0);for(var n=0;n<=t;n++)e+=`0`;for(var r=``,n=0;n<e.length-1;n+=8){var i=e.substr(n,8),a=parseInt(i,2).toString(16);a.length==1&&(a=`0`+a),r+=a}this.hTLV=null,this.isModified=!0,this.hV=`0`+t+r},this.setByBooleanArray=function(e){for(var t=``,n=0;n<e.length;n++)e[n]==1?t+=`1`:t+=`0`;this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=!1;return t},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(typeof e==`string`&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):e.hex===void 0?e.bin===void 0?e.array!==void 0&&this.setByBooleanArray(e.array):this.setByBinaryString(e.bin):this.setHexValueIncludingUnusedBits(e.hex))},X.lang.extend(Z.asn1.DERBitString,Z.asn1.ASN1Object),Z.asn1.DEROctetString=function(e){e!==void 0&&e.obj!==void 0&&(e.hex=Z.asn1.ASN1Util.newObject(e.obj).getEncodedHex()),Z.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT=`04`},X.lang.extend(Z.asn1.DEROctetString,Z.asn1.DERAbstractString),Z.asn1.DERNull=function(){Z.asn1.DERNull.superclass.constructor.call(this),this.hT=`05`,this.hTLV=`0500`},X.lang.extend(Z.asn1.DERNull,Z.asn1.ASN1Object),Z.asn1.DERObjectIdentifier=function(e){var t=function(e){var t=e.toString(16);return t.length==1&&(t=`0`+t),t},n=function(e){var n=``,r=new B(e,10).toString(2),i=7-r.length%7;i==7&&(i=0);for(var a=``,o=0;o<i;o++)a+=`0`;r=a+r;for(var o=0;o<r.length-1;o+=7){var s=r.substr(o,7);o!=r.length-7&&(s=`1`+s),n+=t(parseInt(s,2))}return n};Z.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT=`06`,this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){if(!e.match(/^[0-9.]+$/))throw`malformed oid string: `+e;var r=``,i=e.split(`.`),a=parseInt(i[0])*40+parseInt(i[1]);r+=t(a),i.splice(0,2);for(var o=0;o<i.length;o++)r+=n(i[o]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(e){var t=Z.asn1.x509.OID.name2oid(e);if(t!==``)this.setValueOidString(t);else throw`DERObjectIdentifier oidName undefined: `+e},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(typeof e==`string`?e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e):e.oid===void 0?e.hex===void 0?e.name!==void 0&&this.setValueName(e.name):this.setValueHex(e.hex):this.setValueOidString(e.oid))},X.lang.extend(Z.asn1.DERObjectIdentifier,Z.asn1.ASN1Object),Z.asn1.DEREnumerated=function(e){Z.asn1.DEREnumerated.superclass.constructor.call(this),this.hT=`0a`,this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=Z.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new B(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(e.int===void 0?typeof e==`number`?this.setByInteger(e):e.hex!==void 0&&this.setValueHex(e.hex):this.setByInteger(e.int))},X.lang.extend(Z.asn1.DEREnumerated,Z.asn1.ASN1Object),Z.asn1.DERUTF8String=function(e){Z.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT=`0c`},X.lang.extend(Z.asn1.DERUTF8String,Z.asn1.DERAbstractString),Z.asn1.DERNumericString=function(e){Z.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT=`12`},X.lang.extend(Z.asn1.DERNumericString,Z.asn1.DERAbstractString),Z.asn1.DERPrintableString=function(e){Z.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT=`13`},X.lang.extend(Z.asn1.DERPrintableString,Z.asn1.DERAbstractString),Z.asn1.DERTeletexString=function(e){Z.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT=`14`},X.lang.extend(Z.asn1.DERTeletexString,Z.asn1.DERAbstractString),Z.asn1.DERIA5String=function(e){Z.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT=`16`},X.lang.extend(Z.asn1.DERIA5String,Z.asn1.DERAbstractString),Z.asn1.DERUTCTime=function(e){Z.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT=`17`,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,`utc`),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,`utc`),this.hV=stohex(this.s)),this.hV},e!==void 0&&(e.str===void 0?typeof e==`string`&&e.match(/^[0-9]{12}Z$/)?this.setString(e):e.hex===void 0?e.date!==void 0&&this.setByDate(e.date):this.setStringHex(e.hex):this.setString(e.str))},X.lang.extend(Z.asn1.DERUTCTime,Z.asn1.DERAbstractTime),Z.asn1.DERGeneralizedTime=function(e){Z.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT=`18`,this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,`gen`,this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,`gen`,this.withMillis),this.hV=stohex(this.s)),this.hV},e!==void 0&&(e.str===void 0?typeof e==`string`&&e.match(/^[0-9]{14}Z$/)?this.setString(e):e.hex===void 0?e.date!==void 0&&this.setByDate(e.date):this.setStringHex(e.hex):this.setString(e.str),e.millis===!0&&(this.withMillis=!0))},X.lang.extend(Z.asn1.DERGeneralizedTime,Z.asn1.DERAbstractTime),Z.asn1.DERSequence=function(e){Z.asn1.DERSequence.superclass.constructor.call(this,e),this.hT=`30`,this.getFreshValueHex=function(){for(var e=``,t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e+=n.getEncodedHex()}return this.hV=e,this.hV}},X.lang.extend(Z.asn1.DERSequence,Z.asn1.DERAbstractStructured),Z.asn1.DERSet=function(e){Z.asn1.DERSet.superclass.constructor.call(this,e),this.hT=`31`,this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=[],t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e.push(n.getEncodedHex())}return this.sortFlag==1&&e.sort(),this.hV=e.join(``),this.hV},e!==void 0&&e.sortflag!==void 0&&e.sortflag==0&&(this.sortFlag=!1)},X.lang.extend(Z.asn1.DERSet,Z.asn1.DERAbstractStructured),Z.asn1.DERTaggedObject=function(e){Z.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT=`a0`,this.hV=``,this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,n){this.hT=t,this.isExplicit=e,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(e.tag!==void 0&&(this.hT=e.tag),e.explicit!==void 0&&(this.isExplicit=e.explicit),e.obj!==void 0&&(this.asn1Object=e.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},X.lang.extend(Z.asn1.DERTaggedObject,Z.asn1.ASN1Object);var Ye=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Xe=function(e){Ye(t,e);function t(n){var r=e.call(this)||this;return n&&(typeof n==`string`?r.parseKey(n):(t.hasPrivateKeyProperty(n)||t.hasPublicKeyProperty(n))&&r.parsePropertiesFrom(n)),r}return t.prototype.parseKey=function(e){try{var t=0,n=0,r=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(e)?ye.decode(e):be.unarmor(e),i=Te.decode(r);if(i.sub.length===3&&(i=i.sub[2].sub[0]),i.sub.length===9){t=i.sub[1].getHexStringValue(),this.n=H(t,16),n=i.sub[2].getHexStringValue(),this.e=parseInt(n,16);var a=i.sub[3].getHexStringValue();this.d=H(a,16);var o=i.sub[4].getHexStringValue();this.p=H(o,16);var s=i.sub[5].getHexStringValue();this.q=H(s,16);var c=i.sub[6].getHexStringValue();this.dmp1=H(c,16);var l=i.sub[7].getHexStringValue();this.dmq1=H(l,16);var u=i.sub[8].getHexStringValue();this.coeff=H(u,16)}else if(i.sub.length===2){var d=i.sub[1].sub[0];t=d.sub[0].getHexStringValue(),this.n=H(t,16),n=d.sub[1].getHexStringValue(),this.e=parseInt(n,16)}else return!1;return!0}catch{return!1}},t.prototype.getPrivateBaseKey=function(){var e={array:[new Z.asn1.DERInteger({int:0}),new Z.asn1.DERInteger({bigint:this.n}),new Z.asn1.DERInteger({int:this.e}),new Z.asn1.DERInteger({bigint:this.d}),new Z.asn1.DERInteger({bigint:this.p}),new Z.asn1.DERInteger({bigint:this.q}),new Z.asn1.DERInteger({bigint:this.dmp1}),new Z.asn1.DERInteger({bigint:this.dmq1}),new Z.asn1.DERInteger({bigint:this.coeff})]};return new Z.asn1.DERSequence(e).getEncodedHex()},t.prototype.getPrivateBaseKeyB64=function(){return M(this.getPrivateBaseKey())},t.prototype.getPublicBaseKey=function(){var e=new Z.asn1.DERSequence({array:[new Z.asn1.DERObjectIdentifier({oid:`1.2.840.113549.1.1.1`}),new Z.asn1.DERNull]}),t=new Z.asn1.DERSequence({array:[new Z.asn1.DERInteger({bigint:this.n}),new Z.asn1.DERInteger({int:this.e})]}),n=new Z.asn1.DERBitString({hex:`00`+t.getEncodedHex()});return new Z.asn1.DERSequence({array:[e,n]}).getEncodedHex()},t.prototype.getPublicBaseKeyB64=function(){return M(this.getPublicBaseKey())},t.wordwrap=function(e,t){if(t||=64,!e)return e;var n=`(.{1,`+t+`})( +|$
|
|
27
27
|
?)|(.{1,`+t+`})`;return e.match(RegExp(n,`g`)).join(`
|
|
28
28
|
`)},t.prototype.getPrivateKey=function(){var e=`-----BEGIN RSA PRIVATE KEY-----
|
|
29
29
|
`;return e+=t.wordwrap(this.getPrivateBaseKeyB64())+`
|
|
30
30
|
`,e+=`-----END RSA PRIVATE KEY-----`,e},t.prototype.getPublicKey=function(){var e=`-----BEGIN PUBLIC KEY-----
|
|
31
31
|
`;return e+=t.wordwrap(this.getPublicBaseKeyB64())+`
|
|
32
|
-
`,e+=`-----END PUBLIC KEY-----`,e},t.hasPublicKeyProperty=function(e){return e||={},e.hasOwnProperty(`n`)&&e.hasOwnProperty(`e`)},t.hasPrivateKeyProperty=function(e){return e||={},e.hasOwnProperty(`n`)&&e.hasOwnProperty(`e`)&&e.hasOwnProperty(`d`)&&e.hasOwnProperty(`p`)&&e.hasOwnProperty(`q`)&&e.hasOwnProperty(`dmp1`)&&e.hasOwnProperty(`dmq1`)&&e.hasOwnProperty(`coeff`)},t.prototype.parsePropertiesFrom=function(e){this.n=e.n,this.e=e.e,e.hasOwnProperty(`d`)&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)},t}(Ue),Ze=`3.2.1`,Qe=function(){function e(e){e===void 0&&(e={}),e||={},this.default_key_size=e.default_key_size?parseInt(e.default_key_size,10):1024,this.default_public_exponent=e.default_public_exponent||`010001`,this.log=e.log||!1,this.key=null}return e.prototype.setKey=function(e){this.log&&this.key&&console.warn(`A key was already set, overriding existing.`),this.key=new Xe(e)},e.prototype.setPrivateKey=function(e){this.setKey(e)},e.prototype.setPublicKey=function(e){this.setKey(e)},e.prototype.decrypt=function(e){try{return this.getKey().decrypt(
|
|
33
|
-
`)
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
`,e+=`-----END PUBLIC KEY-----`,e},t.hasPublicKeyProperty=function(e){return e||={},e.hasOwnProperty(`n`)&&e.hasOwnProperty(`e`)},t.hasPrivateKeyProperty=function(e){return e||={},e.hasOwnProperty(`n`)&&e.hasOwnProperty(`e`)&&e.hasOwnProperty(`d`)&&e.hasOwnProperty(`p`)&&e.hasOwnProperty(`q`)&&e.hasOwnProperty(`dmp1`)&&e.hasOwnProperty(`dmq1`)&&e.hasOwnProperty(`coeff`)},t.prototype.parsePropertiesFrom=function(e){this.n=e.n,this.e=e.e,e.hasOwnProperty(`d`)&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)},t}(Ue),Ze=`3.2.1`,Qe=function(){function e(e){e===void 0&&(e={}),e||={},this.default_key_size=e.default_key_size?parseInt(e.default_key_size,10):1024,this.default_public_exponent=e.default_public_exponent||`010001`,this.log=e.log||!1,this.key=null}return e.prototype.setKey=function(e){this.log&&this.key&&console.warn(`A key was already set, overriding existing.`),this.key=new Xe(e)},e.prototype.setPrivateKey=function(e){this.setKey(e)},e.prototype.setPublicKey=function(e){this.setKey(e)},e.prototype.decrypt=function(e){try{return this.getKey().decrypt(ve(e))}catch{return!1}},e.prototype.encrypt=function(e){try{return M(this.getKey().encrypt(e))}catch{return!1}},e.prototype.encryptLong=function(e){try{return M(this.getKey().encryptLong(e))}catch{return!1}},e.prototype.decryptLong=function(e){try{return this.getKey().decryptLong(ve(e))}catch{return!1}},e.prototype.sign=function(e,t,n){try{return M(this.getKey().sign(e,t,n))}catch{return!1}},e.prototype.verify=function(e,t,n){try{return this.getKey().verify(e,ve(t),n)}catch{return!1}},e.prototype.getKey=function(e){if(!this.key){if(this.key=new Xe,e&&{}.toString.call(e)===`[object Function]`){this.key.generateAsync(this.default_key_size,this.default_public_exponent,e);return}this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},e.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},e.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},e.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},e.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},e.version=Ze,e}();const Q=globalThis,$e=new Qe;let $={};const et=()=>e(new Date().getTime()+pt(32));function tt(e){$=Object.assign({PROD:!1,VITE_SALT_KEY:``,VITE_PUBLIC_KEY:``},e);let t=$.VITE_PUBLIC_KEY;$e.setPublicKey(typeof t==`string`?t.replace(/\\r\\n/g,`
|
|
33
|
+
`).replace(/\\n/g,`
|
|
34
|
+
`).trim():``)}function nt(e){let t=encodeURIComponent(e),n=[];for(let e=0;e<t.length;e++)t.charCodeAt(e)===37?(n.push(parseInt(t.slice(e+1,e+3),16)),e+=2):n.push(t.charCodeAt(e));return new Uint8Array(n)}function rt(e){let t=``;for(let n=0;n<e.length;n++)t+=`%${e[n].toString(16).padStart(2,`0`)}`;return decodeURIComponent(t)}function it(e){let t=e.slice().buffer;if(Q.wx?.arrayBufferToBase64)return Q.wx.arrayBufferToBase64(t);if(Q.uni?.arrayBufferToBase64)return Q.uni.arrayBufferToBase64(t);let n=``;for(let t=0;t<e.length;t++)n+=String.fromCharCode(e[t]);return Q.btoa(n)}function at(e){if(Q.wx?.base64ToArrayBuffer)return new Uint8Array(Q.wx.base64ToArrayBuffer(e));if(Q.uni?.base64ToArrayBuffer)return new Uint8Array(Q.uni.base64ToArrayBuffer(e));let t=Q.atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function ot(e,t){let n=nt(e),r=nt(t);if(n.length!==16||r.length!==16)throw Error(`AES-128 key 和 iv 必须都是 16 bytes`);return le(n,r)}function st(e,t,n){return it(ot(t,n).encrypt(nt(e)))}function ct(e,t,n){return rt(ot(t,n).decrypt(at(e)))}function lt(e,t){if(typeof t!=`string`||!/^[\x00-\x7f]{32}$/.test(t))throw Error(`password 必须由 32 个 ASCII 字符组成`);if(!$.VITE_PUBLIC_KEY)throw Error(`请先调用 setEnv 并配置 VITE_PUBLIC_KEY`);let n=$e.getKey();if(!n.n||!n.e)throw Error(`VITE_PUBLIC_KEY 解析失败,请检查 RSA PEM 公钥格式`);let r=n.encrypt(t);if(!r)throw Error(`RSA 加密失败,请检查公钥长度`);let i=M(r);return{value:st(JSON.stringify(e),t.substring(0,16),t.substring(16)),key:i}}function ut(e,t){if(e.data){e.data=ct(e.data,t.substring(0,16),t.substring(16));try{e.data=JSON.parse(e.data||`{}`)}catch(e){console.error(e)}}return e}function dt(e){if(typeof e==`string`)return ft(e);if(e&&typeof e==`object`){let t=[];for(let n of Object.keys(e))e[n]&&t.push(`${n}=${e[n]}`);return ft(t.join(`&`))}return``}function ft(t){return e(`${t.split(`&`).sort().join(`&`)}&key=${$?.VITE_SALT_KEY}`)}function pt(e){let t=``;for(;e--;)t+=`0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`[Math.floor(Math.random()*62)];return t}function mt(e){return it(nt(e))}function ht(e){return rt(at(e))}function gt(e,t){let n=JSON.parse(JSON.stringify(e)),r=dt(n.data.variables);return n.data.variables.sign=r,$?.PROD&&(n.data=lt(n.data,t)),n}function _t(e,t,n){function r(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return e;let n={...e};for(let r of Object.keys(e))Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=i(e[r],t[r].type));return n}function i(e,t){if(e==null)return e;let a=t.endsWith(`!`)?t.slice(0,-1):t;if(a.startsWith(`[`)&&a.endsWith(`]`))return Array.isArray(e)?e.map(e=>i(e,a.slice(1,-1))):e;switch(a){case`JsonString`:if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}case`Int`:case`Float`:{if(typeof e!=`number`&&typeof e!=`string`||typeof e==`string`&&e.trim()===``)return e;let t=Number(e);return Number.isFinite(t)&&(a!==`Int`||Number.isSafeInteger(t))?t:e}case`Boolean`:return e===`false`||e===`0`||e===0?!1:e===`true`||e===`1`||e===1||e;case`String`:case`ID`:return typeof e==`number`||typeof e==`boolean`?String(e):e;default:{let t=n?.types,i=t&&Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;return i?r(e,i.fields):e}}}return e.map(e=>t?r(e,t):{...e})}const vt=Object.freeze(Object.create(null)),yt=e=>e===95||e>=65&&e<=90||e>=97&&e<=122,bt=e=>yt(e)||e>=48&&e<=57,xt=e=>e>=48&&e<=57,St=Object.create(null);function Ct(e){let t=+(e.charCodeAt(0)===65279),n=e.length,r,i=Object.create(null),a=new Set([`String`,`Int`,`Float`,`Boolean`,`ID`]),o=new Set;function s(){for(;;){if(t>=n)return;let r=e.charCodeAt(t);if(r===32||r===9||r===10||r===13||r===44){t++;continue}if(r===35){for(;++t<n;){let n=e.charCodeAt(t);if(n===10||n===13)break}continue}if(r===34&&e.charCodeAt(t+1)===34&&e.charCodeAt(t+2)===34){for(t+=3;t<n;){if(e.charCodeAt(t)===34&&e.charCodeAt(t+1)===34&&e.charCodeAt(t+2)===34){t+=3;break}t+=e.charCodeAt(t)===92?2:1}continue}if(r===34){for(t++;t<n;){let n=e.charCodeAt(t++);if(n===92)t++;else if(n===34)break}return`\0s`}if(yt(r)){let r=t++;for(;t<n&&bt(e.charCodeAt(t));)t++;return e.slice(r,t)}if(xt(r)||r===45&&xt(e.charCodeAt(t+1))){for(t++;t<n;){let n=e.charCodeAt(t);if(xt(n)||n===46||n===101||n===69||n===43||n===45)t++;else break}return`\0n`}if(r===46&&e.charCodeAt(t+1)===46&&e.charCodeAt(t+2)===46)return t+=3,`...`;if(r===123||r===125||r===40||r===41||r===91||r===93||r===58||r===33||r===61||r===36||r===64||r===124||r===38)return t++,String.fromCharCode(r);t++}}let c=()=>r??=s(),l=()=>{let e=r??s();return r=void 0,e},u=e=>c()===e&&(l(),!0),d=e=>{let t=l();if(t!==e)throw Error(`parseSDL: expected "${e}", got "${t??`EOF`}"`)},f=()=>{let e=l();if(!e||e===`\0s`||e===`\0n`||!yt(e.charCodeAt(0)))throw Error(`parseSDL: expected NAME, got "${e??`EOF`}"`);return e};function p(){if(u(`[`)){let e=`[${p()}]`;return d(`]`),u(`!`)&&(e+=`!`),e}let e=f();return u(`!`)&&(e+=`!`),e}function m(){if(u(`[`)){for(;c()&&c()!==`]`;)m();d(`]`);return}if(u(`{`)){for(;c()&&c()!==`}`;)f(),d(`:`),m();d(`}`);return}l()}function h(){for(;u(`@`);){if(f(),!u(`(`))continue;let e=1;for(;e&&c();)u(`(`)?e++:u(`)`)?e--:l()}}function g(){if(!u(`(`))return vt;let e=Object.create(null);for(;c()&&c()!==`)`;){let t=f();d(`:`),e[t]=p(),u(`=`)&&m(),h()}return d(`)`),e}function _(){let e=Object.create(null);for(d(`{`);c()&&c()!==`}`;){let t=f(),n=g();d(`:`);let r=p();h(),e[t]={name:t,args:n,type:r}}return d(`}`),e}function v(){let e=f();if(u(`implements`))for(u(`&`);c()&&c()!==`{`;)l();h(),c()===`{`&&(i[e]={name:e,fields:_()})}function y(){a.add(f()),h()}function b(){if(o.add(f()),h(),u(`{`)){for(;c()&&c()!==`}`;)l(),h();d(`}`)}}for(;c();)switch(l()){case`type`:v();break;case`scalar`:y();break;case`enum`:b()}return{query:i.Query?.fields||{},mutation:i.Mutation?.fields||{},types:i,scalars:a,enums:o}}function wt(e){let t=0,n=e.length,r=e.charCodeAt(0),i=e.charCodeAt(n-1);if(r!==91&&r!==33&&i!==93&&i!==33)return e;let a=St[e];if(a)return a;for(;t<n;){let n=e.charCodeAt(t);if(n!==91&&n!==33)break;t++}for(;n>t;){let t=e.charCodeAt(n-1);if(t!==93&&t!==33)break;n--}let o=e.slice(t,n);return St[e]=o,o}function Tt(e,t,n={}){let r=e.types[wt(t.type)];if(!r)return[];let i=[],a=r.fields;for(let t in a){let r=a[t],o=n[t];if(o!==!1){if(!e.types[wt(r.type)]){i.push(t);continue}o!==void 0&&i.push({name:t,fields:Tt(e,r,o===!0?{}:o)})}}return i}function Et(e,t=` `){let n=``;for(let r of e){if(n&&(n+=`
|
|
35
|
+
`),typeof r==`string`){n+=t+r;continue}let e=Et(r.fields,t+` `);n+=e?`${t}${r.name} {\n${e}\n${t}}`:t+r.name}return n}function Dt(e,t=`query`){let{name:n,args:r=vt,fields:i=[]}=e,a=``,o=``;for(let e in r)a&&(a+=`, `),a+=`$${e}: ${r[e]}`,o+=`${o?`
|
|
36
|
+
`:``} ${e}: $${e}`;let s=Et(i),c=`${t} ${n}`;return a&&(c+=`(${a})`),c+=` {\n ${n}`,o&&(c+=`(\n${o}\n )`),s&&(c+=` {\n${s}\n }`),c+`
|
|
37
|
+
}`}function Ot(e,t){if(t==null)return t;switch(e){case`Int`:{let e=Number.parseInt(t,10);return Number.isNaN(e)?void 0:e}case`Float`:{let e=Number.parseFloat(t);return Number.isNaN(e)?void 0:e}case`Boolean`:return t===`false`||t===`0`?!1:!!t;case`String`:case`ID`:return String(t);case`JsonString`:return typeof t==`string`?t:JSON.stringify(t);default:return t}}function kt(e,t=!1){if(t)return[];switch(e){case`Int`:return 0;case`Float`:return 0;case`Boolean`:return!1;case`String`:case`ID`:return``;case`JsonString`:return`{}`;default:return null}}function At(e){return!!(e==null||e===``||Array.isArray(e)&&e.length===0)}function jt(e={},t=vt,n=!0){if(!e||!t)return e;let r={};for(let i in e){let a=t[i];if(!a)continue;let o=e[i];if(n&&At(o))continue;let s=a.endsWith(`!`),c=a.replace(/!$/,``),l=c.startsWith(`[`)&&c.endsWith(`]`),u=l?c.slice(1,-1).replace(/!$/,``):c,d=/\[.*!\]/.test(a);if(o===null){if(s){let e=kt(u,l);(!n||!At(e))&&(r[i]=e)}else n||(r[i]=null);continue}if(o!==void 0){if(l){let e=(Array.isArray(o)?o:typeof o==`string`?o.split(`,`).map(e=>e.trim()).filter(e=>e.length>0):[o]).map(e=>Ot(u,e)).filter(e=>d?e!=null:e!==void 0);if(n&&e.length===0)continue;(e.length>0||!s)&&(r[i]=e)}else{let e=Ot(u,o);if(e===void 0||n&&At(e))continue;r[i]=e}}}return r}const Mt=Dt;exports.base64decode=ht,exports.base64encode=mt,exports.buildGraphQLQuery=Dt,exports.buildQuery=Mt,exports.buildSelectionFields=Tt,exports.decodeData=ut,exports.decrypt=ct,exports.encodeData=lt,exports.encrypt=st,Object.defineProperty(exports,"env",{enumerable:!0,get:function(){return $}}),exports.formatVariables=jt,exports.getSign=dt,exports.initPassword=et,exports.md5=e,exports.paramProcess=gt,exports.paramsStrSort=ft,exports.parseResponseOptimized=_t,exports.parseSDL=Ct,exports.randomString=pt,exports.setEnv=tt,exports.unwrapType=wt;
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
function e(e){let t=(e,t)=>e+t&4294967295,n=(e,n,r,i,a,o)=>(n=t(t(n,e),t(i,o)),t(n<<a|n>>>32-a,r)),r=(e,t,r,i,a,o,s)=>n(t&r|~t&i,e,t,a,o,s),i=(e,t,r,i,a,o,s)=>n(t&i|r&~i,e,t,a,o,s),a=(e,t,r,i,a,o,s)=>n(t^r^i,e,t,a,o,s),o=(e,t,r,i,a,o,s)=>n(r^(t|~i),e,t,a,o,s),s=(e=>unescape(encodeURIComponent(e)))(e),c=s.length,l=[];for(let e=0;e<c;e++)l[e>>2]=(l[e>>2]||0)|s.charCodeAt(e)<<e%4*8;l[c>>2]=(l[c>>2]||0)|128<<c%4*8,l[((c+8>>6)+1)*16-2]=c*8;let u=1732584193,d=-271733879,f=-1732584194,p=271733878;for(let e=0;e<l.length;e+=16){let n=u,s=d,c=f,m=p;u=r(u,d,f,p,l[e]||0,7,-680876936),p=r(p,u,d,f,l[e+1]||0,12,-389564586),f=r(f,p,u,d,l[e+2]||0,17,606105819),d=r(d,f,p,u,l[e+3]||0,22,-1044525330),u=r(u,d,f,p,l[e+4]||0,7,-176418897),p=r(p,u,d,f,l[e+5]||0,12,1200080426),f=r(f,p,u,d,l[e+6]||0,17,-1473231341),d=r(d,f,p,u,l[e+7]||0,22,-45705983),u=r(u,d,f,p,l[e+8]||0,7,1770035416),p=r(p,u,d,f,l[e+9]||0,12,-1958414417),f=r(f,p,u,d,l[e+10]||0,17,-42063),d=r(d,f,p,u,l[e+11]||0,22,-1990404162),u=r(u,d,f,p,l[e+12]||0,7,1804603682),p=r(p,u,d,f,l[e+13]||0,12,-40341101),f=r(f,p,u,d,l[e+14]||0,17,-1502002290),d=r(d,f,p,u,l[e+15]||0,22,1236535329),u=i(u,d,f,p,l[e+1]||0,5,-165796510),p=i(p,u,d,f,l[e+6]||0,9,-1069501632),f=i(f,p,u,d,l[e+11]||0,14,643717713),d=i(d,f,p,u,l[e]||0,20,-373897302),u=i(u,d,f,p,l[e+5]||0,5,-701558691),p=i(p,u,d,f,l[e+10]||0,9,38016083),f=i(f,p,u,d,l[e+15]||0,14,-660478335),d=i(d,f,p,u,l[e+4]||0,20,-405537848),u=i(u,d,f,p,l[e+9]||0,5,568446438),p=i(p,u,d,f,l[e+14]||0,9,-1019803690),f=i(f,p,u,d,l[e+3]||0,14,-187363961),d=i(d,f,p,u,l[e+8]||0,20,1163531501),u=i(u,d,f,p,l[e+13]||0,5,-1444681467),p=i(p,u,d,f,l[e+2]||0,9,-51403784),f=i(f,p,u,d,l[e+7]||0,14,1735328473),d=i(d,f,p,u,l[e+12]||0,20,-1926607734),u=a(u,d,f,p,l[e+5]||0,4,-378558),p=a(p,u,d,f,l[e+8]||0,11,-2022574463),f=a(f,p,u,d,l[e+11]||0,16,1839030562),d=a(d,f,p,u,l[e+14]||0,23,-35309556),u=a(u,d,f,p,l[e+1]||0,4,-1530992060),p=a(p,u,d,f,l[e+4]||0,11,1272893353),f=a(f,p,u,d,l[e+7]||0,16,-155497632),d=a(d,f,p,u,l[e+10]||0,23,-1094730640),u=a(u,d,f,p,l[e+13]||0,4,681279174),p=a(p,u,d,f,l[e]||0,11,-358537222),f=a(f,p,u,d,l[e+3]||0,16,-722521979),d=a(d,f,p,u,l[e+6]||0,23,76029189),u=a(u,d,f,p,l[e+9]||0,4,-640364487),p=a(p,u,d,f,l[e+12]||0,11,-421815835),f=a(f,p,u,d,l[e+15]||0,16,530742520),d=a(d,f,p,u,l[e+2]||0,23,-995338651),u=o(u,d,f,p,l[e]||0,6,-198630844),p=o(p,u,d,f,l[e+7]||0,10,1126891415),f=o(f,p,u,d,l[e+14]||0,15,-1416354905),d=o(d,f,p,u,l[e+5]||0,21,-57434055),u=o(u,d,f,p,l[e+12]||0,6,1700485571),p=o(p,u,d,f,l[e+3]||0,10,-1894986606),f=o(f,p,u,d,l[e+10]||0,15,-1051523),d=o(d,f,p,u,l[e+1]||0,21,-2054922799),u=o(u,d,f,p,l[e+8]||0,6,1873313359),p=o(p,u,d,f,l[e+15]||0,10,-30611744),f=o(f,p,u,d,l[e+6]||0,15,-1560198380),d=o(d,f,p,u,l[e+13]||0,21,1309151649),u=o(u,d,f,p,l[e+4]||0,6,-145523070),p=o(p,u,d,f,l[e+11]||0,10,-1120210379),f=o(f,p,u,d,l[e+2]||0,15,718787259),d=o(d,f,p,u,l[e+9]||0,21,-343485551),u=t(u,n),d=t(d,s),f=t(f,c),p=t(p,m)}let m=e=>{let t=``;for(let n=0;n<4;n++)t+=`0${(e>>>n*8&255).toString(16)}`.slice(-2);return t};return m(u)+m(d)+m(f)+m(p)}
|
|
2
2
|
/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
|
|
3
|
-
function t(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}const n=e=>e?`"${e}" `:``;function r(e,t=``){if(typeof e!=`number`)throw TypeError(n(t)+`expected number, got `+typeof e);if(!Number.isSafeInteger(e)||e<0)throw RangeError(n(t)+`expected integer >= 0, got `+e);return e}function i(e,i,a=``){if(t(e)&&(i===void 0||e.length===i))return e;i!==void 0&&r(i,`length`);let o=t(e),s=i===void 0?``:` of length ${i}`,c=o?`length=${e.length}`:`type=${typeof e}`,l=n(a)+`expected Uint8Array`+s+`, got `+c;throw o?RangeError(l):TypeError(l)}function a(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function o(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const s=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function c(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function l(e){for(let t=0;t<e.length;t++)e[t]=c(e[t]);return e}const u=s?e=>e:l;function d(e,t){return!e.byteLength||!t.byteLength?!1:e.buffer===t.buffer&&e.byteOffset<t.byteOffset+t.byteLength&&t.byteOffset<e.byteOffset+e.byteLength}function f(e,t){if(d(e,t)&&e.byteOffset<t.byteOffset)throw Error(`complex overlap of input and output is not supported`)}const p=(e,n)=>{function r(r,...a){if(i(r,void 0,`key`),e.nonceLength!==void 0){let t=a[0];i(t,e.varSizeNonce?void 0:e.nonceLength,`nonce`)}let o=e.tagLength,s=e.nonceLength===void 0?0:1;if(!e.withAAD){for(let e=s;e<a.length;e++)if(t(a[e]))throw Error(`AAD not supported`)}e.withAAD&&a[s]!==void 0&&i(a[s],void 0,`AAD`);let c=n(r,...a),l=(e,t)=>{if(t!==void 0){if(e!==2)throw Error(`cipher output not supported`);i(t,void 0,`output`)}},u=!1;return{encrypt(e,t){if(u)throw Error(`cannot encrypt() twice with same key + nonce`);return u=!0,i(e,void 0,`data`),l(c.encrypt.length,t),c.encrypt(e,t)},decrypt(e,t){if(i(e,void 0,`data`),o&&e.length<o)throw Error(`"ciphertext" expected length >= tagLength=`+o);return l(c.decrypt.length,t),c.decrypt(e,t)}}}return Object.assign(r,e),r};function m(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(i(t,e,`output`),n&&!h(t))throw Error(`invalid output, must be aligned`);return t}function h(e){return e.byteOffset%4==0}function g(e){return Uint8Array.from(i(e))}function _(e){if(![16,24,32].includes(e.length))throw Error(`"aes key" expected Uint8Array of length 16/24/32, got length=`+e.length)}function v(e){return e<<1^283&-(e>>7)}function y(e,t){let n=0;for(;t>0;t>>=1)n^=e&-(t&1),e=v(e);return n}const b=(()=>{let e=new Uint8Array(256);for(let t=0,n=1;t<256;t++,n^=v(n))e[t]=n;let t=new Uint8Array(256);t[0]=99;for(let n=0;n<255;n++){let r=e[255-n];r|=r<<8,t[e[n]]=(r^r>>4^r>>5^r>>6^r>>7^99)&255}return o(e),t})(),x=b.map((e,t)=>b.indexOf(t)),S=e=>e<<24|e>>>8,C=e=>e<<8|e>>>24;function w(e,t){if(e.length!==256)throw Error(`wrong sbox length`);let n=new Uint32Array(256).map((n,r)=>t(e[r])),r=n.map(C),i=r.map(C),a=i.map(C),o=new Uint32Array(65536),s=new Uint32Array(65536),c=new Uint16Array(65536);for(let t=0;t<256;t++)for(let l=0;l<256;l++){let u=t*256+l;o[u]=n[t]^r[l],s[u]=i[t]^a[l],c[u]=e[t]<<8|e[l]}return{sbox:e,sbox2:c,T0:n,T1:r,T2:i,T3:a,T01:o,T23:s}}const T=w(b,e=>y(e,3)<<24|e<<16|e<<8|y(e,2)),E=w(x,e=>y(e,11)<<24|y(e,13)<<16|y(e,9)<<8|y(e,14)),ee=(()=>{let e=new Uint8Array(16);for(let t=0,n=1;t<16;t++,n=v(n))e[t]=n;return e})();function D(e){i(e);let t=e.length;_(e);let{sbox2:n}=T,r=[];(!s||!h(e))&&r.push(e=g(e));let c=u(a(e)),l=c.length,d=e=>k(n,e,e,e,e),f=new Uint32Array(t+28);f.set(c);for(let e=l;e<f.length;e++){let t=f[e-1];e%l===0?t=d(S(t))^ee[e/l-1]:l>6&&e%l===4&&(t=d(t)),f[e]=f[e-l]^t}return o(...r),f}function te(e){let t=D(e),n=t.slice(),r=t.length,{sbox2:i}=T,{T0:a,T1:s,T2:c,T3:l}=E;for(let e=0;e<r;e+=4)for(let i=0;i<4;i++)n[e+i]=t[r-e-4+i];o(t);for(let e=4;e<r-4;e++){let t=n[e],r=k(i,t,t,t,t);n[e]=a[r&255]^s[r>>>8&255]^c[r>>>16&255]^l[r>>>24]}return n}function O(e,t,n,r,i,a){return e[n<<8&65280|r>>>8&255]^t[i>>>8&65280|a>>>24&255]}function k(e,t,n,r,i){return e[t&255|n&65280]|e[r>>>16&255|i>>>16&65280]<<16}function ne(e,t,n,r,i){let{sbox2:a,T01:o,T23:s}=T,c=0;t^=e[c++],n^=e[c++],r^=e[c++],i^=e[c++];let l=e.length/4-2;for(let a=0;a<l;a++){let a=e[c++]^O(o,s,t,n,r,i),l=e[c++]^O(o,s,n,r,i,t),u=e[c++]^O(o,s,r,i,t,n),d=e[c++]^O(o,s,i,t,n,r);t=a,n=l,r=u,i=d}return{s0:e[c++]^k(a,t,n,r,i),s1:e[c++]^k(a,n,r,i,t),s2:e[c++]^k(a,r,i,t,n),s3:e[c++]^k(a,i,t,n,r)}}function re(e,t,n,r,i){let{sbox2:a,T01:o,T23:s}=E,c=0;t^=e[c++],n^=e[c++],r^=e[c++],i^=e[c++];let l=e.length/4-2;for(let a=0;a<l;a++){let a=e[c++]^O(o,s,t,i,r,n),l=e[c++]^O(o,s,n,t,i,r),u=e[c++]^O(o,s,r,n,t,i),d=e[c++]^O(o,s,i,r,n,t);t=a,n=l,r=u,i=d}return{s0:e[c++]^k(a,t,i,r,n),s1:e[c++]^k(a,n,t,i,r),s2:e[c++]^k(a,r,n,t,i),s3:e[c++]^k(a,i,r,n,t)}}function ie(e,t){if(i(e),e.length%16!=0)throw Error(`ciphertext must be multiple of 16`);t!==void 0&&(m(e.length,t),f(e,t))}function ae(e,t,n){i(e);let r=e.length,a=r%16;if(!t&&a!==0)throw Error(`plaintext must be multiple of 16`);if(t){let e=16-a;e||=16,r+=e}return n!==void 0&&(m(r,n),f(e,n)),r}function oe(e,t,n){n===void 0&&(n=new Uint8Array(t)),(!s||!h(e))&&(e=g(e));let r=a(n);return{b:e,o:r,out:n}}function se(e,t){if(!t)return e;let n=e.length;if(n===0)throw Error(`pkcs7: empty ciphertext not allowed`);let r=e[n-1],i=1;i&=r-1>>>31^1,i&=16-r>>>31^1;for(let t=0;t<16;t++){let a=t-r>>>31,o=+((e[n-1-t]^r)===0);i&=o|a^1}if(!i)throw Error(`aes: bad decrypt`);return e.subarray(0,n-r)}function ce(e){let t=new Uint8Array(16),n=a(t);t.set(e);let r=16-e.length;for(let e=16-r;e<16;e++)t[e]=r;return n}const le=p({blockSize:16,nonceLength:16},function(e,t,n={}){let r=!n.disablePadding;return{encrypt(n,i){let c=ae(n,r,i),l=D(e),{b:d,o:f,out:p}=oe(n,c,i),m=a(d);u(m);let _=t,v=[l];(!s||!h(_))&&v.push(_=g(_));let y=a(_);u(y);let b=y[0],x=y[1],S=y[2],C=y[3],w=0;for(;w+4<=m.length;)b^=m[w+0],x^=m[w+1],S^=m[w+2],C^=m[w+3],{s0:b,s1:x,s2:S,s3:C}=ne(l,b,x,S,C),f[w++]=b,f[w++]=x,f[w++]=S,f[w++]=C;if(r){let e=ce(n.subarray(w*4));u(e),b^=e[0],x^=e[1],S^=e[2],C^=e[3],{s0:b,s1:x,s2:S,s3:C}=ne(l,b,x,S,C),f[w++]=b,f[w++]=x,f[w++]=S,f[w++]=C,o(e)}return u(f),o(...v),d!==n&&o(d),p},decrypt(n,i){ie(n,i);let c=te(e);i===void 0&&(i=new Uint8Array(n.length));let l=t,d=[c];(!s||!h(l))&&d.push(l=g(l));let f=a(l);u(f),(!s||!h(n))&&d.push(n=g(n));let p=a(n),m=a(i);u(p);let _=f[0],v=f[1],y=f[2],b=f[3];for(let e=0;e+4<=p.length;){let t=_,n=v,r=y,i=b;_=p[e+0],v=p[e+1],y=p[e+2],b=p[e+3];let{s0:a,s1:o,s2:s,s3:l}=re(c,_,v,y,b);m[e++]=a^t,m[e++]=o^n,m[e++]=s^r,m[e++]=l^i}return u(m),o(...d),se(i,r)}}});var ue=`0123456789abcdefghijklmnopqrstuvwxyz`;function A(e){return ue.charAt(e)}function de(e,t){return e&t}function
|
|
4
|
-
\r \xA0\u2028\u2029`;for(
|
|
5
|
-
\r \xA0\u2028\u2029`;for(
|
|
6
|
-
`;break;default:r+=` `}return r},e.prototype.isASCII=function(e,t){for(var n=e;n<t;++n){var r=this.get(n);if(r<32||r>176)return!1}return!0},e.prototype.parseStringISO=function(e,t){for(var n=``,r=e;r<t;++r)n+=String.fromCharCode(this.get(r));return n},e.prototype.parseStringUTF=function(e,t){for(var n=``,r=e;r<t;){var i=this.get(r++);n+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((i&31)<<6|this.get(r++)&63):String.fromCharCode((i&15)<<12|(this.get(r++)&63)<<6|this.get(r++)&63)}return n},e.prototype.parseStringBMP=function(e,t){for(var n=``,r,i,a=e;a<t;)r=this.get(a++),i=this.get(a++),n+=String.fromCharCode(r<<8|i);return n},e.prototype.parseTime=function(e,t,n){var r=this.parseStringISO(e,t),i=(n?
|
|
7
|
-
`}r&&(n-=256);for(var s=new
|
|
8
|
-
`,a=``,o=e+1;o<t;++o){for(var s=this.get(o),c=o==t-1?r:0,l=7;l>=c;--l)a+=s>>l&1?`1`:`0`;if(a.length>n)return i+
|
|
9
|
-
`;n/=2,r>n&&(t=e+n);for(var a=e;a<t;++a)i+=this.hexByte(this.get(a));return r>n&&(i+=
|
|
10
|
-
`,this.sub!==null){e+=` `;for(var n=0,r=this.sub.length;n<r;++n)t+=this.sub[n].toPrettyString(e)}return t},e.prototype.posStart=function(){return this.stream.pos},e.prototype.posContent=function(){return this.stream.pos+this.header},e.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},e.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},e.decodeLength=function(e){var t=e.get(),n=t&127;if(n==t)return n;if(n>6)throw Error(`Length over 48 bits not supported at position `+(e.pos-1));if(n===0)return null;t=0;for(var r=0;r<n;++r)t=t*256+e.get();return t},e.prototype.getHexStringValue=function(){var e=this.toHexString(),t=this.header*2,n=this.length*2;return e.substr(t,n)},e.decode=function(t){var n=t instanceof Ce?t:new Ce(t,0),r=new Ce(n),i=new Te(n),a=e.decodeLength(n),o=n.pos,s=o-r.pos,c=null,l=function(){var t=[];if(a!==null){for(var r=o+a;n.pos<r;)t[t.length]=e.decode(n);if(n.pos!=r)throw Error(`Content size is not correct for container starting at offset `+o)}else try{for(;;){var i=e.decode(n);if(i.tag.isEOC())break;t[t.length]=i}a=o-n.pos}catch(e){throw Error(`Exception while decoding undefined length content: `+e)}return t};if(i.tagConstructed)c=l();else if(i.isUniversal()&&(i.tagNumber==3||i.tagNumber==4))try{if(i.tagNumber==3&&n.get()!=0)throw Error(`BIT STRINGs with unused bits cannot encapsulate.`);c=l();for(var u=0;u<c.length;++u)if(c[u].tag.isEOC())throw Error(`EOC is not supposed to be actual content.`)}catch{c=null}if(c===null){if(a===null)throw Error(`We can't skip over an invalid tag with undefined length at offset `+o);n.pos=o+Math.abs(a)}return new e(r,s,a,i,c)},e}(),Te=function(){function e(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=!!(t&32),this.tagNumber=t&31,this.tagNumber==31){var n=new L;do t=e.get(),n.mulAdd(128,t&127);while(t&128);this.tagNumber=n.simplify()}}return e.prototype.isUniversal=function(){return this.tagClass===0},e.prototype.isEOC=function(){return this.tagClass===0&&this.tagNumber===0},e}(),z,Ee=!0,B=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],De=(1<<26)/B[B.length-1],V=function(){function e(e,t,n){e!=null&&(typeof e==`number`?this.fromNumber(e,t,n):t==null&&typeof e!=`string`?this.fromString(e,256):this.fromString(e,t))}return e.prototype.toString=function(e){if(this.s<0)return`-`+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var n=(1<<t)-1,r,i=!1,a=``,o=this.t,s=this.DB-o*this.DB%t;if(o-->0)for(s<this.DB&&(r=this[o]>>s)>0&&(i=!0,a=A(r));o>=0;)s<t?(r=(this[o]&(1<<s)-1)<<t-s,r|=this[--o]>>(s+=this.DB-t)):(r=this[o]>>(s-=t)&n,s<=0&&(s+=this.DB,--o)),r>0&&(i=!0),i&&(a+=A(r));return i?a:`0`},e.prototype.negate=function(){var t=H();return e.ZERO.subTo(this,t),t},e.prototype.abs=function(){return this.s<0?this.negate():this},e.prototype.compareTo=function(e){var t=this.s-e.s;if(t!=0)return t;var n=this.t;if(t=n-e.t,t!=0)return this.s<0?-t:t;for(;--n>=0;)if((t=this[n]-e[n])!=0)return t;return 0},e.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+q(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=H();return this.abs().divRemTo(t,null,n),this.s<0&&n.compareTo(e.ZERO)>0&&t.subTo(n,n),n},e.prototype.modPowInt=function(e,t){var n=e<256||t.isEven()?new ke(t):new Ae(t);return this.exp(e,n)},e.prototype.clone=function(){var e=H();return this.copyTo(e),e},e.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else if(this.t==1)return this[0];else if(this.t==0)return 0;return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},e.prototype.byteValue=function(){return this.t==0?this.s:this[0]<<24>>24},e.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},e.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},e.prototype.toByteArray=function(){var e=this.t,t=[];t[0]=this.s;var n=this.DB-e*this.DB%8,r,i=0;if(e-->0)for(n<this.DB&&(r=this[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this[e]&(1<<n)-1)<<8-n,r|=this[--e]>>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),r&128&&(r|=-256),i==0&&(this.s&128)!=(r&128)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},e.prototype.equals=function(e){return this.compareTo(e)==0},e.prototype.min=function(e){return this.compareTo(e)<0?this:e},e.prototype.max=function(e){return this.compareTo(e)>0?this:e},e.prototype.and=function(e){var t=H();return this.bitwiseTo(e,de,t),t},e.prototype.or=function(e){var t=H();return this.bitwiseTo(e,j,t),t},e.prototype.xor=function(e){var t=H();return this.bitwiseTo(e,fe,t),t},e.prototype.andNot=function(e){var t=H();return this.bitwiseTo(e,pe,t),t},e.prototype.not=function(){for(var e=H(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},e.prototype.shiftLeft=function(e){var t=H();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=H();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},e.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+me(this[e]);return this.s<0?this.t*this.DB:-1},e.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,n=0;n<this.t;++n)e+=he(this[n]^t);return e},e.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:!!(this[t]&1<<e%this.DB)},e.prototype.setBit=function(e){return this.changeBit(e,j)},e.prototype.clearBit=function(e){return this.changeBit(e,pe)},e.prototype.flipBit=function(e){return this.changeBit(e,fe)},e.prototype.add=function(e){var t=H();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=H();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=H();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=H();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=H();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=H(),n=H();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n=e.bitLength(),r,i=K(1),a;if(n<=0)return i;r=n<18?1:n<48?3:n<144?4:n<768?5:6,a=n<8?new ke(t):t.isEven()?new je(t):new Ae(t);var o=[],s=3,c=r-1,l=(1<<r)-1;if(o[1]=a.convert(this),r>1){var u=H();for(a.sqrTo(o[1],u);s<=l;)o[s]=H(),a.mulTo(u,o[s-2],o[s]),s+=2}var d=e.t-1,f,p=!0,m=H(),h;for(n=q(e[d])-1;d>=0;){for(n>=c?f=e[d]>>n-c&l:(f=(e[d]&(1<<n+1)-1)<<c-n,d>0&&(f|=e[d-1]>>this.DB+n-c)),s=r;!(f&1);)f>>=1,--s;if((n-=s)<0&&(n+=this.DB,--d),p)o[f].copyTo(i),p=!1;else{for(;s>1;)a.sqrTo(i,m),a.sqrTo(m,i),s-=2;s>0?a.sqrTo(i,m):(h=i,i=m,m=h),a.mulTo(m,o[f],i)}for(;d>=0&&!(e[d]&1<<n);)a.sqrTo(i,m),h=i,i=m,m=h,--n<0&&(n=this.DB-1,--d)}return a.revert(i)},e.prototype.modInverse=function(t){var n=t.isEven();if(this.isEven()&&n||t.signum()==0)return e.ZERO;for(var r=t.clone(),i=this.clone(),a=K(1),o=K(0),s=K(0),c=K(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),n?((!a.isEven()||!o.isEven())&&(a.addTo(this,a),o.subTo(t,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),n?((!s.isEven()||!c.isEven())&&(s.addTo(this,s),c.subTo(t,c)),s.rShiftTo(1,s)):c.isEven()||c.subTo(t,c),c.rShiftTo(1,c);r.compareTo(i)>=0?(r.subTo(i,r),n&&a.subTo(s,a),o.subTo(c,o)):(i.subTo(r,i),n&&s.subTo(a,s),c.subTo(o,c))}if(i.compareTo(e.ONE)!=0)return e.ZERO;if(c.compareTo(t)>=0)return c.subtract(t);if(c.signum()<0)c.addTo(t,c);else return c;return c.signum()<0?c.add(t):c},e.prototype.pow=function(e){return this.exp(e,new Oe)},e.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(t.compareTo(n)<0){var r=t;t=n,n=r}var i=t.getLowestSetBit(),a=n.getLowestSetBit();if(a<0)return t;for(i<a&&(a=i),a>0&&(t.rShiftTo(a,t),n.rShiftTo(a,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return a>0&&n.lShiftTo(a,n),n},e.prototype.isProbablePrime=function(e){var t,n=this.abs();if(n.t==1&&n[0]<=B[B.length-1]){for(t=0;t<B.length;++t)if(n[0]==B[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<B.length;){for(var r=B[t],i=t+1;i<B.length&&r<De;)r*=B[i++];for(r=n.modInt(r);t<i;)if(r%B[t++]==0)return!1}return n.millerRabin(e)},e.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},e.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},e.prototype.fromString=function(t,n){var r;if(n==16)r=4;else if(n==8)r=3;else if(n==256)r=8;else if(n==2)r=1;else if(n==32)r=5;else if(n==4)r=2;else{this.fromRadix(t,n);return}this.t=0,this.s=0;for(var i=t.length,a=!1,o=0;--i>=0;){var s=r==8?t[i]&255:Fe(t,i);if(s<0){t.charAt(i)==`-`&&(a=!0);continue}a=!1,o==0?this[this.t++]=s:o+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,o+=r,o>=this.DB&&(o-=this.DB)}r==8&&t[0]&128&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),a&&e.ZERO.subTo(this,this)},e.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},e.prototype.dlShiftTo=function(e,t){for(var n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},e.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},e.prototype.lShiftTo=function(e,t){for(var n=e%this.DB,r=this.DB-n,i=(1<<r)-1,a=Math.floor(e/this.DB),o=this.s<<n&this.DM,s=this.t-1;s>=0;--s)t[s+a+1]=this[s]>>r|o,o=(this[s]&i)<<n;for(var s=a-1;s>=0;--s)t[s]=0;t[a]=o,t.t=this.t+a+1,t.s=this.s,t.clamp()},e.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t){t.t=0;return}var r=e%this.DB,i=this.DB-r,a=(1<<r)-1;t[0]=this[n]>>r;for(var o=n+1;o<this.t;++o)t[o-n-1]|=(this[o]&a)<<i,t[o-n]=this[o]>>r;r>0&&(t[this.t-n-1]|=(this.s&a)<<i),t.t=this.t-n,t.clamp()},e.prototype.subTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()},e.prototype.multiplyTo=function(t,n){var r=this.abs(),i=t.abs(),a=r.t;for(n.t=a+i.t;--a>=0;)n[a]=0;for(a=0;a<i.t;++a)n[a+r.t]=r.am(0,i[a],n,a,0,r.t);n.s=0,n.clamp(),this.s!=t.s&&e.ZERO.subTo(n,n)},e.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},e.prototype.divRemTo=function(t,n,r){var i=t.abs();if(!(i.t<=0)){var a=this.abs();if(a.t<i.t){n?.fromInt(0),r!=null&&this.copyTo(r);return}r??=H();var o=H(),s=this.s,c=t.s,l=this.DB-q(i[i.t-1]);l>0?(i.lShiftTo(l,o),a.lShiftTo(l,r)):(i.copyTo(o),a.copyTo(r));var u=o.t,d=o[u-1];if(d!=0){var f=d*(1<<this.F1)+(u>1?o[u-2]>>this.F2:0),p=this.FV/f,m=(1<<this.F1)/f,h=1<<this.F2,g=r.t,_=g-u,v=n??H();for(o.dlShiftTo(_,v),r.compareTo(v)>=0&&(r[r.t++]=1,r.subTo(v,r)),e.ONE.dlShiftTo(u,v),v.subTo(o,o);o.t<u;)o[o.t++]=0;for(;--_>=0;){var y=r[--g]==d?this.DM:Math.floor(r[g]*p+(r[g-1]+h)*m);if((r[g]+=o.am(0,y,r,_,0,u))<y)for(o.dlShiftTo(_,v),r.subTo(v,r);r[g]<--y;)r.subTo(v,r)}n!=null&&(r.drShiftTo(u,n),s!=c&&e.ZERO.subTo(n,n)),r.t=u,r.clamp(),l>0&&r.rShiftTo(l,r),s<0&&e.ZERO.subTo(r,r)}}},e.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(!(e&1))return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t},e.prototype.isEven=function(){return(this.t>0?this[0]&1:this.s)==0},e.prototype.exp=function(t,n){if(t>4294967295||t<1)return e.ONE;var r=H(),i=H(),a=n.convert(this),o=q(t)-1;for(a.copyTo(r);--o>=0;)if(n.sqrTo(r,i),(t&1<<o)>0)n.mulTo(i,a,r);else{var s=r;r=i,i=s}return n.revert(r)},e.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},e.prototype.toRadix=function(e){if(e??=10,this.signum()==0||e<2||e>36)return`0`;var t=this.chunkSize(e),n=e**+t,r=K(n),i=H(),a=H(),o=``;for(this.divRemTo(r,i,a);i.signum()>0;)o=(n+a.intValue()).toString(e).substr(1)+o,i.divRemTo(r,i,a);return a.intValue().toString(e)+o},e.prototype.fromRadix=function(t,n){this.fromInt(0),n??=10;for(var r=this.chunkSize(n),i=n**+r,a=!1,o=0,s=0,c=0;c<t.length;++c){var l=Fe(t,c);if(l<0){t.charAt(c)==`-`&&this.signum()==0&&(a=!0);continue}s=n*s+l,++o>=r&&(this.dMultiply(i),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(n**+o),this.dAddOffset(s,0)),a&&e.ZERO.subTo(this,this)},e.prototype.fromNumber=function(t,n,r){if(typeof n==`number`){if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),j,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this)}else{var i=[],a=t&7;i.length=(t>>3)+1,n.nextBytes(i),a>0?i[0]&=(1<<a)-1:i[0]=0,this.fromString(i,256)}},e.prototype.bitwiseTo=function(e,t,n){var r,i,a=Math.min(e.t,this.t);for(r=0;r<a;++r)n[r]=t(this[r],e[r]);if(e.t<this.t){for(i=e.s&this.DM,r=a;r<this.t;++r)n[r]=t(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=a;r<e.t;++r)n[r]=t(i,e[r]);n.t=e.t}n.s=t(this.s,e.s),n.clamp()},e.prototype.changeBit=function(t,n){var r=e.ONE.shiftLeft(t);return this.bitwiseTo(r,n,r),r},e.prototype.addTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]+e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r+=e[n],t[n++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()},e.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},e.prototype.dAddOffset=function(e,t){if(e!=0){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},e.prototype.multiplyLowerTo=function(e,t,n){var r=Math.min(this.t+e.t,t);for(n.s=0,n.t=r;r>0;)n[--r]=0;for(var i=n.t-this.t;r<i;++r)n[r+this.t]=this.am(0,e[r],n,r,0,this.t);for(var i=Math.min(e.t,t);r<i;++r)this.am(0,e[r],n,r,0,t-r);n.clamp()},e.prototype.multiplyUpperTo=function(e,t,n){--t;var r=n.t=this.t+e.t-t;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)n[this.t+r-t]=this.am(t-r,e[r],n,0,0,this.t+r-t);n.clamp(),n.drShiftTo(1,n)},e.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0){if(t==0)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e}return n},e.prototype.millerRabin=function(t){var n=this.subtract(e.ONE),r=n.getLowestSetBit();if(r<=0)return!1;var i=n.shiftRight(r);t=t+1>>1,t>B.length&&(t=B.length);for(var a=H(),o=0;o<t;++o){a.fromInt(B[Math.floor(Math.random()*B.length)]);var s=a.modPow(i,this);if(s.compareTo(e.ONE)!=0&&s.compareTo(n)!=0){for(var c=1;c++<r&&s.compareTo(n)!=0;)if(s=s.modPowInt(2,this),s.compareTo(e.ONE)==0)return!1;if(s.compareTo(n)!=0)return!1}}return!0},e.prototype.square=function(){var e=H();return this.squareTo(e),e},e.prototype.gcda=function(e,t){var n=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(n.compareTo(r)<0){var i=n;n=r,r=i}var a=n.getLowestSetBit(),o=r.getLowestSetBit();if(o<0){t(n);return}a<o&&(o=a),o>0&&(n.rShiftTo(o,n),r.rShiftTo(o,r));var s=function(){(a=n.getLowestSetBit())>0&&n.rShiftTo(a,n),(a=r.getLowestSetBit())>0&&r.rShiftTo(a,r),n.compareTo(r)>=0?(n.subTo(r,n),n.rShiftTo(1,n)):(r.subTo(n,r),r.rShiftTo(1,r)),n.signum()>0?setTimeout(s,0):(o>0&&r.lShiftTo(o,r),setTimeout(function(){t(r)},0))};setTimeout(s,10)},e.prototype.fromNumberAsync=function(t,n,r,i){if(typeof n==`number`){if(t<2)this.fromInt(1);else{this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),j,this),this.isEven()&&this.dAddOffset(1,0);var a=this,o=function(){a.dAddOffset(2,0),a.bitLength()>t&&a.subTo(e.ONE.shiftLeft(t-1),a),a.isProbablePrime(n)?setTimeout(function(){i()},0):setTimeout(o,0)};setTimeout(o,0)}}else{var s=[],c=t&7;s.length=(t>>3)+1,n.nextBytes(s),c>0?s[0]&=(1<<c)-1:s[0]=0,this.fromString(s,256)}},e}(),Oe=function(){function e(){}return e.prototype.convert=function(e){return e},e.prototype.revert=function(e){return e},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},e.prototype.sqrTo=function(e,t){e.squareTo(t)},e}(),ke=function(){function e(e){this.m=e}return e.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),Ae=function(){function e(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return e.prototype.convert=function(e){var t=H();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(V.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=H();return e.copyTo(t),this.reduce(t),t},e.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=e[t]&32767,r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),je=function(){function e(e){this.m=e,this.r2=H(),this.q3=H(),V.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return e.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=H();return e.copyTo(t),this.reduce(t),t},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}();function H(){return new V(null)}function U(e,t){return new V(e,t)}var Me=typeof navigator<`u`;Me&&Ee&&navigator.appName==`Microsoft Internet Explorer`?(V.prototype.am=function(e,t,n,r,i,a){for(var o=t&32767,s=t>>15;--a>=0;){var c=this[e]&32767,l=this[e++]>>15,u=s*c+l*o;c=o*c+((u&32767)<<15)+n[r]+(i&1073741823),i=(c>>>30)+(u>>>15)+s*l+(i>>>30),n[r++]=c&1073741823}return i},z=30):Me&&Ee&&navigator.appName!=`Netscape`?(V.prototype.am=function(e,t,n,r,i,a){for(;--a>=0;){var o=t*this[e++]+n[r]+i;i=Math.floor(o/67108864),n[r++]=o&67108863}return i},z=26):(V.prototype.am=function(e,t,n,r,i,a){for(var o=t&16383,s=t>>14;--a>=0;){var c=this[e]&16383,l=this[e++]>>14,u=s*c+l*o;c=o*c+((u&16383)<<14)+n[r]+i,i=(c>>28)+(u>>14)+s*l,n[r++]=c&268435455}return i},z=28),V.prototype.DB=z,V.prototype.DM=(1<<z)-1,V.prototype.DV=1<<z;var Ne=52;V.prototype.FV=2**Ne,V.prototype.F1=Ne-z,V.prototype.F2=2*z-Ne;for(var Pe=[],W=48,G=0;G<=9;++G)Pe[W++]=G;for(W=97,G=10;G<36;++G)Pe[W++]=G;for(W=65,G=10;G<36;++G)Pe[W++]=G;function Fe(e,t){return Pe[e.charCodeAt(t)]??-1}function K(e){var t=H();return t.fromInt(e),t}function q(e){var t=1,n;return(n=e>>>16)!=0&&(e=n,t+=16),(n=e>>8)!=0&&(e=n,t+=8),(n=e>>4)!=0&&(e=n,t+=4),(n=e>>2)!=0&&(e=n,t+=2),(n=e>>1)!=0&&(e=n,t+=1),t}V.ZERO=K(0),V.ONE=K(1);var Ie=function(){function e(){this.i=0,this.j=0,this.S=[]}return e.prototype.init=function(e){for(var t=0,n,r;t<256;++t)this.S[t]=t;for(n=0,t=0;t<256;++t)n=n+this.S[t]+e[t%e.length]&255,r=this.S[t],this.S[t]=this.S[n],this.S[n]=r;this.i=0,this.j=0},e.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]},e}();function Le(){return new Ie}var Re,J=null,Y;J??(J=[],Y=0);function ze(){if(Re==null){for(Re=Le();Y<256;){var e=Math.floor(65536*Math.random());J[Y++]=e&255}for(Re.init(J),Y=0;Y<J.length;++Y)J[Y]=0;Y=0}return Re.next()}var Be=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=ze()},e}();function Ve(e,t){if(t<e.length+22)return console.error(`Message too long for RSA`),null;for(var n=t-e.length-6,r=``,i=0;i<n;i+=2)r+=`ff`;return U(`0001`+r+`00`+e,16)}function He(e,t){if(t<e.length+11)return console.error(`Message too long for RSA`),null;for(var n=[],r=e.length-1;r>=0&&t>0;){var i=e.charCodeAt(r--);i<128?n[--t]=i:i>127&&i<2048?(n[--t]=i&63|128,n[--t]=i>>6|192):(n[--t]=i&63|128,n[--t]=i>>6&63|128,n[--t]=i>>12|224)}n[--t]=0;for(var a=new Be,o=[];t>2;){for(o[0]=0;o[0]==0;)a.nextBytes(o);n[--t]=o[0]}return n[--t]=2,n[--t]=0,new V(n)}var Ue=function(){function e(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return e.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},e.prototype.doPrivate=function(e){if(this.p==null||this.q==null)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),n=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(n)<0;)t=t.add(this.p);return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},e.prototype.setPublic=function(e,t){e!=null&&t!=null&&e.length>0&&t.length>0?(this.n=U(e,16),this.e=parseInt(t,16)):console.error(`Invalid RSA public key`)},e.prototype.encrypt=function(e){var t=this.n.bitLength()+7>>3,n=He(e,t);if(n==null)return null;var r=this.doPublic(n);if(r==null)return null;for(var i=r.toString(16),a=i.length,o=0;o<t*2-a;o++)i=`0`+i;return i},e.prototype.setPrivate=function(e,t,n){e!=null&&t!=null&&e.length>0&&t.length>0?(this.n=U(e,16),this.e=parseInt(t,16),this.d=U(n,16)):console.error(`Invalid RSA private key`)},e.prototype.setPrivateEx=function(e,t,n,r,i,a,o,s){e!=null&&t!=null&&e.length>0&&t.length>0?(this.n=U(e,16),this.e=parseInt(t,16),this.d=U(n,16),this.p=U(r,16),this.q=U(i,16),this.dmp1=U(a,16),this.dmq1=U(o,16),this.coeff=U(s,16)):console.error(`Invalid RSA private key`)},e.prototype.generate=function(e,t){var n=new Be,r=e>>1;this.e=parseInt(t,16);for(var i=new V(t,16);;){for(;this.p=new V(e-r,1,n),!(this.p.subtract(V.ONE).gcd(i).compareTo(V.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new V(r,1,n),!(this.q.subtract(V.ONE).gcd(i).compareTo(V.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var a=this.p;this.p=this.q,this.q=a}var o=this.p.subtract(V.ONE),s=this.q.subtract(V.ONE),c=o.multiply(s);if(c.gcd(i).compareTo(V.ONE)==0){this.n=this.p.multiply(this.q),this.d=i.modInverse(c),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(s),this.coeff=this.q.modInverse(this.p);break}}},e.prototype.decrypt=function(e){var t=U(e,16),n=this.doPrivate(t);return n==null?null:We(n,this.n.bitLength()+7>>3)},e.prototype.generateAsync=function(e,t,n){var r=new Be,i=e>>1;this.e=parseInt(t,16);var a=new V(t,16),o=this,s=function(){var t=function(){if(o.p.compareTo(o.q)<=0){var e=o.p;o.p=o.q,o.q=e}var t=o.p.subtract(V.ONE),r=o.q.subtract(V.ONE),i=t.multiply(r);i.gcd(a).compareTo(V.ONE)==0?(o.n=o.p.multiply(o.q),o.d=a.modInverse(i),o.dmp1=o.d.mod(t),o.dmq1=o.d.mod(r),o.coeff=o.q.modInverse(o.p),setTimeout(function(){n()},0)):setTimeout(s,0)},c=function(){o.q=H(),o.q.fromNumberAsync(i,1,r,function(){o.q.subtract(V.ONE).gcda(a,function(e){e.compareTo(V.ONE)==0&&o.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(c,0)})})},l=function(){o.p=H(),o.p.fromNumberAsync(e-i,1,r,function(){o.p.subtract(V.ONE).gcda(a,function(e){e.compareTo(V.ONE)==0&&o.p.isProbablePrime(10)?setTimeout(c,0):setTimeout(l,0)})})};setTimeout(l,0)};setTimeout(s,0)},e.prototype.sign=function(e,t,n){var r=Ve(qe(n)+t(e).toString(),this.n.bitLength()/4);if(r==null)return null;var i=this.doPrivate(r);if(i==null)return null;var a=i.toString(16);return a.length&1?`0`+a:a},e.prototype.verify=function(e,t,n){var r=U(t,16),i=this.doPublic(r);return i==null?null:Je(i.toString(16).replace(/^1f+00/,``))==n(e).toString()},e.prototype.encryptLong=function(e){var t=this,n=``,r=(this.n.bitLength()+7>>3)-11;return this.setSplitChn(e,r).forEach(function(e){n+=t.encrypt(e)}),n},e.prototype.decryptLong=function(e){var t=``,n=this.n.bitLength()+7>>3,r=n*2;if(e.length>r){for(var i=e.match(RegExp(`.{1,`+r+`}`,`g`))||[],a=[],o=0;o<i.length;o++){var s=U(i[o],16),c=this.doPrivate(s);if(c==null)return null;a.push(c)}t=Ge(a,n)}else t=this.decrypt(e);return t},e.prototype.setSplitChn=function(e,t,n){n===void 0&&(n=[]);for(var r=e.split(``),i=0,a=0;a<r.length;a++){var o=r[a].charCodeAt(0);if(i+=o<=127?1:o<=2047?2:o<=65535?3:4,i>t){var s=e.substring(0,a);return n.push(s),this.setSplitChn(e.substring(a),t,n)}}return n.push(e),n},e}();function We(e,t){for(var n=e.toByteArray(),r=0;r<n.length&&n[r]==0;)++r;if(n.length-r!=t-1||n[r]!=2)return null;for(++r;n[r]!=0;)if(++r>=n.length)return null;for(var i=``;++r<n.length;){var a=n[r]&255;a<128?i+=String.fromCharCode(a):a>191&&a<224?(i+=String.fromCharCode((a&31)<<6|n[r+1]&63),++r):(i+=String.fromCharCode((a&15)<<12|(n[r+1]&63)<<6|n[r+2]&63),r+=2)}return i}function Ge(e,t){for(var n=[],r=0;r<e.length;r++){for(var i=e[r].toByteArray(),a=0;a<i.length&&i[a]==0;)++a;if(i.length-a!=t-1||i[a]!=2)return null;for(++a;i[a]!=0;)if(++a>=i.length)return null;n=n.concat(i.slice(a+1))}for(var o=n,s=-1,c=``;++s<o.length;){var l=o[s]&255;l<128?c+=String.fromCharCode(l):l>191&&l<224?(c+=String.fromCharCode((l&31)<<6|o[s+1]&63),++s):(c+=String.fromCharCode((l&15)<<12|(o[s+1]&63)<<6|o[s+2]&63),s+=2)}return c}var Ke={md2:`3020300c06082a864886f70d020205000410`,md5:`3020300c06082a864886f70d020505000410`,sha1:`3021300906052b0e03021a05000414`,sha224:`302d300d06096086480165030402040500041c`,sha256:`3031300d060960864801650304020105000420`,sha384:`3041300d060960864801650304020205000430`,sha512:`3051300d060960864801650304020305000440`,ripemd160:`3021300906052b2403020105000414`};function qe(e){return Ke[e]||``}function Je(e){for(var t in Ke)if(Ke.hasOwnProperty(t)){var n=Ke[t],r=n.length;if(e.substr(0,r)==n)return e.substr(r)}return e}
|
|
3
|
+
function t(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}const n=e=>e?`"${e}" `:``;function r(e,t=``){if(typeof e!=`number`)throw TypeError(n(t)+`expected number, got `+typeof e);if(!Number.isSafeInteger(e)||e<0)throw RangeError(n(t)+`expected integer >= 0, got `+e);return e}function i(e,i,a=``){if(t(e)&&(i===void 0||e.length===i))return e;i!==void 0&&r(i,`length`);let o=t(e),s=i===void 0?``:` of length ${i}`,c=o?`length=${e.length}`:`type=${typeof e}`,l=n(a)+`expected Uint8Array`+s+`, got `+c;throw o?RangeError(l):TypeError(l)}function a(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function o(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const s=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function c(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function l(e){for(let t=0;t<e.length;t++)e[t]=c(e[t]);return e}const u=s?e=>e:l;function d(e,t){return!e.byteLength||!t.byteLength?!1:e.buffer===t.buffer&&e.byteOffset<t.byteOffset+t.byteLength&&t.byteOffset<e.byteOffset+e.byteLength}function f(e,t){if(d(e,t)&&e.byteOffset<t.byteOffset)throw Error(`complex overlap of input and output is not supported`)}const p=(e,n)=>{function r(r,...a){if(i(r,void 0,`key`),e.nonceLength!==void 0){let t=a[0];i(t,e.varSizeNonce?void 0:e.nonceLength,`nonce`)}let o=e.tagLength,s=e.nonceLength===void 0?0:1;if(!e.withAAD){for(let e=s;e<a.length;e++)if(t(a[e]))throw Error(`AAD not supported`)}e.withAAD&&a[s]!==void 0&&i(a[s],void 0,`AAD`);let c=n(r,...a),l=(e,t)=>{if(t!==void 0){if(e!==2)throw Error(`cipher output not supported`);i(t,void 0,`output`)}},u=!1;return{encrypt(e,t){if(u)throw Error(`cannot encrypt() twice with same key + nonce`);return u=!0,i(e,void 0,`data`),l(c.encrypt.length,t),c.encrypt(e,t)},decrypt(e,t){if(i(e,void 0,`data`),o&&e.length<o)throw Error(`"ciphertext" expected length >= tagLength=`+o);return l(c.decrypt.length,t),c.decrypt(e,t)}}}return Object.assign(r,e),r};function m(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(i(t,e,`output`),n&&!h(t))throw Error(`invalid output, must be aligned`);return t}function h(e){return e.byteOffset%4==0}function g(e){return Uint8Array.from(i(e))}function _(e){if(![16,24,32].includes(e.length))throw Error(`"aes key" expected Uint8Array of length 16/24/32, got length=`+e.length)}function v(e){return e<<1^283&-(e>>7)}function y(e,t){let n=0;for(;t>0;t>>=1)n^=e&-(t&1),e=v(e);return n}const b=(()=>{let e=new Uint8Array(256);for(let t=0,n=1;t<256;t++,n^=v(n))e[t]=n;let t=new Uint8Array(256);t[0]=99;for(let n=0;n<255;n++){let r=e[255-n];r|=r<<8,t[e[n]]=(r^r>>4^r>>5^r>>6^r>>7^99)&255}return o(e),t})(),x=b.map((e,t)=>b.indexOf(t)),S=e=>e<<24|e>>>8,C=e=>e<<8|e>>>24;function w(e,t){if(e.length!==256)throw Error(`wrong sbox length`);let n=new Uint32Array(256).map((n,r)=>t(e[r])),r=n.map(C),i=r.map(C),a=i.map(C),o=new Uint32Array(65536),s=new Uint32Array(65536),c=new Uint16Array(65536);for(let t=0;t<256;t++)for(let l=0;l<256;l++){let u=t*256+l;o[u]=n[t]^r[l],s[u]=i[t]^a[l],c[u]=e[t]<<8|e[l]}return{sbox:e,sbox2:c,T0:n,T1:r,T2:i,T3:a,T01:o,T23:s}}const T=w(b,e=>y(e,3)<<24|e<<16|e<<8|y(e,2)),E=w(x,e=>y(e,11)<<24|y(e,13)<<16|y(e,9)<<8|y(e,14)),ee=(()=>{let e=new Uint8Array(16);for(let t=0,n=1;t<16;t++,n=v(n))e[t]=n;return e})();function D(e){i(e);let t=e.length;_(e);let{sbox2:n}=T,r=[];(!s||!h(e))&&r.push(e=g(e));let c=u(a(e)),l=c.length,d=e=>k(n,e,e,e,e),f=new Uint32Array(t+28);f.set(c);for(let e=l;e<f.length;e++){let t=f[e-1];e%l===0?t=d(S(t))^ee[e/l-1]:l>6&&e%l===4&&(t=d(t)),f[e]=f[e-l]^t}return o(...r),f}function te(e){let t=D(e),n=t.slice(),r=t.length,{sbox2:i}=T,{T0:a,T1:s,T2:c,T3:l}=E;for(let e=0;e<r;e+=4)for(let i=0;i<4;i++)n[e+i]=t[r-e-4+i];o(t);for(let e=4;e<r-4;e++){let t=n[e],r=k(i,t,t,t,t);n[e]=a[r&255]^s[r>>>8&255]^c[r>>>16&255]^l[r>>>24]}return n}function O(e,t,n,r,i,a){return e[n<<8&65280|r>>>8&255]^t[i>>>8&65280|a>>>24&255]}function k(e,t,n,r,i){return e[t&255|n&65280]|e[r>>>16&255|i>>>16&65280]<<16}function ne(e,t,n,r,i){let{sbox2:a,T01:o,T23:s}=T,c=0;t^=e[c++],n^=e[c++],r^=e[c++],i^=e[c++];let l=e.length/4-2;for(let a=0;a<l;a++){let a=e[c++]^O(o,s,t,n,r,i),l=e[c++]^O(o,s,n,r,i,t),u=e[c++]^O(o,s,r,i,t,n),d=e[c++]^O(o,s,i,t,n,r);t=a,n=l,r=u,i=d}return{s0:e[c++]^k(a,t,n,r,i),s1:e[c++]^k(a,n,r,i,t),s2:e[c++]^k(a,r,i,t,n),s3:e[c++]^k(a,i,t,n,r)}}function re(e,t,n,r,i){let{sbox2:a,T01:o,T23:s}=E,c=0;t^=e[c++],n^=e[c++],r^=e[c++],i^=e[c++];let l=e.length/4-2;for(let a=0;a<l;a++){let a=e[c++]^O(o,s,t,i,r,n),l=e[c++]^O(o,s,n,t,i,r),u=e[c++]^O(o,s,r,n,t,i),d=e[c++]^O(o,s,i,r,n,t);t=a,n=l,r=u,i=d}return{s0:e[c++]^k(a,t,i,r,n),s1:e[c++]^k(a,n,t,i,r),s2:e[c++]^k(a,r,n,t,i),s3:e[c++]^k(a,i,r,n,t)}}function ie(e,t){if(i(e),e.length%16!=0)throw Error(`ciphertext must be multiple of 16`);t!==void 0&&(m(e.length,t),f(e,t))}function ae(e,t,n){i(e);let r=e.length,a=r%16;if(!t&&a!==0)throw Error(`plaintext must be multiple of 16`);if(t){let e=16-a;e||=16,r+=e}return n!==void 0&&(m(r,n),f(e,n)),r}function oe(e,t,n){n===void 0&&(n=new Uint8Array(t)),(!s||!h(e))&&(e=g(e));let r=a(n);return{b:e,o:r,out:n}}function se(e,t){if(!t)return e;let n=e.length;if(n===0)throw Error(`pkcs7: empty ciphertext not allowed`);let r=e[n-1],i=1;i&=r-1>>>31^1,i&=16-r>>>31^1;for(let t=0;t<16;t++){let a=t-r>>>31,o=+((e[n-1-t]^r)===0);i&=o|a^1}if(!i)throw Error(`aes: bad decrypt`);return e.subarray(0,n-r)}function ce(e){let t=new Uint8Array(16),n=a(t);t.set(e);let r=16-e.length;for(let e=16-r;e<16;e++)t[e]=r;return n}const le=p({blockSize:16,nonceLength:16},function(e,t,n={}){let r=!n.disablePadding;return{encrypt(n,i){let c=ae(n,r,i),l=D(e),{b:d,o:f,out:p}=oe(n,c,i),m=a(d);u(m);let _=t,v=[l];(!s||!h(_))&&v.push(_=g(_));let y=a(_);u(y);let b=y[0],x=y[1],S=y[2],C=y[3],w=0;for(;w+4<=m.length;)b^=m[w+0],x^=m[w+1],S^=m[w+2],C^=m[w+3],{s0:b,s1:x,s2:S,s3:C}=ne(l,b,x,S,C),f[w++]=b,f[w++]=x,f[w++]=S,f[w++]=C;if(r){let e=ce(n.subarray(w*4));u(e),b^=e[0],x^=e[1],S^=e[2],C^=e[3],{s0:b,s1:x,s2:S,s3:C}=ne(l,b,x,S,C),f[w++]=b,f[w++]=x,f[w++]=S,f[w++]=C,o(e)}return u(f),o(...v),d!==n&&o(d),p},decrypt(n,i){ie(n,i);let c=te(e);i===void 0&&(i=new Uint8Array(n.length));let l=t,d=[c];(!s||!h(l))&&d.push(l=g(l));let f=a(l);u(f),(!s||!h(n))&&d.push(n=g(n));let p=a(n),m=a(i);u(p);let _=f[0],v=f[1],y=f[2],b=f[3];for(let e=0;e+4<=p.length;){let t=_,n=v,r=y,i=b;_=p[e+0],v=p[e+1],y=p[e+2],b=p[e+3];let{s0:a,s1:o,s2:s,s3:l}=re(c,_,v,y,b);m[e++]=a^t,m[e++]=o^n,m[e++]=s^r,m[e++]=l^i}return u(m),o(...d),se(i,r)}}});var ue=`0123456789abcdefghijklmnopqrstuvwxyz`;function A(e){return ue.charAt(e)}function de(e,t){return e&t}function fe(e,t){return e|t}function pe(e,t){return e^t}function me(e,t){return e&~t}function he(e){if(e==0)return-1;var t=0;return e&65535||(e>>=16,t+=16),e&255||(e>>=8,t+=8),e&15||(e>>=4,t+=4),e&3||(e>>=2,t+=2),e&1||++t,t}function ge(e){for(var t=0;e!=0;)e&=e-1,++t;return t}var j=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,_e=`=`;function M(e){var t,n,r=``;for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=j.charAt(n>>6)+j.charAt(n&63);for(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=j.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=j.charAt(n>>2)+j.charAt((n&3)<<4));(r.length&3)>0;)r+=_e;return r}function ve(e){var t=``,n,r=0,i=0;for(n=0;n<e.length&&e.charAt(n)!=_e;++n){var a=j.indexOf(e.charAt(n));a<0||(r==0?(t+=A(a>>2),i=a&3,r=1):r==1?(t+=A(i<<2|a>>4),i=a&15,r=2):r==2?(t+=A(i),t+=A(a>>2),i=a&3,r=3):(t+=A(i<<2|a>>4),t+=A(a&15),r=0))}return r==1&&(t+=A(i<<2)),t}var N,ye={decode:function(e){var t;if(N===void 0){var n=`0123456789ABCDEF`,r=` \f
|
|
4
|
+
\r \xA0\u2028\u2029`;for(N={},t=0;t<16;++t)N[n.charAt(t)]=t;for(n=n.toLowerCase(),t=10;t<16;++t)N[n.charAt(t)]=t;for(t=0;t<r.length;++t)N[r.charAt(t)]=-1}var i=[],a=0,o=0;for(t=0;t<e.length;++t){var s=e.charAt(t);if(s==`=`)break;if(s=N[s],s!=-1){if(s===void 0)throw Error(`Illegal character at offset `+t);a|=s,++o>=2?(i[i.length]=a,a=0,o=0):a<<=4}}if(o)throw Error(`Hex encoding incomplete: 4 bits missing`);return i}},P,be={decode:function(e){var t;if(P===void 0){var n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,r=`= \f
|
|
5
|
+
\r \xA0\u2028\u2029`;for(P=Object.create(null),t=0;t<64;++t)P[n.charAt(t)]=t;for(P[`-`]=62,P._=63,t=0;t<r.length;++t)P[r.charAt(t)]=-1}var i=[],a=0,o=0;for(t=0;t<e.length;++t){var s=e.charAt(t);if(s==`=`)break;if(s=P[s],s!=-1){if(s===void 0)throw Error(`Illegal character at offset `+t);a|=s,++o>=4?(i[i.length]=a>>16,i[i.length]=a>>8&255,i[i.length]=a&255,a=0,o=0):a<<=6}}switch(o){case 1:throw Error(`Base64 encoding incomplete: at least 2 bits missing`);case 2:i[i.length]=a>>10;break;case 3:i[i.length]=a>>16,i[i.length]=a>>8&255}return i},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=be.re.exec(e);if(t){if(t[1])e=t[1];else if(t[2])e=t[2];else throw Error(`RegExp out of sync`)}return be.decode(e)}},F=0x9184e72a000,I=function(){function e(e){this.buf=[+e||0]}return e.prototype.mulAdd=function(e,t){for(var n=this.buf,r=n.length,i=0,a;i<r;++i)a=n[i]*e+t,a<F?t=0:(t=0|a/F,a-=t*F),n[i]=a;t>0&&(n[i]=t)},e.prototype.sub=function(e){for(var t=this.buf,n=t.length,r=0,i;r<n;++r)i=t[r]-e,i<0?(i+=F,e=1):e=0,t[r]=i;for(;t[t.length-1]===0;)t.pop()},e.prototype.toString=function(e){if((e||10)!=10)throw Error(`only base 10 is supported`);for(var t=this.buf,n=t[t.length-1].toString(),r=t.length-2;r>=0;--r)n+=(F+t[r]).toString().substring(1);return n},e.prototype.valueOf=function(){for(var e=this.buf,t=0,n=e.length-1;n>=0;--n)t=t*F+e[n];return t},e.prototype.simplify=function(){var e=this.buf;return e.length==1?e[0]:this},e}(),xe=`…`,Se=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,Ce=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function L(e,t){return e.length>t&&(e=e.substring(0,t)+xe),e}var we=function(){function e(t,n){this.hexDigits=`0123456789ABCDEF`,t instanceof e?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=n)}return e.prototype.get=function(e){if(e===void 0&&(e=this.pos++),e>=this.enc.length)throw Error(`Requesting byte offset `+e+` on a stream of length `+this.enc.length);return typeof this.enc==`string`?this.enc.charCodeAt(e):this.enc[e]},e.prototype.hexByte=function(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(e&15)},e.prototype.hexDump=function(e,t,n){for(var r=``,i=e;i<t;++i)if(r+=this.hexByte(this.get(i)),n!==!0)switch(i&15){case 7:r+=` `;break;case 15:r+=`
|
|
6
|
+
`;break;default:r+=` `}return r},e.prototype.isASCII=function(e,t){for(var n=e;n<t;++n){var r=this.get(n);if(r<32||r>176)return!1}return!0},e.prototype.parseStringISO=function(e,t){for(var n=``,r=e;r<t;++r)n+=String.fromCharCode(this.get(r));return n},e.prototype.parseStringUTF=function(e,t){for(var n=``,r=e;r<t;){var i=this.get(r++);n+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((i&31)<<6|this.get(r++)&63):String.fromCharCode((i&15)<<12|(this.get(r++)&63)<<6|this.get(r++)&63)}return n},e.prototype.parseStringBMP=function(e,t){for(var n=``,r,i,a=e;a<t;)r=this.get(a++),i=this.get(a++),n+=String.fromCharCode(r<<8|i);return n},e.prototype.parseTime=function(e,t,n){var r=this.parseStringISO(e,t),i=(n?Se:Ce).exec(r);return i?(n&&(i[1]=+i[1],i[1]+=+i[1]<70?2e3:1900),r=i[1]+`-`+i[2]+`-`+i[3]+` `+i[4],i[5]&&(r+=`:`+i[5],i[6]&&(r+=`:`+i[6],i[7]&&(r+=`.`+i[7]))),i[8]&&(r+=` UTC`,i[8]!=`Z`&&(r+=i[8],i[9]&&(r+=`:`+i[9]))),r):`Unrecognized time: `+r},e.prototype.parseInteger=function(e,t){for(var n=this.get(e),r=n>127,i=r?255:0,a,o=``;n==i&&++e<t;)n=this.get(e);if(a=t-e,a===0)return r?-1:0;if(a>4){for(o=n,a<<=3;!((+o^i)&128);)o<<=1,--a;o=`(`+a+` bit)
|
|
7
|
+
`}r&&(n-=256);for(var s=new I(n),c=e+1;c<t;++c)s.mulAdd(256,this.get(c));return o+s.toString()},e.prototype.parseBitString=function(e,t,n){for(var r=this.get(e),i=`(`+((t-e-1<<3)-r)+` bit)
|
|
8
|
+
`,a=``,o=e+1;o<t;++o){for(var s=this.get(o),c=o==t-1?r:0,l=7;l>=c;--l)a+=s>>l&1?`1`:`0`;if(a.length>n)return i+L(a,n)}return i+a},e.prototype.parseOctetString=function(e,t,n){if(this.isASCII(e,t))return L(this.parseStringISO(e,t),n);var r=t-e,i=`(`+r+` byte)
|
|
9
|
+
`;n/=2,r>n&&(t=e+n);for(var a=e;a<t;++a)i+=this.hexByte(this.get(a));return r>n&&(i+=xe),i},e.prototype.parseOID=function(e,t,n){for(var r=``,i=new I,a=0,o=e;o<t;++o){var s=this.get(o);if(i.mulAdd(128,s&127),a+=7,!(s&128)){if(r===``){if(i=i.simplify(),i instanceof I)i.sub(80),r=`2.`+i.toString();else{var c=i<80?i<40?0:1:2;r=c+`.`+(i-c*40)}}else r+=`.`+i.toString();if(r.length>n)return L(r,n);i=new I,a=0}}return a>0&&(r+=`.incomplete`),r},e}(),Te=function(){function e(e,t,n,r,i){if(!(r instanceof Ee))throw Error(`Invalid tag value.`);this.stream=e,this.header=t,this.length=n,this.tag=r,this.sub=i}return e.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return`EOC`;case 1:return`BOOLEAN`;case 2:return`INTEGER`;case 3:return`BIT_STRING`;case 4:return`OCTET_STRING`;case 5:return`NULL`;case 6:return`OBJECT_IDENTIFIER`;case 7:return`ObjectDescriptor`;case 8:return`EXTERNAL`;case 9:return`REAL`;case 10:return`ENUMERATED`;case 11:return`EMBEDDED_PDV`;case 12:return`UTF8String`;case 16:return`SEQUENCE`;case 17:return`SET`;case 18:return`NumericString`;case 19:return`PrintableString`;case 20:return`TeletexString`;case 21:return`VideotexString`;case 22:return`IA5String`;case 23:return`UTCTime`;case 24:return`GeneralizedTime`;case 25:return`GraphicString`;case 26:return`VisibleString`;case 27:return`GeneralString`;case 28:return`UniversalString`;case 30:return`BMPString`}return`Universal_`+this.tag.tagNumber.toString();case 1:return`Application_`+this.tag.tagNumber.toString();case 2:return`[`+this.tag.tagNumber.toString()+`]`;case 3:return`Private_`+this.tag.tagNumber.toString()}},e.prototype.content=function(e){if(this.tag===void 0)return null;e===void 0&&(e=1/0);var t=this.posContent(),n=Math.abs(this.length);if(!this.tag.isUniversal())return this.sub===null?this.stream.parseOctetString(t,t+n,e):`(`+this.sub.length+` elem)`;switch(this.tag.tagNumber){case 1:return this.stream.get(t)===0?`false`:`true`;case 2:return this.stream.parseInteger(t,t+n);case 3:return this.sub?`(`+this.sub.length+` elem)`:this.stream.parseBitString(t,t+n,e);case 4:return this.sub?`(`+this.sub.length+` elem)`:this.stream.parseOctetString(t,t+n,e);case 6:return this.stream.parseOID(t,t+n,e);case 16:case 17:return this.sub===null?`(no elem)`:`(`+this.sub.length+` elem)`;case 12:return L(this.stream.parseStringUTF(t,t+n),e);case 18:case 19:case 20:case 21:case 22:case 26:return L(this.stream.parseStringISO(t,t+n),e);case 30:return L(this.stream.parseStringBMP(t,t+n),e);case 23:case 24:return this.stream.parseTime(t,t+n,this.tag.tagNumber==23)}return null},e.prototype.toString=function(){return this.typeName()+`@`+this.stream.pos+`[header:`+this.header+`,length:`+this.length+`,sub:`+(this.sub===null?`null`:this.sub.length)+`]`},e.prototype.toPrettyString=function(e){e===void 0&&(e=``);var t=e+this.typeName()+` @`+this.stream.pos;if(this.length>=0&&(t+=`+`),t+=this.length,this.tag.tagConstructed?t+=` (constructed)`:this.tag.isUniversal()&&(this.tag.tagNumber==3||this.tag.tagNumber==4)&&this.sub!==null&&(t+=` (encapsulates)`),t+=`
|
|
10
|
+
`,this.sub!==null){e+=` `;for(var n=0,r=this.sub.length;n<r;++n)t+=this.sub[n].toPrettyString(e)}return t},e.prototype.posStart=function(){return this.stream.pos},e.prototype.posContent=function(){return this.stream.pos+this.header},e.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},e.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},e.decodeLength=function(e){var t=e.get(),n=t&127;if(n==t)return n;if(n>6)throw Error(`Length over 48 bits not supported at position `+(e.pos-1));if(n===0)return null;t=0;for(var r=0;r<n;++r)t=t*256+e.get();return t},e.prototype.getHexStringValue=function(){var e=this.toHexString(),t=this.header*2,n=this.length*2;return e.substr(t,n)},e.decode=function(t){var n=t instanceof we?t:new we(t,0),r=new we(n),i=new Ee(n),a=e.decodeLength(n),o=n.pos,s=o-r.pos,c=null,l=function(){var t=[];if(a!==null){for(var r=o+a;n.pos<r;)t[t.length]=e.decode(n);if(n.pos!=r)throw Error(`Content size is not correct for container starting at offset `+o)}else try{for(;;){var i=e.decode(n);if(i.tag.isEOC())break;t[t.length]=i}a=o-n.pos}catch(e){throw Error(`Exception while decoding undefined length content: `+e)}return t};if(i.tagConstructed)c=l();else if(i.isUniversal()&&(i.tagNumber==3||i.tagNumber==4))try{if(i.tagNumber==3&&n.get()!=0)throw Error(`BIT STRINGs with unused bits cannot encapsulate.`);c=l();for(var u=0;u<c.length;++u)if(c[u].tag.isEOC())throw Error(`EOC is not supposed to be actual content.`)}catch{c=null}if(c===null){if(a===null)throw Error(`We can't skip over an invalid tag with undefined length at offset `+o);n.pos=o+Math.abs(a)}return new e(r,s,a,i,c)},e}(),Ee=function(){function e(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=!!(t&32),this.tagNumber=t&31,this.tagNumber==31){var n=new I;do t=e.get(),n.mulAdd(128,t&127);while(t&128);this.tagNumber=n.simplify()}}return e.prototype.isUniversal=function(){return this.tagClass===0},e.prototype.isEOC=function(){return this.tagClass===0&&this.tagNumber===0},e}(),R,De=!0,z=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Oe=(1<<26)/z[z.length-1],B=function(){function e(e,t,n){e!=null&&(typeof e==`number`?this.fromNumber(e,t,n):t==null&&typeof e!=`string`?this.fromString(e,256):this.fromString(e,t))}return e.prototype.toString=function(e){if(this.s<0)return`-`+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var n=(1<<t)-1,r,i=!1,a=``,o=this.t,s=this.DB-o*this.DB%t;if(o-->0)for(s<this.DB&&(r=this[o]>>s)>0&&(i=!0,a=A(r));o>=0;)s<t?(r=(this[o]&(1<<s)-1)<<t-s,r|=this[--o]>>(s+=this.DB-t)):(r=this[o]>>(s-=t)&n,s<=0&&(s+=this.DB,--o)),r>0&&(i=!0),i&&(a+=A(r));return i?a:`0`},e.prototype.negate=function(){var t=V();return e.ZERO.subTo(this,t),t},e.prototype.abs=function(){return this.s<0?this.negate():this},e.prototype.compareTo=function(e){var t=this.s-e.s;if(t!=0)return t;var n=this.t;if(t=n-e.t,t!=0)return this.s<0?-t:t;for(;--n>=0;)if((t=this[n]-e[n])!=0)return t;return 0},e.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+q(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=V();return this.abs().divRemTo(t,null,n),this.s<0&&n.compareTo(e.ZERO)>0&&t.subTo(n,n),n},e.prototype.modPowInt=function(e,t){var n=e<256||t.isEven()?new Ae(t):new je(t);return this.exp(e,n)},e.prototype.clone=function(){var e=V();return this.copyTo(e),e},e.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else if(this.t==1)return this[0];else if(this.t==0)return 0;return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},e.prototype.byteValue=function(){return this.t==0?this.s:this[0]<<24>>24},e.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},e.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},e.prototype.toByteArray=function(){var e=this.t,t=[];t[0]=this.s;var n=this.DB-e*this.DB%8,r,i=0;if(e-->0)for(n<this.DB&&(r=this[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this[e]&(1<<n)-1)<<8-n,r|=this[--e]>>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),r&128&&(r|=-256),i==0&&(this.s&128)!=(r&128)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},e.prototype.equals=function(e){return this.compareTo(e)==0},e.prototype.min=function(e){return this.compareTo(e)<0?this:e},e.prototype.max=function(e){return this.compareTo(e)>0?this:e},e.prototype.and=function(e){var t=V();return this.bitwiseTo(e,de,t),t},e.prototype.or=function(e){var t=V();return this.bitwiseTo(e,fe,t),t},e.prototype.xor=function(e){var t=V();return this.bitwiseTo(e,pe,t),t},e.prototype.andNot=function(e){var t=V();return this.bitwiseTo(e,me,t),t},e.prototype.not=function(){for(var e=V(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},e.prototype.shiftLeft=function(e){var t=V();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=V();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},e.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+he(this[e]);return this.s<0?this.t*this.DB:-1},e.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,n=0;n<this.t;++n)e+=ge(this[n]^t);return e},e.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:!!(this[t]&1<<e%this.DB)},e.prototype.setBit=function(e){return this.changeBit(e,fe)},e.prototype.clearBit=function(e){return this.changeBit(e,me)},e.prototype.flipBit=function(e){return this.changeBit(e,pe)},e.prototype.add=function(e){var t=V();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=V();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=V();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=V();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=V();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=V(),n=V();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n=e.bitLength(),r,i=K(1),a;if(n<=0)return i;r=n<18?1:n<48?3:n<144?4:n<768?5:6,a=n<8?new Ae(t):t.isEven()?new Me(t):new je(t);var o=[],s=3,c=r-1,l=(1<<r)-1;if(o[1]=a.convert(this),r>1){var u=V();for(a.sqrTo(o[1],u);s<=l;)o[s]=V(),a.mulTo(u,o[s-2],o[s]),s+=2}var d=e.t-1,f,p=!0,m=V(),h;for(n=q(e[d])-1;d>=0;){for(n>=c?f=e[d]>>n-c&l:(f=(e[d]&(1<<n+1)-1)<<c-n,d>0&&(f|=e[d-1]>>this.DB+n-c)),s=r;!(f&1);)f>>=1,--s;if((n-=s)<0&&(n+=this.DB,--d),p)o[f].copyTo(i),p=!1;else{for(;s>1;)a.sqrTo(i,m),a.sqrTo(m,i),s-=2;s>0?a.sqrTo(i,m):(h=i,i=m,m=h),a.mulTo(m,o[f],i)}for(;d>=0&&!(e[d]&1<<n);)a.sqrTo(i,m),h=i,i=m,m=h,--n<0&&(n=this.DB-1,--d)}return a.revert(i)},e.prototype.modInverse=function(t){var n=t.isEven();if(this.isEven()&&n||t.signum()==0)return e.ZERO;for(var r=t.clone(),i=this.clone(),a=K(1),o=K(0),s=K(0),c=K(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),n?((!a.isEven()||!o.isEven())&&(a.addTo(this,a),o.subTo(t,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),n?((!s.isEven()||!c.isEven())&&(s.addTo(this,s),c.subTo(t,c)),s.rShiftTo(1,s)):c.isEven()||c.subTo(t,c),c.rShiftTo(1,c);r.compareTo(i)>=0?(r.subTo(i,r),n&&a.subTo(s,a),o.subTo(c,o)):(i.subTo(r,i),n&&s.subTo(a,s),c.subTo(o,c))}if(i.compareTo(e.ONE)!=0)return e.ZERO;if(c.compareTo(t)>=0)return c.subtract(t);if(c.signum()<0)c.addTo(t,c);else return c;return c.signum()<0?c.add(t):c},e.prototype.pow=function(e){return this.exp(e,new ke)},e.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(t.compareTo(n)<0){var r=t;t=n,n=r}var i=t.getLowestSetBit(),a=n.getLowestSetBit();if(a<0)return t;for(i<a&&(a=i),a>0&&(t.rShiftTo(a,t),n.rShiftTo(a,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return a>0&&n.lShiftTo(a,n),n},e.prototype.isProbablePrime=function(e){var t,n=this.abs();if(n.t==1&&n[0]<=z[z.length-1]){for(t=0;t<z.length;++t)if(n[0]==z[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<z.length;){for(var r=z[t],i=t+1;i<z.length&&r<Oe;)r*=z[i++];for(r=n.modInt(r);t<i;)if(r%z[t++]==0)return!1}return n.millerRabin(e)},e.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},e.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},e.prototype.fromString=function(t,n){var r;if(n==16)r=4;else if(n==8)r=3;else if(n==256)r=8;else if(n==2)r=1;else if(n==32)r=5;else if(n==4)r=2;else{this.fromRadix(t,n);return}this.t=0,this.s=0;for(var i=t.length,a=!1,o=0;--i>=0;){var s=r==8?t[i]&255:Fe(t,i);if(s<0){t.charAt(i)==`-`&&(a=!0);continue}a=!1,o==0?this[this.t++]=s:o+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,o+=r,o>=this.DB&&(o-=this.DB)}r==8&&t[0]&128&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),a&&e.ZERO.subTo(this,this)},e.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},e.prototype.dlShiftTo=function(e,t){for(var n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},e.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},e.prototype.lShiftTo=function(e,t){for(var n=e%this.DB,r=this.DB-n,i=(1<<r)-1,a=Math.floor(e/this.DB),o=this.s<<n&this.DM,s=this.t-1;s>=0;--s)t[s+a+1]=this[s]>>r|o,o=(this[s]&i)<<n;for(var s=a-1;s>=0;--s)t[s]=0;t[a]=o,t.t=this.t+a+1,t.s=this.s,t.clamp()},e.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t){t.t=0;return}var r=e%this.DB,i=this.DB-r,a=(1<<r)-1;t[0]=this[n]>>r;for(var o=n+1;o<this.t;++o)t[o-n-1]|=(this[o]&a)<<i,t[o-n]=this[o]>>r;r>0&&(t[this.t-n-1]|=(this.s&a)<<i),t.t=this.t-n,t.clamp()},e.prototype.subTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()},e.prototype.multiplyTo=function(t,n){var r=this.abs(),i=t.abs(),a=r.t;for(n.t=a+i.t;--a>=0;)n[a]=0;for(a=0;a<i.t;++a)n[a+r.t]=r.am(0,i[a],n,a,0,r.t);n.s=0,n.clamp(),this.s!=t.s&&e.ZERO.subTo(n,n)},e.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},e.prototype.divRemTo=function(t,n,r){var i=t.abs();if(!(i.t<=0)){var a=this.abs();if(a.t<i.t){n?.fromInt(0),r!=null&&this.copyTo(r);return}r??=V();var o=V(),s=this.s,c=t.s,l=this.DB-q(i[i.t-1]);l>0?(i.lShiftTo(l,o),a.lShiftTo(l,r)):(i.copyTo(o),a.copyTo(r));var u=o.t,d=o[u-1];if(d!=0){var f=d*(1<<this.F1)+(u>1?o[u-2]>>this.F2:0),p=this.FV/f,m=(1<<this.F1)/f,h=1<<this.F2,g=r.t,_=g-u,v=n??V();for(o.dlShiftTo(_,v),r.compareTo(v)>=0&&(r[r.t++]=1,r.subTo(v,r)),e.ONE.dlShiftTo(u,v),v.subTo(o,o);o.t<u;)o[o.t++]=0;for(;--_>=0;){var y=r[--g]==d?this.DM:Math.floor(r[g]*p+(r[g-1]+h)*m);if((r[g]+=o.am(0,y,r,_,0,u))<y)for(o.dlShiftTo(_,v),r.subTo(v,r);r[g]<--y;)r.subTo(v,r)}n!=null&&(r.drShiftTo(u,n),s!=c&&e.ZERO.subTo(n,n)),r.t=u,r.clamp(),l>0&&r.rShiftTo(l,r),s<0&&e.ZERO.subTo(r,r)}}},e.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(!(e&1))return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t},e.prototype.isEven=function(){return(this.t>0?this[0]&1:this.s)==0},e.prototype.exp=function(t,n){if(t>4294967295||t<1)return e.ONE;var r=V(),i=V(),a=n.convert(this),o=q(t)-1;for(a.copyTo(r);--o>=0;)if(n.sqrTo(r,i),(t&1<<o)>0)n.mulTo(i,a,r);else{var s=r;r=i,i=s}return n.revert(r)},e.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},e.prototype.toRadix=function(e){if(e??=10,this.signum()==0||e<2||e>36)return`0`;var t=this.chunkSize(e),n=e**+t,r=K(n),i=V(),a=V(),o=``;for(this.divRemTo(r,i,a);i.signum()>0;)o=(n+a.intValue()).toString(e).substr(1)+o,i.divRemTo(r,i,a);return a.intValue().toString(e)+o},e.prototype.fromRadix=function(t,n){this.fromInt(0),n??=10;for(var r=this.chunkSize(n),i=n**+r,a=!1,o=0,s=0,c=0;c<t.length;++c){var l=Fe(t,c);if(l<0){t.charAt(c)==`-`&&this.signum()==0&&(a=!0);continue}s=n*s+l,++o>=r&&(this.dMultiply(i),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(n**+o),this.dAddOffset(s,0)),a&&e.ZERO.subTo(this,this)},e.prototype.fromNumber=function(t,n,r){if(typeof n==`number`){if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),fe,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this)}else{var i=[],a=t&7;i.length=(t>>3)+1,n.nextBytes(i),a>0?i[0]&=(1<<a)-1:i[0]=0,this.fromString(i,256)}},e.prototype.bitwiseTo=function(e,t,n){var r,i,a=Math.min(e.t,this.t);for(r=0;r<a;++r)n[r]=t(this[r],e[r]);if(e.t<this.t){for(i=e.s&this.DM,r=a;r<this.t;++r)n[r]=t(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=a;r<e.t;++r)n[r]=t(i,e[r]);n.t=e.t}n.s=t(this.s,e.s),n.clamp()},e.prototype.changeBit=function(t,n){var r=e.ONE.shiftLeft(t);return this.bitwiseTo(r,n,r),r},e.prototype.addTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]+e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r+=e[n],t[n++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()},e.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},e.prototype.dAddOffset=function(e,t){if(e!=0){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},e.prototype.multiplyLowerTo=function(e,t,n){var r=Math.min(this.t+e.t,t);for(n.s=0,n.t=r;r>0;)n[--r]=0;for(var i=n.t-this.t;r<i;++r)n[r+this.t]=this.am(0,e[r],n,r,0,this.t);for(var i=Math.min(e.t,t);r<i;++r)this.am(0,e[r],n,r,0,t-r);n.clamp()},e.prototype.multiplyUpperTo=function(e,t,n){--t;var r=n.t=this.t+e.t-t;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)n[this.t+r-t]=this.am(t-r,e[r],n,0,0,this.t+r-t);n.clamp(),n.drShiftTo(1,n)},e.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0){if(t==0)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e}return n},e.prototype.millerRabin=function(t){var n=this.subtract(e.ONE),r=n.getLowestSetBit();if(r<=0)return!1;var i=n.shiftRight(r);t=t+1>>1,t>z.length&&(t=z.length);for(var a=V(),o=0;o<t;++o){a.fromInt(z[Math.floor(Math.random()*z.length)]);var s=a.modPow(i,this);if(s.compareTo(e.ONE)!=0&&s.compareTo(n)!=0){for(var c=1;c++<r&&s.compareTo(n)!=0;)if(s=s.modPowInt(2,this),s.compareTo(e.ONE)==0)return!1;if(s.compareTo(n)!=0)return!1}}return!0},e.prototype.square=function(){var e=V();return this.squareTo(e),e},e.prototype.gcda=function(e,t){var n=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(n.compareTo(r)<0){var i=n;n=r,r=i}var a=n.getLowestSetBit(),o=r.getLowestSetBit();if(o<0){t(n);return}a<o&&(o=a),o>0&&(n.rShiftTo(o,n),r.rShiftTo(o,r));var s=function(){(a=n.getLowestSetBit())>0&&n.rShiftTo(a,n),(a=r.getLowestSetBit())>0&&r.rShiftTo(a,r),n.compareTo(r)>=0?(n.subTo(r,n),n.rShiftTo(1,n)):(r.subTo(n,r),r.rShiftTo(1,r)),n.signum()>0?setTimeout(s,0):(o>0&&r.lShiftTo(o,r),setTimeout(function(){t(r)},0))};setTimeout(s,10)},e.prototype.fromNumberAsync=function(t,n,r,i){if(typeof n==`number`){if(t<2)this.fromInt(1);else{this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),fe,this),this.isEven()&&this.dAddOffset(1,0);var a=this,o=function(){a.dAddOffset(2,0),a.bitLength()>t&&a.subTo(e.ONE.shiftLeft(t-1),a),a.isProbablePrime(n)?setTimeout(function(){i()},0):setTimeout(o,0)};setTimeout(o,0)}}else{var s=[],c=t&7;s.length=(t>>3)+1,n.nextBytes(s),c>0?s[0]&=(1<<c)-1:s[0]=0,this.fromString(s,256)}},e}(),ke=function(){function e(){}return e.prototype.convert=function(e){return e},e.prototype.revert=function(e){return e},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},e.prototype.sqrTo=function(e,t){e.squareTo(t)},e}(),Ae=function(){function e(e){this.m=e}return e.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),je=function(){function e(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return e.prototype.convert=function(e){var t=V();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(B.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=V();return e.copyTo(t),this.reduce(t),t},e.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=e[t]&32767,r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),Me=function(){function e(e){this.m=e,this.r2=V(),this.q3=V(),B.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return e.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=V();return e.copyTo(t),this.reduce(t),t},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}();function V(){return new B(null)}function H(e,t){return new B(e,t)}var Ne=typeof navigator<`u`;Ne&&De&&navigator.appName==`Microsoft Internet Explorer`?(B.prototype.am=function(e,t,n,r,i,a){for(var o=t&32767,s=t>>15;--a>=0;){var c=this[e]&32767,l=this[e++]>>15,u=s*c+l*o;c=o*c+((u&32767)<<15)+n[r]+(i&1073741823),i=(c>>>30)+(u>>>15)+s*l+(i>>>30),n[r++]=c&1073741823}return i},R=30):Ne&&De&&navigator.appName!=`Netscape`?(B.prototype.am=function(e,t,n,r,i,a){for(;--a>=0;){var o=t*this[e++]+n[r]+i;i=Math.floor(o/67108864),n[r++]=o&67108863}return i},R=26):(B.prototype.am=function(e,t,n,r,i,a){for(var o=t&16383,s=t>>14;--a>=0;){var c=this[e]&16383,l=this[e++]>>14,u=s*c+l*o;c=o*c+((u&16383)<<14)+n[r]+i,i=(c>>28)+(u>>14)+s*l,n[r++]=c&268435455}return i},R=28),B.prototype.DB=R,B.prototype.DM=(1<<R)-1,B.prototype.DV=1<<R;var Pe=52;B.prototype.FV=2**Pe,B.prototype.F1=Pe-R,B.prototype.F2=2*R-Pe;for(var U=[],W=48,G=0;G<=9;++G)U[W++]=G;for(W=97,G=10;G<36;++G)U[W++]=G;for(W=65,G=10;G<36;++G)U[W++]=G;function Fe(e,t){return U[e.charCodeAt(t)]??-1}function K(e){var t=V();return t.fromInt(e),t}function q(e){var t=1,n;return(n=e>>>16)!=0&&(e=n,t+=16),(n=e>>8)!=0&&(e=n,t+=8),(n=e>>4)!=0&&(e=n,t+=4),(n=e>>2)!=0&&(e=n,t+=2),(n=e>>1)!=0&&(e=n,t+=1),t}B.ZERO=K(0),B.ONE=K(1);var Ie=function(){function e(){this.i=0,this.j=0,this.S=[]}return e.prototype.init=function(e){for(var t=0,n,r;t<256;++t)this.S[t]=t;for(n=0,t=0;t<256;++t)n=n+this.S[t]+e[t%e.length]&255,r=this.S[t],this.S[t]=this.S[n],this.S[n]=r;this.i=0,this.j=0},e.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]},e}();function Le(){return new Ie}var Re,J=null,Y;J??(J=[],Y=0);function ze(){if(Re==null){for(Re=Le();Y<256;){var e=Math.floor(65536*Math.random());J[Y++]=e&255}for(Re.init(J),Y=0;Y<J.length;++Y)J[Y]=0;Y=0}return Re.next()}var Be=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=ze()},e}();function Ve(e,t){if(t<e.length+22)return console.error(`Message too long for RSA`),null;for(var n=t-e.length-6,r=``,i=0;i<n;i+=2)r+=`ff`;return H(`0001`+r+`00`+e,16)}function He(e,t){if(t<e.length+11)return console.error(`Message too long for RSA`),null;for(var n=[],r=e.length-1;r>=0&&t>0;){var i=e.charCodeAt(r--);i<128?n[--t]=i:i>127&&i<2048?(n[--t]=i&63|128,n[--t]=i>>6|192):(n[--t]=i&63|128,n[--t]=i>>6&63|128,n[--t]=i>>12|224)}n[--t]=0;for(var a=new Be,o=[];t>2;){for(o[0]=0;o[0]==0;)a.nextBytes(o);n[--t]=o[0]}return n[--t]=2,n[--t]=0,new B(n)}var Ue=function(){function e(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return e.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},e.prototype.doPrivate=function(e){if(this.p==null||this.q==null)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),n=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(n)<0;)t=t.add(this.p);return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},e.prototype.setPublic=function(e,t){e!=null&&t!=null&&e.length>0&&t.length>0?(this.n=H(e,16),this.e=parseInt(t,16)):console.error(`Invalid RSA public key`)},e.prototype.encrypt=function(e){var t=this.n.bitLength()+7>>3,n=He(e,t);if(n==null)return null;var r=this.doPublic(n);if(r==null)return null;for(var i=r.toString(16),a=i.length,o=0;o<t*2-a;o++)i=`0`+i;return i},e.prototype.setPrivate=function(e,t,n){e!=null&&t!=null&&e.length>0&&t.length>0?(this.n=H(e,16),this.e=parseInt(t,16),this.d=H(n,16)):console.error(`Invalid RSA private key`)},e.prototype.setPrivateEx=function(e,t,n,r,i,a,o,s){e!=null&&t!=null&&e.length>0&&t.length>0?(this.n=H(e,16),this.e=parseInt(t,16),this.d=H(n,16),this.p=H(r,16),this.q=H(i,16),this.dmp1=H(a,16),this.dmq1=H(o,16),this.coeff=H(s,16)):console.error(`Invalid RSA private key`)},e.prototype.generate=function(e,t){var n=new Be,r=e>>1;this.e=parseInt(t,16);for(var i=new B(t,16);;){for(;this.p=new B(e-r,1,n),!(this.p.subtract(B.ONE).gcd(i).compareTo(B.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new B(r,1,n),!(this.q.subtract(B.ONE).gcd(i).compareTo(B.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var a=this.p;this.p=this.q,this.q=a}var o=this.p.subtract(B.ONE),s=this.q.subtract(B.ONE),c=o.multiply(s);if(c.gcd(i).compareTo(B.ONE)==0){this.n=this.p.multiply(this.q),this.d=i.modInverse(c),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(s),this.coeff=this.q.modInverse(this.p);break}}},e.prototype.decrypt=function(e){var t=H(e,16),n=this.doPrivate(t);return n==null?null:We(n,this.n.bitLength()+7>>3)},e.prototype.generateAsync=function(e,t,n){var r=new Be,i=e>>1;this.e=parseInt(t,16);var a=new B(t,16),o=this,s=function(){var t=function(){if(o.p.compareTo(o.q)<=0){var e=o.p;o.p=o.q,o.q=e}var t=o.p.subtract(B.ONE),r=o.q.subtract(B.ONE),i=t.multiply(r);i.gcd(a).compareTo(B.ONE)==0?(o.n=o.p.multiply(o.q),o.d=a.modInverse(i),o.dmp1=o.d.mod(t),o.dmq1=o.d.mod(r),o.coeff=o.q.modInverse(o.p),setTimeout(function(){n()},0)):setTimeout(s,0)},c=function(){o.q=V(),o.q.fromNumberAsync(i,1,r,function(){o.q.subtract(B.ONE).gcda(a,function(e){e.compareTo(B.ONE)==0&&o.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(c,0)})})},l=function(){o.p=V(),o.p.fromNumberAsync(e-i,1,r,function(){o.p.subtract(B.ONE).gcda(a,function(e){e.compareTo(B.ONE)==0&&o.p.isProbablePrime(10)?setTimeout(c,0):setTimeout(l,0)})})};setTimeout(l,0)};setTimeout(s,0)},e.prototype.sign=function(e,t,n){var r=Ve(qe(n)+t(e).toString(),this.n.bitLength()/4);if(r==null)return null;var i=this.doPrivate(r);if(i==null)return null;var a=i.toString(16);return a.length&1?`0`+a:a},e.prototype.verify=function(e,t,n){var r=H(t,16),i=this.doPublic(r);return i==null?null:Je(i.toString(16).replace(/^1f+00/,``))==n(e).toString()},e.prototype.encryptLong=function(e){var t=this,n=``,r=(this.n.bitLength()+7>>3)-11;return this.setSplitChn(e,r).forEach(function(e){n+=t.encrypt(e)}),n},e.prototype.decryptLong=function(e){var t=``,n=this.n.bitLength()+7>>3,r=n*2;if(e.length>r){for(var i=e.match(RegExp(`.{1,`+r+`}`,`g`))||[],a=[],o=0;o<i.length;o++){var s=H(i[o],16),c=this.doPrivate(s);if(c==null)return null;a.push(c)}t=Ge(a,n)}else t=this.decrypt(e);return t},e.prototype.setSplitChn=function(e,t,n){n===void 0&&(n=[]);for(var r=e.split(``),i=0,a=0;a<r.length;a++){var o=r[a].charCodeAt(0);if(i+=o<=127?1:o<=2047?2:o<=65535?3:4,i>t){var s=e.substring(0,a);return n.push(s),this.setSplitChn(e.substring(a),t,n)}}return n.push(e),n},e}();function We(e,t){for(var n=e.toByteArray(),r=0;r<n.length&&n[r]==0;)++r;if(n.length-r!=t-1||n[r]!=2)return null;for(++r;n[r]!=0;)if(++r>=n.length)return null;for(var i=``;++r<n.length;){var a=n[r]&255;a<128?i+=String.fromCharCode(a):a>191&&a<224?(i+=String.fromCharCode((a&31)<<6|n[r+1]&63),++r):(i+=String.fromCharCode((a&15)<<12|(n[r+1]&63)<<6|n[r+2]&63),r+=2)}return i}function Ge(e,t){for(var n=[],r=0;r<e.length;r++){for(var i=e[r].toByteArray(),a=0;a<i.length&&i[a]==0;)++a;if(i.length-a!=t-1||i[a]!=2)return null;for(++a;i[a]!=0;)if(++a>=i.length)return null;n=n.concat(i.slice(a+1))}for(var o=n,s=-1,c=``;++s<o.length;){var l=o[s]&255;l<128?c+=String.fromCharCode(l):l>191&&l<224?(c+=String.fromCharCode((l&31)<<6|o[s+1]&63),++s):(c+=String.fromCharCode((l&15)<<12|(o[s+1]&63)<<6|o[s+2]&63),s+=2)}return c}var Ke={md2:`3020300c06082a864886f70d020205000410`,md5:`3020300c06082a864886f70d020505000410`,sha1:`3021300906052b0e03021a05000414`,sha224:`302d300d06096086480165030402040500041c`,sha256:`3031300d060960864801650304020105000420`,sha384:`3041300d060960864801650304020205000430`,sha512:`3051300d060960864801650304020305000440`,ripemd160:`3021300906052b2403020105000414`};function qe(e){return Ke[e]||``}function Je(e){for(var t in Ke)if(Ke.hasOwnProperty(t)){var n=Ke[t],r=n.length;if(e.substr(0,r)==n)return e.substr(r)}return e}
|
|
11
11
|
/*!
|
|
12
12
|
Copyright (c) 2011, Yahoo! Inc. All rights reserved.
|
|
13
13
|
Code licensed under the BSD License:
|
|
@@ -23,13 +23,15 @@ var X={};X.lang={extend:function(e,t,n){if(!t||!e)throw Error(`YAHOO.lang.extend
|
|
|
23
23
|
* @since jsrsasign 2.1
|
|
24
24
|
* @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
|
|
25
25
|
*/
|
|
26
|
-
var Z={};(Z.asn1===void 0||!Z.asn1)&&(Z.asn1={}),Z.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t=`0`+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if(t.substr(0,1)!=`-`)t.length%2==1?t=`0`+t:t.match(/^[0-7]/)||(t=`00`+t);else{var n=t.substr(1).length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var r=``,i=0;i<n;i++)r+=`f`;t=new V(r,16).xor(e).add(V.ONE).toString(16).replace(/^-/,``)}return t},this.getPEMStringFromHex=function(e,t){return hextopem(e,t)},this.newObject=function(e){var t=Z.asn1,n=t.DERBoolean,r=t.DERInteger,i=t.DERBitString,a=t.DEROctetString,o=t.DERNull,s=t.DERObjectIdentifier,c=t.DEREnumerated,l=t.DERUTF8String,u=t.DERNumericString,d=t.DERPrintableString,f=t.DERTeletexString,p=t.DERIA5String,m=t.DERUTCTime,h=t.DERGeneralizedTime,g=t.DERSequence,_=t.DERSet,v=t.DERTaggedObject,y=t.ASN1Util.newObject,b=Object.keys(e);if(b.length!=1)throw`key of param shall be only one.`;var x=b[0];if(`:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:`.indexOf(`:`+x+`:`)==-1)throw`undefined key: `+x;if(x==`bool`)return new n(e[x]);if(x==`int`)return new r(e[x]);if(x==`bitstr`)return new i(e[x]);if(x==`octstr`)return new a(e[x]);if(x==`null`)return new o(e[x]);if(x==`oid`)return new s(e[x]);if(x==`enum`)return new c(e[x]);if(x==`utf8str`)return new l(e[x]);if(x==`numstr`)return new u(e[x]);if(x==`prnstr`)return new d(e[x]);if(x==`telstr`)return new f(e[x]);if(x==`ia5str`)return new p(e[x]);if(x==`utctime`)return new m(e[x]);if(x==`gentime`)return new h(e[x]);if(x==`seq`){for(var S=e[x],C=[],w=0;w<S.length;w++){var T=y(S[w]);C.push(T)}return new g({array:C})}if(x==`set`){for(var S=e[x],C=[],w=0;w<S.length;w++){var T=y(S[w]);C.push(T)}return new _({array:C})}if(x==`tag`){var E=e[x];if(Object.prototype.toString.call(E)===`[object Array]`&&E.length==3){var ee=y(E[2]);return new v({tag:E[0],explicit:E[1],obj:ee})}var D={};if(E.explicit!==void 0&&(D.explicit=E.explicit),E.tag!==void 0&&(D.tag=E.tag),E.obj===void 0)throw`obj shall be specified for 'tag'.`;return D.obj=y(E.obj),new v(D)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},Z.asn1.ASN1Util.oidHexToInt=function(e){for(var t=``,n=parseInt(e.substr(0,2),16),r=Math.floor(n/40),i=n%40,t=r+`.`+i,a=``,o=2;o<e.length;o+=2){var s=(`00000000`+parseInt(e.substr(o,2),16).toString(2)).slice(-8);if(a+=s.substr(1,7),s.substr(0,1)==`0`){var c=new V(a,2);t=t+`.`+c.toString(10),a=``}}return t},Z.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return t.length==1&&(t=`0`+t),t},n=function(e){var n=``,r=new V(e,10).toString(2),i=7-r.length%7;i==7&&(i=0);for(var a=``,o=0;o<i;o++)a+=`0`;r=a+r;for(var o=0;o<r.length-1;o+=7){var s=r.substr(o,7);o!=r.length-7&&(s=`1`+s),n+=t(parseInt(s,2))}return n};if(!e.match(/^[0-9.]+$/))throw`malformed oid string: `+e;var r=``,i=e.split(`.`),a=parseInt(i[0])*40+parseInt(i[1]);r+=t(a),i.splice(0,2);for(var o=0;o<i.length;o++)r+=n(i[o]);return r},Z.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(this.hV===void 0||this.hV==null)throw`this.hV is null or undefined.`;if(this.hV.length%2==1)throw`value hex must be even length: n=0,v=`+this.hV;var e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t=`0`+t),e<128)return t;var n=t.length/2;if(n>15)throw`ASN.1 length too long to represent by 8x: n = `+e.toString(16);return(128+n).toString(16)+t},this.getEncodedHex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return``}},Z.asn1.DERAbstractString=function(e){Z.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(this.s)},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(typeof e==`string`?this.setString(e):e.str===void 0?e.hex!==void 0&&this.setStringHex(e.hex):this.setString(e.str))},X.lang.extend(Z.asn1.DERAbstractString,Z.asn1.ASN1Object),Z.asn1.DERAbstractTime=function(e){Z.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){return utc=e.getTime()+e.getTimezoneOffset()*6e4,new Date(utc)},this.formatDate=function(e,t,n){var r=this.zeroPadding,i=this.localDateToUTC(e),a=String(i.getFullYear());t==`utc`&&(a=a.substr(2,2));var o=r(String(i.getMonth()+1),2),s=r(String(i.getDate()),2),c=r(String(i.getHours()),2),l=r(String(i.getMinutes()),2),u=r(String(i.getSeconds()),2),d=a+o+s+c+l+u;if(n===!0){var f=i.getMilliseconds();if(f!=0){var p=r(String(f),3);p=p.replace(/[0]+$/,``),d=d+`.`+p}}return d+`Z`},this.zeroPadding=function(e,t){return e.length>=t?e:Array(t-e.length+1).join(`0`)+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(e)},this.setByDateValue=function(e,t,n,r,i,a){var o=new Date(Date.UTC(e,t-1,n,r,i,a,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},X.lang.extend(Z.asn1.DERAbstractTime,Z.asn1.ASN1Object),Z.asn1.DERAbstractStructured=function(e){Z.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=[],e!==void 0&&e.array!==void 0&&(this.asn1Array=e.array)},X.lang.extend(Z.asn1.DERAbstractStructured,Z.asn1.ASN1Object),Z.asn1.DERBoolean=function(){Z.asn1.DERBoolean.superclass.constructor.call(this),this.hT=`01`,this.hTLV=`0101ff`},X.lang.extend(Z.asn1.DERBoolean,Z.asn1.ASN1Object),Z.asn1.DERInteger=function(e){Z.asn1.DERInteger.superclass.constructor.call(this),this.hT=`02`,this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=Z.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new V(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(e.bigint===void 0?e.int===void 0?typeof e==`number`?this.setByInteger(e):e.hex!==void 0&&this.setValueHex(e.hex):this.setByInteger(e.int):this.setByBigInteger(e.bigint))},X.lang.extend(Z.asn1.DERInteger,Z.asn1.ASN1Object),Z.asn1.DERBitString=function(e){e!==void 0&&e.obj!==void 0&&(e.hex=`00`+Z.asn1.ASN1Util.newObject(e.obj).getEncodedHex()),Z.asn1.DERBitString.superclass.constructor.call(this),this.hT=`03`,this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw`unused bits shall be from 0 to 7: u = `+e;var n=`0`+e;this.hTLV=null,this.isModified=!0,this.hV=n+t},this.setByBinaryString=function(e){e=e.replace(/0+$/,``);var t=8-e.length%8;t==8&&(t=0);for(var n=0;n<=t;n++)e+=`0`;for(var r=``,n=0;n<e.length-1;n+=8){var i=e.substr(n,8),a=parseInt(i,2).toString(16);a.length==1&&(a=`0`+a),r+=a}this.hTLV=null,this.isModified=!0,this.hV=`0`+t+r},this.setByBooleanArray=function(e){for(var t=``,n=0;n<e.length;n++)e[n]==1?t+=`1`:t+=`0`;this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=!1;return t},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(typeof e==`string`&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):e.hex===void 0?e.bin===void 0?e.array!==void 0&&this.setByBooleanArray(e.array):this.setByBinaryString(e.bin):this.setHexValueIncludingUnusedBits(e.hex))},X.lang.extend(Z.asn1.DERBitString,Z.asn1.ASN1Object),Z.asn1.DEROctetString=function(e){e!==void 0&&e.obj!==void 0&&(e.hex=Z.asn1.ASN1Util.newObject(e.obj).getEncodedHex()),Z.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT=`04`},X.lang.extend(Z.asn1.DEROctetString,Z.asn1.DERAbstractString),Z.asn1.DERNull=function(){Z.asn1.DERNull.superclass.constructor.call(this),this.hT=`05`,this.hTLV=`0500`},X.lang.extend(Z.asn1.DERNull,Z.asn1.ASN1Object),Z.asn1.DERObjectIdentifier=function(e){var t=function(e){var t=e.toString(16);return t.length==1&&(t=`0`+t),t},n=function(e){var n=``,r=new V(e,10).toString(2),i=7-r.length%7;i==7&&(i=0);for(var a=``,o=0;o<i;o++)a+=`0`;r=a+r;for(var o=0;o<r.length-1;o+=7){var s=r.substr(o,7);o!=r.length-7&&(s=`1`+s),n+=t(parseInt(s,2))}return n};Z.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT=`06`,this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){if(!e.match(/^[0-9.]+$/))throw`malformed oid string: `+e;var r=``,i=e.split(`.`),a=parseInt(i[0])*40+parseInt(i[1]);r+=t(a),i.splice(0,2);for(var o=0;o<i.length;o++)r+=n(i[o]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(e){var t=Z.asn1.x509.OID.name2oid(e);if(t!==``)this.setValueOidString(t);else throw`DERObjectIdentifier oidName undefined: `+e},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(typeof e==`string`?e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e):e.oid===void 0?e.hex===void 0?e.name!==void 0&&this.setValueName(e.name):this.setValueHex(e.hex):this.setValueOidString(e.oid))},X.lang.extend(Z.asn1.DERObjectIdentifier,Z.asn1.ASN1Object),Z.asn1.DEREnumerated=function(e){Z.asn1.DEREnumerated.superclass.constructor.call(this),this.hT=`0a`,this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=Z.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new V(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(e.int===void 0?typeof e==`number`?this.setByInteger(e):e.hex!==void 0&&this.setValueHex(e.hex):this.setByInteger(e.int))},X.lang.extend(Z.asn1.DEREnumerated,Z.asn1.ASN1Object),Z.asn1.DERUTF8String=function(e){Z.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT=`0c`},X.lang.extend(Z.asn1.DERUTF8String,Z.asn1.DERAbstractString),Z.asn1.DERNumericString=function(e){Z.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT=`12`},X.lang.extend(Z.asn1.DERNumericString,Z.asn1.DERAbstractString),Z.asn1.DERPrintableString=function(e){Z.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT=`13`},X.lang.extend(Z.asn1.DERPrintableString,Z.asn1.DERAbstractString),Z.asn1.DERTeletexString=function(e){Z.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT=`14`},X.lang.extend(Z.asn1.DERTeletexString,Z.asn1.DERAbstractString),Z.asn1.DERIA5String=function(e){Z.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT=`16`},X.lang.extend(Z.asn1.DERIA5String,Z.asn1.DERAbstractString),Z.asn1.DERUTCTime=function(e){Z.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT=`17`,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,`utc`),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,`utc`),this.hV=stohex(this.s)),this.hV},e!==void 0&&(e.str===void 0?typeof e==`string`&&e.match(/^[0-9]{12}Z$/)?this.setString(e):e.hex===void 0?e.date!==void 0&&this.setByDate(e.date):this.setStringHex(e.hex):this.setString(e.str))},X.lang.extend(Z.asn1.DERUTCTime,Z.asn1.DERAbstractTime),Z.asn1.DERGeneralizedTime=function(e){Z.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT=`18`,this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,`gen`,this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,`gen`,this.withMillis),this.hV=stohex(this.s)),this.hV},e!==void 0&&(e.str===void 0?typeof e==`string`&&e.match(/^[0-9]{14}Z$/)?this.setString(e):e.hex===void 0?e.date!==void 0&&this.setByDate(e.date):this.setStringHex(e.hex):this.setString(e.str),e.millis===!0&&(this.withMillis=!0))},X.lang.extend(Z.asn1.DERGeneralizedTime,Z.asn1.DERAbstractTime),Z.asn1.DERSequence=function(e){Z.asn1.DERSequence.superclass.constructor.call(this,e),this.hT=`30`,this.getFreshValueHex=function(){for(var e=``,t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e+=n.getEncodedHex()}return this.hV=e,this.hV}},X.lang.extend(Z.asn1.DERSequence,Z.asn1.DERAbstractStructured),Z.asn1.DERSet=function(e){Z.asn1.DERSet.superclass.constructor.call(this,e),this.hT=`31`,this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=[],t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e.push(n.getEncodedHex())}return this.sortFlag==1&&e.sort(),this.hV=e.join(``),this.hV},e!==void 0&&e.sortflag!==void 0&&e.sortflag==0&&(this.sortFlag=!1)},X.lang.extend(Z.asn1.DERSet,Z.asn1.DERAbstractStructured),Z.asn1.DERTaggedObject=function(e){Z.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT=`a0`,this.hV=``,this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,n){this.hT=t,this.isExplicit=e,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(e.tag!==void 0&&(this.hT=e.tag),e.explicit!==void 0&&(this.isExplicit=e.explicit),e.obj!==void 0&&(this.asn1Object=e.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},X.lang.extend(Z.asn1.DERTaggedObject,Z.asn1.ASN1Object);var Ye=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Xe=function(e){Ye(t,e);function t(n){var r=e.call(this)||this;return n&&(typeof n==`string`?r.parseKey(n):(t.hasPrivateKeyProperty(n)||t.hasPublicKeyProperty(n))&&r.parsePropertiesFrom(n)),r}return t.prototype.parseKey=function(e){try{var t=0,n=0,r=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(e)?ve.decode(e):ye.unarmor(e),i=we.decode(r);if(i.sub.length===3&&(i=i.sub[2].sub[0]),i.sub.length===9){t=i.sub[1].getHexStringValue(),this.n=U(t,16),n=i.sub[2].getHexStringValue(),this.e=parseInt(n,16);var a=i.sub[3].getHexStringValue();this.d=U(a,16);var o=i.sub[4].getHexStringValue();this.p=U(o,16);var s=i.sub[5].getHexStringValue();this.q=U(s,16);var c=i.sub[6].getHexStringValue();this.dmp1=U(c,16);var l=i.sub[7].getHexStringValue();this.dmq1=U(l,16);var u=i.sub[8].getHexStringValue();this.coeff=U(u,16)}else if(i.sub.length===2){var d=i.sub[1].sub[0];t=d.sub[0].getHexStringValue(),this.n=U(t,16),n=d.sub[1].getHexStringValue(),this.e=parseInt(n,16)}else return!1;return!0}catch{return!1}},t.prototype.getPrivateBaseKey=function(){var e={array:[new Z.asn1.DERInteger({int:0}),new Z.asn1.DERInteger({bigint:this.n}),new Z.asn1.DERInteger({int:this.e}),new Z.asn1.DERInteger({bigint:this.d}),new Z.asn1.DERInteger({bigint:this.p}),new Z.asn1.DERInteger({bigint:this.q}),new Z.asn1.DERInteger({bigint:this.dmp1}),new Z.asn1.DERInteger({bigint:this.dmq1}),new Z.asn1.DERInteger({bigint:this.coeff})]};return new Z.asn1.DERSequence(e).getEncodedHex()},t.prototype.getPrivateBaseKeyB64=function(){return N(this.getPrivateBaseKey())},t.prototype.getPublicBaseKey=function(){var e=new Z.asn1.DERSequence({array:[new Z.asn1.DERObjectIdentifier({oid:`1.2.840.113549.1.1.1`}),new Z.asn1.DERNull]}),t=new Z.asn1.DERSequence({array:[new Z.asn1.DERInteger({bigint:this.n}),new Z.asn1.DERInteger({int:this.e})]}),n=new Z.asn1.DERBitString({hex:`00`+t.getEncodedHex()});return new Z.asn1.DERSequence({array:[e,n]}).getEncodedHex()},t.prototype.getPublicBaseKeyB64=function(){return N(this.getPublicBaseKey())},t.wordwrap=function(e,t){if(t||=64,!e)return e;var n=`(.{1,`+t+`})( +|$
|
|
26
|
+
var Z={};(Z.asn1===void 0||!Z.asn1)&&(Z.asn1={}),Z.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t=`0`+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if(t.substr(0,1)!=`-`)t.length%2==1?t=`0`+t:t.match(/^[0-7]/)||(t=`00`+t);else{var n=t.substr(1).length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var r=``,i=0;i<n;i++)r+=`f`;t=new B(r,16).xor(e).add(B.ONE).toString(16).replace(/^-/,``)}return t},this.getPEMStringFromHex=function(e,t){return hextopem(e,t)},this.newObject=function(e){var t=Z.asn1,n=t.DERBoolean,r=t.DERInteger,i=t.DERBitString,a=t.DEROctetString,o=t.DERNull,s=t.DERObjectIdentifier,c=t.DEREnumerated,l=t.DERUTF8String,u=t.DERNumericString,d=t.DERPrintableString,f=t.DERTeletexString,p=t.DERIA5String,m=t.DERUTCTime,h=t.DERGeneralizedTime,g=t.DERSequence,_=t.DERSet,v=t.DERTaggedObject,y=t.ASN1Util.newObject,b=Object.keys(e);if(b.length!=1)throw`key of param shall be only one.`;var x=b[0];if(`:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:`.indexOf(`:`+x+`:`)==-1)throw`undefined key: `+x;if(x==`bool`)return new n(e[x]);if(x==`int`)return new r(e[x]);if(x==`bitstr`)return new i(e[x]);if(x==`octstr`)return new a(e[x]);if(x==`null`)return new o(e[x]);if(x==`oid`)return new s(e[x]);if(x==`enum`)return new c(e[x]);if(x==`utf8str`)return new l(e[x]);if(x==`numstr`)return new u(e[x]);if(x==`prnstr`)return new d(e[x]);if(x==`telstr`)return new f(e[x]);if(x==`ia5str`)return new p(e[x]);if(x==`utctime`)return new m(e[x]);if(x==`gentime`)return new h(e[x]);if(x==`seq`){for(var S=e[x],C=[],w=0;w<S.length;w++){var T=y(S[w]);C.push(T)}return new g({array:C})}if(x==`set`){for(var S=e[x],C=[],w=0;w<S.length;w++){var T=y(S[w]);C.push(T)}return new _({array:C})}if(x==`tag`){var E=e[x];if(Object.prototype.toString.call(E)===`[object Array]`&&E.length==3){var ee=y(E[2]);return new v({tag:E[0],explicit:E[1],obj:ee})}var D={};if(E.explicit!==void 0&&(D.explicit=E.explicit),E.tag!==void 0&&(D.tag=E.tag),E.obj===void 0)throw`obj shall be specified for 'tag'.`;return D.obj=y(E.obj),new v(D)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},Z.asn1.ASN1Util.oidHexToInt=function(e){for(var t=``,n=parseInt(e.substr(0,2),16),r=Math.floor(n/40),i=n%40,t=r+`.`+i,a=``,o=2;o<e.length;o+=2){var s=(`00000000`+parseInt(e.substr(o,2),16).toString(2)).slice(-8);if(a+=s.substr(1,7),s.substr(0,1)==`0`){var c=new B(a,2);t=t+`.`+c.toString(10),a=``}}return t},Z.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return t.length==1&&(t=`0`+t),t},n=function(e){var n=``,r=new B(e,10).toString(2),i=7-r.length%7;i==7&&(i=0);for(var a=``,o=0;o<i;o++)a+=`0`;r=a+r;for(var o=0;o<r.length-1;o+=7){var s=r.substr(o,7);o!=r.length-7&&(s=`1`+s),n+=t(parseInt(s,2))}return n};if(!e.match(/^[0-9.]+$/))throw`malformed oid string: `+e;var r=``,i=e.split(`.`),a=parseInt(i[0])*40+parseInt(i[1]);r+=t(a),i.splice(0,2);for(var o=0;o<i.length;o++)r+=n(i[o]);return r},Z.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(this.hV===void 0||this.hV==null)throw`this.hV is null or undefined.`;if(this.hV.length%2==1)throw`value hex must be even length: n=0,v=`+this.hV;var e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t=`0`+t),e<128)return t;var n=t.length/2;if(n>15)throw`ASN.1 length too long to represent by 8x: n = `+e.toString(16);return(128+n).toString(16)+t},this.getEncodedHex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return``}},Z.asn1.DERAbstractString=function(e){Z.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(this.s)},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(typeof e==`string`?this.setString(e):e.str===void 0?e.hex!==void 0&&this.setStringHex(e.hex):this.setString(e.str))},X.lang.extend(Z.asn1.DERAbstractString,Z.asn1.ASN1Object),Z.asn1.DERAbstractTime=function(e){Z.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){return utc=e.getTime()+e.getTimezoneOffset()*6e4,new Date(utc)},this.formatDate=function(e,t,n){var r=this.zeroPadding,i=this.localDateToUTC(e),a=String(i.getFullYear());t==`utc`&&(a=a.substr(2,2));var o=r(String(i.getMonth()+1),2),s=r(String(i.getDate()),2),c=r(String(i.getHours()),2),l=r(String(i.getMinutes()),2),u=r(String(i.getSeconds()),2),d=a+o+s+c+l+u;if(n===!0){var f=i.getMilliseconds();if(f!=0){var p=r(String(f),3);p=p.replace(/[0]+$/,``),d=d+`.`+p}}return d+`Z`},this.zeroPadding=function(e,t){return e.length>=t?e:Array(t-e.length+1).join(`0`)+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(e)},this.setByDateValue=function(e,t,n,r,i,a){var o=new Date(Date.UTC(e,t-1,n,r,i,a,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},X.lang.extend(Z.asn1.DERAbstractTime,Z.asn1.ASN1Object),Z.asn1.DERAbstractStructured=function(e){Z.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=[],e!==void 0&&e.array!==void 0&&(this.asn1Array=e.array)},X.lang.extend(Z.asn1.DERAbstractStructured,Z.asn1.ASN1Object),Z.asn1.DERBoolean=function(){Z.asn1.DERBoolean.superclass.constructor.call(this),this.hT=`01`,this.hTLV=`0101ff`},X.lang.extend(Z.asn1.DERBoolean,Z.asn1.ASN1Object),Z.asn1.DERInteger=function(e){Z.asn1.DERInteger.superclass.constructor.call(this),this.hT=`02`,this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=Z.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new B(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(e.bigint===void 0?e.int===void 0?typeof e==`number`?this.setByInteger(e):e.hex!==void 0&&this.setValueHex(e.hex):this.setByInteger(e.int):this.setByBigInteger(e.bigint))},X.lang.extend(Z.asn1.DERInteger,Z.asn1.ASN1Object),Z.asn1.DERBitString=function(e){e!==void 0&&e.obj!==void 0&&(e.hex=`00`+Z.asn1.ASN1Util.newObject(e.obj).getEncodedHex()),Z.asn1.DERBitString.superclass.constructor.call(this),this.hT=`03`,this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw`unused bits shall be from 0 to 7: u = `+e;var n=`0`+e;this.hTLV=null,this.isModified=!0,this.hV=n+t},this.setByBinaryString=function(e){e=e.replace(/0+$/,``);var t=8-e.length%8;t==8&&(t=0);for(var n=0;n<=t;n++)e+=`0`;for(var r=``,n=0;n<e.length-1;n+=8){var i=e.substr(n,8),a=parseInt(i,2).toString(16);a.length==1&&(a=`0`+a),r+=a}this.hTLV=null,this.isModified=!0,this.hV=`0`+t+r},this.setByBooleanArray=function(e){for(var t=``,n=0;n<e.length;n++)e[n]==1?t+=`1`:t+=`0`;this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=!1;return t},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(typeof e==`string`&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):e.hex===void 0?e.bin===void 0?e.array!==void 0&&this.setByBooleanArray(e.array):this.setByBinaryString(e.bin):this.setHexValueIncludingUnusedBits(e.hex))},X.lang.extend(Z.asn1.DERBitString,Z.asn1.ASN1Object),Z.asn1.DEROctetString=function(e){e!==void 0&&e.obj!==void 0&&(e.hex=Z.asn1.ASN1Util.newObject(e.obj).getEncodedHex()),Z.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT=`04`},X.lang.extend(Z.asn1.DEROctetString,Z.asn1.DERAbstractString),Z.asn1.DERNull=function(){Z.asn1.DERNull.superclass.constructor.call(this),this.hT=`05`,this.hTLV=`0500`},X.lang.extend(Z.asn1.DERNull,Z.asn1.ASN1Object),Z.asn1.DERObjectIdentifier=function(e){var t=function(e){var t=e.toString(16);return t.length==1&&(t=`0`+t),t},n=function(e){var n=``,r=new B(e,10).toString(2),i=7-r.length%7;i==7&&(i=0);for(var a=``,o=0;o<i;o++)a+=`0`;r=a+r;for(var o=0;o<r.length-1;o+=7){var s=r.substr(o,7);o!=r.length-7&&(s=`1`+s),n+=t(parseInt(s,2))}return n};Z.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT=`06`,this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){if(!e.match(/^[0-9.]+$/))throw`malformed oid string: `+e;var r=``,i=e.split(`.`),a=parseInt(i[0])*40+parseInt(i[1]);r+=t(a),i.splice(0,2);for(var o=0;o<i.length;o++)r+=n(i[o]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(e){var t=Z.asn1.x509.OID.name2oid(e);if(t!==``)this.setValueOidString(t);else throw`DERObjectIdentifier oidName undefined: `+e},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(typeof e==`string`?e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e):e.oid===void 0?e.hex===void 0?e.name!==void 0&&this.setValueName(e.name):this.setValueHex(e.hex):this.setValueOidString(e.oid))},X.lang.extend(Z.asn1.DERObjectIdentifier,Z.asn1.ASN1Object),Z.asn1.DEREnumerated=function(e){Z.asn1.DEREnumerated.superclass.constructor.call(this),this.hT=`0a`,this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=Z.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new B(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(e.int===void 0?typeof e==`number`?this.setByInteger(e):e.hex!==void 0&&this.setValueHex(e.hex):this.setByInteger(e.int))},X.lang.extend(Z.asn1.DEREnumerated,Z.asn1.ASN1Object),Z.asn1.DERUTF8String=function(e){Z.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT=`0c`},X.lang.extend(Z.asn1.DERUTF8String,Z.asn1.DERAbstractString),Z.asn1.DERNumericString=function(e){Z.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT=`12`},X.lang.extend(Z.asn1.DERNumericString,Z.asn1.DERAbstractString),Z.asn1.DERPrintableString=function(e){Z.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT=`13`},X.lang.extend(Z.asn1.DERPrintableString,Z.asn1.DERAbstractString),Z.asn1.DERTeletexString=function(e){Z.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT=`14`},X.lang.extend(Z.asn1.DERTeletexString,Z.asn1.DERAbstractString),Z.asn1.DERIA5String=function(e){Z.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT=`16`},X.lang.extend(Z.asn1.DERIA5String,Z.asn1.DERAbstractString),Z.asn1.DERUTCTime=function(e){Z.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT=`17`,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,`utc`),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,`utc`),this.hV=stohex(this.s)),this.hV},e!==void 0&&(e.str===void 0?typeof e==`string`&&e.match(/^[0-9]{12}Z$/)?this.setString(e):e.hex===void 0?e.date!==void 0&&this.setByDate(e.date):this.setStringHex(e.hex):this.setString(e.str))},X.lang.extend(Z.asn1.DERUTCTime,Z.asn1.DERAbstractTime),Z.asn1.DERGeneralizedTime=function(e){Z.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT=`18`,this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,`gen`,this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,`gen`,this.withMillis),this.hV=stohex(this.s)),this.hV},e!==void 0&&(e.str===void 0?typeof e==`string`&&e.match(/^[0-9]{14}Z$/)?this.setString(e):e.hex===void 0?e.date!==void 0&&this.setByDate(e.date):this.setStringHex(e.hex):this.setString(e.str),e.millis===!0&&(this.withMillis=!0))},X.lang.extend(Z.asn1.DERGeneralizedTime,Z.asn1.DERAbstractTime),Z.asn1.DERSequence=function(e){Z.asn1.DERSequence.superclass.constructor.call(this,e),this.hT=`30`,this.getFreshValueHex=function(){for(var e=``,t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e+=n.getEncodedHex()}return this.hV=e,this.hV}},X.lang.extend(Z.asn1.DERSequence,Z.asn1.DERAbstractStructured),Z.asn1.DERSet=function(e){Z.asn1.DERSet.superclass.constructor.call(this,e),this.hT=`31`,this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=[],t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e.push(n.getEncodedHex())}return this.sortFlag==1&&e.sort(),this.hV=e.join(``),this.hV},e!==void 0&&e.sortflag!==void 0&&e.sortflag==0&&(this.sortFlag=!1)},X.lang.extend(Z.asn1.DERSet,Z.asn1.DERAbstractStructured),Z.asn1.DERTaggedObject=function(e){Z.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT=`a0`,this.hV=``,this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,n){this.hT=t,this.isExplicit=e,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(e.tag!==void 0&&(this.hT=e.tag),e.explicit!==void 0&&(this.isExplicit=e.explicit),e.obj!==void 0&&(this.asn1Object=e.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},X.lang.extend(Z.asn1.DERTaggedObject,Z.asn1.ASN1Object);var Ye=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Xe=function(e){Ye(t,e);function t(n){var r=e.call(this)||this;return n&&(typeof n==`string`?r.parseKey(n):(t.hasPrivateKeyProperty(n)||t.hasPublicKeyProperty(n))&&r.parsePropertiesFrom(n)),r}return t.prototype.parseKey=function(e){try{var t=0,n=0,r=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(e)?ye.decode(e):be.unarmor(e),i=Te.decode(r);if(i.sub.length===3&&(i=i.sub[2].sub[0]),i.sub.length===9){t=i.sub[1].getHexStringValue(),this.n=H(t,16),n=i.sub[2].getHexStringValue(),this.e=parseInt(n,16);var a=i.sub[3].getHexStringValue();this.d=H(a,16);var o=i.sub[4].getHexStringValue();this.p=H(o,16);var s=i.sub[5].getHexStringValue();this.q=H(s,16);var c=i.sub[6].getHexStringValue();this.dmp1=H(c,16);var l=i.sub[7].getHexStringValue();this.dmq1=H(l,16);var u=i.sub[8].getHexStringValue();this.coeff=H(u,16)}else if(i.sub.length===2){var d=i.sub[1].sub[0];t=d.sub[0].getHexStringValue(),this.n=H(t,16),n=d.sub[1].getHexStringValue(),this.e=parseInt(n,16)}else return!1;return!0}catch{return!1}},t.prototype.getPrivateBaseKey=function(){var e={array:[new Z.asn1.DERInteger({int:0}),new Z.asn1.DERInteger({bigint:this.n}),new Z.asn1.DERInteger({int:this.e}),new Z.asn1.DERInteger({bigint:this.d}),new Z.asn1.DERInteger({bigint:this.p}),new Z.asn1.DERInteger({bigint:this.q}),new Z.asn1.DERInteger({bigint:this.dmp1}),new Z.asn1.DERInteger({bigint:this.dmq1}),new Z.asn1.DERInteger({bigint:this.coeff})]};return new Z.asn1.DERSequence(e).getEncodedHex()},t.prototype.getPrivateBaseKeyB64=function(){return M(this.getPrivateBaseKey())},t.prototype.getPublicBaseKey=function(){var e=new Z.asn1.DERSequence({array:[new Z.asn1.DERObjectIdentifier({oid:`1.2.840.113549.1.1.1`}),new Z.asn1.DERNull]}),t=new Z.asn1.DERSequence({array:[new Z.asn1.DERInteger({bigint:this.n}),new Z.asn1.DERInteger({int:this.e})]}),n=new Z.asn1.DERBitString({hex:`00`+t.getEncodedHex()});return new Z.asn1.DERSequence({array:[e,n]}).getEncodedHex()},t.prototype.getPublicBaseKeyB64=function(){return M(this.getPublicBaseKey())},t.wordwrap=function(e,t){if(t||=64,!e)return e;var n=`(.{1,`+t+`})( +|$
|
|
27
27
|
?)|(.{1,`+t+`})`;return e.match(RegExp(n,`g`)).join(`
|
|
28
28
|
`)},t.prototype.getPrivateKey=function(){var e=`-----BEGIN RSA PRIVATE KEY-----
|
|
29
29
|
`;return e+=t.wordwrap(this.getPrivateBaseKeyB64())+`
|
|
30
30
|
`,e+=`-----END RSA PRIVATE KEY-----`,e},t.prototype.getPublicKey=function(){var e=`-----BEGIN PUBLIC KEY-----
|
|
31
31
|
`;return e+=t.wordwrap(this.getPublicBaseKeyB64())+`
|
|
32
|
-
`,e+=`-----END PUBLIC KEY-----`,e},t.hasPublicKeyProperty=function(e){return e||={},e.hasOwnProperty(`n`)&&e.hasOwnProperty(`e`)},t.hasPrivateKeyProperty=function(e){return e||={},e.hasOwnProperty(`n`)&&e.hasOwnProperty(`e`)&&e.hasOwnProperty(`d`)&&e.hasOwnProperty(`p`)&&e.hasOwnProperty(`q`)&&e.hasOwnProperty(`dmp1`)&&e.hasOwnProperty(`dmq1`)&&e.hasOwnProperty(`coeff`)},t.prototype.parsePropertiesFrom=function(e){this.n=e.n,this.e=e.e,e.hasOwnProperty(`d`)&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)},t}(Ue),Ze=`3.2.1`,Qe=function(){function e(e){e===void 0&&(e={}),e||={},this.default_key_size=e.default_key_size?parseInt(e.default_key_size,10):1024,this.default_public_exponent=e.default_public_exponent||`010001`,this.log=e.log||!1,this.key=null}return e.prototype.setKey=function(e){this.log&&this.key&&console.warn(`A key was already set, overriding existing.`),this.key=new Xe(e)},e.prototype.setPrivateKey=function(e){this.setKey(e)},e.prototype.setPublicKey=function(e){this.setKey(e)},e.prototype.decrypt=function(e){try{return this.getKey().decrypt(
|
|
33
|
-
`)
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
`,e+=`-----END PUBLIC KEY-----`,e},t.hasPublicKeyProperty=function(e){return e||={},e.hasOwnProperty(`n`)&&e.hasOwnProperty(`e`)},t.hasPrivateKeyProperty=function(e){return e||={},e.hasOwnProperty(`n`)&&e.hasOwnProperty(`e`)&&e.hasOwnProperty(`d`)&&e.hasOwnProperty(`p`)&&e.hasOwnProperty(`q`)&&e.hasOwnProperty(`dmp1`)&&e.hasOwnProperty(`dmq1`)&&e.hasOwnProperty(`coeff`)},t.prototype.parsePropertiesFrom=function(e){this.n=e.n,this.e=e.e,e.hasOwnProperty(`d`)&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)},t}(Ue),Ze=`3.2.1`,Qe=function(){function e(e){e===void 0&&(e={}),e||={},this.default_key_size=e.default_key_size?parseInt(e.default_key_size,10):1024,this.default_public_exponent=e.default_public_exponent||`010001`,this.log=e.log||!1,this.key=null}return e.prototype.setKey=function(e){this.log&&this.key&&console.warn(`A key was already set, overriding existing.`),this.key=new Xe(e)},e.prototype.setPrivateKey=function(e){this.setKey(e)},e.prototype.setPublicKey=function(e){this.setKey(e)},e.prototype.decrypt=function(e){try{return this.getKey().decrypt(ve(e))}catch{return!1}},e.prototype.encrypt=function(e){try{return M(this.getKey().encrypt(e))}catch{return!1}},e.prototype.encryptLong=function(e){try{return M(this.getKey().encryptLong(e))}catch{return!1}},e.prototype.decryptLong=function(e){try{return this.getKey().decryptLong(ve(e))}catch{return!1}},e.prototype.sign=function(e,t,n){try{return M(this.getKey().sign(e,t,n))}catch{return!1}},e.prototype.verify=function(e,t,n){try{return this.getKey().verify(e,ve(t),n)}catch{return!1}},e.prototype.getKey=function(e){if(!this.key){if(this.key=new Xe,e&&{}.toString.call(e)===`[object Function]`){this.key.generateAsync(this.default_key_size,this.default_public_exponent,e);return}this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},e.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},e.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},e.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},e.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},e.version=Ze,e}();const Q=globalThis,$e=new Qe;let $={};const et=()=>e(new Date().getTime()+pt(32));function tt(e){$=Object.assign({PROD:!1,VITE_SALT_KEY:``,VITE_PUBLIC_KEY:``},e);let t=$.VITE_PUBLIC_KEY;$e.setPublicKey(typeof t==`string`?t.replace(/\\r\\n/g,`
|
|
33
|
+
`).replace(/\\n/g,`
|
|
34
|
+
`).trim():``)}function nt(e){let t=encodeURIComponent(e),n=[];for(let e=0;e<t.length;e++)t.charCodeAt(e)===37?(n.push(parseInt(t.slice(e+1,e+3),16)),e+=2):n.push(t.charCodeAt(e));return new Uint8Array(n)}function rt(e){let t=``;for(let n=0;n<e.length;n++)t+=`%${e[n].toString(16).padStart(2,`0`)}`;return decodeURIComponent(t)}function it(e){let t=e.slice().buffer;if(Q.wx?.arrayBufferToBase64)return Q.wx.arrayBufferToBase64(t);if(Q.uni?.arrayBufferToBase64)return Q.uni.arrayBufferToBase64(t);let n=``;for(let t=0;t<e.length;t++)n+=String.fromCharCode(e[t]);return Q.btoa(n)}function at(e){if(Q.wx?.base64ToArrayBuffer)return new Uint8Array(Q.wx.base64ToArrayBuffer(e));if(Q.uni?.base64ToArrayBuffer)return new Uint8Array(Q.uni.base64ToArrayBuffer(e));let t=Q.atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function ot(e,t){let n=nt(e),r=nt(t);if(n.length!==16||r.length!==16)throw Error(`AES-128 key 和 iv 必须都是 16 bytes`);return le(n,r)}function st(e,t,n){return it(ot(t,n).encrypt(nt(e)))}function ct(e,t,n){return rt(ot(t,n).decrypt(at(e)))}function lt(e,t){if(typeof t!=`string`||!/^[\x00-\x7f]{32}$/.test(t))throw Error(`password 必须由 32 个 ASCII 字符组成`);if(!$.VITE_PUBLIC_KEY)throw Error(`请先调用 setEnv 并配置 VITE_PUBLIC_KEY`);let n=$e.getKey();if(!n.n||!n.e)throw Error(`VITE_PUBLIC_KEY 解析失败,请检查 RSA PEM 公钥格式`);let r=n.encrypt(t);if(!r)throw Error(`RSA 加密失败,请检查公钥长度`);let i=M(r);return{value:st(JSON.stringify(e),t.substring(0,16),t.substring(16)),key:i}}function ut(e,t){if(e.data){e.data=ct(e.data,t.substring(0,16),t.substring(16));try{e.data=JSON.parse(e.data||`{}`)}catch(e){console.error(e)}}return e}function dt(e){if(typeof e==`string`)return ft(e);if(e&&typeof e==`object`){let t=[];for(let n of Object.keys(e))e[n]&&t.push(`${n}=${e[n]}`);return ft(t.join(`&`))}return``}function ft(t){return e(`${t.split(`&`).sort().join(`&`)}&key=${$?.VITE_SALT_KEY}`)}function pt(e){let t=``;for(;e--;)t+=`0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`[Math.floor(Math.random()*62)];return t}function mt(e){return it(nt(e))}function ht(e){return rt(at(e))}function gt(e,t){let n=JSON.parse(JSON.stringify(e)),r=dt(n.data.variables);return n.data.variables.sign=r,$?.PROD&&(n.data=lt(n.data,t)),n}function _t(e,t,n){function r(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return e;let n={...e};for(let r of Object.keys(e))Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=i(e[r],t[r].type));return n}function i(e,t){if(e==null)return e;let a=t.endsWith(`!`)?t.slice(0,-1):t;if(a.startsWith(`[`)&&a.endsWith(`]`))return Array.isArray(e)?e.map(e=>i(e,a.slice(1,-1))):e;switch(a){case`JsonString`:if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}case`Int`:case`Float`:{if(typeof e!=`number`&&typeof e!=`string`||typeof e==`string`&&e.trim()===``)return e;let t=Number(e);return Number.isFinite(t)&&(a!==`Int`||Number.isSafeInteger(t))?t:e}case`Boolean`:return e===`false`||e===`0`||e===0?!1:e===`true`||e===`1`||e===1||e;case`String`:case`ID`:return typeof e==`number`||typeof e==`boolean`?String(e):e;default:{let t=n?.types,i=t&&Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;return i?r(e,i.fields):e}}}return e.map(e=>t?r(e,t):{...e})}const vt=Object.freeze(Object.create(null)),yt=e=>e===95||e>=65&&e<=90||e>=97&&e<=122,bt=e=>yt(e)||e>=48&&e<=57,xt=e=>e>=48&&e<=57,St=Object.create(null);function Ct(e){let t=+(e.charCodeAt(0)===65279),n=e.length,r,i=Object.create(null),a=new Set([`String`,`Int`,`Float`,`Boolean`,`ID`]),o=new Set;function s(){for(;;){if(t>=n)return;let r=e.charCodeAt(t);if(r===32||r===9||r===10||r===13||r===44){t++;continue}if(r===35){for(;++t<n;){let n=e.charCodeAt(t);if(n===10||n===13)break}continue}if(r===34&&e.charCodeAt(t+1)===34&&e.charCodeAt(t+2)===34){for(t+=3;t<n;){if(e.charCodeAt(t)===34&&e.charCodeAt(t+1)===34&&e.charCodeAt(t+2)===34){t+=3;break}t+=e.charCodeAt(t)===92?2:1}continue}if(r===34){for(t++;t<n;){let n=e.charCodeAt(t++);if(n===92)t++;else if(n===34)break}return`\0s`}if(yt(r)){let r=t++;for(;t<n&&bt(e.charCodeAt(t));)t++;return e.slice(r,t)}if(xt(r)||r===45&&xt(e.charCodeAt(t+1))){for(t++;t<n;){let n=e.charCodeAt(t);if(xt(n)||n===46||n===101||n===69||n===43||n===45)t++;else break}return`\0n`}if(r===46&&e.charCodeAt(t+1)===46&&e.charCodeAt(t+2)===46)return t+=3,`...`;if(r===123||r===125||r===40||r===41||r===91||r===93||r===58||r===33||r===61||r===36||r===64||r===124||r===38)return t++,String.fromCharCode(r);t++}}let c=()=>r??=s(),l=()=>{let e=r??s();return r=void 0,e},u=e=>c()===e&&(l(),!0),d=e=>{let t=l();if(t!==e)throw Error(`parseSDL: expected "${e}", got "${t??`EOF`}"`)},f=()=>{let e=l();if(!e||e===`\0s`||e===`\0n`||!yt(e.charCodeAt(0)))throw Error(`parseSDL: expected NAME, got "${e??`EOF`}"`);return e};function p(){if(u(`[`)){let e=`[${p()}]`;return d(`]`),u(`!`)&&(e+=`!`),e}let e=f();return u(`!`)&&(e+=`!`),e}function m(){if(u(`[`)){for(;c()&&c()!==`]`;)m();d(`]`);return}if(u(`{`)){for(;c()&&c()!==`}`;)f(),d(`:`),m();d(`}`);return}l()}function h(){for(;u(`@`);){if(f(),!u(`(`))continue;let e=1;for(;e&&c();)u(`(`)?e++:u(`)`)?e--:l()}}function g(){if(!u(`(`))return vt;let e=Object.create(null);for(;c()&&c()!==`)`;){let t=f();d(`:`),e[t]=p(),u(`=`)&&m(),h()}return d(`)`),e}function _(){let e=Object.create(null);for(d(`{`);c()&&c()!==`}`;){let t=f(),n=g();d(`:`);let r=p();h(),e[t]={name:t,args:n,type:r}}return d(`}`),e}function v(){let e=f();if(u(`implements`))for(u(`&`);c()&&c()!==`{`;)l();h(),c()===`{`&&(i[e]={name:e,fields:_()})}function y(){a.add(f()),h()}function b(){if(o.add(f()),h(),u(`{`)){for(;c()&&c()!==`}`;)l(),h();d(`}`)}}for(;c();)switch(l()){case`type`:v();break;case`scalar`:y();break;case`enum`:b()}return{query:i.Query?.fields||{},mutation:i.Mutation?.fields||{},types:i,scalars:a,enums:o}}function wt(e){let t=0,n=e.length,r=e.charCodeAt(0),i=e.charCodeAt(n-1);if(r!==91&&r!==33&&i!==93&&i!==33)return e;let a=St[e];if(a)return a;for(;t<n;){let n=e.charCodeAt(t);if(n!==91&&n!==33)break;t++}for(;n>t;){let t=e.charCodeAt(n-1);if(t!==93&&t!==33)break;n--}let o=e.slice(t,n);return St[e]=o,o}function Tt(e,t,n={}){let r=e.types[wt(t.type)];if(!r)return[];let i=[],a=r.fields;for(let t in a){let r=a[t],o=n[t];if(o!==!1){if(!e.types[wt(r.type)]){i.push(t);continue}o!==void 0&&i.push({name:t,fields:Tt(e,r,o===!0?{}:o)})}}return i}function Et(e,t=` `){let n=``;for(let r of e){if(n&&(n+=`
|
|
35
|
+
`),typeof r==`string`){n+=t+r;continue}let e=Et(r.fields,t+` `);n+=e?`${t}${r.name} {\n${e}\n${t}}`:t+r.name}return n}function Dt(e,t=`query`){let{name:n,args:r=vt,fields:i=[]}=e,a=``,o=``;for(let e in r)a&&(a+=`, `),a+=`$${e}: ${r[e]}`,o+=`${o?`
|
|
36
|
+
`:``} ${e}: $${e}`;let s=Et(i),c=`${t} ${n}`;return a&&(c+=`(${a})`),c+=` {\n ${n}`,o&&(c+=`(\n${o}\n )`),s&&(c+=` {\n${s}\n }`),c+`
|
|
37
|
+
}`}function Ot(e,t){if(t==null)return t;switch(e){case`Int`:{let e=Number.parseInt(t,10);return Number.isNaN(e)?void 0:e}case`Float`:{let e=Number.parseFloat(t);return Number.isNaN(e)?void 0:e}case`Boolean`:return t===`false`||t===`0`?!1:!!t;case`String`:case`ID`:return String(t);case`JsonString`:return typeof t==`string`?t:JSON.stringify(t);default:return t}}function kt(e,t=!1){if(t)return[];switch(e){case`Int`:return 0;case`Float`:return 0;case`Boolean`:return!1;case`String`:case`ID`:return``;case`JsonString`:return`{}`;default:return null}}function At(e){return!!(e==null||e===``||Array.isArray(e)&&e.length===0)}function jt(e={},t=vt,n=!0){if(!e||!t)return e;let r={};for(let i in e){let a=t[i];if(!a)continue;let o=e[i];if(n&&At(o))continue;let s=a.endsWith(`!`),c=a.replace(/!$/,``),l=c.startsWith(`[`)&&c.endsWith(`]`),u=l?c.slice(1,-1).replace(/!$/,``):c,d=/\[.*!\]/.test(a);if(o===null){if(s){let e=kt(u,l);(!n||!At(e))&&(r[i]=e)}else n||(r[i]=null);continue}if(o!==void 0){if(l){let e=(Array.isArray(o)?o:typeof o==`string`?o.split(`,`).map(e=>e.trim()).filter(e=>e.length>0):[o]).map(e=>Ot(u,e)).filter(e=>d?e!=null:e!==void 0);if(n&&e.length===0)continue;(e.length>0||!s)&&(r[i]=e)}else{let e=Ot(u,o);if(e===void 0||n&&At(e))continue;r[i]=e}}}return r}const Mt=Dt;export{ht as base64decode,mt as base64encode,Dt as buildGraphQLQuery,Mt as buildQuery,Tt as buildSelectionFields,ut as decodeData,ct as decrypt,lt as encodeData,st as encrypt,$ as env,jt as formatVariables,dt as getSign,et as initPassword,e as md5,gt as paramProcess,ft as paramsStrSort,_t as parseResponseOptimized,Ct as parseSDL,pt as randomString,tt as setEnv,wt as unwrapType};
|
package/dist/processData.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SchemaMeta, SchemaType } from './index';
|
|
1
2
|
export { md5 } from './md5';
|
|
2
3
|
export declare let env: any;
|
|
3
4
|
/** 生成指定长度的随机字母数字字符串。 */
|
|
@@ -26,3 +27,15 @@ export declare function base64encode(code: string): string;
|
|
|
26
27
|
export declare function base64decode(code: string): string;
|
|
27
28
|
/** 参数处理。 */
|
|
28
29
|
export declare function paramProcess(param: any, password: string): any;
|
|
30
|
+
/**
|
|
31
|
+
* 按 SDL 字段类型格式化响应数组,返回新数组,不修改原数据。
|
|
32
|
+
* @param data 接口返回的记录数组(不是整个响应对象)
|
|
33
|
+
* @param fields schema.types?.['类型名']?.fields;未找到定义时保持原样
|
|
34
|
+
* @param schema 可选的 schema,用于递归格式化对象字段及对象数组
|
|
35
|
+
*
|
|
36
|
+
* JsonString 字符串通过 JSON.parse 还原,已解析值和无效 JSON 保持原样。
|
|
37
|
+
* 支持 Int/Float/Boolean/String/ID、非空修饰符及多层数组;
|
|
38
|
+
* 空值、缺失字段、未知字段和其他自定义标量保持原样,不补默认值。
|
|
39
|
+
* @example parseResponseOptimized(data, schema.types?.['User']?.fields, schema)
|
|
40
|
+
*/
|
|
41
|
+
export declare function parseResponseOptimized(data: readonly Record<string, any>[], fields: SchemaType['fields'] | undefined, schema?: Pick<SchemaMeta, 'types'>): Record<string, any>[];
|