Files
aaPanel/BTPanel/static/vite/js/vendor-crypto-legacy.js
T
2026-07-24 16:25:43 +08:00

14 lines
57 KiB
JavaScript

(function(){System.register([],function(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,ee,te,ne,M,re,N,P,ie,ae,F,I,L,R,oe,z,se,B,V;function H(e,t){"@swc/helpers - instanceof";return t!=null&&typeof Symbol<`u`&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function U(e){return s.charAt(e)}function ce(e,t){return e&t}function W(e,t){return e|t}function le(e,t){return e^t}function ue(e,t){return e&~t}function de(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 fe(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function G(e){var t,n,r=``;for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=E.charAt(n>>6)+E.charAt(n&63);for(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=E.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=E.charAt(n>>2)+E.charAt((n&3)<<4));(r.length&3)>0;)r+=D;return r}function pe(e){var t=``,n,r=0,i=0;for(n=0;n<e.length&&e.charAt(n)!=D;++n){var a=E.indexOf(e.charAt(n));a<0||(r==0?(t+=U(a>>2),i=a&3,r=1):r==1?(t+=U(i<<2|a>>4),i=a&15,r=2):r==2?(t+=U(i),t+=U(a>>2),i=a&3,r=3):(t+=U(i<<2|a>>4),t+=U(a&15),r=0))}return r==1&&(t+=U(i<<2)),t}function K(e,t){return e.length>t&&(e=e.substring(0,t)+ee),e}function q(){return new u(null)}function J(e,t){return new u(e,t)}function me(e,t){var n=o[e.charCodeAt(t)];return n==null?-1:n}function Y(e){var t=q();return t.fromInt(e),t}function X(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}function he(){return new i}function ge(){if(L==null){for(L=he();I<256;){var e=Math.floor(65536*Math.random());F[I++]=e&255}for(L.init(F),I=0;I<F.length;++I)F[I]=0;I=0}return L.next()}function _e(e){return be(Oe(ye(e),e.length*8))}function ve(e){for(var t=`0123456789abcdef`,n=``,r=0;r<e.length;r++){var i=e.charCodeAt(r);n+=t.charAt(i>>>4&15)+t.charAt(i&15)}return n}function ye(e){for(var t=Array(e.length>>2),n=0;n<t.length;n++)t[n]=0;for(var n=0;n<e.length*8;n+=8)t[n>>5]|=(e.charCodeAt(n/8)&255)<<24-n%32;return t}function be(e){for(var t=``,n=0;n<e.length*32;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t}function Z(e,t){return e>>>t|e<<32-t}function xe(e,t){return e>>>t}function Se(e,t,n){return e&t^~e&n}function Ce(e,t,n){return e&t^e&n^t&n}function we(e){return Z(e,2)^Z(e,13)^Z(e,22)}function Te(e){return Z(e,6)^Z(e,11)^Z(e,25)}function Ee(e){return Z(e,7)^Z(e,18)^xe(e,3)}function De(e){return Z(e,17)^Z(e,19)^xe(e,10)}function Oe(e,t){var n=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],r=Array(64),i,a,o,s,c,l,u,d,f,p,m,h;for(e[t>>5]|=128<<24-t%32,e[(t+64>>9<<4)+15]=t,f=0;f<e.length;f+=16){for(i=n[0],a=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],d=n[7],p=0;p<64;p++)p<16?r[p]=e[p+f]:r[p]=Q(Q(Q(De(r[p-2]),r[p-7]),Ee(r[p-15])),r[p-16]),m=Q(Q(Q(Q(d,Te(c)),Se(c,l,u)),oe[p]),r[p]),h=Q(we(i),Ce(i,a,o)),d=u,u=l,l=c,c=Q(s,m),s=o,o=a,a=i,i=Q(m,h);n[0]=Q(i,n[0]),n[1]=Q(a,n[1]),n[2]=Q(o,n[2]),n[3]=Q(s,n[3]),n[4]=Q(c,n[4]),n[5]=Q(l,n[5]),n[6]=Q(u,n[6]),n[7]=Q(d,n[7])}return n}function Q(e,t){var n=(e&65535)+(t&65535);return(e>>16)+(t>>16)+(n>>16)<<16|n&65535}function ke(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 J(`0001`+r+`00`+e,16)}function Ae(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 S,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 u(n)}function je(e,t,n){for(var r=``,i=0;r.length<t;)r+=n(String.fromCharCode.apply(String,e.concat([(i&4278190080)>>24,(i&16711680)>>16,(i&65280)>>8,i&255]))),i+=1;return r}function Me(e,t){var n=x,r=_e;if(e.length+2*n+2>t)throw`Message too long for RSA`;var i=``,a;for(a=0;a<t-e.length-2*n-2;a+=1)i+=`\0`;var o=r(``)+i+``+e,s=Array(n);new S().nextBytes(s);var c=je(s,o.length,r),l=[];for(a=0;a<o.length;a+=1)l[a]=o.charCodeAt(a)^c.charCodeAt(a);var d=je(l,s.length,r),f=[0];for(a=0;a<s.length;a+=1)f[a+1]=s[a]^d.charCodeAt(a);return new u(f.concat(l))}function Ne(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 Pe(e){return f[e]||``}function Fe(e){for(var t in f)if(f.hasOwnProperty(t)){var n=f[t],r=n.length;if(e.substring(0,r)==n)return e.substring(r)}return e}function $(e,t,n){if(!t||!e)throw Error(`extend failed, please check that all dependencies are included.`);var r=function(){};if(r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t),n){for(var i in n)e.prototype[i]=n[i];var a=function(){},o=[`toString`,`valueOf`];try{/MSIE/.test(navigator.userAgent)&&(a=function(e,t){for(i=0;i<o.length;i+=1){var n=o[i],r=t[n];typeof r==`function`&&r!=Object.prototype[n]&&(e[n]=r)}})}catch(e){}a(e.prototype,n)}}return e(`t`,void 0),{setters:[],execute:function(){for(s=`0123456789abcdefghijklmnopqrstuvwxyz`,E=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,D=`=`,p={decode:function(e){var t;if(j===void 0){var n=`0123456789ABCDEF`,r=` \f
\r \xA0\u2028\u2029`;for(j={},t=0;t<16;++t)j[n.charAt(t)]=t;for(n=n.toLowerCase(),t=10;t<16;++t)j[n.charAt(t)]=t;for(t=0;t<r.length;++t)j[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=j[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}},l={decode:function(e){var t;if(A===void 0){var n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,r=`= \f
\r \xA0\u2028\u2029`;for(A=Object.create(null),t=0;t<64;++t)A[n.charAt(t)]=t;for(A[`-`]=62,A._=63,t=0;t<r.length;++t)A[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=A[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;break}return i},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=l.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 l.decode(e)}},N=0x9184e72a000,m=function(){function e(e){this.buf=[+e||0]}return e.prototype.mulAdd=function(e,t){var n=this.buf,r=n.length,i,a;for(i=0;i<r;++i)a=n[i]*e+t,a<N?t=0:(t=0|a/N,a-=t*N),n[i]=a;t>0&&(n[i]=t)},e.prototype.sub=function(e){var t=this.buf,n=t.length,r,i;for(r=0;r<n;++r)i=t[r]-e,i<0?(i+=N,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+=(N+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*N+e[n];return t},e.prototype.simplify=function(){var e=this.buf;return e.length==1?e[0]:this},e}(),ee=`…`,ae=/^(\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)?)?$/,ie=/^(\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)?)?$/,C=function(){function e(t,n){this.hexDigits=`0123456789ABCDEF`,H(t,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 `.concat(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+=`
`;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++);i<128?n+=String.fromCharCode(i):i>191&&i<224?n+=String.fromCharCode((i&31)<<6|this.get(r++)&63):n+=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?ae:ie).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)
`}r&&(n-=256);for(var s=new m(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)
`,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+K(a,n)}return i+a},e.prototype.parseOctetString=function(e,t,n){if(this.isASCII(e,t))return K(this.parseStringISO(e,t),n);var r=t-e,i=`(`+r+` byte)
`;n/=2,r>n&&(t=e+n);for(var a=e;a<t;++a)i+=this.hexByte(this.get(a));return r>n&&(i+=ee),i},e.prototype.parseOID=function(e,t,n){for(var r=``,i=new m,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(),H(i,m))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 K(r,n);i=new m,a=0}}return a>0&&(r+=`.incomplete`),r},e}(),n=function(){function e(e,t,n,i,a){if(!H(i,r))throw Error(`Invalid tag value.`);this.stream=e,this.header=t,this.length=n,this.tag=i,this.sub=a}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 K(this.stream.parseStringUTF(t,t+n),e);case 18:case 19:case 20:case 21:case 22:case 26:return K(this.stream.parseStringISO(t,t+n),e);case 30:return K(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+=`
`,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.substring(t,t+n)},e.decode=function(t){var n=H(t,C)?t:new C(t,0),i=new C(n),a=new r(n),o=e.decodeLength(n),s=n.pos,c=s-i.pos,l=null,u=function(){var t=[];if(o!==null){for(var r=s+o;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 `+s)}else try{for(;;){var i=e.decode(n);if(i.tag.isEOC())break;t[t.length]=i}o=s-n.pos}catch(e){throw Error(`Exception while decoding undefined length content: `+e)}return t};if(a.tagConstructed)l=u();else if(a.isUniversal()&&(a.tagNumber==3||a.tagNumber==4))try{if(a.tagNumber==3&&n.get()!=0)throw Error(`BIT STRINGs with unused bits cannot encapsulate.`);l=u();for(var d=0;d<l.length;++d)if(l[d].tag.isEOC())throw Error(`EOC is not supposed to be actual content.`)}catch(e){l=null}if(l===null){if(o===null)throw Error(`We can't skip over an invalid tag with undefined length at offset `+s);n.pos=s+Math.abs(o)}return new e(i,c,o,a,l)},e}(),r=function(){function e(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=(t&32)!=0,this.tagNumber=t&31,this.tagNumber==31){var n=new m;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}(),ne=!0,M=[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],re=(1<<26)/M[M.length-1],u=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=U(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+=U(r));return i?a:`0`},e.prototype.negate=function(){var t=q();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)+X(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=q();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 d(t):new v(t);return this.exp(e,n)},e.prototype.clone=function(){var e=q();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=q();return this.bitwiseTo(e,ce,t),t},e.prototype.or=function(e){var t=q();return this.bitwiseTo(e,W,t),t},e.prototype.xor=function(e){var t=q();return this.bitwiseTo(e,le,t),t},e.prototype.andNot=function(e){var t=q();return this.bitwiseTo(e,ue,t),t},e.prototype.not=function(){for(var e=q(),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=q();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=q();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+de(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+=fe(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)!=0},e.prototype.setBit=function(e){return this.changeBit(e,W)},e.prototype.clearBit=function(e){return this.changeBit(e,ue)},e.prototype.flipBit=function(e){return this.changeBit(e,le)},e.prototype.add=function(e){var t=q();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=q();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=q();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=q();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=q();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=q(),n=q();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n=e.bitLength(),r,i=Y(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 d(t):t.isEven()?new c(t):new v(t);var o=[],s=3,l=r-1,u=(1<<r)-1;if(o[1]=a.convert(this),r>1){var f=q();for(a.sqrTo(o[1],f);s<=u;)o[s]=q(),a.mulTo(f,o[s-2],o[s]),s+=2}var p=e.t-1,m,h=!0,g=q(),_;for(n=X(e[p])-1;p>=0;){for(n>=l?m=e[p]>>n-l&u:(m=(e[p]&(1<<n+1)-1)<<l-n,p>0&&(m|=e[p-1]>>this.DB+n-l)),s=r;!(m&1);)m>>=1,--s;if((n-=s)<0&&(n+=this.DB,--p),h)o[m].copyTo(i),h=!1;else{for(;s>1;)a.sqrTo(i,g),a.sqrTo(g,i),s-=2;s>0?a.sqrTo(i,g):(_=i,i=g,g=_),a.mulTo(g,o[m],i)}for(;p>=0&&!(e[p]&1<<n);)a.sqrTo(i,g),_=i,i=g,g=_,--n<0&&(n=this.DB-1,--p)}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=Y(1),o=Y(0),s=Y(0),c=Y(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 y)},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]<=M[M.length-1]){for(t=0;t<M.length;++t)if(n[0]==M[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<M.length;){for(var r=M[t],i=t+1;i<M.length&&r<re;)r*=M[i++];for(r=n.modInt(r);t<i;)if(r%M[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:me(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){var n;for(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!=null&&n.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=q());var o=q(),s=this.s,c=t.s,l=this.DB-X(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==null?q():n;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=q(),i=q(),a=n.convert(this),o=X(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==null&&(e=10),this.signum()==0||e<2||e>36)return`0`;var t=this.chunkSize(e),n=e**+t,r=Y(n),i=q(),a=q(),o=``;for(this.divRemTo(r,i,a);i.signum()>0;)o=(n+a.intValue()).toString(e).substring(1)+o,i.divRemTo(r,i,a);return a.intValue().toString(e)+o},e.prototype.fromRadix=function(t,n){this.fromInt(0),n==null&&(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=me(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),W,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>M.length&&(t=M.length);for(var a=q(),o=0;o<t;++o){a.fromInt(M[Math.floor(Math.random()*M.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=q();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),W,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}(),y=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}(),d=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}(),v=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=q();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(u.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=q();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}(),c=function(){function e(e){this.m=e,this.r2=q(),this.q3=q(),u.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=q();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}(),te=typeof navigator<`u`,te&&ne&&navigator.appName==`Microsoft Internet Explorer`?(u.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},k=30):te&&ne&&navigator.appName!=`Netscape`?(u.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},k=26):(u.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},k=28),u.prototype.DB=k,u.prototype.DM=(1<<k)-1,u.prototype.DV=1<<k,a=52,u.prototype.FV=2**a,u.prototype.F1=a-k,u.prototype.F2=2*k-a,o=[],R=48,B=0;B<=9;++B)o[R++]=B;for(R=97,B=10;B<36;++B)o[R++]=B;for(R=65,B=10;B<36;++B)o[R++]=B;if(u.ZERO=Y(0),u.ONE=Y(1),i=function(){function e(){this.i=0,this.j=0,this.S=[]}return e.prototype.init=function(e){var t,n,r;for(t=0;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}(),F=null,F==null){if(F=[],I=0,z=void 0,typeof window<`u`&&self.crypto&&self.crypto.getRandomValues)for(V=new Uint32Array(256),self.crypto.getRandomValues(V),z=0;z<V.length;++z)F[I++]=V[z]&255;O=0,P=function(e){if(O=O||0,O>=256||I>=256){self.removeEventListener?self.removeEventListener(`mousemove`,P,!1):self.detachEvent&&self.detachEvent(`onmousemove`,P);return}try{var t=e.x+e.y;F[I++]=t&255,O+=1}catch(e){}},typeof window<`u`&&(self.addEventListener?self.addEventListener(`mousemove`,P,!1):self.attachEvent&&self.attachEvent(`onmousemove`,P))}S=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=ge()},e}(),oe=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],x=32,b=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=J(e,16),this.e=parseInt(t,16)):console.error(`Invalid RSA public key`)},e.prototype.encrypt=function(e,t){t===void 0&&(t=Ae);var n=this.n.bitLength()+7>>3,r=t(e,n);if(r==null)return null;var i=this.doPublic(r);if(i==null)return null;for(var a=i.toString(16),o=a.length,s=0;s<n*2-o;s++)a=`0`+a;return a},e.prototype.setPrivate=function(e,t,n){e!=null&&t!=null&&e.length>0&&t.length>0?(this.n=J(e,16),this.e=parseInt(t,16),this.d=J(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=J(e,16),this.e=parseInt(t,16),this.d=J(n,16),this.p=J(r,16),this.q=J(i,16),this.dmp1=J(a,16),this.dmq1=J(o,16),this.coeff=J(s,16)):console.error(`Invalid RSA private key`)},e.prototype.generate=function(e,t){var n=new S,r=e>>1;this.e=parseInt(t,16);for(var i=new u(t,16);;){for(;this.p=new u(e-r,1,n),!(this.p.subtract(u.ONE).gcd(i).compareTo(u.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new u(r,1,n),!(this.q.subtract(u.ONE).gcd(i).compareTo(u.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(u.ONE),s=this.q.subtract(u.ONE),c=o.multiply(s);if(c.gcd(i).compareTo(u.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=J(e,16),n=this.doPrivate(t);return n==null?null:Ne(n,this.n.bitLength()+7>>3)},e.prototype.generateAsync=function(e,t,n){var r=new S,i=e>>1;this.e=parseInt(t,16);var a=new u(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(u.ONE),r=o.q.subtract(u.ONE),i=t.multiply(r);i.gcd(a).compareTo(u.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=q(),o.q.fromNumberAsync(i,1,r,function(){o.q.subtract(u.ONE).gcda(a,function(e){e.compareTo(u.ONE)==0&&o.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(c,0)})})},l=function(){o.p=q(),o.p.fromNumberAsync(e-i,1,r,function(){o.p.subtract(u.ONE).gcda(a,function(e){e.compareTo(u.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=Pe(n)+t(e).toString(),i=this.n.bitLength()/4,a=ke(r,i);if(a==null)return null;var o=this.doPrivate(a);if(o==null)return null;for(var s=o.toString(16),c=s.length,l=0;l<i-c;l++)s=`0`+s;return s},e.prototype.verify=function(e,t,n){var r=J(t,16),i=this.doPublic(r);return i==null?null:Fe(i.toString(16).replace(/^1f+00/,``))==n(e).toString()},e}(),f={md2:`3020300c06082a864886f70d020205000410`,md5:`3020300c06082a864886f70d020505000410`,sha1:`3021300906052b0e03021a05000414`,sha224:`302d300d06096086480165030402040500041c`,sha256:`3031300d060960864801650304020105000420`,sha384:`3041300d060960864801650304020205000430`,sha512:`3051300d060960864801650304020305000440`,ripemd160:`3021300906052b2403020105000414`},_={},(_.asn1===void 0||!_.asn1)&&(_.asn1={}),_.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.substring(0,1)!=`-`)t.length%2==1?t=`0`+t:t.match(/^[0-7]/)||(t=`00`+t);else{var n=t.substring(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 u(r,16).xor(e).add(u.ONE).toString(16).replace(/^-/,``)}return t},this.getPEMStringFromHex=function(e,t){return hextopem(e,t)},this.newObject=function(e){var t=_.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,v=t.DERSet,y=t.DERTaggedObject,b=t.ASN1Util.newObject,x=Object.keys(e);if(x.length!=1)throw`key of param shall be only one.`;var S=x[0];if(`:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:`.indexOf(`:`+S+`:`)==-1)throw`undefined key: `+S;if(S==`bool`)return new n(e[S]);if(S==`int`)return new r(e[S]);if(S==`bitstr`)return new i(e[S]);if(S==`octstr`)return new a(e[S]);if(S==`null`)return new o(e[S]);if(S==`oid`)return new s(e[S]);if(S==`enum`)return new c(e[S]);if(S==`utf8str`)return new l(e[S]);if(S==`numstr`)return new u(e[S]);if(S==`prnstr`)return new d(e[S]);if(S==`telstr`)return new f(e[S]);if(S==`ia5str`)return new p(e[S]);if(S==`utctime`)return new m(e[S]);if(S==`gentime`)return new h(e[S]);if(S==`seq`){for(var C=e[S],w=[],T=0;T<C.length;T++){var E=b(C[T]);w.push(E)}return new g({array:w})}if(S==`set`){for(var C=e[S],w=[],T=0;T<C.length;T++){var E=b(C[T]);w.push(E)}return new v({array:w})}if(S==`tag`){var D=e[S];if(Object.prototype.toString.call(D)===`[object Array]`&&D.length==3){var O=b(D[2]);return new y({tag:D[0],explicit:D[1],obj:O})}else{var k={};if(D.explicit!==void 0&&(k.explicit=D.explicit),D.tag!==void 0&&(k.tag=D.tag),D.obj===void 0)throw`obj shall be specified for 'tag'.`;return k.obj=b(D.obj),new y(k)}}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},_.asn1.ASN1Util.oidHexToInt=function(e){for(var t=``,n=parseInt(e.substring(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.substring(o,o+2),16).toString(2)).slice(-8);if(a+=s.substring(1,8),s.substring(0,1)==`0`){var c=new u(a,2);t=t+`.`+c.toString(10),a=``}}return t},_.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 u(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.substring(o,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},_.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``}},_.asn1.DERAbstractString=function(e){_.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))},$(_.asn1.DERAbstractString,_.asn1.ASN1Object),_.asn1.DERAbstractTime=function(e){_.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.substring(2,4));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}},$(_.asn1.DERAbstractTime,_.asn1.ASN1Object),_.asn1.DERAbstractStructured=function(e){_.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)},$(_.asn1.DERAbstractStructured,_.asn1.ASN1Object),_.asn1.DERBoolean=function(){_.asn1.DERBoolean.superclass.constructor.call(this),this.hT=`01`,this.hTLV=`0101ff`},$(_.asn1.DERBoolean,_.asn1.ASN1Object),_.asn1.DERInteger=function(e){_.asn1.DERInteger.superclass.constructor.call(this),this.hT=`02`,this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=_.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new u(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))},$(_.asn1.DERInteger,_.asn1.ASN1Object),_.asn1.DERBitString=function(e){e!==void 0&&e.obj!==void 0&&(e.hex=`00`+_.asn1.ASN1Util.newObject(e.obj).getEncodedHex()),_.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.substring(n,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))},$(_.asn1.DERBitString,_.asn1.ASN1Object),_.asn1.DEROctetString=function(e){e!==void 0&&e.obj!==void 0&&(e.hex=_.asn1.ASN1Util.newObject(e.obj).getEncodedHex()),_.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT=`04`},$(_.asn1.DEROctetString,_.asn1.DERAbstractString),_.asn1.DERNull=function(){_.asn1.DERNull.superclass.constructor.call(this),this.hT=`05`,this.hTLV=`0500`},$(_.asn1.DERNull,_.asn1.ASN1Object),_.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 u(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.substring(o,o+7);o!=r.length-7&&(s=`1`+s),n+=t(parseInt(s,2))}return n};_.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=_.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))},$(_.asn1.DERObjectIdentifier,_.asn1.ASN1Object),_.asn1.DEREnumerated=function(e){_.asn1.DEREnumerated.superclass.constructor.call(this),this.hT=`0a`,this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=_.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new u(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))},$(_.asn1.DEREnumerated,_.asn1.ASN1Object),_.asn1.DERUTF8String=function(e){_.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT=`0c`},$(_.asn1.DERUTF8String,_.asn1.DERAbstractString),_.asn1.DERNumericString=function(e){_.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT=`12`},$(_.asn1.DERNumericString,_.asn1.DERAbstractString),_.asn1.DERPrintableString=function(e){_.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT=`13`},$(_.asn1.DERPrintableString,_.asn1.DERAbstractString),_.asn1.DERTeletexString=function(e){_.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT=`14`},$(_.asn1.DERTeletexString,_.asn1.DERAbstractString),_.asn1.DERIA5String=function(e){_.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT=`16`},$(_.asn1.DERIA5String,_.asn1.DERAbstractString),_.asn1.DERUTCTime=function(e){_.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))},$(_.asn1.DERUTCTime,_.asn1.DERAbstractTime),_.asn1.DERGeneralizedTime=function(e){_.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))},$(_.asn1.DERGeneralizedTime,_.asn1.DERAbstractTime),_.asn1.DERSequence=function(e){_.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}},$(_.asn1.DERSequence,_.asn1.DERAbstractStructured),_.asn1.DERSet=function(e){_.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)},$(_.asn1.DERSet,_.asn1.DERAbstractStructured),_.asn1.DERTaggedObject=function(e){_.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)))},$(_.asn1.DERTaggedObject,_.asn1.ASN1Object),w=function(){var e=function(t,n){return e=Object.setPrototypeOf||H({__proto__:[]},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)}}(),g=function(e){w(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,r=0,i=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(e)?p.decode(e):l.unarmor(e),a=n.decode(i);if(a.sub.length===3&&(a=a.sub[2].sub[0]),a.sub.length===9){t=a.sub[1].getHexStringValue(),this.n=J(t,16),r=a.sub[2].getHexStringValue(),this.e=parseInt(r,16);var o=a.sub[3].getHexStringValue();this.d=J(o,16);var s=a.sub[4].getHexStringValue();this.p=J(s,16);var c=a.sub[5].getHexStringValue();this.q=J(c,16);var u=a.sub[6].getHexStringValue();this.dmp1=J(u,16);var d=a.sub[7].getHexStringValue();this.dmq1=J(d,16);var f=a.sub[8].getHexStringValue();this.coeff=J(f,16)}else if(a.sub.length===2)if(a.sub[0].sub){var m=a.sub[1].sub[0];t=m.sub[0].getHexStringValue(),this.n=J(t,16),r=m.sub[1].getHexStringValue(),this.e=parseInt(r,16)}else t=a.sub[0].getHexStringValue(),this.n=J(t,16),r=a.sub[1].getHexStringValue(),this.e=parseInt(r,16);else return!1;return!0}catch(e){return!1}},t.prototype.getPrivateBaseKey=function(){var e={array:[new _.asn1.DERInteger({int:0}),new _.asn1.DERInteger({bigint:this.n}),new _.asn1.DERInteger({int:this.e}),new _.asn1.DERInteger({bigint:this.d}),new _.asn1.DERInteger({bigint:this.p}),new _.asn1.DERInteger({bigint:this.q}),new _.asn1.DERInteger({bigint:this.dmp1}),new _.asn1.DERInteger({bigint:this.dmq1}),new _.asn1.DERInteger({bigint:this.coeff})]};return new _.asn1.DERSequence(e).getEncodedHex()},t.prototype.getPrivateBaseKeyB64=function(){return G(this.getPrivateBaseKey())},t.prototype.getPublicBaseKey=function(){var e=new _.asn1.DERSequence({array:[new _.asn1.DERObjectIdentifier({oid:`1.2.840.113549.1.1.1`}),new _.asn1.DERNull]}),t=new _.asn1.DERSequence({array:[new _.asn1.DERInteger({bigint:this.n}),new _.asn1.DERInteger({int:this.e})]}),n=new _.asn1.DERBitString({hex:`00`+t.getEncodedHex()});return new _.asn1.DERSequence({array:[e,n]}).getEncodedHex()},t.prototype.getPublicBaseKeyB64=function(){return G(this.getPublicBaseKey())},t.wordwrap=function(e,t){if(t=t||64,!e)return e;var n=`(.{1,`+t+`})( +|$
?)|(.{1,`+t+`})`;return e.match(RegExp(n,`g`)).join(`
`)},t.prototype.getPrivateKey=function(){var e=`-----BEGIN RSA PRIVATE KEY-----
`;return e+=t.wordwrap(this.getPrivateBaseKeyB64())+`
`,e+=`-----END RSA PRIVATE KEY-----`,e},t.prototype.getPublicKey=function(){var e=`-----BEGIN PUBLIC KEY-----
`;return e+=t.wordwrap(this.getPublicBaseKeyB64())+`
`,e+=`-----END PUBLIC KEY-----`,e},t.hasPublicKeyProperty=function(e){return e=e||{},e.hasOwnProperty(`n`)&&e.hasOwnProperty(`e`)},t.hasPrivateKeyProperty=function(e){return e=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}(b),se=typeof process<`u`?(T={})==null?void 0:T.npm_package_version:void 0,h=function(){function e(e){e===void 0&&(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=e.key||null}return e.prototype.setKey=function(e){e?(this.log&&this.key&&console.warn(`A key was already set, overriding existing.`),this.key=new g(e)):!this.key&&this.log&&console.error(`A key was not set.`)},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(pe(e))}catch(e){return!1}},e.prototype.encrypt=function(e){try{return G(this.getKey().encrypt(e))}catch(e){return!1}},e.prototype.encryptOAEP=function(e){try{return G(this.getKey().encrypt(e,Me))}catch(e){return!1}},e.prototype.sign=function(e,t,n){t===void 0&&(t=function(e){return e}),n===void 0&&(n=``);try{return G(this.getKey().sign(e,t,n))}catch(e){return!1}},e.prototype.signSha256=function(e){return this.sign(e,function(e){return ve(_e(e))},`sha256`)},e.prototype.verify=function(e,t,n){n===void 0&&(n=function(e){return e});try{return this.getKey().verify(e,pe(t),n)}catch(e){return!1}},e.prototype.verifySha256=function(e,t){return this.verify(e,t,function(e){return ve(_e(e))})},e.prototype.getKey=function(e){if(!this.key){if(this.key=new g,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=se,e}(),e(`t`,h)}}})})();