!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports):"function"==typeof define&&define.amd?define(["exports"],factory):factory(global.JSEncrypt={})}(this,(function(exports){"use strict";function int2char(n){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(n)}function op_and(x,y){return x&y}function op_or(x,y){return x|y}function op_xor(x,y){return x^y}function op_andnot(x,y){return x&~y}function lbit(x){if(0==x)return-1;var r=0;return 0==(65535&x)&&(x>>=16,r+=16),0==(255&x)&&(x>>=8,r+=8),0==(15&x)&&(x>>=4,r+=4),0==(3&x)&&(x>>=2,r+=2),0==(1&x)&&++r,r}function cbit(x){for(var r=0;0!=x;)x&=x-1,++r;return r}var b64map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function hex2b64(h){var i,c,ret="";for(i=0;i+3<=h.length;i+=3)c=parseInt(h.substring(i,i+3),16),ret+=b64map.charAt(c>>6)+b64map.charAt(63&c);for(i+1==h.length?(c=parseInt(h.substring(i,i+1),16),ret+=b64map.charAt(c<<2)):i+2==h.length&&(c=parseInt(h.substring(i,i+2),16),ret+=b64map.charAt(c>>2)+b64map.charAt((3&c)<<4));(3&ret.length)>0;)ret+="=";return ret}function b64tohex(s){var i,ret="",k=0,slop=0;for(i=0;i<s.length&&"="!=s.charAt(i);++i){var v=b64map.indexOf(s.charAt(i));v<0||(0==k?(ret+=int2char(v>>2),slop=3&v,k=1):1==k?(ret+=int2char(slop<<2|v>>4),slop=15&v,k=2):2==k?(ret+=int2char(slop),ret+=int2char(v>>2),slop=3&v,k=3):(ret+=int2char(slop<<2|v>>4),ret+=int2char(15&v),k=0))}return 1==k&&(ret+=int2char(slop<<2)),ret}var decoder,extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};var decoder$1,Hex_decode=function(a){var i;if(void 0===decoder){var hex="0123456789ABCDEF";for(decoder={},i=0;i<16;++i)decoder[hex.charAt(i)]=i;for(hex=hex.toLowerCase(),i=10;i<16;++i)decoder[hex.charAt(i)]=i;for(i=0;i<" \f\n\r\t \u2028\u2029".length;++i)decoder[" \f\n\r\t \u2028\u2029".charAt(i)]=-1}var out=[],bits=0,char_count=0;for(i=0;i<a.length;++i){var c=a.charAt(i);if("="==c)break;if(-1!=(c=decoder[c])){if(void 0===c)throw new Error("Illegal character at offset "+i);bits|=c,++char_count>=2?(out[out.length]=bits,bits=0,char_count=0):bits<<=4}}if(char_count)throw new Error("Hex encoding incomplete: 4 bits missing");return out},Base64={decode:function(a){var i;if(void 0===decoder$1){for(decoder$1=Object.create(null),i=0;i<64;++i)decoder$1["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(i)]=i;for(i=0;i<"= \f\n\r\t \u2028\u2029".length;++i)decoder$1["= \f\n\r\t \u2028\u2029".charAt(i)]=-1}var out=[],bits=0,char_count=0;for(i=0;i<a.length;++i){var c=a.charAt(i);if("="==c)break;if(-1!=(c=decoder$1[c])){if(void 0===c)throw new Error("Illegal character at offset "+i);bits|=c,++char_count>=4?(out[out.length]=bits>>16,out[out.length]=bits>>8&255,out[out.length]=255&bits,bits=0,char_count=0):bits<<=6}}switch(char_count){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:out[out.length]=bits>>10;break;case 3:out[out.length]=bits>>16,out[out.length]=bits>>8&255}return out},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(a){var m=Base64.re.exec(a);if(m)if(m[1])a=m[1];else{if(!m[2])throw new Error("RegExp out of sync");a=m[2]}return Base64.decode(a)}},max=1e13,Int10=function(){function Int10(value){this.buf=[+value||0]}return Int10.prototype.mulAdd=function(m,c){var i,t,b=this.buf,l=b.length;for(i=0;i<l;++i)(t=b[i]*m+c)<max?c=0:t-=(c=0|t/max)*max,b[i]=t;c>0&&(b[i]=c)},Int10.prototype.sub=function(c){var i,t,b=this.buf,l=b.length;for(i=0;i<l;++i)(t=b[i]-c)<0?(t+=max,c=1):c=0,b[i]=t;for(;0===b[b.length-1];)b.pop()},Int10.prototype.toString=function(base){if(10!=(base||10))throw new Error("only base 10 is supported");for(var b=this.buf,s=b[b.length-1].toString(),i=b.length-2;i>=0;--i)s+=(max+b[i]).toString().substring(1);return s},Int10.prototype.valueOf=function(){for(var b=this.buf,v=0,i=b.length-1;i>=0;--i)v=v*max+b[i];return v},Int10.prototype.simplify=function(){var b=this.buf;return 1==b.length?b[0]:this},Int10}(),reTimeS=/^(\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)?)?$/,reTimeL=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function stringCut(str,len){return str.length>len&&(str=str.substring(0,len)+"…"),str}var dbits,Stream=function(){function Stream(enc,pos){this.hexDigits="0123456789ABCDEF",enc instanceof Stream?(this.enc=enc.enc,this.pos=enc.pos):(this.enc=enc,this.pos=pos)}return Stream.prototype.get=function(pos){if(void 0===pos&&(pos=this.pos++),pos>=this.enc.length)throw new Error("Requesting byte offset "+pos+" on a stream of length "+this.enc.length);return"string"==typeof this.enc?this.enc.charCodeAt(pos):this.enc[pos]},Stream.prototype.hexByte=function(b){return this.hexDigits.charAt(b>>4&15)+this.hexDigits.charAt(15&b)},Stream.prototype.hexDump=function(start,end,raw){for(var s="",i=start;i<end;++i)if(s+=this.hexByte(this.get(i)),!0!==raw)switch(15&i){case 7:s+="  ";break;case 15:s+="\n";break;default:s+=" "}return s},Stream.prototype.isASCII=function(start,end){for(var i=start;i<end;++i){var c=this.get(i);if(c<32||c>176)return!1}return!0},Stream.prototype.parseStringISO=function(start,end){for(var s="",i=start;i<end;++i)s+=String.fromCharCode(this.get(i));return s},Stream.prototype.parseStringUTF=function(start,end){for(var s="",i=start;i<end;){var c=this.get(i++);s+=c<128?String.fromCharCode(c):c>191&&c<224?String.fromCharCode((31&c)<<6|63&this.get(i++)):String.fromCharCode((15&c)<<12|(63&this.get(i++))<<6|63&this.get(i++))}return s},Stream.prototype.parseStringBMP=function(start,end){for(var hi,lo,str="",i=start;i<end;)hi=this.get(i++),lo=this.get(i++),str+=String.fromCharCode(hi<<8|lo);return str},Stream.prototype.parseTime=function(start,end,shortYear){var s=this.parseStringISO(start,end),m=(shortYear?reTimeS:reTimeL).exec(s);return m?(shortYear&&(m[1]=+m[1],m[1]+=+m[1]<70?2e3:1900),s=m[1]+"-"+m[2]+"-"+m[3]+" "+m[4],m[5]&&(s+=":"+m[5],m[6]&&(s+=":"+m[6],m[7]&&(s+="."+m[7]))),m[8]&&(s+=" UTC","Z"!=m[8]&&(s+=m[8],m[9]&&(s+=":"+m[9]))),s):"Unrecognized time: "+s},Stream.prototype.parseInteger=function(start,end){for(var len,v=this.get(start),neg=v>127,pad=neg?255:0,s="";v==pad&&++start<end;)v=this.get(start);if(0===(len=end-start))return neg?-1:0;if(len>4){for(s=v,len<<=3;0==(128&(+s^pad));)s=+s<<1,--len;s="("+len+" bit)\n"}neg&&(v-=256);for(var n=new Int10(v),i=start+1;i<end;++i)n.mulAdd(256,this.get(i));return s+n.toString()},Stream.prototype.parseBitString=function(start,end,maxLength){for(var unusedBit=this.get(start),intro="("+((end-start-1<<3)-unusedBit)+" bit)\n",s="",i=start+1;i<end;++i){for(var b=this.get(i),skip=i==end-1?unusedBit:0,j=7;j>=skip;--j)s+=b>>j&1?"1":"0";if(s.length>maxLength)return intro+stringCut(s,maxLength)}return intro+s},Stream.prototype.parseOctetString=function(start,end,maxLength){if(this.isASCII(start,end))return stringCut(this.parseStringISO(start,end),maxLength);var len=end-start,s="("+len+" byte)\n";len>(maxLength/=2)&&(end=start+maxLength);for(var i=start;i<end;++i)s+=this.hexByte(this.get(i));return len>maxLength&&(s+="…"),s},Stream.prototype.parseOID=function(start,end,maxLength){for(var s="",n=new Int10,bits=0,i=start;i<end;++i){var v=this.get(i);if(n.mulAdd(128,127&v),bits+=7,!(128&v)){if(""===s)if((n=n.simplify())instanceof Int10)n.sub(80),s="2."+n.toString();else{var m=n<80?n<40?0:1:2;s=m+"."+(n-40*m)}else s+="."+n.toString();if(s.length>maxLength)return stringCut(s,maxLength);n=new Int10,bits=0}}return bits>0&&(s+=".incomplete"),s},Stream}(),ASN1=function(){function ASN1(stream,header,length,tag,sub){if(!(tag instanceof ASN1Tag))throw new Error("Invalid tag value.");this.stream=stream,this.header=header,this.length=length,this.tag=tag,this.sub=sub}return ASN1.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()}},ASN1.prototype.content=function(maxLength){if(void 0===this.tag)return null;void 0===maxLength&&(maxLength=1/0);var content=this.posContent(),len=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(content,content+len,maxLength);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(content)?"false":"true";case 2:return this.stream.parseInteger(content,content+len);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(content,content+len,maxLength);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(content,content+len,maxLength);case 6:return this.stream.parseOID(content,content+len,maxLength);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return stringCut(this.stream.parseStringUTF(content,content+len),maxLength);case 18:case 19:case 20:case 21:case 22:case 26:return stringCut(this.stream.parseStringISO(content,content+len),maxLength);case 30:return stringCut(this.stream.parseStringBMP(content,content+len),maxLength);case 23:case 24:return this.stream.parseTime(content,content+len,23==this.tag.tagNumber)}return null},ASN1.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},ASN1.prototype.toPrettyString=function(indent){void 0===indent&&(indent="");var s=indent+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(s+="+"),s+=this.length,this.tag.tagConstructed?s+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(s+=" (encapsulates)"),s+="\n",null!==this.sub){indent+="  ";for(var i=0,max=this.sub.length;i<max;++i)s+=this.sub[i].toPrettyString(indent)}return s},ASN1.prototype.posStart=function(){return this.stream.pos},ASN1.prototype.posContent=function(){return this.stream.pos+this.header},ASN1.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},ASN1.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},ASN1.decodeLength=function(stream){var buf=stream.get(),len=127&buf;if(len==buf)return len;if(len>6)throw new Error("Length over 48 bits not supported at position "+(stream.pos-1));if(0===len)return null;buf=0;for(var i=0;i<len;++i)buf=256*buf+stream.get();return buf},ASN1.prototype.getHexStringValue=function(){var hexString=this.toHexString(),offset=2*this.header,length=2*this.length;return hexString.substr(offset,length)},ASN1.decode=function(str){var stream;stream=str instanceof Stream?str:new Stream(str,0);var streamStart=new Stream(stream),tag=new ASN1Tag(stream),len=ASN1.decodeLength(stream),start=stream.pos,header=start-streamStart.pos,sub=null,getSub=function(){var ret=[];if(null!==len){for(var end=start+len;stream.pos<end;)ret[ret.length]=ASN1.decode(stream);if(stream.pos!=end)throw new Error("Content size is not correct for container starting at offset "+start)}else try{for(;;){var s=ASN1.decode(stream);if(s.tag.isEOC())break;ret[ret.length]=s}len=start-stream.pos}catch(e){throw new Error("Exception while decoding undefined length content: "+e)}return ret};if(tag.tagConstructed)sub=getSub();else if(tag.isUniversal()&&(3==tag.tagNumber||4==tag.tagNumber))try{if(3==tag.tagNumber&&0!=stream.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");sub=getSub();for(var i=0;i<sub.length;++i)if(sub[i].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(e){sub=null}if(null===sub){if(null===len)throw new Error("We can't skip over an invalid tag with undefined length at offset "+start);stream.pos=start+Math.abs(len)}return new ASN1(streamStart,header,len,tag,sub)},ASN1}(),ASN1Tag=function(){function ASN1Tag(stream){var buf=stream.get();if(this.tagClass=buf>>6,this.tagConstructed=0!=(32&buf),this.tagNumber=31&buf,31==this.tagNumber){var n=new Int10;do{buf=stream.get(),n.mulAdd(128,127&buf)}while(128&buf);this.tagNumber=n.simplify()}}return ASN1Tag.prototype.isUniversal=function(){return 0===this.tagClass},ASN1Tag.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},ASN1Tag}(),lowprimes=[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],lplim=(1<<26)/lowprimes[lowprimes.length-1],BigInteger=function(){function BigInteger(a,b,c){null!=a&&("number"==typeof a?this.fromNumber(a,b,c):null==b&&"string"!=typeof a?this.fromString(a,256):this.fromString(a,b))}return BigInteger.prototype.toString=function(b){if(this.s<0)return"-"+this.negate().toString(b);var k;if(16==b)k=4;else if(8==b)k=3;else if(2==b)k=1;else if(32==b)k=5;else{if(4!=b)return this.toRadix(b);k=2}var d,km=(1<<k)-1,m=!1,r="",i=this.t,p=this.DB-i*this.DB%k;if(i-- >0)for(p<this.DB&&(d=this[i]>>p)>0&&(m=!0,r=int2char(d));i>=0;)p<k?(d=(this[i]&(1<<p)-1)<<k-p,d|=this[--i]>>(p+=this.DB-k)):(d=this[i]>>(p-=k)&km,p<=0&&(p+=this.DB,--i)),d>0&&(m=!0),m&&(r+=int2char(d));return m?r:"0"},BigInteger.prototype.negate=function(){var r=nbi();return BigInteger.ZERO.subTo(this,r),r},BigInteger.prototype.abs=function(){return this.s<0?this.negate():this},BigInteger.prototype.compareTo=function(a){var r=this.s-a.s;if(0!=r)return r;var i=this.t;if(0!=(r=i-a.t))return this.s<0?-r:r;for(;--i>=0;)if(0!=(r=this[i]-a[i]))return r;return 0},BigInteger.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)},BigInteger.prototype.mod=function(a){var r=nbi();return this.abs().divRemTo(a,null,r),this.s<0&&r.compareTo(BigInteger.ZERO)>0&&a.subTo(r,r),r},BigInteger.prototype.modPowInt=function(e,m){var z;return z=e<256||m.isEven()?new Classic(m):new Montgomery(m),this.exp(e,z)},BigInteger.prototype.clone=function(){var r=nbi();return this.copyTo(r),r},BigInteger.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},BigInteger.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},BigInteger.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},BigInteger.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},BigInteger.prototype.toByteArray=function(){var i=this.t,r=[];r[0]=this.s;var d,p=this.DB-i*this.DB%8,k=0;if(i-- >0)for(p<this.DB&&(d=this[i]>>p)!=(this.s&this.DM)>>p&&(r[k++]=d|this.s<<this.DB-p);i>=0;)p<8?(d=(this[i]&(1<<p)-1)<<8-p,d|=this[--i]>>(p+=this.DB-8)):(d=this[i]>>(p-=8)&255,p<=0&&(p+=this.DB,--i)),0!=(128&d)&&(d|=-256),0==k&&(128&this.s)!=(128&d)&&++k,(k>0||d!=this.s)&&(r[k++]=d);return r},BigInteger.prototype.equals=function(a){return 0==this.compareTo(a)},BigInteger.prototype.min=function(a){return this.compareTo(a)<0?this:a},BigInteger.prototype.max=function(a){return this.compareTo(a)>0?this:a},BigInteger.prototype.and=function(a){var r=nbi();return this.bitwiseTo(a,op_and,r),r},BigInteger.prototype.or=function(a){var r=nbi();return this.bitwiseTo(a,op_or,r),r},BigInteger.prototype.xor=function(a){var r=nbi();return this.bitwiseTo(a,op_xor,r),r},BigInteger.prototype.andNot=function(a){var r=nbi();return this.bitwiseTo(a,op_andnot,r),r},BigInteger.prototype.not=function(){for(var r=nbi(),i=0;i<this.t;++i)r[i]=this.DM&~this[i];return r.t=this.t,r.s=~this.s,r},BigInteger.prototype.shiftLeft=function(n){var r=nbi();return n<0?this.rShiftTo(-n,r):this.lShiftTo(n,r),r},BigInteger.prototype.shiftRight=function(n){var r=nbi();return n<0?this.lShiftTo(-n,r):this.rShiftTo(n,r),r},BigInteger.prototype.getLowestSetBit=function(){for(var i=0;i<this.t;++i)if(0!=this[i])return i*this.DB+lbit(this[i]);return this.s<0?this.t*this.DB:-1},BigInteger.prototype.bitCount=function(){for(var r=0,x=this.s&this.DM,i=0;i<this.t;++i)r+=cbit(this[i]^x);return r},BigInteger.prototype.testBit=function(n){var j=Math.floor(n/this.DB);return j>=this.t?0!=this.s:0!=(this[j]&1<<n%this.DB)},BigInteger.prototype.setBit=function(n){return this.changeBit(n,op_or)},BigInteger.prototype.clearBit=function(n){return this.changeBit(n,op_andnot)},BigInteger.prototype.flipBit=function(n){return this.changeBit(n,op_xor)},BigInteger.prototype.add=function(a){var r=nbi();return this.addTo(a,r),r},BigInteger.prototype.subtract=function(a){var r=nbi();return this.subTo(a,r),r},BigInteger.prototype.multiply=function(a){var r=nbi();return this.multiplyTo(a,r),r},BigInteger.prototype.divide=function(a){var r=nbi();return this.divRemTo(a,r,null),r},BigInteger.prototype.remainder=function(a){var r=nbi();return this.divRemTo(a,null,r),r},BigInteger.prototype.divideAndRemainder=function(a){var q=nbi(),r=nbi();return this.divRemTo(a,q,r),[q,r]},BigInteger.prototype.modPow=function(e,m){var k,z,i=e.bitLength(),r=nbv(1);if(i<=0)return r;k=i<18?1:i<48?3:i<144?4:i<768?5:6,z=i<8?new Classic(m):m.isEven()?new Barrett(m):new Montgomery(m);var g=[],n=3,k1=k-1,km=(1<<k)-1;if(g[1]=z.convert(this),k>1){var g2=nbi();for(z.sqrTo(g[1],g2);n<=km;)g[n]=nbi(),z.mulTo(g2,g[n-2],g[n]),n+=2}var w,t,j=e.t-1,is1=!0,r2=nbi();for(i=nbits(e[j])-1;j>=0;){for(i>=k1?w=e[j]>>i-k1&km:(w=(e[j]&(1<<i+1)-1)<<k1-i,j>0&&(w|=e[j-1]>>this.DB+i-k1)),n=k;0==(1&w);)w>>=1,--n;if((i-=n)<0&&(i+=this.DB,--j),is1)g[w].copyTo(r),is1=!1;else{for(;n>1;)z.sqrTo(r,r2),z.sqrTo(r2,r),n-=2;n>0?z.sqrTo(r,r2):(t=r,r=r2,r2=t),z.mulTo(r2,g[w],r)}for(;j>=0&&0==(e[j]&1<<i);)z.sqrTo(r,r2),t=r,r=r2,r2=t,--i<0&&(i=this.DB-1,--j)}return z.revert(r)},BigInteger.prototype.modInverse=function(m){var ac=m.isEven();if(this.isEven()&&ac||0==m.signum())return BigInteger.ZERO;for(var u=m.clone(),v=this.clone(),a=nbv(1),b=nbv(0),c=nbv(0),d=nbv(1);0!=u.signum();){for(;u.isEven();)u.rShiftTo(1,u),ac?(a.isEven()&&b.isEven()||(a.addTo(this,a),b.subTo(m,b)),a.rShiftTo(1,a)):b.isEven()||b.subTo(m,b),b.rShiftTo(1,b);for(;v.isEven();)v.rShiftTo(1,v),ac?(c.isEven()&&d.isEven()||(c.addTo(this,c),d.subTo(m,d)),c.rShiftTo(1,c)):d.isEven()||d.subTo(m,d),d.rShiftTo(1,d);u.compareTo(v)>=0?(u.subTo(v,u),ac&&a.subTo(c,a),b.subTo(d,b)):(v.subTo(u,v),ac&&c.subTo(a,c),d.subTo(b,d))}return 0!=v.compareTo(BigInteger.ONE)?BigInteger.ZERO:d.compareTo(m)>=0?d.subtract(m):d.signum()<0?(d.addTo(m,d),d.signum()<0?d.add(m):d):d},BigInteger.prototype.pow=function(e){return this.exp(e,new NullExp)},BigInteger.prototype.gcd=function(a){var x=this.s<0?this.negate():this.clone(),y=a.s<0?a.negate():a.clone();if(x.compareTo(y)<0){var t=x;x=y,y=t}var i=x.getLowestSetBit(),g=y.getLowestSetBit();if(g<0)return x;for(i<g&&(g=i),g>0&&(x.rShiftTo(g,x),y.rShiftTo(g,y));x.signum()>0;)(i=x.getLowestSetBit())>0&&x.rShiftTo(i,x),(i=y.getLowestSetBit())>0&&y.rShiftTo(i,y),x.compareTo(y)>=0?(x.subTo(y,x),x.rShiftTo(1,x)):(y.subTo(x,y),y.rShiftTo(1,y));return g>0&&y.lShiftTo(g,y),y},BigInteger.prototype.isProbablePrime=function(t){var i,x=this.abs();if(1==x.t&&x[0]<=lowprimes[lowprimes.length-1]){for(i=0;i<lowprimes.length;++i)if(x[0]==lowprimes[i])return!0;return!1}if(x.isEven())return!1;for(i=1;i<lowprimes.length;){for(var m=lowprimes[i],j=i+1;j<lowprimes.length&&m<lplim;)m*=lowprimes[j++];for(m=x.modInt(m);i<j;)if(m%lowprimes[i++]==0)return!1}return x.millerRabin(t)},BigInteger.prototype.copyTo=function(r){for(var i=this.t-1;i>=0;--i)r[i]=this[i];r.t=this.t,r.s=this.s},BigInteger.prototype.fromInt=function(x){this.t=1,this.s=x<0?-1:0,x>0?this[0]=x:x<-1?this[0]=x+this.DV:this.t=0},BigInteger.prototype.fromString=function(s,b){var k;if(16==b)k=4;else if(8==b)k=3;else if(256==b)k=8;else if(2==b)k=1;else if(32==b)k=5;else{if(4!=b)return void this.fromRadix(s,b);k=2}this.t=0,this.s=0;for(var i=s.length,mi=!1,sh=0;--i>=0;){var x=8==k?255&+s[i]:intAt(s,i);x<0?"-"==s.charAt(i)&&(mi=!0):(mi=!1,0==sh?this[this.t++]=x:sh+k>this.DB?(this[this.t-1]|=(x&(1<<this.DB-sh)-1)<<sh,this[this.t++]=x>>this.DB-sh):this[this.t-1]|=x<<sh,(sh+=k)>=this.DB&&(sh-=this.DB))}8==k&&0!=(128&+s[0])&&(this.s=-1,sh>0&&(this[this.t-1]|=(1<<this.DB-sh)-1<<sh)),this.clamp(),mi&&BigInteger.ZERO.subTo(this,this)},BigInteger.prototype.clamp=function(){for(var c=this.s&this.DM;this.t>0&&this[this.t-1]==c;)--this.t},BigInteger.prototype.dlShiftTo=function(n,r){var i;for(i=this.t-1;i>=0;--i)r[i+n]=this[i];for(i=n-1;i>=0;--i)r[i]=0;r.t=this.t+n,r.s=this.s},BigInteger.prototype.drShiftTo=function(n,r){for(var i=n;i<this.t;++i)r[i-n]=this[i];r.t=Math.max(this.t-n,0),r.s=this.s},BigInteger.prototype.lShiftTo=function(n,r){for(var bs=n%this.DB,cbs=this.DB-bs,bm=(1<<cbs)-1,ds=Math.floor(n/this.DB),c=this.s<<bs&this.DM,i=this.t-1;i>=0;--i)r[i+ds+1]=this[i]>>cbs|c,c=(this[i]&bm)<<bs;for(i=ds-1;i>=0;--i)r[i]=0;r[ds]=c,r.t=this.t+ds+1,r.s=this.s,r.clamp()},BigInteger.prototype.rShiftTo=function(n,r){r.s=this.s;var ds=Math.floor(n/this.DB);if(ds>=this.t)r.t=0;else{var bs=n%this.DB,cbs=this.DB-bs,bm=(1<<bs)-1;r[0]=this[ds]>>bs;for(var i=ds+1;i<this.t;++i)r[i-ds-1]|=(this[i]&bm)<<cbs,r[i-ds]=this[i]>>bs;bs>0&&(r[this.t-ds-1]|=(this.s&bm)<<cbs),r.t=this.t-ds,r.clamp()}},BigInteger.prototype.subTo=function(a,r){for(var i=0,c=0,m=Math.min(a.t,this.t);i<m;)c+=this[i]-a[i],r[i++]=c&this.DM,c>>=this.DB;if(a.t<this.t){for(c-=a.s;i<this.t;)c+=this[i],r[i++]=c&this.DM,c>>=this.DB;c+=this.s}else{for(c+=this.s;i<a.t;)c-=a[i],r[i++]=c&this.DM,c>>=this.DB;c-=a.s}r.s=c<0?-1:0,c<-1?r[i++]=this.DV+c:c>0&&(r[i++]=c),r.t=i,r.clamp()},BigInteger.prototype.multiplyTo=function(a,r){var x=this.abs(),y=a.abs(),i=x.t;for(r.t=i+y.t;--i>=0;)r[i]=0;for(i=0;i<y.t;++i)r[i+x.t]=x.am(0,y[i],r,i,0,x.t);r.s=0,r.clamp(),this.s!=a.s&&BigInteger.ZERO.subTo(r,r)},BigInteger.prototype.squareTo=function(r){for(var x=this.abs(),i=r.t=2*x.t;--i>=0;)r[i]=0;for(i=0;i<x.t-1;++i){var c=x.am(i,x[i],r,2*i,0,1);(r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1))>=x.DV&&(r[i+x.t]-=x.DV,r[i+x.t+1]=1)}r.t>0&&(r[r.t-1]+=x.am(i,x[i],r,2*i,0,1)),r.s=0,r.clamp()},BigInteger.prototype.divRemTo=function(m,q,r){var pm=m.abs();if(!(pm.t<=0)){var pt=this.abs();if(pt.t<pm.t)return null!=q&&q.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=nbi());var y=nbi(),ts=this.s,ms=m.s,nsh=this.DB-nbits(pm[pm.t-1]);nsh>0?(pm.lShiftTo(nsh,y),pt.lShiftTo(nsh,r)):(pm.copyTo(y),pt.copyTo(r));var ys=y.t,y0=y[ys-1];if(0!=y0){var yt=y0*(1<<this.F1)+(ys>1?y[ys-2]>>this.F2:0),d1=this.FV/yt,d2=(1<<this.F1)/yt,e=1<<this.F2,i=r.t,j=i-ys,t=null==q?nbi():q;for(y.dlShiftTo(j,t),r.compareTo(t)>=0&&(r[r.t++]=1,r.subTo(t,r)),BigInteger.ONE.dlShiftTo(ys,t),t.subTo(y,y);y.t<ys;)y[y.t++]=0;for(;--j>=0;){var qd=r[--i]==y0?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2);if((r[i]+=y.am(0,qd,r,j,0,ys))<qd)for(y.dlShiftTo(j,t),r.subTo(t,r);r[i]<--qd;)r.subTo(t,r)}null!=q&&(r.drShiftTo(ys,q),ts!=ms&&BigInteger.ZERO.subTo(q,q)),r.t=ys,r.clamp(),nsh>0&&r.rShiftTo(nsh,r),ts<0&&BigInteger.ZERO.subTo(r,r)}}},BigInteger.prototype.invDigit=function(){if(this.t<1)return 0;var x=this[0];if(0==(1&x))return 0;var y=3&x;return(y=(y=(y=(y=y*(2-(15&x)*y)&15)*(2-(255&x)*y)&255)*(2-((65535&x)*y&65535))&65535)*(2-x*y%this.DV)%this.DV)>0?this.DV-y:-y},BigInteger.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},BigInteger.prototype.exp=function(e,z){if(e>4294967295||e<1)return BigInteger.ONE;var r=nbi(),r2=nbi(),g=z.convert(this),i=nbits(e)-1;for(g.copyTo(r);--i>=0;)if(z.sqrTo(r,r2),(e&1<<i)>0)z.mulTo(r2,g,r);else{var t=r;r=r2,r2=t}return z.revert(r)},BigInteger.prototype.chunkSize=function(r){return Math.floor(Math.LN2*this.DB/Math.log(r))},BigInteger.prototype.toRadix=function(b){if(null==b&&(b=10),0==this.signum()||b<2||b>36)return"0";var cs=this.chunkSize(b),a=Math.pow(b,cs),d=nbv(a),y=nbi(),z=nbi(),r="";for(this.divRemTo(d,y,z);y.signum()>0;)r=(a+z.intValue()).toString(b).substr(1)+r,y.divRemTo(d,y,z);return z.intValue().toString(b)+r},BigInteger.prototype.fromRadix=function(s,b){this.fromInt(0),null==b&&(b=10);for(var cs=this.chunkSize(b),d=Math.pow(b,cs),mi=!1,j=0,w=0,i=0;i<s.length;++i){var x=intAt(s,i);x<0?"-"==s.charAt(i)&&0==this.signum()&&(mi=!0):(w=b*w+x,++j>=cs&&(this.dMultiply(d),this.dAddOffset(w,0),j=0,w=0))}j>0&&(this.dMultiply(Math.pow(b,j)),this.dAddOffset(w,0)),mi&&BigInteger.ZERO.subTo(this,this)},BigInteger.prototype.fromNumber=function(a,b,c){if("number"==typeof b)if(a<2)this.fromInt(1);else for(this.fromNumber(a,c),this.testBit(a-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(BigInteger.ONE.shiftLeft(a-1),this);else{var x=[],t=7&a;x.length=1+(a>>3),b.nextBytes(x),t>0?x[0]&=(1<<t)-1:x[0]=0,this.fromString(x,256)}},BigInteger.prototype.bitwiseTo=function(a,op,r){var i,f,m=Math.min(a.t,this.t);for(i=0;i<m;++i)r[i]=op(this[i],a[i]);if(a.t<this.t){for(f=a.s&this.DM,i=m;i<this.t;++i)r[i]=op(this[i],f);r.t=this.t}else{for(f=this.s&this.DM,i=m;i<a.t;++i)r[i]=op(f,a[i]);r.t=a.t}r.s=op(this.s,a.s),r.clamp()},BigInteger.prototype.changeBit=function(n,op){var r=BigInteger.ONE.shiftLeft(n);return this.bitwiseTo(r,op,r),r},BigInteger.prototype.addTo=function(a,r){for(var i=0,c=0,m=Math.min(a.t,this.t);i<m;)c+=this[i]+a[i],r[i++]=c&this.DM,c>>=this.DB;if(a.t<this.t){for(c+=a.s;i<this.t;)c+=this[i],r[i++]=c&this.DM,c>>=this.DB;c+=this.s}else{for(c+=this.s;i<a.t;)c+=a[i],r[i++]=c&this.DM,c>>=this.DB;c+=a.s}r.s=c<0?-1:0,c>0?r[i++]=c:c<-1&&(r[i++]=this.DV+c),r.t=i,r.clamp()},BigInteger.prototype.dMultiply=function(n){this[this.t]=this.am(0,n-1,this,0,0,this.t),++this.t,this.clamp()},BigInteger.prototype.dAddOffset=function(n,w){if(0!=n){for(;this.t<=w;)this[this.t++]=0;for(this[w]+=n;this[w]>=this.DV;)this[w]-=this.DV,++w>=this.t&&(this[this.t++]=0),++this[w]}},BigInteger.prototype.multiplyLowerTo=function(a,n,r){var i=Math.min(this.t+a.t,n);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(var j=r.t-this.t;i<j;++i)r[i+this.t]=this.am(0,a[i],r,i,0,this.t);for(j=Math.min(a.t,n);i<j;++i)this.am(0,a[i],r,i,0,n-i);r.clamp()},BigInteger.prototype.multiplyUpperTo=function(a,n,r){--n;var i=r.t=this.t+a.t-n;for(r.s=0;--i>=0;)r[i]=0;for(i=Math.max(n-this.t,0);i<a.t;++i)r[this.t+i-n]=this.am(n-i,a[i],r,0,0,this.t+i-n);r.clamp(),r.drShiftTo(1,r)},BigInteger.prototype.modInt=function(n){if(n<=0)return 0;var d=this.DV%n,r=this.s<0?n-1:0;if(this.t>0)if(0==d)r=this[0]%n;else for(var i=this.t-1;i>=0;--i)r=(d*r+this[i])%n;return r},BigInteger.prototype.millerRabin=function(t){var n1=this.subtract(BigInteger.ONE),k=n1.getLowestSetBit();if(k<=0)return!1;var r=n1.shiftRight(k);(t=t+1>>1)>lowprimes.length&&(t=lowprimes.length);for(var a=nbi(),i=0;i<t;++i){a.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]);var y=a.modPow(r,this);if(0!=y.compareTo(BigInteger.ONE)&&0!=y.compareTo(n1)){for(var j=1;j++<k&&0!=y.compareTo(n1);)if(0==(y=y.modPowInt(2,this)).compareTo(BigInteger.ONE))return!1;if(0!=y.compareTo(n1))return!1}}return!0},BigInteger.prototype.square=function(){var r=nbi();return this.squareTo(r),r},BigInteger.prototype.gcda=function(a,callback){var x=this.s<0?this.negate():this.clone(),y=a.s<0?a.negate():a.clone();if(x.compareTo(y)<0){var t=x;x=y,y=t}var i=x.getLowestSetBit(),g=y.getLowestSetBit();if(g<0)callback(x);else{i<g&&(g=i),g>0&&(x.rShiftTo(g,x),y.rShiftTo(g,y));var gcda1=function(){(i=x.getLowestSetBit())>0&&x.rShiftTo(i,x),(i=y.getLowestSetBit())>0&&y.rShiftTo(i,y),x.compareTo(y)>=0?(x.subTo(y,x),x.rShiftTo(1,x)):(y.subTo(x,y),y.rShiftTo(1,y)),x.signum()>0?setTimeout(gcda1,0):(g>0&&y.lShiftTo(g,y),setTimeout((function(){callback(y)}),0))};setTimeout(gcda1,10)}},BigInteger.prototype.fromNumberAsync=function(a,b,c,callback){if("number"==typeof b)if(a<2)this.fromInt(1);else{this.fromNumber(a,c),this.testBit(a-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this),this.isEven()&&this.dAddOffset(1,0);var bnp_1=this,bnpfn1_1=function(){bnp_1.dAddOffset(2,0),bnp_1.bitLength()>a&&bnp_1.subTo(BigInteger.ONE.shiftLeft(a-1),bnp_1),bnp_1.isProbablePrime(b)?setTimeout((function(){callback()}),0):setTimeout(bnpfn1_1,0)};setTimeout(bnpfn1_1,0)}else{var x=[],t=7&a;x.length=1+(a>>3),b.nextBytes(x),t>0?x[0]&=(1<<t)-1:x[0]=0,this.fromString(x,256)}},BigInteger}(),NullExp=function(){function NullExp(){}return NullExp.prototype.convert=function(x){return x},NullExp.prototype.revert=function(x){return x},NullExp.prototype.mulTo=function(x,y,r){x.multiplyTo(y,r)},NullExp.prototype.sqrTo=function(x,r){x.squareTo(r)},NullExp}(),Classic=function(){function Classic(m){this.m=m}return Classic.prototype.convert=function(x){return x.s<0||x.compareTo(this.m)>=0?x.mod(this.m):x},Classic.prototype.revert=function(x){return x},Classic.prototype.reduce=function(x){x.divRemTo(this.m,null,x)},Classic.prototype.mulTo=function(x,y,r){x.multiplyTo(y,r),this.reduce(r)},Classic.prototype.sqrTo=function(x,r){x.squareTo(r),this.reduce(r)},Classic}(),Montgomery=function(){function Montgomery(m){this.m=m,this.mp=m.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<m.DB-15)-1,this.mt2=2*m.t}return Montgomery.prototype.convert=function(x){var r=nbi();return x.abs().dlShiftTo(this.m.t,r),r.divRemTo(this.m,null,r),x.s<0&&r.compareTo(BigInteger.ZERO)>0&&this.m.subTo(r,r),r},Montgomery.prototype.revert=function(x){var r=nbi();return x.copyTo(r),this.reduce(r),r},Montgomery.prototype.reduce=function(x){for(;x.t<=this.mt2;)x[x.t++]=0;for(var i=0;i<this.m.t;++i){var j=32767&x[i],u0=j*this.mpl+((j*this.mph+(x[i]>>15)*this.mpl&this.um)<<15)&x.DM;for(x[j=i+this.m.t]+=this.m.am(0,u0,x,i,0,this.m.t);x[j]>=x.DV;)x[j]-=x.DV,x[++j]++}x.clamp(),x.drShiftTo(this.m.t,x),x.compareTo(this.m)>=0&&x.subTo(this.m,x)},Montgomery.prototype.mulTo=function(x,y,r){x.multiplyTo(y,r),this.reduce(r)},Montgomery.prototype.sqrTo=function(x,r){x.squareTo(r),this.reduce(r)},Montgomery}(),Barrett=function(){function Barrett(m){this.m=m,this.r2=nbi(),this.q3=nbi(),BigInteger.ONE.dlShiftTo(2*m.t,this.r2),this.mu=this.r2.divide(m)}return Barrett.prototype.convert=function(x){if(x.s<0||x.t>2*this.m.t)return x.mod(this.m);if(x.compareTo(this.m)<0)return x;var r=nbi();return x.copyTo(r),this.reduce(r),r},Barrett.prototype.revert=function(x){return x},Barrett.prototype.reduce=function(x){for(x.drShiftTo(this.m.t-1,this.r2),x.t>this.m.t+1&&(x.t=this.m.t+1,x.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);x.compareTo(this.r2)<0;)x.dAddOffset(1,this.m.t+1);for(x.subTo(this.r2,x);x.compareTo(this.m)>=0;)x.subTo(this.m,x)},Barrett.prototype.mulTo=function(x,y,r){x.multiplyTo(y,r),this.reduce(r)},Barrett.prototype.sqrTo=function(x,r){x.squareTo(r),this.reduce(r)},Barrett}();function nbi(){return new BigInteger(null)}function parseBigInt(str,r){return new BigInteger(str,r)}"Microsoft Internet Explorer"==navigator.appName?(BigInteger.prototype.am=function(i,x,w,j,c,n){for(var xl=32767&x,xh=x>>15;--n>=0;){var l=32767&this[i],h=this[i++]>>15,m=xh*l+h*xl;c=((l=xl*l+((32767&m)<<15)+w[j]+(1073741823&c))>>>30)+(m>>>15)+xh*h+(c>>>30),w[j++]=1073741823&l}return c},dbits=30):"Netscape"!=navigator.appName?(BigInteger.prototype.am=function(i,x,w,j,c,n){for(;--n>=0;){var v=x*this[i++]+w[j]+c;c=Math.floor(v/67108864),w[j++]=67108863&v}return c},dbits=26):(BigInteger.prototype.am=function(i,x,w,j,c,n){for(var xl=16383&x,xh=x>>14;--n>=0;){var l=16383&this[i],h=this[i++]>>14,m=xh*l+h*xl;c=((l=xl*l+((16383&m)<<14)+w[j]+c)>>28)+(m>>14)+xh*h,w[j++]=268435455&l}return c},dbits=28),BigInteger.prototype.DB=dbits,BigInteger.prototype.DM=(1<<dbits)-1,BigInteger.prototype.DV=1<<dbits;BigInteger.prototype.FV=Math.pow(2,52),BigInteger.prototype.F1=52-dbits,BigInteger.prototype.F2=2*dbits-52;var rr,vv,BI_RC=[];for(rr="0".charCodeAt(0),vv=0;vv<=9;++vv)BI_RC[rr++]=vv;for(rr="a".charCodeAt(0),vv=10;vv<36;++vv)BI_RC[rr++]=vv;for(rr="A".charCodeAt(0),vv=10;vv<36;++vv)BI_RC[rr++]=vv;function intAt(s,i){var c=BI_RC[s.charCodeAt(i)];return null==c?-1:c}function nbv(i){var r=nbi();return r.fromInt(i),r}function nbits(x){var t,r=1;return 0!=(t=x>>>16)&&(x=t,r+=16),0!=(t=x>>8)&&(x=t,r+=8),0!=(t=x>>4)&&(x=t,r+=4),0!=(t=x>>2)&&(x=t,r+=2),0!=(t=x>>1)&&(x=t,r+=1),r}BigInteger.ZERO=nbv(0),BigInteger.ONE=nbv(1);var Arcfour=function(){function Arcfour(){this.i=0,this.j=0,this.S=[]}return Arcfour.prototype.init=function(key){var i,j,t;for(i=0;i<256;++i)this.S[i]=i;for(j=0,i=0;i<256;++i)j=j+this.S[i]+key[i%key.length]&255,t=this.S[i],this.S[i]=this.S[j],this.S[j]=t;this.i=0,this.j=0},Arcfour.prototype.next=function(){var t;return this.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]},Arcfour}();var rng_state,rng_pptr,rng_pool=null;if(null==rng_pool){rng_pool=[],rng_pptr=0;var t=void 0;if(window.crypto&&window.crypto.getRandomValues){var z=new Uint32Array(256);for(window.crypto.getRandomValues(z),t=0;t<z.length;++t)rng_pool[rng_pptr++]=255&z[t]}var onMouseMoveListener_1=function(ev){if(this.count=this.count||0,this.count>=256||rng_pptr>=256)window.removeEventListener?window.removeEventListener("mousemove",onMouseMoveListener_1,!1):window.detachEvent&&window.detachEvent("onmousemove",onMouseMoveListener_1);else try{var mouseCoordinates=ev.x+ev.y;rng_pool[rng_pptr++]=255&mouseCoordinates,this.count+=1}catch(e){}};window.addEventListener?window.addEventListener("mousemove",onMouseMoveListener_1,!1):window.attachEvent&&window.attachEvent("onmousemove",onMouseMoveListener_1)}function rng_get_byte(){if(null==rng_state){for(rng_state=new Arcfour;rng_pptr<256;){var random=Math.floor(65536*Math.random());rng_pool[rng_pptr++]=255&random}for(rng_state.init(rng_pool),rng_pptr=0;rng_pptr<rng_pool.length;++rng_pptr)rng_pool[rng_pptr]=0;rng_pptr=0}return rng_state.next()}var SecureRandom=function(){function SecureRandom(){}return SecureRandom.prototype.nextBytes=function(ba){for(var i=0;i<ba.length;++i)ba[i]=rng_get_byte()},SecureRandom}();var RSAKey=function(){function RSAKey(){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 RSAKey.prototype.doPublic=function(x){return x.modPowInt(this.e,this.n)},RSAKey.prototype.doPrivate=function(x){if(null==this.p||null==this.q)return x.modPow(this.d,this.n);for(var xp=x.mod(this.p).modPow(this.dmp1,this.p),xq=x.mod(this.q).modPow(this.dmq1,this.q);xp.compareTo(xq)<0;)xp=xp.add(this.p);return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq)},RSAKey.prototype.setPublic=function(N,E){null!=N&&null!=E&&N.length>0&&E.length>0&&(this.n=parseBigInt(N,16),this.e=parseInt(E,16))},RSAKey.prototype.encrypt=function(text){var m=function(s,n){if(n<s.length+11)return null;for(var ba=[],i=s.length-1;i>=0&&n>0;){var c=s.charCodeAt(i--);c<128?ba[--n]=c:c>127&&c<2048?(ba[--n]=63&c|128,ba[--n]=c>>6|192):(ba[--n]=63&c|128,ba[--n]=c>>6&63|128,ba[--n]=c>>12|224)}ba[--n]=0;for(var rng=new SecureRandom,x=[];n>2;){for(x[0]=0;0==x[0];)rng.nextBytes(x);ba[--n]=x[0]}return ba[--n]=2,ba[--n]=0,new BigInteger(ba)}(text,this.n.bitLength()+7>>3);if(null==m)return null;var c=this.doPublic(m);if(null==c)return null;var h=c.toString(16);return 0==(1&h.length)?h:"0"+h},RSAKey.prototype.setPrivate=function(N,E,D){null!=N&&null!=E&&N.length>0&&E.length>0&&(this.n=parseBigInt(N,16),this.e=parseInt(E,16),this.d=parseBigInt(D,16))},RSAKey.prototype.setPrivateEx=function(N,E,D,P,Q,DP,DQ,C){null!=N&&null!=E&&N.length>0&&E.length>0&&(this.n=parseBigInt(N,16),this.e=parseInt(E,16),this.d=parseBigInt(D,16),this.p=parseBigInt(P,16),this.q=parseBigInt(Q,16),this.dmp1=parseBigInt(DP,16),this.dmq1=parseBigInt(DQ,16),this.coeff=parseBigInt(C,16))},RSAKey.prototype.generate=function(B,E){var rng=new SecureRandom,qs=B>>1;this.e=parseInt(E,16);for(var ee=new BigInteger(E,16);;){for(;this.p=new BigInteger(B-qs,1,rng),0!=this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE)||!this.p.isProbablePrime(10););for(;this.q=new BigInteger(qs,1,rng),0!=this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var t=this.p;this.p=this.q,this.q=t}var p1=this.p.subtract(BigInteger.ONE),q1=this.q.subtract(BigInteger.ONE),phi=p1.multiply(q1);if(0==phi.gcd(ee).compareTo(BigInteger.ONE)){this.n=this.p.multiply(this.q),this.d=ee.modInverse(phi),this.dmp1=this.d.mod(p1),this.dmq1=this.d.mod(q1),this.coeff=this.q.modInverse(this.p);break}}},RSAKey.prototype.decrypt=function(ctext){var c=parseBigInt(ctext,16),m=this.doPrivate(c);return null==m?null:function(d,n){var b=d.toByteArray(),i=0;for(;i<b.length&&0==b[i];)++i;if(b.length-i!=n-1||2!=b[i])return null;++i;for(;0!=b[i];)if(++i>=b.length)return null;var ret="";for(;++i<b.length;){var c=255&b[i];c<128?ret+=String.fromCharCode(c):c>191&&c<224?(ret+=String.fromCharCode((31&c)<<6|63&b[i+1]),++i):(ret+=String.fromCharCode((15&c)<<12|(63&b[i+1])<<6|63&b[i+2]),i+=2)}return ret}(m,this.n.bitLength()+7>>3)},RSAKey.prototype.generateAsync=function(B,E,callback){var rng=new SecureRandom,qs=B>>1;this.e=parseInt(E,16);var ee=new BigInteger(E,16),rsa=this,loop1=function(){var loop4=function(){if(rsa.p.compareTo(rsa.q)<=0){var t=rsa.p;rsa.p=rsa.q,rsa.q=t}var p1=rsa.p.subtract(BigInteger.ONE),q1=rsa.q.subtract(BigInteger.ONE),phi=p1.multiply(q1);0==phi.gcd(ee).compareTo(BigInteger.ONE)?(rsa.n=rsa.p.multiply(rsa.q),rsa.d=ee.modInverse(phi),rsa.dmp1=rsa.d.mod(p1),rsa.dmq1=rsa.d.mod(q1),rsa.coeff=rsa.q.modInverse(rsa.p),setTimeout((function(){callback()}),0)):setTimeout(loop1,0)},loop3=function(){rsa.q=nbi(),rsa.q.fromNumberAsync(qs,1,rng,(function(){rsa.q.subtract(BigInteger.ONE).gcda(ee,(function(r){0==r.compareTo(BigInteger.ONE)&&rsa.q.isProbablePrime(10)?setTimeout(loop4,0):setTimeout(loop3,0)}))}))},loop2=function(){rsa.p=nbi(),rsa.p.fromNumberAsync(B-qs,1,rng,(function(){rsa.p.subtract(BigInteger.ONE).gcda(ee,(function(r){0==r.compareTo(BigInteger.ONE)&&rsa.p.isProbablePrime(10)?setTimeout(loop3,0):setTimeout(loop2,0)}))}))};setTimeout(loop2,0)};setTimeout(loop1,0)},RSAKey.prototype.sign=function(text,digestMethod,digestName){var m=function(s,n){if(n<s.length+22)return null;for(var len=n-s.length-6,filler="",f=0;f<len;f+=2)filler+="ff";return parseBigInt("0001"+filler+"00"+s,16)}((DIGEST_HEADERS[digestName]||"")+digestMethod(text).toString(),this.n.bitLength()/4);if(null==m)return null;var c=this.doPrivate(m);if(null==c)return null;var h=c.toString(16);return 0==(1&h.length)?h:"0"+h},RSAKey.prototype.verify=function(text,signature,digestMethod){var c=parseBigInt(signature,16),m=this.doPublic(c);return null==m?null:function(str){for(var name_1 in DIGEST_HEADERS)if(DIGEST_HEADERS.hasOwnProperty(name_1)){var header=DIGEST_HEADERS[name_1],len=header.length;if(str.substr(0,len)==header)return str.substr(len)}return str}(m.toString(16).replace(/^1f+00/,""))==digestMethod(text).toString()},RSAKey}();var DIGEST_HEADERS={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};var YAHOO={};YAHOO.lang={extend:function(subc,superc,overrides){if(!superc||!subc)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var F=function(){};if(F.prototype=superc.prototype,subc.prototype=new F,subc.prototype.constructor=subc,subc.superclass=superc.prototype,superc.prototype.constructor==Object.prototype.constructor&&(superc.prototype.constructor=superc),overrides){var i;for(i in overrides)subc.prototype[i]=overrides[i];var _IEEnumFix=function(){},ADD=["toString","valueOf"];try{/MSIE/.test(navigator.userAgent)&&(_IEEnumFix=function(r,s){for(i=0;i<ADD.length;i+=1){var fname=ADD[i],f=s[fname];"function"==typeof f&&f!=Object.prototype[fname]&&(r[fname]=f)}})}catch(ex){}_IEEnumFix(subc.prototype,overrides)}}};var KJUR={};void 0!==KJUR.asn1&&KJUR.asn1||(KJUR.asn1={}),KJUR.asn1.ASN1Util=new function(){this.integerToByteHex=function(i){var h=i.toString(16);return h.length%2==1&&(h="0"+h),h},this.bigIntToMinTwosComplementsHex=function(bigIntegerValue){var h=bigIntegerValue.toString(16);if("-"!=h.substr(0,1))h.length%2==1?h="0"+h:h.match(/^[0-7]/)||(h="00"+h);else{var xorLen=h.substr(1).length;xorLen%2==1?xorLen+=1:h.match(/^[0-7]/)||(xorLen+=2);for(var hMask="",i=0;i<xorLen;i++)hMask+="f";h=new BigInteger(hMask,16).xor(bigIntegerValue).add(BigInteger.ONE).toString(16).replace(/^-/,"")}return h},this.getPEMStringFromHex=function(dataHex,pemHeader){return hextopem(dataHex,pemHeader)},this.newObject=function(param){var _KJUR_asn1=KJUR.asn1,_DERBoolean=_KJUR_asn1.DERBoolean,_DERInteger=_KJUR_asn1.DERInteger,_DERBitString=_KJUR_asn1.DERBitString,_DEROctetString=_KJUR_asn1.DEROctetString,_DERNull=_KJUR_asn1.DERNull,_DERObjectIdentifier=_KJUR_asn1.DERObjectIdentifier,_DEREnumerated=_KJUR_asn1.DEREnumerated,_DERUTF8String=_KJUR_asn1.DERUTF8String,_DERNumericString=_KJUR_asn1.DERNumericString,_DERPrintableString=_KJUR_asn1.DERPrintableString,_DERTeletexString=_KJUR_asn1.DERTeletexString,_DERIA5String=_KJUR_asn1.DERIA5String,_DERUTCTime=_KJUR_asn1.DERUTCTime,_DERGeneralizedTime=_KJUR_asn1.DERGeneralizedTime,_DERSequence=_KJUR_asn1.DERSequence,_DERSet=_KJUR_asn1.DERSet,_DERTaggedObject=_KJUR_asn1.DERTaggedObject,_newObject=_KJUR_asn1.ASN1Util.newObject,keys=Object.keys(param);if(1!=keys.length)throw"key of param shall be only one.";var key=keys[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+key+":"))throw"undefined key: "+key;if("bool"==key)return new _DERBoolean(param[key]);if("int"==key)return new _DERInteger(param[key]);if("bitstr"==key)return new _DERBitString(param[key]);if("octstr"==key)return new _DEROctetString(param[key]);if("null"==key)return new _DERNull(param[key]);if("oid"==key)return new _DERObjectIdentifier(param[key]);if("enum"==key)return new _DEREnumerated(param[key]);if("utf8str"==key)return new _DERUTF8String(param[key]);if("numstr"==key)return new _DERNumericString(param[key]);if("prnstr"==key)return new _DERPrintableString(param[key]);if("telstr"==key)return new _DERTeletexString(param[key]);if("ia5str"==key)return new _DERIA5String(param[key]);if("utctime"==key)return new _DERUTCTime(param[key]);if("gentime"==key)return new _DERGeneralizedTime(param[key]);if("seq"==key){for(var paramList=param[key],a=[],i=0;i<paramList.length;i++){var asn1Obj=_newObject(paramList[i]);a.push(asn1Obj)}return new _DERSequence({array:a})}if("set"==key){for(paramList=param[key],a=[],i=0;i<paramList.length;i++){asn1Obj=_newObject(paramList[i]);a.push(asn1Obj)}return new _DERSet({array:a})}if("tag"==key){var tagParam=param[key];if("[object Array]"===Object.prototype.toString.call(tagParam)&&3==tagParam.length){var obj=_newObject(tagParam[2]);return new _DERTaggedObject({tag:tagParam[0],explicit:tagParam[1],obj:obj})}var newParam={};if(void 0!==tagParam.explicit&&(newParam.explicit=tagParam.explicit),void 0!==tagParam.tag&&(newParam.tag=tagParam.tag),void 0===tagParam.obj)throw"obj shall be specified for 'tag'.";return newParam.obj=_newObject(tagParam.obj),new _DERTaggedObject(newParam)}},this.jsonToASN1HEX=function(param){return this.newObject(param).getEncodedHex()}},KJUR.asn1.ASN1Util.oidHexToInt=function(hex){for(var s="",i01=parseInt(hex.substr(0,2),16),binbuf=(s=Math.floor(i01/40)+"."+i01%40,""),i=2;i<hex.length;i+=2){var bin=("00000000"+parseInt(hex.substr(i,2),16).toString(2)).slice(-8);if(binbuf+=bin.substr(1,7),"0"==bin.substr(0,1))s=s+"."+new BigInteger(binbuf,2).toString(10),binbuf=""}return s},KJUR.asn1.ASN1Util.oidIntToHex=function(oidString){var itox=function(i){var h=i.toString(16);return 1==h.length&&(h="0"+h),h},roidtox=function(roid){var h="",b=new BigInteger(roid,10).toString(2),padLen=7-b.length%7;7==padLen&&(padLen=0);for(var bPad="",i=0;i<padLen;i++)bPad+="0";b=bPad+b;for(i=0;i<b.length-1;i+=7){var b8=b.substr(i,7);i!=b.length-7&&(b8="1"+b8),h+=itox(parseInt(b8,2))}return h};if(!oidString.match(/^[0-9.]+$/))throw"malformed oid string: "+oidString;var h="",a=oidString.split("."),i0=40*parseInt(a[0])+parseInt(a[1]);h+=itox(i0),a.splice(0,2);for(var i=0;i<a.length;i++)h+=roidtox(a[i]);return h},KJUR.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(void 0===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;var n=this.hV.length/2,hN=n.toString(16);if(hN.length%2==1&&(hN="0"+hN),n<128)return hN;var hNlen=hN.length/2;if(hNlen>15)throw"ASN.1 length too long to represent by 8x: n = "+n.toString(16);return(128+hNlen).toString(16)+hN},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(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},KJUR.asn1.DERAbstractString=function(params){KJUR.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(newS){this.hTLV=null,this.isModified=!0,this.s=newS,this.hV=stohex(this.s)},this.setStringHex=function(newHexString){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=newHexString},this.getFreshValueHex=function(){return this.hV},void 0!==params&&("string"==typeof params?this.setString(params):void 0!==params.str?this.setString(params.str):void 0!==params.hex&&this.setStringHex(params.hex))},YAHOO.lang.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object),KJUR.asn1.DERAbstractTime=function(params){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(d){return utc=d.getTime()+6e4*d.getTimezoneOffset(),new Date(utc)},this.formatDate=function(dateObject,type,withMillis){var pad=this.zeroPadding,d=this.localDateToUTC(dateObject),year=String(d.getFullYear());"utc"==type&&(year=year.substr(2,2));var s=year+pad(String(d.getMonth()+1),2)+pad(String(d.getDate()),2)+pad(String(d.getHours()),2)+pad(String(d.getMinutes()),2)+pad(String(d.getSeconds()),2);if(!0===withMillis){var millis=d.getMilliseconds();if(0!=millis){var sMillis=pad(String(millis),3);s=s+"."+(sMillis=sMillis.replace(/[0]+$/,""))}}return s+"Z"},this.zeroPadding=function(s,len){return s.length>=len?s:new Array(len-s.length+1).join("0")+s},this.getString=function(){return this.s},this.setString=function(newS){this.hTLV=null,this.isModified=!0,this.s=newS,this.hV=stohex(newS)},this.setByDateValue=function(year,month,day,hour,min,sec){var dateObject=new Date(Date.UTC(year,month-1,day,hour,min,sec,0));this.setByDate(dateObject)},this.getFreshValueHex=function(){return this.hV}},YAHOO.lang.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object),KJUR.asn1.DERAbstractStructured=function(params){KJUR.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(asn1ObjectArray){this.hTLV=null,this.isModified=!0,this.asn1Array=asn1ObjectArray},this.appendASN1Object=function(asn1Object){this.hTLV=null,this.isModified=!0,this.asn1Array.push(asn1Object)},this.asn1Array=new Array,void 0!==params&&void 0!==params.array&&(this.asn1Array=params.array)},YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object),KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},YAHOO.lang.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object),KJUR.asn1.DERInteger=function(params){KJUR.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(bigIntegerValue){this.hTLV=null,this.isModified=!0,this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue)},this.setByInteger=function(intValue){var bi=new BigInteger(String(intValue),10);this.setByBigInteger(bi)},this.setValueHex=function(newHexString){this.hV=newHexString},this.getFreshValueHex=function(){return this.hV},void 0!==params&&(void 0!==params.bigint?this.setByBigInteger(params.bigint):void 0!==params.int?this.setByInteger(params.int):"number"==typeof params?this.setByInteger(params):void 0!==params.hex&&this.setValueHex(params.hex))},YAHOO.lang.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object),KJUR.asn1.DERBitString=function(params){if(void 0!==params&&void 0!==params.obj){var o=KJUR.asn1.ASN1Util.newObject(params.obj);params.hex="00"+o.getEncodedHex()}KJUR.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(newHexStringIncludingUnusedBits){this.hTLV=null,this.isModified=!0,this.hV=newHexStringIncludingUnusedBits},this.setUnusedBitsAndHexValue=function(unusedBits,hValue){if(unusedBits<0||7<unusedBits)throw"unused bits shall be from 0 to 7: u = "+unusedBits;var hUnusedBits="0"+unusedBits;this.hTLV=null,this.isModified=!0,this.hV=hUnusedBits+hValue},this.setByBinaryString=function(binaryString){var unusedBits=8-(binaryString=binaryString.replace(/0+$/,"")).length%8;8==unusedBits&&(unusedBits=0);for(var i=0;i<=unusedBits;i++)binaryString+="0";var h="";for(i=0;i<binaryString.length-1;i+=8){var b=binaryString.substr(i,8),x=parseInt(b,2).toString(16);1==x.length&&(x="0"+x),h+=x}this.hTLV=null,this.isModified=!0,this.hV="0"+unusedBits+h},this.setByBooleanArray=function(booleanArray){for(var s="",i=0;i<booleanArray.length;i++)1==booleanArray[i]?s+="1":s+="0";this.setByBinaryString(s)},this.newFalseArray=function(nLength){for(var a=new Array(nLength),i=0;i<nLength;i++)a[i]=!1;return a},this.getFreshValueHex=function(){return this.hV},void 0!==params&&("string"==typeof params&&params.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(params):void 0!==params.hex?this.setHexValueIncludingUnusedBits(params.hex):void 0!==params.bin?this.setByBinaryString(params.bin):void 0!==params.array&&this.setByBooleanArray(params.array))},YAHOO.lang.extend(KJUR.asn1.DERBitString,KJUR.asn1.ASN1Object),KJUR.asn1.DEROctetString=function(params){if(void 0!==params&&void 0!==params.obj){var o=KJUR.asn1.ASN1Util.newObject(params.obj);params.hex=o.getEncodedHex()}KJUR.asn1.DEROctetString.superclass.constructor.call(this,params),this.hT="04"},YAHOO.lang.extend(KJUR.asn1.DEROctetString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERNull=function(){KJUR.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},YAHOO.lang.extend(KJUR.asn1.DERNull,KJUR.asn1.ASN1Object),KJUR.asn1.DERObjectIdentifier=function(params){var itox=function(i){var h=i.toString(16);return 1==h.length&&(h="0"+h),h},roidtox=function(roid){var h="",b=new BigInteger(roid,10).toString(2),padLen=7-b.length%7;7==padLen&&(padLen=0);for(var bPad="",i=0;i<padLen;i++)bPad+="0";b=bPad+b;for(i=0;i<b.length-1;i+=7){var b8=b.substr(i,7);i!=b.length-7&&(b8="1"+b8),h+=itox(parseInt(b8,2))}return h};KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(newHexString){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=newHexString},this.setValueOidString=function(oidString){if(!oidString.match(/^[0-9.]+$/))throw"malformed oid string: "+oidString;var h="",a=oidString.split("."),i0=40*parseInt(a[0])+parseInt(a[1]);h+=itox(i0),a.splice(0,2);for(var i=0;i<a.length;i++)h+=roidtox(a[i]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=h},this.setValueName=function(oidName){var oid=KJUR.asn1.x509.OID.name2oid(oidName);if(""===oid)throw"DERObjectIdentifier oidName undefined: "+oidName;this.setValueOidString(oid)},this.getFreshValueHex=function(){return this.hV},void 0!==params&&("string"==typeof params?params.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(params):this.setValueName(params):void 0!==params.oid?this.setValueOidString(params.oid):void 0!==params.hex?this.setValueHex(params.hex):void 0!==params.name&&this.setValueName(params.name))},YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier,KJUR.asn1.ASN1Object),KJUR.asn1.DEREnumerated=function(params){KJUR.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(bigIntegerValue){this.hTLV=null,this.isModified=!0,this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue)},this.setByInteger=function(intValue){var bi=new BigInteger(String(intValue),10);this.setByBigInteger(bi)},this.setValueHex=function(newHexString){this.hV=newHexString},this.getFreshValueHex=function(){return this.hV},void 0!==params&&(void 0!==params.int?this.setByInteger(params.int):"number"==typeof params?this.setByInteger(params):void 0!==params.hex&&this.setValueHex(params.hex))},YAHOO.lang.extend(KJUR.asn1.DEREnumerated,KJUR.asn1.ASN1Object),KJUR.asn1.DERUTF8String=function(params){KJUR.asn1.DERUTF8String.superclass.constructor.call(this,params),this.hT="0c"},YAHOO.lang.extend(KJUR.asn1.DERUTF8String,KJUR.asn1.DERAbstractString),KJUR.asn1.DERNumericString=function(params){KJUR.asn1.DERNumericString.superclass.constructor.call(this,params),this.hT="12"},YAHOO.lang.extend(KJUR.asn1.DERNumericString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERPrintableString=function(params){KJUR.asn1.DERPrintableString.superclass.constructor.call(this,params),this.hT="13"},YAHOO.lang.extend(KJUR.asn1.DERPrintableString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERTeletexString=function(params){KJUR.asn1.DERTeletexString.superclass.constructor.call(this,params),this.hT="14"},YAHOO.lang.extend(KJUR.asn1.DERTeletexString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERIA5String=function(params){KJUR.asn1.DERIA5String.superclass.constructor.call(this,params),this.hT="16"},YAHOO.lang.extend(KJUR.asn1.DERIA5String,KJUR.asn1.DERAbstractString),KJUR.asn1.DERUTCTime=function(params){KJUR.asn1.DERUTCTime.superclass.constructor.call(this,params),this.hT="17",this.setByDate=function(dateObject){this.hTLV=null,this.isModified=!0,this.date=dateObject,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},void 0!==params&&(void 0!==params.str?this.setString(params.str):"string"==typeof params&&params.match(/^[0-9]{12}Z$/)?this.setString(params):void 0!==params.hex?this.setStringHex(params.hex):void 0!==params.date&&this.setByDate(params.date))},YAHOO.lang.extend(KJUR.asn1.DERUTCTime,KJUR.asn1.DERAbstractTime),KJUR.asn1.DERGeneralizedTime=function(params){KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this,params),this.hT="18",this.withMillis=!1,this.setByDate=function(dateObject){this.hTLV=null,this.isModified=!0,this.date=dateObject,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void 0!==params&&(void 0!==params.str?this.setString(params.str):"string"==typeof params&&params.match(/^[0-9]{14}Z$/)?this.setString(params):void 0!==params.hex?this.setStringHex(params.hex):void 0!==params.date&&this.setByDate(params.date),!0===params.millis&&(this.withMillis=!0))},YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime,KJUR.asn1.DERAbstractTime),KJUR.asn1.DERSequence=function(params){KJUR.asn1.DERSequence.superclass.constructor.call(this,params),this.hT="30",this.getFreshValueHex=function(){for(var h="",i=0;i<this.asn1Array.length;i++){h+=this.asn1Array[i].getEncodedHex()}return this.hV=h,this.hV}},YAHOO.lang.extend(KJUR.asn1.DERSequence,KJUR.asn1.DERAbstractStructured),KJUR.asn1.DERSet=function(params){KJUR.asn1.DERSet.superclass.constructor.call(this,params),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var a=new Array,i=0;i<this.asn1Array.length;i++){var asn1Obj=this.asn1Array[i];a.push(asn1Obj.getEncodedHex())}return 1==this.sortFlag&&a.sort(),this.hV=a.join(""),this.hV},void 0!==params&&void 0!==params.sortflag&&0==params.sortflag&&(this.sortFlag=!1)},YAHOO.lang.extend(KJUR.asn1.DERSet,KJUR.asn1.DERAbstractStructured),KJUR.asn1.DERTaggedObject=function(params){KJUR.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(isExplicitFlag,tagNoHex,asn1Object){this.hT=tagNoHex,this.isExplicit=isExplicitFlag,this.asn1Object=asn1Object,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=asn1Object.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,tagNoHex),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==params&&(void 0!==params.tag&&(this.hT=params.tag),void 0!==params.explicit&&(this.isExplicit=params.explicit),void 0!==params.obj&&(this.asn1Object=params.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},YAHOO.lang.extend(KJUR.asn1.DERTaggedObject,KJUR.asn1.ASN1Object);var JSEncryptRSAKey=function(_super){function JSEncryptRSAKey(key){var _this=_super.call(this)||this;return key&&("string"==typeof key?_this.parseKey(key):(JSEncryptRSAKey.hasPrivateKeyProperty(key)||JSEncryptRSAKey.hasPublicKeyProperty(key))&&_this.parsePropertiesFrom(key)),_this}return function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}(JSEncryptRSAKey,_super),JSEncryptRSAKey.prototype.parseKey=function(pem){try{var modulus=0,public_exponent=0,der=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(pem)?Hex_decode(pem):Base64.unarmor(pem),asn1=ASN1.decode(der);if(3===asn1.sub.length&&(asn1=asn1.sub[2].sub[0]),9===asn1.sub.length){modulus=asn1.sub[1].getHexStringValue(),this.n=parseBigInt(modulus,16),public_exponent=asn1.sub[2].getHexStringValue(),this.e=parseInt(public_exponent,16);var private_exponent=asn1.sub[3].getHexStringValue();this.d=parseBigInt(private_exponent,16);var prime1=asn1.sub[4].getHexStringValue();this.p=parseBigInt(prime1,16);var prime2=asn1.sub[5].getHexStringValue();this.q=parseBigInt(prime2,16);var exponent1=asn1.sub[6].getHexStringValue();this.dmp1=parseBigInt(exponent1,16);var exponent2=asn1.sub[7].getHexStringValue();this.dmq1=parseBigInt(exponent2,16);var coefficient=asn1.sub[8].getHexStringValue();this.coeff=parseBigInt(coefficient,16)}else{if(2!==asn1.sub.length)return!1;var sequence=asn1.sub[1].sub[0];modulus=sequence.sub[0].getHexStringValue(),this.n=parseBigInt(modulus,16),public_exponent=sequence.sub[1].getHexStringValue(),this.e=parseInt(public_exponent,16)}return!0}catch(ex){return!1}},JSEncryptRSAKey.prototype.getPrivateBaseKey=function(){var options={array:[new KJUR.asn1.DERInteger({int:0}),new KJUR.asn1.DERInteger({bigint:this.n}),new KJUR.asn1.DERInteger({int:this.e}),new KJUR.asn1.DERInteger({bigint:this.d}),new KJUR.asn1.DERInteger({bigint:this.p}),new KJUR.asn1.DERInteger({bigint:this.q}),new KJUR.asn1.DERInteger({bigint:this.dmp1}),new KJUR.asn1.DERInteger({bigint:this.dmq1}),new KJUR.asn1.DERInteger({bigint:this.coeff})]};return new KJUR.asn1.DERSequence(options).getEncodedHex()},JSEncryptRSAKey.prototype.getPrivateBaseKeyB64=function(){return hex2b64(this.getPrivateBaseKey())},JSEncryptRSAKey.prototype.getPublicBaseKey=function(){var first_sequence=new KJUR.asn1.DERSequence({array:[new KJUR.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new KJUR.asn1.DERNull]}),second_sequence=new KJUR.asn1.DERSequence({array:[new KJUR.asn1.DERInteger({bigint:this.n}),new KJUR.asn1.DERInteger({int:this.e})]}),bit_string=new KJUR.asn1.DERBitString({hex:"00"+second_sequence.getEncodedHex()});return new KJUR.asn1.DERSequence({array:[first_sequence,bit_string]}).getEncodedHex()},JSEncryptRSAKey.prototype.getPublicBaseKeyB64=function(){return hex2b64(this.getPublicBaseKey())},JSEncryptRSAKey.wordwrap=function(str,width){if(!str)return str;var regex="(.{1,"+(width=width||64)+"})( +|$\n?)|(.{1,"+width+"})";return str.match(RegExp(regex,"g")).join("\n")},JSEncryptRSAKey.prototype.getPrivateKey=function(){var key="-----BEGIN RSA PRIVATE KEY-----\n";return key+=JSEncryptRSAKey.wordwrap(this.getPrivateBaseKeyB64())+"\n",key+="-----END RSA PRIVATE KEY-----"},JSEncryptRSAKey.prototype.getPublicKey=function(){var key="-----BEGIN PUBLIC KEY-----\n";return key+=JSEncryptRSAKey.wordwrap(this.getPublicBaseKeyB64())+"\n",key+="-----END PUBLIC KEY-----"},JSEncryptRSAKey.hasPublicKeyProperty=function(obj){return(obj=obj||{}).hasOwnProperty("n")&&obj.hasOwnProperty("e")},JSEncryptRSAKey.hasPrivateKeyProperty=function(obj){return(obj=obj||{}).hasOwnProperty("n")&&obj.hasOwnProperty("e")&&obj.hasOwnProperty("d")&&obj.hasOwnProperty("p")&&obj.hasOwnProperty("q")&&obj.hasOwnProperty("dmp1")&&obj.hasOwnProperty("dmq1")&&obj.hasOwnProperty("coeff")},JSEncryptRSAKey.prototype.parsePropertiesFrom=function(obj){this.n=obj.n,this.e=obj.e,obj.hasOwnProperty("d")&&(this.d=obj.d,this.p=obj.p,this.q=obj.q,this.dmp1=obj.dmp1,this.dmq1=obj.dmq1,this.coeff=obj.coeff)},JSEncryptRSAKey}(RSAKey),JSEncrypt=function(){function JSEncrypt(options){options=options||{},this.default_key_size=parseInt(options.default_key_size,10)||1024,this.default_public_exponent=options.default_public_exponent||"010001",this.log=options.log||!1,this.key=null}return JSEncrypt.prototype.setKey=function(key){this.log&&this.key,this.key=new JSEncryptRSAKey(key)},JSEncrypt.prototype.setPrivateKey=function(privkey){this.setKey(privkey)},JSEncrypt.prototype.setPublicKey=function(pubkey){this.setKey(pubkey)},JSEncrypt.prototype.decrypt=function(str){try{return this.getKey().decrypt(b64tohex(str))}catch(ex){return!1}},JSEncrypt.prototype.encrypt=function(str){try{return hex2b64(this.getKey().encrypt(str))}catch(ex){return!1}},JSEncrypt.prototype.sign=function(str,digestMethod,digestName){try{return hex2b64(this.getKey().sign(str,digestMethod,digestName))}catch(ex){return!1}},JSEncrypt.prototype.verify=function(str,signature,digestMethod){try{return this.getKey().verify(str,b64tohex(signature),digestMethod)}catch(ex){return!1}},JSEncrypt.prototype.getKey=function(cb){if(!this.key){if(this.key=new JSEncryptRSAKey,cb&&"[object Function]"==={}.toString.call(cb))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,cb);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},JSEncrypt.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},JSEncrypt.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},JSEncrypt.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},JSEncrypt.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},JSEncrypt.version="3.0.0-rc.1",JSEncrypt}();window.JSEncrypt=JSEncrypt}));let keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function encodeFuc(input){let chr1,chr2,chr3,enc1,enc2,enc3,enc4,output="",i=0;for(input=utf8_encode(input);i<input.length;)chr1=input.charCodeAt(i++),chr2=input.charCodeAt(i++),chr3=input.charCodeAt(i++),enc1=chr1>>2,enc2=(3&chr1)<<4|chr2>>4,enc3=(15&chr2)<<2|chr3>>6,enc4=63&chr3,isNaN(chr2)?enc3=enc4=64:isNaN(chr3)&&(enc4=64),output=output+keyStr.charAt(enc1)+keyStr.charAt(enc2)+keyStr.charAt(enc3)+keyStr.charAt(enc4);return output}function utf8_encode(string){string=string.replace(/\r\n/g,"\n");let utftext="";for(let n=0;n<string.length;n++){let c=string.charCodeAt(n);c<128?utftext+=String.fromCharCode(c):c>127&&c<2048?(utftext+=String.fromCharCode(c>>6|192),utftext+=String.fromCharCode(63&c|128)):(utftext+=String.fromCharCode(c>>12|224),utftext+=String.fromCharCode(c>>6&63|128),utftext+=String.fromCharCode(63&c|128))}return utftext}function encryptPublicLong(str,pubKey){var strB64=encodeFuc(str),jsEncrypt=new JSEncrypt;jsEncrypt.setPublicKey(pubKey);for(var str117="",strEncrypt="",length=Math.ceil(strB64.length/117),i=0;i<length;i++)str117=strB64.substr(117*i,117),strEncrypt+=str117=jsEncrypt.encrypt(str117);return strEncrypt}