!function(t,e){"object"==typeofexports&&"undefined"!=typeofmodule?e(exports):"function"==typeofdefine&&define.amd?define(["exports"],e):e(t.JSEncrypt={})}(this,function(t){"use strict";vare="0123456789abcdefghijklmnopqrstuvwxyz";functioni(t){returne.charAt(t)}functionr(t,e){returnt&e}functionn(t,e){returnt|e}functions(t,e){returnt^e}functiono(t,e){returnt&~e}functionh(t){if(0==t)return-1;vare=0;return0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}functiona(t){for(vare=0;0!=t;)t&=t-1,++e;returne}varu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c="=";functionf(t){vare,i,r="";for(e=0;e+3<=t.length;e+=3)i=parseInt(t.substring(e,e+3),16),r+=u.charAt(i>>6)+u.charAt(63&i);for(e+1==t.length?(i=parseInt(t.substring(e,e+1),16),r+=u.charAt(i<<2)):e+2==t.length&&(i=parseInt(t.substring(e,e+2),16),r+=u.charAt(i>>2)+u.charAt((3&i)<<4));(3&r.length)>0;)r+=c;returnr}varl,p=Object.setPrototypeOf||{__proto__:[]}instanceofArray&&function(t,e){t.__proto__=e}||function(t,e){for(variine)e.hasOwnProperty(i)&&(t[i]=e[i])};varg,d=function(t){vare;if(void0===l){vari="0123456789ABCDEF",r=" \f\n\r\t \u2028\u2029";for(l={},e=0;e<16;++e)l[i.charAt(e)]=e;for(i=i.toLowerCase(),e=10;e<16;++e)l[i.charAt(e)]=e;for(e=0;e<r.length;++e)l[r.charAt(e)]=-1}varn=[],s=0,o=0;for(e=0;e<t.length;++e){varh=t.charAt(e);if("="==h)break;if(-1!=(h=l[h])){if(void0===h)thrownewError("Illegal character at offset "+e);s|=h,++o>=2?(n[n.length]=s,s=0,o=0):s<<=4}}if(o)thrownewError("Hex encoding incomplete: 4 bits missing");returnn},v={decode:function(t){vare;if(void0===g){vari="= \f\n\r\t \u2028\u2029";for(g=Object.create(null),e=0;e<64;++e)g["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)]=e;for(e=0;e<i.length;++e)g[i.charAt(e)]=-1}varr=[],n=0,s=0;for(e=0;e<t.length;++e){varo=t.charAt(e);if("="==o)break;if(-1!=(o=g[o])){if(void0===o)thrownewError("Illegal character at offset "+e);n|=o,++s>=4?(r[r.length]=n>>16,r[r.length]=n>>8&255,r[r.length]=255&n,n=0,s=0):n<<=6}}switch(s){case1:thrownewError("Base64 encoding incomplete: at least 2 bits missing");case2:r[r.length]=n>>10;break;case3:r[r.length]=n>>16,r[r.length]=n>>8&255}returnr},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){vare=v.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])thrownewError("RegExp out of sync");t=e[2]}returnv.decode(t)}},m=1e13,y=function(){functiont(t){this.buf=[+t||0]}returnt.prototype.mulAdd=function(t,e){vari,r,n=this.buf,s=n.length;for(i=0;i<s;++i)(r=n[i]*t+e)<m?e=0:r-=(e=0|r/m)*m,n[i]=r;e>0&&(n[i]=e)},t.prototype.sub=function(t){vare,i,r=this.buf,n=r.length;for(e=0;e<n;++e)(i=r[e]-t)<0?(i+=m,t=1):t=0,r[e]=i;for(;0===r[r.length-1];)r.pop()},t.prototype.toString=function(t){if(10!=(t||10))thrownewError("only base 10 is supported");for(vare=this.buf,i=e[e.length-1].toString(),r=e.length-2;r>=0;--r)i+=(m+e[r]).toString().substring(1);returni},t.prototype.valueOf=function(){for(vart=this.buf,e=0,i=t.length-1;i>=0;--i)e=e*m+t[i];returne},t.prototype.simplify=function(){vart=this.buf;return1==t.length?t[0]:this},t}(),b="…",T=/^(\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)?)?$/,S=/^(\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)?)?$/;functionE(t,e){returnt.length>e&&(t=t.substring(0,e)+b),t}varw,D=function(){functiont(e,i){this.hexDigits="0123456789ABCDEF",einstanceoft?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=i)}returnt.prototype.get=function(t){if(void0===t&&(t=this.pos++),t>=this.enc.length)thrownewError("Requesting byte offset "+t+" on a stream of length "+this.enc.length);return"string"==typeofthis.enc?this.enc.charCodeAt(t):this.enc[t]},t.prototype.hexByte=function(t){returnthis.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)},t.prototype.hexDump=function(t,e,i){for(varr="",n=t;n<e;++n)if(r+=this.hexByte(this.get(n)),!0!==i)switch(15&n){case7:r+=" ";break;case15:r+="\n";break;default:r+=" "}returnr},t.prototype.isASCII=function(t,e){for(vari=t;i<e;++i){varr=this.get(i);if(r<32||r>176)return!1}return!0},t.prototype.parseStringISO=function(t,e){for(vari="",r=t;r<e;++r)i+=String.fromCharCode(this.get(r));returni},t.prototype.parseStringUTF=function(t,e){for(vari="",r=t;r<e;){varn=this.get(r++);i+=n<128?String.fromCharCode(n):n>191&&n<224?String.fromCharCode((31&n)<<6|63&this.get(r++)):String.fromCharCode((15&n)<<12|(63&this.get(r++))<<6|63&this.get(r++))}returni},t.prototype.parseStringBMP=function(t,e){for(vari,r,n="",s=t;s<e;)i=this.get(s++),r=this.get(s++),n+=String.fromCharCode(i<<8|r);returnn},t.prototype.parseTime=function(t,e,i){varr=this.parseStringISO(t,e),n=(i?T:S).exec(r);returnn?(i&&(n[1]=+n[1],n[1]+=+n[1]<70?2e3:1900),r=n[1]+"-"+n[2]+"-"+n[3]+" "+n[4],n[5]&&(r+=":"+n[5],n[6]&&(r+=":"+n[6],n[7]&&(r+="."+n[7]))),n[8]&&(r+=" UTC","Z"!=n[8]&&(r+=n[8],n[9]&&(r+=":"+n[9]))),r):"Unrecognized time: "+r},t.prototype.parseInteger=function(t,e){for(vari,r=this.get(t),n=r>127,s=n?255:0,o="";r==s&&++t<e;)r=this.get(t);if(0===(i=e-t))returnn?-1:0;if(i>4){for(o=r,i<<=3;0==(128&(+o^s));)o=+o<<1,--i;o="("+i+" bit)\n"}n&&(r-=256);for(varh=newy(r),a=t+1;a<e;++a)h.mulAdd(256,this.get(a));returno+h.toString()},t.prototype.parseBitString=function(t,e,i){for(varr=this.get(t),n="("+((e-t-1<<3)-r)+" bit)\n",s="",o=t+1;o<e;++o){for(varh=this.get(o),a=o==e-1?r:0,u=7;u>=a;--u)s+=h>>u&1?"1":"0";if(s.length>i)returnn+E(s,i)}returnn+s},t.prototype.parseOctetString=function(t,e,i){if(this.isASCII(t,e))returnE(this.parseStringISO(t,e),i);varr=e-t,n="("+r+" byte)\n";r>(i/=2)&&(e=t+i);for(vars=t;s<e;++s)n+=this.hexByte(this.get(s));returnr>i&&(n+=b),n},t.prototype.parseOID=function(t,e,i){for(varr="",n=newy,s=0,o=t;o<e;++o){varh=this.get(o);if(n.mulAdd(128,127&h),s+=7,!(128&h)){if(""===r)if((n=n.simplify())instanceofy)n.sub(80),r="2."+n.toString();else{vara=n<80?n<40?0:1:2;r=a+"."+(n-40*a)}elser+="."+n.toString();if(r.length>i)returnE(r,i);n=newy,s=0}}returns>0&&(r+=".incomplete"),r},t}(),x=function(){functiont(t,e,i,r,n){if(!(rinstanceofR))thrownewError("Invalid tag value.");this.stream=t,this.header=e,this.length=i,this.tag=r,this.sub=n}returnt.prototype.typeName=function(){switch(this.tag.tagClass){case0:switch(this.tag.tagNumber){case0:return"EOC";case1:return"BOOLEAN";case2:return"INTEGER";case3:return"BIT_STRING";case4:return"OCTET_STRING";case5:return"NULL";case6:return"OBJECT_IDENTIFIER";case7:return"ObjectDescriptor";case8:return"EXTERNAL";case9:return"REAL";case10:return"ENUMERATED";case11:return"EMBEDDED_PDV";case12:return"UTF8String";case16:return"SEQUENCE";case17:return"SET";case18:return"NumericString";case19:return"PrintableString";case20:return"TeletexString";case21:return"VideotexString";case22:return"IA5String";case23:return"UTCTime";case24:return"GeneralizedTime";case25:return"GraphicString";case26:return"VisibleString";case27:return"GeneralString";case28:return"UniversalString";case30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case1:return"Application_"+this.tag.tagNumber.toString();case2:return"["+this.tag.tagNumber.toString()+"]";case3:return"Private_"+this.tag.tagNumber.toString()}},t.prototype.content=function(t){if(void0===this.tag)returnnull;void0===t&&(t=1/0);vare=this.posContent(),i=Math.abs(this.length);if(!this.tag.isUniversal())returnnull!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+i,t);switch(this.tag.tagNumber){case1:return0===this.stream.get(e)?"false":"true";case2:returnthis.stream.parseInteger(e,e+i);case3:returnthis.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+i,t);case4:returnthis.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+i,t);case6:returnthis.stream.parseOID(e,e+i,t);case16:case17:returnnull!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case12:returnE(this.stream.parseStringUTF(e,e+i),t);case18:case19:case20:case21:case22:case26:returnE(this.stream.parseStringISO(e,e+i),t);case30:returnE(this.stream.parseStringBMP(e,e+i),t);case23:case24:returnthis.stream.parseTime(e,e+i,23==this.tag.tagNumber)}returnnull},t.prototype.toString=function(){returnthis.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},t.prototype.toPrettyString=function(t){void0===t&&(t="");vare=t+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(e+=" (encapsulates)"),e+="\n",null!==this.sub){t+=" ";for(vari=0,r=this.sub.length;i<r;++i)e+=this.sub[i].toPrettyString(t)}returne},t.prototype.posStart=function(){returnthis.stream.pos},t.prototype.posContent=function(){returnthis.stream.pos+this.header},t.prototype.posEnd=function(){returnthis.stream.pos+this.header+Math.abs(this.length)},t.prototype.toHexString=function(){returnthis.stream.hexDump(this.posStart(),this.posEnd(),!0)},t.decodeLength=function(t){vare=t.get(),i=127&e;if(i==e)returni;if(i>6)thrownewError("Length over 48 bits not supported at position "+(t.pos-1));if(0===i)returnnull;e=0;for(varr=0;r<i;++r)e=256*e+t.get();returne},t.prototype.getHexStringValue=function(){vart=this.toHexString(),e=2*this.header,i=2*this.length;returnt.substr(e,i)},t.decode=function(e){vari;i=einstanceofD?e:newD(e,0);varr=newD(i),n=newR(i),s=t.decodeLength(i),o=i.pos,h=o-r.pos,a=null,u=function(){vare=[];if(null!==s){for(varr=o+s;i.pos<r;)e[e.length]=t.decode(i);if(i.pos!=r)thrownewError("Content size is not correct for container starting at offset "+o)}elsetry{for(;;){varn=t.decode(i);if(n.tag.isEOC())break;e[e.length]=n}s=o-i.pos}catch(t){thrownewError("Exception while decoding undefined length content: "+t)}returne};if(n.tagConstructed)a=u();elseif(n.isUniversal()&&(3==n.tagNumber||4==n.tagNumber))try{if(3==n.tagNumber&&0!=i.get())thrownewError("BIT STRINGs with unused bits cannot encapsulate.");a=u();for(varc=0;c<a.length;++c)if(a[c].tag.isEOC())thrownewError("EOC is not supposed to be actual content.")}catch(t){a=null}if(null===a){if(null===s)thrownewError("We can't skip over an invalid tag with undefined length at offset "+o);i.pos=o+Math.abs(s)}returnnewt(r,h,s,n,a)},t}(),R=function(){functiont(t){vare=t.get();if(this.tagClass=e>>6,this.tagConstructed=0!=(32&e),this.tagNumber=31&e,31==this.tagNumber){for(vari=newy;e=t.get(),i.mulAdd(128,127&e),128&e;);this.tagNumber=i.simplify()}}returnt.prototype.isUniversal=function(){return0===this.tagClass},t.prototype.isEOC=function(){return0===this.tagClass&&0===this.tagNumber},t}(),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],A=(1<<26)/B[B.length-1],O=function(){functiont(t,e,i){null!=t&&("number"==typeoft?this.fromNumber(t,e,i):null==e&&"string"!=typeoft?this.fromString(t,256):this.fromString(t,e))}returnt.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);vare;if(16==t)e=4;elseif(8==t)e=3;elseif(2==t)e=1;elseif(32==t)e=5;else{if(4!=t)returnthis.toRadix(t);e=2}varr,n=(1<<e)-1,s=!1,o="",h=this.t,a=this.DB-h*this.DB%e;if(h-->0)for(a<this.DB&&(r=this[h]>>a)>0&&(s=!0,o=i(r));h>=0;)a<e?(r=(this[h]&(1<<a)-1)<<e-a,r|=this[--h]>>(a+=this.DB-e)):(r=this[h]>>(a-=e)&n,a<=0&&(a+=this.DB,--h)),r>0&&(s=!0),s&&(o+=i(r));returns?o:"0"},t.prototype.negate=function(){vare=M();returnt.ZERO.subTo(this,e),e},t.prototype.abs=function(){returnthis.s<0?this.negate():this},t.prototype.compareTo=function(t){vare=this.s-t.s;if(0!=e)returne;vari=this.t;if(0!=(e=i-t.t))returnthis.s<0?-e:e;for(;--i>=0;)if(0!=(e=this[i]-t[i]))returne;return0},t.prototype.bitLength=function(){returnthis.t<=0?0:this.DB*(this.t-1)+U(this[this.t-1]^this.s&this.DM)},t.prototype.mod=function(e){vari=M();returnthis.abs().divRemTo(e,null,i),this.s<0&&i.compareTo(t.ZERO)>0&&e.subTo(i,i),i},t.prototype.modPowInt=function(t,e){vari;returni=t<256||e.isEven()?newI(e):newN(e),this.exp(t,i)},t.prototype.clone=function(){vart=M();returnthis.copyTo(t),t},t.prototype.intValue=function(){if(this.s<0){if(1==this.t)returnthis[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)returnthis[0];if(0==this.t)return0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},t.prototype.byteValue=function(){return0==this.t?this.s:this[0]<<24>>24},t.prototype.shortValue=function(){return0==this.t?this.s:this[0]<<16>>16},t.prototype.signum=function(){returnthis.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},t.prototype.toByteArray=function(){vart=this.t,e=[];e[0]=this.s;vari,r=this.DB-t*this.DB%8,n=0;if(t-->0)for(r<this.DB&&(i=this[t]>>r)!=(this.s&this.DM)>>r&&(e[n++]=i|this.s<<this.DB-r);t>=0;)r<8?(i=(this[t]&(1<<r)-1)<<8-r,i|=this[--t]>>(r+=this.DB-8)):(i=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&i)&&(i|=-256),0==n&&(128&this.s)!=(128&i)&&++n,(n>0||i!=this.s)&&(e[n++]=i);returne},t.prototype.equals=function(t){return0==this.compareTo(t)},t.prototype.min=function(t){returnthis.compareTo(t)<0?this:t},t.prototype.max=function(t){returnthis.compareTo(t)>0?this:t},t.prototype.and=function(t){vare=M();returnthis.bitwiseTo(t,r,e),e},t.prototype.or=function(t){vare=M();returnthis.bitwiseTo(t,n,e),e},t.prototype.xor=function(t){vare=M();returnthis.bitwiseTo(t,s,e),e},t.prototype.andNot=function(t){vare=M();returnthis.bitwiseTo(t,o,e),e},t.prototype.not=function(){for(vart=M(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];returnt.t=this.t,t.s=~this.s,t},t.prototype.shiftLeft=function(t){vare=M();returnt<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},t.prototype.shiftRight=function(t){vare=M();returnt<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},t.prototype.getLowestSetBit=function(){for(vart=0;t<this.t;++t)if(0!=this[t])returnt*this.DB+h(this[t]);returnthis.s<0?this.t*this.DB:-1},t.prototype.bitCount=function(){for(vart=0,e=this.s&this.DM,i=0;i<this.t;++i)t+=a(this[i]^e);returnt},t.prototype.testBit=function(t){vare=Math.floor(t/this.DB);returne>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)},t.prototype.setBit=function(t){returnthis.changeBit(t,n)},t.prototype.clearBit=function(t){returnthis.changeBit(t,o)},t.prototype.flipBit=function(t){returnthis.changeBit(t,s)},t.prototype.add=function(t){vare=M();returnthis.addTo(t,e),e},t.prototype.subtract=function(t){vare=M();returnthis.subTo(t,e),e},t.prototype.multiply=function(t){vare=M();returnthis.multiplyTo(t,e),e},t.prototype.divide=function(t){vare=M();returnthis.divRemTo(t,e,null),e},t.prototype.remainder=function(t){vare=M();returnthis.divRemTo(t,null,e),e},t.prototype.divideAndRemainder=function(t){vare=M(),i=M();returnthis.divRemTo(t,e,i),[e,i]},t.prototype.modPow=function(t,e){vari,r,n=t.bitLength(),s=F(1);if(n<=0)returns;i=n<18?1:n<48?3:n<144?4:n<768?5:6,r=n<8?newI(e):e.isEven()?newP(e):newN(e);varo=[],h=3,a=i-1,u=(1<<i)-1;if(o[1]=r.convert(this),i>1){varc=M();for(r.sqrTo(o[1],c);h<=u;)o[h]=M(),r.mulTo(c,o[h-2],o[h]),h+=2}varf,l,p=t.t-1,g=!0,d=M();for(n=U(t[p])-1;p>=0;){for(n>=a?f=t[p]>>n-a&u:(f=(t[p]&(1<<n+1)-1)<<a-n,p>0&&(f|=t[p-1]>>this.DB+n-a)),h=i;0==(1&f);)f>>=1,--h;if((n-=h)<0&&(n+=this.DB,--p),g)o[f].copyTo(s),g=!1;else{for(;h>1;)r.sqrTo(s,d),r.sqrTo(d,s),h-=2;h>0?r.sqrTo(s,d):(l=s,s=d,d=l),r.mulTo(d,o[f],s)}for(;p>=0&&0==(t[p]&1<<n);)r.sqrTo(s,d),l=s,s=d,d=l,--n<0&&(n=this.DB-1,--p)}returnr.revert(s)},t.prototype.modInverse=function(e){vari=e.isEven();if(this.isEven()&&i||0==e.signum())returnt.ZERO;for(varr=e.clone(),n=this.clone(),s=F(1),o=F(0),h=F(0),a=F(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),i?(s.isEven()&&o.isEven()||(s.addTo(this,s),o.subTo(e,o)),s.rShiftTo(1,s)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),i?(h.isEven()&&a.isEven()||(h.addTo(this,h),a.subTo(e,a)),h.rShiftTo(1,h)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),i&&s.subTo(h,s),o.subTo(a,o)):(n.subTo(r,n),i&&h.subTo(s,h),a.subTo(o,a))}return0!=n.compareTo(t.ONE)?t.ZERO:a.compareTo(e)>=0?a.subtract(e):a.signum()<0?(a.addTo(e,a),a.signum()<0?a.add(e):a):a},t.prototype.pow=function(t){returnthis.exp(t,newV)},t.prototype.gcd=function(t){vare=this.s<0?this.negate():this.clone(),i=t.s<0?t.negate():t.clone();if(e.compareTo(i)<0){varr=e;e=i,i=r}varn=e.getLowestSetBit(),s=i.getLowestSetBit();if(s<0)returne;for(n<s&&(s=n),s>0&&(e.rShiftTo(s,e),i.rShiftTo(s,i));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=i.getLowestSetBit())>0&&i.rShiftTo(n,i),e.compareTo(i)>=0?(e.subTo(i,e),e.rShiftTo(1,e)):(i.subTo(e,i),i.rShiftTo(1,i));returns>0&&i.lShiftTo(s,i),i},t.prototype.isProbablePrime=function(t){vare,i=this.abs();if(1==i.t&&i[0]<=B[B.length-1]){for(e=0;e<B.length;++e)if(i[0]==B[e])return!0;return!1}if(i.isEven())return!1;for(e=1;e<B.length;){for(varr=B[e],n=e+1;n<B.length&&r<A;)r*=B[n++];for(r=i.modInt(r);e<n;)if(r%B[e++]==0)return!1}returni.millerRabin(t)},t.prototype.copyTo=function(t){for(vare=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},t.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},t.prototype.fromString=function(e,i){varr;if(16==i)r=4;elseif(8==i)r=3;elseif(256==i)r=8;elseif(2==i)r=1;elseif(32==i)r=5;else{if(4!=i)returnvoidthis.fromRadix(e,i);r=2}this.t=0,this.s=0;for(varn=e.length,s=!1,o=0;--n>=0;){varh=8==r?255&+e[n]:C(e,n);h<0?"-"==e.charAt(n)&&(s=!0):(s=!1,0==o?this[this.t++]=h:o+r>this.DB?(this[this.t-1]|=(h&(1<<this.DB-o)-1)<<o,this[this.t++]=h>>this.DB-o):this[this.t-1]|=h<<o,(o+=r)>=this.DB&&(o-=this.DB))}8==r&&0!=(128&+e[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),s&&t.ZERO.subTo(this,this)},t.prototype.clamp=function(){for(vart=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},t.prototype.dlShiftTo=function(t,e){vari;for(i=this.t-1;i>=0;--i)e[i+t]=this[i];for(i=t-1;i>=0;--i)e[i]=0;e.t=this.t+t,e.s=this.s},t.prototype.drShiftTo=function(t,e){for(vari=t;i<this.t;++i)e[i-t]=this[i];e.t=Math.max(this.t-t,0),e.s=this.s},t.prototype.lShiftTo=function(t,e){for(vari=t%this.DB,r=this.DB-i,n=(1<<r)-1,s=Math.floor(t/this.DB),o=this.s<<i&this.DM,h=this.t-1;h>=0;--h)e[h+s+1]=this[h]>>r|o,o=(this[h]&n)<<i;for(h=s-1;h>=0;--h)e[h]=0;e[s]=o,e.t=this.t+s+1,e.s=this.s,e.clamp()},t.prototype.rShiftTo=function(t,e){e.s=this.s;vari=Math.floor(t/this.DB);if(i>=this.t)e.t=0;else{varr=t%this.DB,n=this.DB-r,s=(1<<r)-1;e[0]=this[i]>>r;for(varo=i+1;o<this.t;++o)e[o-i-1]|=(this[o]&s)<<n,e[o-i]=this[o]>>r;r>0&&(e[this.t-i-1]|=(this.s&s)<<n),e.t=this.t-i,e.clamp()}},t.prototype.subTo=function(t,e){for(vari=0,r=0,n=Math.min(t.t,this.t);i<n;)r+=this[i]-t[i],e[i++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;i<this.t;)r+=this[i],e[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<t.t;)r-=t[i],e[i++]=r&this.DM,r>>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[i++]=this.DV+r:r>0&&(e[i++]=r),e.t=i,e.clamp()},t.prototype.multiplyTo=function(e,i){varr=this.abs(),n=e.abs(),s=r.t;for(i.t=s+n.t;--s>=0;)i[s]=0;for(s=0;s<n.t;++s)i[s+r.t]=r.am(0,n[s],i,s,0,r.t);i.s=0,i.clamp(),this.s!=e.s&&t.ZERO.subTo(i,i)},t.prototype.squareTo=function(t){for(vare=this.abs(),i=t.t=2*e.t;--i>=0;)t[i]=0;for(i=0;i<e.t-1;++i){varr=e.am(i,e[i],t,2*i,0,1);(t[i+e.t]+=e.am(i+1,2*e[i],t,2*i+1,r,e.t-i-1))>=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(i,e[i],t,2*i,0,1)),t.s=0,t.clamp()},t.prototype.divRemTo=function(e,i,r){varn=e.abs();if(!(n.t<=0)){vars=this.abs();if(s.t<n.t)returnnull!=i&&i.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=M());varo=M(),h=this.s,a=e.s,u=this.DB-U(n[n.t-1]);u>0?(n.lShiftTo(u,o),s.lShiftTo(u,r)):(n.copyTo(o),s.copyTo(r));varc=o.t,f=o[c-1];if(0!=f){varl=f*(1<<this.F1)+(c>1?o[c-2]>>this.F2:0),p=this.FV/l,g=(1<<this.F1)/l,d=1<<this.F2,v=r.t,m=v-c,y=null==i?M():i;for(o.dlShiftTo(m,y),r.compareTo(y)>=0&&(r[r.t++]=1,r.subTo(y,r)),t.ONE.dlShiftTo(c,y),y.subTo(o,o);o.t<c;)o[o.t++]=0;for(;--m>=0;){varb=r[--v]==f?this.DM:Math.floor(r[v]*p+(r[v-1]+d)*g);if((r[v]+=o.am(0,b,r,m,0,c))<b)for(o.dlShiftTo(m,y),r.subTo(y,r);r[v]<--b;)r.subTo(y,r)}null!=i&&(r.drShiftTo(c,i),h!=a&&t.ZERO.subTo(i,i)),r.t=c,r.clamp(),u>0&&r.rShiftTo(u,r),h<0&&t.ZERO.subTo(r,r)}}},t.prototype.invDigit=function(){if(this.t<1)return0;vart=this[0];if(0==(1&t))return0;vare=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},t.prototype.isEven=function(){return0==(this.t>0?1&this[0]:this.s)},t.prototype.exp=function(e,i){if(e>4294967295||e<1)returnt.ONE;varr=M(),n=M(),s=i.convert(this),o=U(e)-1;for(s.copyTo(r);--o>=0;)if(i.sqrTo(r,n),(e&1<<o)>0)i.mulTo(n,s,r);else{varh=r;r=n,n=h}returni.revert(r)},t.prototype.chunkSize=function(t){returnMath.floor(Math.LN2*this.DB/Math.log(t))},t.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";vare=this.chunkSize(t),i=Math.pow(t,e),r=F(i),n=M(),s=M(),o="";for(this.divRemTo(r,n,s);n.signum()>0;)o=(i+s.intValue()).toString(t).substr(1)+o,n.divRemTo(r,n,s);returns.intValue().toString(t)+o},t.prototype.fromRadix=function(e,i){this.fromInt(0),null==i&&(i=10);for(varr=this.chunkSize(i),n=Math.pow(i,r),s=!1,o=0,h=0,a=0;a<e.length;++a){varu=C(e,a);u<0?"-"==e.charAt(a)&&0==this.signum()&&(s=!0):(h=i*h+u,++o>=r&&(this.dMultiply(n),this.dAddOffset(h,0),o=0,h=0))}o>0&&(this.dMultiply(Math.pow(i,o)),this.dAddOffset(h,0)),s&&t.ZERO.subTo(this,this)},t.prototype.fromNumber=function(e,i,r){if("number"==typeofi)if(e<2)this.fromInt(1);elsefor(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),n,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(t.ONE.shiftLeft(e-1),this);else{vars=[],o=7&e;s.length=1+(e>>3),i.nextBytes(s),o>0?s[0]&=(1<<o)-1:s[0]=0,this.fromString(s,256)}},t.prototype.bitwiseTo=function(t,e,i){varr,n,s=Math.min(t.t,this.t);for(r=0;r<s;++r)i[r]=e(this[r],t[r]);if(t.t<this.t){for(n=t.s&this.DM,r=s;r<this.t;++r)i[r]=e(this[r],n);i.t=this.t}else{for(n=this.s&this.DM,r=s;r<t.t;++r)i[r]=e(n,t[r]);i.t=t.t}i.s=e(this.s,t.s),i.clamp()},t.prototype.changeBit=function(e,i){varr=t.ONE.shiftLeft(e);returnthis.bitwiseTo(r,i,r),r},t.prototype.addTo=function(t,e){for(vari=0,r=0,n=Math.min(t.t,this.t);i<n;)r+=this[i]+t[i],e[i++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;i<this.t;)r+=this[i],e[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<t.t;)r+=t[i],e[i++]=r&this.DM,r>>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[i++]=r:r<-1&&(e[i++]=this.DV+r),e.t=i,e.clamp()},t.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},t.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},t.prototype.multiplyLowerTo=function(t,e,i){varr=Math.min(this.t+t.t,e);for(i.s=0,i.t=r;r>0;)i[--r]=0;for(varn=i.t-this.t;r<n;++r)i[r+this.t]=this.am(0,t[r],i,r,0,this.t);for(n=Math.min(t.t,e);r<n;++r)this.am(0,t[r],i,r,0,e-r);i.clamp()},t.prototype.multiplyUpperTo=function(t,e,i){--e;varr=i.t=this.t+t.t-e;for(i.s=0;--r>=0;)i[r]=0;for(r=Math.max(e-this.t,0);r<t.t;++r)i[this.t+r-e]=this.am(e-r,t[r],i,0,0,this.t+r-e);i.clamp(),i.drShiftTo(1,i)},t.prototype.modInt=function(t){if(t<=0)return0;vare=this.DV%t,i=this.s<0?t-1:0;if(this.t>0)if(0==e)i=this[0]%t;elsefor(varr=this.t-1;r>=0;--r)i=(e*i+this[r])%t;returni},t.prototype.millerRabin=function(e){vari=this.subtract(t.ONE),r=i.getLowestSetBit();if(r<=0)return!1;varn=i.shiftRight(r);(e=e+1>>1)>B.length&&(e=B.length);for(vars=M(),o=0;o<e;++o){s.fromInt(B[Math.floor(Math.random()*B.length)]);varh=s.modPow(n,this);if(0!=h.compareTo(t.ONE)&&0!=h.compareTo(i)){for(vara=1;a++<r&&0!=h.compareTo(i);)if(0==(h=h.modPowInt(2,this)).compareTo(t.ONE))return!1;if(0!=h.compareTo(i))return!1}}return!0},t.prototype.square=function(){vart=M();returnthis.squareTo(t),t},t.prototype.gcda=function(t,e){vari=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(i.compareTo(r)<0){varn=i;i=r,r=n}vars=i.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)e(i);else{s<o&&(o=s),o>0&&(i.rShiftTo(o,i),r.rShiftTo(o,r));varh=function(){(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),(s=r.getLowestSetBit())>0&&r.rShiftTo(s,r),i.compareTo(r)>=0?(i.subTo(r,i),i.rShiftTo(1,i)):(r.subTo(i,r),r.rShiftTo(1,r)),i.signum()>0?setTimeout(h,0):(o>0&&r.lShiftTo(o,r),setTimeout(function(){e(r)},0))};setTimeout(h,10)}},t.prototype.fromNumberAsync=function(e,i,r,s){if("number"==typeofi)if(e<2)this.fromInt(1);else{this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),n,this),this.isEven()&&this.dAddOffset(1,0);varo=this,h=function(){o.dAddOffset(2,0),o.bitLength()>e&&o.subTo(t.ONE.shiftLeft(e-1),o),o.isProbablePrime(i)?setTimeout(function(){s()},0):setTimeout(h,0)};setTimeout(h,0)}else{vara=[],u=7&e;a.length=1+(e>>3),i.nextBytes(a),u>0?a[0]&=(1<<u)-1:a[0]=0,this.fromString(a,256)}},t}(),V=function(){functiont(){}returnt.prototype.convert=function(t){returnt},t.prototype.revert=function(t){returnt},t.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i)},t.prototype.sqrTo=function(t,e){t.squareTo(e)},t}(),I=function(){functiont(t){this.m=t}returnt.prototype.convert=function(t){returnt.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},t.prototype.revert=function(t){returnt},t.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},t.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),N=function(){functiont(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}returnt.prototype.convert=function(t){vare=M();returnt.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(O.ZERO)>0&&this.m.subTo(e,e),e},t.prototype.revert=function(t){vare=M();returnt.copyTo(e),this.reduce(e),e},t.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(vare=0;e<this.m.t;++e){vari=32767&t[e],r=i*this.mpl+((i*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[i=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),P=function(){functiont(t){this.m=t,this.r2=M(),this.q3=M(),O.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}returnt.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)returnt.mod(this.m);if(t.compareTo(this.m)<0)returnt;vare=M();returnt.copyTo(e),this.reduce(e),e},t.prototype.revert=function(t){returnt},t.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}();functionM(){returnnewO(null)}functionq(t,e){returnnewO(t,e)}"Microsoft Internet Explorer"==navigator.appName?(O.prototype.am=function(t,e,i,r,n,s){for(varo=32767&e,h=e>>15;--s>=0;){vara=32767&this[t],u=this[t++]>>15,c=h*a+u*o;n=((a=o*a+((32767&c)<<15)+i[r]+(1073741823&n))>>>30)+(c>>>15)+h*u+(n>>>30),i[r++]=1073741823&a}returnn},w=30):"Netscape"!=navigator.appName?(O.prototype.am=function(t,e,i,r,n,s){for(;--s>=0;){varo=e*this[t++]+i[r]+n;n=Math.floor(o/67108864),i[r++]=67108863&o}returnn},w=26):(O.prototype.am=function(t,e,i,r,n,s){for(varo=16383&e,h=e>>14;--s>=0;){vara=16383&this[t],u=this[t++]>>14,c=h*a+u*o;n=((a=o*a+((16383&c)<<14)+i[r]+n)>>28)+(c>>14)+h*u,i[r++]=268435455&a}returnn},w=28),O.prototype.DB=w,O.prototype.DM=(1<<w)-1,O.prototype.DV=1<<w;O.prototype.FV=Math.pow(2,52),O.prototype.F1=52-w,O.prototype.F2=2*w-52;varj,L,H=[];for(j="0".charCodeAt(0),L=0;L<=9;++L)H[j++]=L;for(j="a".charCodeAt(0),L=10;L<36;++L)H[j++]=L;for(j="A".charCodeAt(0),L=10;L<36;++L)H[j++]=L;functionC(t,e){vari=H[t.charCodeAt(e)];returnnull==i?-1:i}functionF(t){vare=M();returne.fromInt(t),e}functionU(t){vare,i=1;return0!=(e=t>>>16)&&(t=e,i+=16),0!=(e=t>>8)&&(t=e,i+=8),0!=(e=t>>4)&&(t=e,i+=4),0!=(e=t>>2)&&(t=e,i+=2),0!=(e=t>>1)&&(t=e,i+=1),i}O.ZERO=F(0),O.ONE=F(1);varK=function(){functiont(){this.i=0,this.j=0,this.S=[]}returnt.prototype.init=function(t){vare,i,r;for(e=0;e<256;++e)this.S[e]=e;for(i=0,e=0;e<256;++e)i=i+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[i],this.S[i]=r;this.i=0,this.j=0},t.prototype.next=function(){vart;returnthis.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]},t}();vark,_,z=256,Z=null;if(null==Z){Z=[],_=0;varG=void0;if(window.crypto&&window.crypto.getRandomValues){var$=newUint32Array(256);for(window.crypto.getRandomValues($),G=0;G<$.length;++G)Z[_++]=255&$[G]}varY=function(t){if(this.count=this.count||0,this.count>=256||_>=z)window.removeEventListener?window.removeEventListener("mousemove",Y,!1):window.detachEvent&&window.detachEvent("onmousemove",Y);elsetry{vare=t.x+t.y;Z[_++]=255&e,this.count+=1}catch(t){}};window.addEventListener?window.addEventListener("mousemove",Y,!1):window.attachEvent&&window.attachEvent("onmousemove",Y)}functionJ(){if(null==k){for(k=newK;_<z;){vart=Math.floor(65536*Math.random());Z[_++]=255&t}for(k.init(Z),_=0;_<Z.length;++_)Z[_]=0;_=0}returnk.next()}varX=function(){functiont(){}returnt.prototype.nextBytes=function(t){for(vare=0;e<t.length;++e)t[e]=J()},t}();varQ=function(){functiont(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}returnt.prototype.doPublic=function(t){returnt.modPowInt(this.e,this.n)},t.prototype.doPrivate=function(t){if(null==this.p||null==this.q)returnt.modPow(this.d,this.n);for(vare=t.mod(this.p).modPow(this.dmp1,this.p),i=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(i)<0;)e=e.add(this.p);returne.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i)},t.prototype.setPublic=function(t,e){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=q(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},t.prototype.encrypt=function(t){vare=function(t,e){if(e<t.length+11)returnconsole.error("Message too long for RSA"),null;for(vari=[],r=t.length-1;r>=0&&e>0;){varn=t.charCodeAt(r--);n<128?i[--e]=n:n>127&&n<2048?(i[--e]=63&n|128,i[--e]=n>>6|192):(i[--e]=63&n|128,i[--e]=n>>6&63|128,i[--e]=n>>12|224)}i[--e]=0;for(vars=newX,o=[];e>2;){for(o[0]=0;0==o[0];)s.nextBytes(o);i[--e]=o[0]}returni[--e]=2,i[--e]=0,newO(i)}(t,this.n.bitLength()+7>>3);if(null==e)returnnull;vari=this.doPublic(e);if(null==i)returnnull;varr=i.toString(16);return0==(1&r.length)?r:"0"+r},t.prototype.setPrivate=function(t,e,i){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=q(t,16),this.e=parseInt(e,16),this.d=q(i,16)):console.error("Invalid RSA private key")},t.prototype.setPrivateEx=function(t,e,i,r,n,s,o,h){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=q(t,16),this.e=parseInt(e,16),this.d=q(i,16),this.p=q(r,16),this.q=q(n,16),this.dmp1=q(s,16),this.dmq1=q(o,16),this.coeff=q(h,16)):console.error("Invalid RSA private key")},t.prototype.generate=function(t,e){vari=newX,r=t>>1;this.e=parseInt(e,16);for(varn=newO(e,16);;){for(;this.p=newO(t-r,1,i),0!=this.p.subtract(O.ONE).gcd(n).compareTo(O.ONE)||!this.p.isProbablePrime(10););for(;this.q=newO(r,1,i),0!=this.q.subtract(O.ONE).gcd(n).compareTo(O.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){vars=this.p;this.p=this.q,this.q=s}varo=this.p.subtract(O.ONE),h=this.q.subtract(O.ONE),a=o.multiply(h);if(0==a.gcd(n).compareTo(O.ONE)){this.n=this.p.multiply(this.q),this.d=n.modInverse(a),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(h),this.coeff=this.q.modInverse(this.p);break}}},t.prototype.decrypt=function(t){vare=q(t,16),i=this.doPrivate(e);returnnull==i?null:function(t,e){vari=t.toByteArray(),r=0;for(;r<i.length&&0==i[r];)++r;if(i.length-r!=e-1||2!=i[r])returnnull;++r;for(;0!=i[r];)if(++r>=i.length)returnnull;varn="";for(;++r<i.length;){vars=255&i[r];s<128?n+=String.fromCharCode(s):s>191&&s<224?(n+=String.fromCharCode((31&s)<<6|63&i[r+1]),++r):(n+=String.fromCharCode((15&s)<<12|(63&i[r+1])<<6|63&i[r+2]),r+=2)}returnn}(i,this.n.bitLength()+7>>3)},t.prototype.generateAsync=function(t,e,i){varr=newX,n=t>>1;this.e=parseInt(e,16);vars=newO(e,16),o=this,h=function(){vare=function(){if(o.p.compareTo(o.q)<=0){vart=o.p;o.p=o.q,o.q=t}vare=o.p.subtract(O.ONE),r=o.q.subtract(O.ONE),n=e.multiply(r);0==n.gcd(s).compareTo(O.ONE)?(o.n=o.p.multiply(o.q),o.d=s.modInverse(n),o.dmp1=o.d.mod(e),o.dmq1=o.d.mod(r),o.coeff=o.q.modInverse(o.p),setTimeout(function(){i()},0)):setTimeout(h,0)},a=function(){o.q=M(),o.q.fromNumberAsync(n,1,r,function(){o.q.subtract(O.ONE).gcda(s,function(t){0==t.compareTo(O.ONE)&&o.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(a,0)})})},u=function(){o.p=M(),o.p.fromNumberAsync(t-n,1,r,function(){o.p.subtract(O.ONE).gcda(s,function(t){0==t.compareTo(O.ONE)&&o.p.isProbablePrime(10)?setTimeout(a,0):setTimeout(u,0)})})};setTimeout(u,0)};setTimeout(h,0)},t}();varW={};W.lang={extend:function(t,e,i){if(!e||!t)thrownewError("YAHOO.lang.extend failed, please check that all dependencies are included.");varr=function(){};if(r.prototype=e.prototype,t.prototype=newr,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e),i){varn;for(nini)t.prototype[n]=i[n];vars=function(){},o=["toString","valueOf"];try{/MSIE/.test(navigator.userAgent)&&(s=function(t,e){for(n=0;n<o.length;n+=1){vari=o[n],r=e[i];"function"==typeofr&&r!=Object.prototype[i]&&(t[i]=r)}})}catch(t){}s(t.prototype,i)}}};vartt={};void0!==tt.asn1&&tt.asn1||(tt.asn1={}),tt.asn1.ASN1Util=newfunction(){this.integerToByteHex=function(t){vare=t.toString(16);returne.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){vare=t.toString(16);if("-"!=e.substr(0,1))e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e);else{vari=e.substr(1).length;i%2==1?i+=1:e.match(/^[0-7]/)||(i+=2);for(varr="",n=0;n<i;n++)r+="f";e=newO(r,16).xor(t).add(O.ONE).toString(16).replace(/^-/,"")}returne},this.getPEMStringFromHex=function(t,e){returnhextopem(t,e)},this.newObject=function(t){vare=tt.asn1,i=e.DERBoolean,r=e.DERInteger,n=e.DERBitString,s=e.DEROctetString,o=e.DERNull,h=e.DERObjectIdentifier,a=e.DEREnumerated,u=e.DERUTF8String,c=e.DERNumericString,f=e.DERPrintableString,l=e.DERTeletexString,p=e.DERIA5String,g=e.DERUTCTime,d=e.DERGeneralizedTime,v=e.DERSequence,m=e.DERSet,y=e.DERTaggedObject,b=e.ASN1Util.newObject,T=Object.keys(t);if(1!=T.length)throw"key of param shall be only one.";varS=T[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+S+":"))throw"undefined key: "+S;if("bool"==S)returnnewi(t[S]);if("int"==S)returnnewr(t[S]);if("bitstr"==S)returnnewn(t[S]);if("octstr"==S)returnnews(t[S]);if("null"==S)returnnewo(t[S]);if("oid"==S)returnnewh(t[S]);if("enum"==S)returnnewa(t[S]);if("utf8str"==S)returnnewu(t[S]);if("numstr"==S)returnnewc(t[S]);if("prnstr"==S)returnnewf(t[S]);if("telstr"==S)returnnewl(t[S]);if("ia5str"==S)returnnewp(t[S]);if("utctime"==S)returnnewg(t[S]);if("gentime"==S)returnnewd(t[S]);if("seq"==S){for(varE=t[S],w=[],D=0;D<E.length;D++){varx=b(E[D]);w.push(x)}returnnewv({array:w})}if("set"==S){for(E=t[S],w=[],D=0;D<E.length;D++){x=b(E[D]);w.push(x)}returnnewm({array:w})}if("tag"==S){varR=t[S];if("[object Array]"===Object.prototype.toString.call(R)&&3==R.length){varB=b(R[2]);returnnewy({tag:R[0],explicit:R[1],obj:B})}varA={};if(void0!==R.explicit&&(A.explicit=R.explicit),void0!==R.tag&&(A.tag=R.tag),void0===R.obj)throw"obj shall be specified for 'tag'.";returnA.obj=b(R.obj),newy(A)}},this.jsonToASN1HEX=function(t){returnthis.newObject(t).getEncodedHex()}},tt.asn1.ASN1Util.oidHexToInt=function(t){for(vare="",i=parseInt(t.substr(0,2),16),r=(e=Math.floor(i/40)+"."+i%40,""),n=2;n<t.length;n+=2){vars=("00000000"+parseInt(t.substr(n,2),16).toString(2)).slice(-8);if(r+=s.substr(1,7),"0"==s.substr(0,1))e=e+"."+newO(r,2).toString(10),r=""}returne},tt.asn1.ASN1Util.oidIntToHex=function(t){vare=function(t){vare=t.toString(16);return1==e.length&&(e="0"+e),e},i=function(t){vari="",r=newO(t,10).toString(2),n=7-r.length%7;7==n&&(n=0);for(vars="",o=0;o<n;o++)s+="0";r=s+r;for(o=0;o<r.length-1;o+=7){varh=r.substr(o,7);o!=r.length-7&&(h="1"+h),i+=e(parseInt(h,2))}returni};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;varr="",n=t.split("."),s=40*parseInt(n[0])+parseInt(n[1]);r+=e(s),n.splice(0,2);for(varo=0;o<n.length;o++)r+=i(n[o]);returnr},tt.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(void0===this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+"".length+",v="+this.hV;vart=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)returne;vari=e.length/2;if(i>15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+i).toString(16)+e},this.getEncodedHex=function(){return(null==this.hTLV||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(){returnthis.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},tt.asn1.DERAbstractString=function(t){tt.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){returnthis.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){returnthis.hV},void0!==t&&("string"==typeoft?this.setString(t):void0!==t.str?this.setString(t.str):void0!==t.hex&&this.setStringHex(t.hex))},W.lang.extend(tt.asn1.DERAbstractString,tt.asn1.ASN1Object),tt.asn1.DERAbstractTime=function(t){tt.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){returnutc=t.getTime()+6e4*t.getTimezoneOffset(),newDate(utc)},this.formatDate=function(t,e,i){varr=this.zeroPadding,n=this.localDateToUTC(t),s=String(n.getFullYear());"utc"==e&&(s=s.substr(2,2));varo=s+r(String(n.getMonth()+1),2)+r(String(n.getDate()),2)+r(String(n.getHours()),2)+r(String(n.getMinutes()),2)+r(String(n.getSeconds()),2);if(!0===i){varh=n.getMilliseconds();if(0!=h){vara=r(String(h),3);o=o+"."+(a=a.replace(/[0]+$/,""))}}returno+"Z"},this.zeroPadding=function(t,e){returnt.length>=e?t:newArray(e-t.length+1).join("0")+t},this.getString=function(){returnthis.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(t)},this.setByDateValue=function(t,e,i,r,n,s){varo=newDate(Date.UTC(t,e-1,i,r,n,s,0));this.setByDate(o)},this.getFreshValueHex=function(){returnthis.hV}},W.lang.extend(tt.asn1.DERAbstractTime,tt.asn1.ASN1Object),tt.asn1.DERAbstractStructured=function(t){tt.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=newArray,void0!==t&&void0!==t.array&&(this.asn1Array=t.array)},W.lang.extend(tt.asn1.DERAbstractStructured,tt.asn1.ASN1Object),tt.asn1.DERBoolean=function(){tt.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},W.lang.extend(tt.asn1.DERBoolean,tt.asn1.ASN1Object),tt.asn1.DERInteger=function(t){tt.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=tt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){vare=newO(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){returnthis.hV},void0!==t&&(void0!==t.bigint?this.setByBigInteger(t.bigint):void0!==t.int?this.setByInteger(t.int):"number"==typeoft?this.setByInteger(t):void0!==t.hex&&this.setValueHex(t.hex))},W.lang.extend(tt.asn1.DERInteger,tt.asn1.ASN1Object),tt.asn1.DERBitString=function(t){if(void0!==t&&void0!==t.obj){vare=tt.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}tt.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;vari="0"+t;this.hTLV=null,this.isModified=!0,this.hV=i+e},this.setByBinaryString=function(t){vare=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0);for(vari=0;i<=e;i++)t+="0";varr="";for(i=0;i<t.length-1;i+=8){varn=t.substr(i,8),s=parseInt(n,2).toString(16);1==s.length&&(s="0"+s),r+=s}this.hTLV=null,this.isModified=!0,this.hV="0"+e+r},this.setByBooleanArray=function(t){for(vare="",i=0;i<t.length;i++)1==t[i]?e+="1":e+="0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(vare=newArray(t),i=0;i<t;i++)e[i]=!1;returne},this.getFreshValueHex=function(){returnthis.hV},void0!==t&&("string"==typeoft&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void0!==t.bin?this.setByBinaryString(t.bin):void0!==t.array&&this.setByBooleanArray(t.array))},W.lang.extend(tt.asn1.DERBitString,tt.asn1.ASN1Object),tt.asn1.DEROctetString=function(t){if(void0!==t&&void0!==t.obj){vare=tt.asn1.ASN1Util.newObject(t.obj);t.hex=e.getEncodedHex()}tt.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},W.lang.extend(tt.asn1.DEROctetString,tt.asn1.DERAbstractString),tt.asn1.DERNull=function(){tt.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},W.lang.extend(tt.asn1.DERNull,tt.asn1.ASN1Object),tt.asn1.DERObjectIdentifier=function(t){vare=function(t){vare=t.toString(16);return1==e.length&&(e="0"+e),e},i=function(t){vari="",r=newO(t,10).toString(2),n=7-r.length%7;7==n&&(n=0);for(vars="",o=0;o<n;o++)s+="0";r=s+r;for(o=0;o<r.length-1;o+=7){varh=r.substr(o,7);o!=r.length-7&&(h="1"+h),i+=e(parseInt(h,2))}returni};tt.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;varr="",n=t.split("."),s=40*parseInt(n[0])+parseInt(n[1]);r+=e(s),n.splice(0,2);for(varo=0;o<n.length;o++)r+=i(n[o]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(t){vare=tt.asn1.x509.OID.name2oid(t);if(""===e)throw"DERObjectIdentifier oidName undefined: "+t;this.setValueOidString(e)},this.getFreshValueHex=function(){returnthis.hV},void0!==t&&("string"==typeoft?t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t):void0!==t.oid?this.setValueOidString(t.oid):void0!==t.hex?this.setValueHex(t.hex):void0!==t.name&&this.setValueName(t.name))},W.lang.extend(tt.asn1.DERObjectIdentifier,tt.asn1.ASN1Object),tt.asn1.DEREnumerated=function(t){tt.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=tt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){vare=newO(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){returnthis.hV},void0!==t&&(void0!==t.int?this.setByInteger(t.int):"number"==typeoft?this.setByInteger(t):void0!==t.hex&&this.setValueHex(t.hex))},W.lang.extend(tt.asn1.DEREnumerated,tt.asn1.ASN1Object),tt.asn1.DERUTF8String=function(t){tt.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},W.lang.extend(tt.asn1.DERUTF8String,tt.asn1.DERAbstractString),tt.asn1.DERNumericString=function(t){tt.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},W.lang.extend(tt.asn1.DERNumericString,tt.asn1.DERAbstractString),tt.asn1.DERPrintableString=function(t){tt.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},W.lang.extend(tt.asn1.DERPrintableString,tt.asn1.DERAbstractString),tt.asn1.DERTeletexString=function(t){tt.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},W.lang.extend(tt.asn1.DERTeletexString,tt.asn1.DERAbstractString),tt.asn1.DERIA5String=function(t){tt.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},W.lang.extend(tt.asn1.DERIA5String,tt.asn1.DERAbstractString),tt.asn1.DERUTCTime=function(t){tt.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){returnvoid0===this.date&&void0===this.s&&(this.date=newDate,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},void0!==t&&(void0!==t.str?this.setString(t.str):"string"==typeoft&&t.match(/^[0-9]{12}Z$/)?this.setString(t):void0!==t.hex?this.setStringHex(t.hex):void0!==t.date&&this.setByDate(t.date))},W.lang.extend(tt.asn1.DERUTCTime,tt.asn1.DERAbstractTime),tt.asn1.DERGeneralizedTime=function(t){tt.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){returnvoid0===this.date&&void0===this.s&&(this.date=newDate,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void0!==t&&(void0!==t.str?this.setString(t.str):"string"==typeoft&&t.match(/^[0-9]{14}Z$/)?this.setString(t):void0!==t.hex?this.setStringHex(t.hex):void0!==t.date&&this.setByDate(t.date),!0===t.millis&&(this.withMillis=!0))},W.lang.extend(tt.asn1.DERGeneralizedTime,tt.asn1.DERAbstractTime),tt.asn1.DERSequence=function(t){tt.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(vart="",e=0;e<this.asn1Array.length;e++){t+=this.asn1Array[e].getEncodedHex()}returnthis.hV=t,this.hV}},W.lang.extend(tt.asn1.DERSequence,tt.asn1.DERAbstractStructured),tt.asn1.DERSet=function(t){tt.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(vart=newArray,e=0;e<this.asn1Array.length;e++){vari=this.asn1Array[e];t.push(i.getEncodedHex())}return1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void0!==t&&void0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},W.lang.extend(tt.asn1.DERSet,tt.asn1.DERAbstractStructured),tt.asn1.DERTaggedObject=function(t){tt.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,i){this.hT=e,this.isExplicit=t,this.asn1Object=i,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=i.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){returnthis.hV},void0!==t&&(void0!==t.tag&&(this.hT=t.tag),void0!==t.explicit&&(this.isExplicit=t.explicit),void0!==t.obj&&(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},W.lang.extend(tt.asn1.DERTaggedObject,tt.asn1.ASN1Object);varet=function(t){functione(i){varr=t.call(this)||this;returni&&("string"==typeofi?r.parseKey(i):(e.hasPrivateKeyProperty(i)||e.hasPublicKeyProperty(i))&&r.parsePropertiesFrom(i)),r}returnfunction(t,e){functioni(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,newi)}(e,t),e.prototype.parseKey=function(t){try{vare=0,i=0,r=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t)?d(t):v.unarmor(t),n=x.decode(r);if(3===n.sub.length&&(n=n.sub[2].sub[0]),9===n.sub.length){e=n.sub[1].getHexStringValue(),this.n=q(e,16),i=n.sub[2].getHexStringValue(),this.e=parseInt(i,16);vars=n.sub[3].getHexStringValue();this.d=q(s,16);varo=n.sub[4].getHexStringValue();this.p=q(o,16);varh=n.sub[5].getHexStringValue();this.q=q(h,16);vara=n.sub[6].getHexStringValue();this.dmp1=q(a,16);varu=n.sub[7].getHexStringValue();this.dmq1=q(u,16);varc=n.sub[8].getHexStringValue();this.coeff=q(c,16)}else{if(2!==n.sub.length)return!1;varf=n.sub[1].sub[0];e=f.sub[0].getHexStringValue(),this.n=q(e,16),i=f.sub[1].getHexStringValue(),this.e=parseInt(i,16)}return!0}catch(t){return!1}},e.prototype.getPrivateBaseKey=function(){vart={array:[newtt.asn1.DERInteger({int:0}),newtt.asn1.DERInteger({bigint:this.n}),newtt.asn1.DERInteger({int:this.e}),newtt.asn1.DERInteger({bigint:this.d}),newtt.asn1.DERInteger({bigint:this.p}),newtt.asn1.DERInteger({bigint:this.q}),newtt.asn1.DERInteger({bigint:this.dmp1}),newtt.asn1.DERInteger({bigint:this.dmq1}),newtt.asn1.DERInteger({bigint:this.coeff})]};returnnewtt.asn1.DERSequence(t).getEncodedHex()},e.prototype.getPrivateBaseKeyB64=function(){returnf(this.getPrivateBaseKey())},e.prototype.getPublicBaseKey=function(){vart=newtt.asn1.DERSequence({array:[newtt.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),newtt.asn1.DERNull]}),e=newtt.asn1.DERSequence({array:[newtt.asn1.DERInteger({bigint:this.n}),newtt.asn1.DERInteger({int:this.e})]}),i=newtt.asn1.DERBitString({hex:"00"+e.getEncodedHex()});returnnewtt.asn1.DERSequence({array:[t,i]}).getEncodedHex()},e.prototype.getPublicBaseKeyB64=function(){returnf(this.getPublicBaseKey())},e.wordwrap=function(t,e){if(!t)returnt;vari="(.{1,"+(e=e||64)+"})( +|$\n?)|(.{1,"+e+"})";returnt.match(RegExp(i,"g")).join("\n")},e.prototype.getPrivateKey=function(){vart="-----BEGIN RSA PRIVATE KEY-----\n";returnt+=e.wordwrap(this.getPrivateBaseKeyB64())+"\n",t+="-----END RSA PRIVATE KEY-----"},e.prototype.getPublicKey=function(){vart="-----BEGIN PUBLIC KEY-----\n";returnt+=e.wordwrap(this.getPublicBaseKeyB64())+"\n",t+="-----END PUBLIC KEY-----"},e.hasPublicKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")},e.hasPrivateKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")},e.prototype.parsePropertiesFrom=function(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)},e}(Q),it=function(){functiont(t){t=t||{},this.default_key_size=parseInt(t.default_key_size,10)||1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null}returnt.prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=newet(t)},t.prototype.setPrivateKey=function(t){this.setKey(t)},t.prototype.setPublicKey=function(t){this.setKey(t)},t.prototype.decrypt=function(t){try{returnthis.getKey().decrypt(function(t){vare,r="",n=0,s=0;for(e=0;e<t.length&&t.charAt(e)!=c;++e){varo=u.indexOf(t.charAt(e));o<0||(0==n?(r+=i(o>>2),s=3&o,n=1):1==n?(r+=i(s<<2|o>>4),s=15&o,n=2):2==n?(r+=i(s),r+=i(o>>2),s=3&o,n=3):(r+=i(s<<2|o>>4),r+=i(15&o),n=0))}return1==n&&(r+=i(s<<2)),r}(t))}catch(t){return!1}},t.prototype.encrypt=function(t){try{returnf(this.getKey().encrypt(t))}catch(t){return!1}},t.prototype.getKey=function(t){if(!this.key){if(this.key=newet,t&&"[object Function]"==={}.toString.call(t))returnvoidthis.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}returnthis.key},t.prototype.getPrivateKey=function(){returnthis.getKey().getPrivateKey()},t.prototype.getPrivateKeyB64=function(){returnthis.getKey().getPrivateBaseKeyB64()},t.prototype.getPublicKey=function(){returnthis.getKey().getPublicKey()},t.prototype.getPublicKeyB64=function(){returnthis.getKey().getPublicBaseKeyB64()},t.version="3.0.0-beta.1",t}();window.JSEncrypt=it,t.JSEncrypt=it,t.default=it,Object.defineProperty(t,"__esModule",{value:!0})});