/*
almond 0.3.3 Copyright jQuery Foundation and other contributors.
Released under MIT license, http://github.com/requirejs/almond/LICENSE
*/
var separation="|-|",MobileUtils={unregisterFunction:function(E){"string"==typeof func&&delete window[E]},count:(new Date).getTime(),registerFunction:function(E){if("function"==typeof E){MobileUtils.count++;var p="mobilejscbf"+MobileUtils.count;window[p]=function(){E.apply(this,arguments);delete window[p]};return p}return"string"==typeof E?E:""},supportTwidAndroid:function(){return"undefined"!=typeof this.androidInterface&&"function"==typeof this.androidInterface.GetVersion},toNumber:function(E){return"number"!=
typeof E?(E=parseInt(E),isNaN(E)?0:E):E},androidInterface:window.twidMobile||window.mobile};function mobileAndTabletcheck(){var E=!1;/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(E=!0);return E}
function TwcaCryptoLibAlertDialog(){this.show=function(E,p,H,t,K,B){if(!document.getElementById("dialogoverlay")){var y=document.createElement("DIV");y.id="dialogoverlay";document.body.appendChild(y)}if(!document.getElementById("dialogbox")){y=document.createElement("DIV");y.id="dialogbox";var C=document.createElement("DIV");C.id="dialogboxhead";var z=document.createElement("DIV");z.id="dialogboxbody";var a=document.createElement("DIV");a.id="dialogboxfoot";y.appendChild(C);y.appendChild(z);y.appendChild(a);
document.body.appendChild(y)}y=window.innerWidth;var g=window.innerHeight;if(void 0===y||void 0===g)y=document.documentElement.clientWidth,g=document.documentElement.clientHeight;var d=Math.max(Math.min(.35*y,420),280),G=document.getElementById("dialogoverlay"),h=document.getElementById("dialogbox");C=document.getElementById("dialogboxhead");z=document.getElementById("dialogboxbody");a=document.getElementById("dialogboxfoot");G.style.display="block";G.style.height=g+"px";G.style.opacity=.8;G.style.position=
"fixed";G.style.top="0px";G.style.left="0px";G.style.background="#000";G.style.width="100%";G.style.zIndex=10;h.style.display="block";h.style.left=y/2-d/2+"px";h.style.top=.15*g+"px";h.style.position="fixed";h.style.background="#FFF";h.style.width=d+"px";h.style.zIndex=10;h.style.border="solid";h.style.borderWidth="1px";h.style.borderColor="#000000";h.style.borderTopLeftRadius="5px";h.style.borderTopRightRadius="5px";h.style.borderBottomLeftRadius="5px";h.style.borderBottomRightRadius="5px";C.style.background=
"#E2E2E2";C.style.borderColor="#000000";C.style.color="#666666";C.style.fontWeight="bold";C.style.font.size="19px";C.style.padding="10px";C.style.borderTopLeftRadius="5px";C.style.borderTopRightRadius="5px";C.style.textAlign="center";z.style.font.size="18px";z.style.color="#717171";z.style.textAlign="center";a.style.background="#E2E2E2";a.style.borderColor="#000000";a.style.font.size="10px";a.style.height="35px";a.style.lineHeight="35px";a.style.textAlign="center";a.style.borderBottomLeftRadius="5px";
a.style.borderBottomRightRadius="5px";twcaDialogParams=B;document.getElementById("dialogboxhead").innerHTML=E;document.getElementById("dialogboxbody").innerHTML="
"+p+"
"+H+'
';document.getElementById("dialogboxfoot").innerHTML=' ';document.getElementById("twcaCryptoLibInput").addEventListener("keyup",function(a){a.preventDefault();13==a.keyCode&&document.getElementById("twcaCryptoLibAlertDialogBtnOK").click();27==a.keyCode&&document.getElementById("twcaCryptoLibAlertDialogBtnCancel").click()});document.getElementById("twcaCryptoLibInput").focus()};this.ok=function(E){twcaDialogParams=null;document.getElementById("dialogbox").style.display=
"none";document.getElementById("dialogoverlay").style.display="none";"SelectSignerEx"==E[0]?E[10].SelectSignerEx(E[1],E[2],E[3],document.getElementById("twcaCryptoLibInput").value,E[5],E[6],E[7],E[8],E[9]):"SelectSignerExFromChild"==E[0]&&E[10].SelectSignerEx(E[1],E[2],E[3],document.getElementById("twcaCryptoLibInput").value,E[5],E[6],E[7],E[8],E[9])};this.cancel=function(E){twcaDialogParams=null;document.getElementById("dialogbox").style.display="none";document.getElementById("dialogoverlay").style.display=
"none";"SelectSignerEx"==E[0]?E[10].callback(E[9],5070,"\u4f7f\u7528\u8005\u6309\u4e0b\u53d6\u6d88",""):"SelectSignerExFromChild"==E[0]&&E[10].callback(E[9],5070,"\u4f7f\u7528\u8005\u6309\u4e0b\u53d6\u6d88","")}}var support_amd;
try{support_amd=define.amd}catch(E){(function(p,H){"function"===typeof define&&define.amd?define([],H):p.forge=H()})(this,function(){var p,H,t;(function(K){function B(c,a){var e,l,r=a&&a.split("/"),n=b.map,q=n&&n["*"]||{};if(c){c=c.split("/");var m=c.length-1;b.nodeIdCompat&&u.test(c[m])&&(c[m]=c[m].replace(u,""));"."===c[0].charAt(0)&&r&&(m=r.slice(0,r.length-1),c=m.concat(c));for(m=0;m=this.length()};d.ByteStringBuffer.prototype.putByte=function(c){return this.putBytes(String.fromCharCode(c))};d.ByteStringBuffer.prototype.fillWithByte=function(c,a){c=String.fromCharCode(c);for(var b=this.data;0>>=1,0>8&255)+String.fromCharCode(c&255))};d.ByteStringBuffer.prototype.putInt24=function(c){return this.putBytes(String.fromCharCode(c>>16&255)+String.fromCharCode(c>>8&255)+String.fromCharCode(c&255))};d.ByteStringBuffer.prototype.putInt32=function(c){return this.putBytes(String.fromCharCode(c>>
24&255)+String.fromCharCode(c>>16&255)+String.fromCharCode(c>>8&255)+String.fromCharCode(c&255))};d.ByteStringBuffer.prototype.putInt16Le=function(c){return this.putBytes(String.fromCharCode(c&255)+String.fromCharCode(c>>8&255))};d.ByteStringBuffer.prototype.putInt24Le=function(c){return this.putBytes(String.fromCharCode(c&255)+String.fromCharCode(c>>8&255)+String.fromCharCode(c>>16&255))};d.ByteStringBuffer.prototype.putInt32Le=function(c){return this.putBytes(String.fromCharCode(c&255)+String.fromCharCode(c>>
8&255)+String.fromCharCode(c>>16&255)+String.fromCharCode(c>>24&255))};d.ByteStringBuffer.prototype.putInt=function(c,a){var b="";do a-=8,b+=String.fromCharCode(c>>a&255);while(0c&&(c+=2<=c&&(a-=c<<1);return a};d.ByteStringBuffer.prototype.getBytes=function(c){if(c){c=Math.min(this.length(),c);var a=this.data.slice(this.read,this.read+c);this.read+=c}else 0===c?a="":(a=0===this.read?this.data:this.data.slice(this.read),
this.clear());return a};d.ByteStringBuffer.prototype.bytes=function(c){return"undefined"===typeof c?this.data.slice(this.read):this.data.slice(this.read,this.read+c)};d.ByteStringBuffer.prototype.at=function(c){return this.data.charCodeAt(this.read+c)};d.ByteStringBuffer.prototype.setAt=function(c,a){this.data=this.data.substr(0,this.read+c)+String.fromCharCode(a)+this.data.substr(this.read+c+1);return this};d.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-
1)};d.ByteStringBuffer.prototype.copy=function(){var c=d.createBuffer(this.data);c.read=this.read;return c};d.ByteStringBuffer.prototype.compact=function(){0b&&(c+="0");c+=b.toString(16)}return c};d.ByteStringBuffer.prototype.toString=function(){return d.decodeUtf8(this.bytes())};d.DataBuffer=function(c,a){a=a||{};this.read=a.readOffset||0;this.growSize=a.growSize||1024;var b=d.isArrayBuffer(c),e=d.isArrayBufferView(c);b||e?(this.data=b?new DataView(c):new DataView(c.buffer,c.byteOffset,c.byteLength),this.write="writeOffset"in a?a.writeOffset:this.data.byteLength):(this.data=new DataView(new ArrayBuffer(0)),
this.write=0,null!==c&&void 0!==c&&this.putBytes(c),"writeOffset"in a&&(this.write=a.writeOffset))};d.DataBuffer.prototype.length=function(){return this.write-this.read};d.DataBuffer.prototype.isEmpty=function(){return 0>=this.length()};d.DataBuffer.prototype.accommodate=function(c,a){if(this.length()>=c)return this;a=Math.max(a||this.growSize,c);var b=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),e=new Uint8Array(this.length()+a);e.set(b);this.data=new DataView(e.buffer);
return this};d.DataBuffer.prototype.putByte=function(c){this.accommodate(1);this.data.setUint8(this.write++,c);return this};d.DataBuffer.prototype.fillWithByte=function(c,a){this.accommodate(a);for(var b=0;b>8&65535);this.data.setInt8(this.write,c>>16&255);this.write+=3;return this};d.DataBuffer.prototype.putInt32=function(c){this.accommodate(4);this.data.setInt32(this.write,c);this.write+=4;return this};d.DataBuffer.prototype.putInt16Le=function(c){this.accommodate(2);this.data.setInt16(this.write,c,!0);this.write+=2;return this};d.DataBuffer.prototype.putInt24Le=function(c){this.accommodate(3);
this.data.setInt8(this.write,c>>16&255);this.data.setInt16(this.write,c>>8&65535,!0);this.write+=3;return this};d.DataBuffer.prototype.putInt32Le=function(c){this.accommodate(4);this.data.setInt32(this.write,c,!0);this.write+=4;return this};d.DataBuffer.prototype.putInt=function(c,a){this.accommodate(a/8);do a-=8,this.data.setInt8(this.write++,c>>a&255);while(0c&&(c+=2<=c&&(a-=c<<1);return a};d.DataBuffer.prototype.getBytes=function(c){if(c){c=Math.min(this.length(),
c);var a=this.data.slice(this.read,this.read+c);this.read+=c}else 0===c?a="":(a=0===this.read?this.data:this.data.slice(this.read),this.clear());return a};d.DataBuffer.prototype.bytes=function(c){return"undefined"===typeof c?this.data.slice(this.read):this.data.slice(this.read,this.read+c)};d.DataBuffer.prototype.at=function(c){return this.data.getUint8(this.read+c)};d.DataBuffer.prototype.setAt=function(c,a){this.data.setUint8(c,a);return this};d.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-
1)};d.DataBuffer.prototype.copy=function(){return new d.DataBuffer(this)};d.DataBuffer.prototype.compact=function(){if(0b&&(c+="0");c+=b.toString(16)}return c};d.DataBuffer.prototype.toString=function(c){var a=new Uint8Array(this.data,this.read,this.length());c=c||"utf8";if("binary"===c||"raw"===c)return d.binary.raw.encode(a);if("hex"===c)return d.binary.hex.encode(a);if("base64"===c)return d.binary.base64.encode(a);if("utf8"===c)return d.text.utf8.decode(a);
if("utf16"===c)return d.text.utf16.decode(a);throw Error("Invalid encoding: "+c);};d.createBuffer=function(c,a){void 0!==c&&"utf8"===(a||"raw")&&(c=d.encodeUtf8(c));return new d.ByteBuffer(c)};d.fillString=function(c,a){for(var b="";0>>=1,0>24&255)+String.fromCharCode(c>>16&255)+String.fromCharCode(c>>8&255)+String.fromCharCode(c&255)};var G=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,
29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];d.encode64=function(c,a){for(var b="",e="",f,l,r,n=0;n>2),b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((f&3)<<4|l>>4),isNaN(l)?b+="==":(b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((l&15)<<2|r>>6),b+=isNaN(r)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(r&
63)),a&&b.length>a&&(e+=b.substr(0,a)+"\r\n",b=b.substr(a));return e+b};d.decode64=function(c){c=c.replace(/[^A-Za-z0-9\+\/=]/g,"");for(var a="",b,e,f,l,r=0;r>4),64!==f&&(a+=String.fromCharCode((e&15)<<4|f>>2),64!==l&&(a+=String.fromCharCode((f&3)<<6|l)));return a};d.encodeUtf8=function(c){return unescape(encodeURIComponent(c))};d.decodeUtf8=function(c){return decodeURIComponent(escape(c))};
d.binary={raw:{},hex:{},base64:{}};d.binary.raw.encode=function(c){return String.fromCharCode.apply(null,c)};d.binary.raw.decode=function(c,a,b){var e=a;e||(e=new Uint8Array(c.length));for(var f=b=b||0,l=0;l>2),b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((f&3)<<4|l>>4),isNaN(l)?b+="==":(b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((l&15)<<2|r>>6),b+=isNaN(r)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(r&63)),
a&&b.length>a&&(e+=b.substr(0,a)+"\r\n",b=b.substr(a));return e+b};d.binary.base64.decode=function(c,a,b){var e=a;e||(e=new Uint8Array(3*Math.ceil(c.length/4)));c=c.replace(/[^A-Za-z0-9\+\/=]/g,"");b=b||0;for(var f,l,r,n,q=0,m=b;q>4,64!==r&&(e[m++]=(l&15)<<4|r>>2,64!==n&&(e[m++]=(r&3)<<6|n));return a?m-b:e.subarray(0,m)};d.text={utf8:{},utf16:{}};d.text.utf8.encode=function(c,
a,b){c=d.encodeUtf8(c);var e=a;e||(e=new Uint8Array(c.length));for(var f=b=b||0,l=0;l");break;case "%":l.push("%");break;default:l.push("<%"+b+"?>")}l.push(a.substring(e));return l.join("")};d.formatNumber=function(a,b,e,f){var c=isNaN(b=Math.abs(b))?2:b;b=void 0===e?",":e;f=void 0===f?".":f;e=0>a?"-":"";var l=parseInt(a=Math.abs(+a||0).toFixed(c),10)+"",r=3f;++f)if(a[f]&&0!==a[f].length){var l=d.hexToBytes(a[f]);2>l.length&&e.putByte(0);e.putBytes(l)}else e.fillWithByte(0,b),b=0;return e.getBytes()};d.bytesToIP=function(a){return 4===a.length?d.bytesToIPv4(a):16===a.length?d.bytesToIPv6(a):null};d.bytesToIPv4=function(a){if(4!==a.length)return null;for(var c=[],b=0;bc[e].end-c[e].start&&(e=c.length-1)):c.push({start:n,end:n})}b.push(l)}0f.st&&e.st
e.st&&f.stthis.blockSize<<2)return!1;a.truncate(e);return!0};h.cbc=function(a){a=a||{};this.name="CBC";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=
this.blockSize/4;this._inBlock=Array(this._ints);this._outBlock=Array(this._ints)};h.cbc.prototype.start=function(a){if(null===a.iv){if(!this._prev)throw Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in a)this._iv=g(a.iv),this._prev=this._iv.slice(0);else throw Error("Invalid IV parameter.");};h.cbc.prototype.encrypt=function(a,b,e){if(a.length()this.blockSize<<2)return!1;a.truncate(e);return!0};h.cfb=function(f){f=f||{};this.name="CFB";this.cipher=f.cipher;this.blockSize=f.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialBlock=Array(this._ints);this._partialOutput=a.util.createBuffer();this._partialBytes=0};h.cfb.prototype.start=function(a){if(!("iv"in
a))throw Error("Invalid IV parameter.");this._iv=g(a.iv);this._inBlock=this._iv.slice(0);this._partialBytes=0};h.cfb.prototype.encrypt=function(a,b,e){var f=a.length();if(0===f)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&f>=this.blockSize)for(var k=0;k=this.blockSize)for(var k=0;k=this.blockSize)for(var k=0;k=this.blockSize)for(var k=0;k=this.blockSize){for(var k=0;kk;++k)a[k/32|0]&1<<31-k%32&&(e[0]^=f[0],e[1]^=f[1],e[2]^=f[2],e[3]^=f[3]),this.pow(f,f);return e};h.gcm.prototype.pow=function(a,b){for(var e=a[3]&1,f=3;0>>1|(a[f-1]&1)<<31;b[0]=a[0]>>>1;e&&(b[0]^=this._R)};h.gcm.prototype.tableMultiply=
function(a){for(var b=[0,0,0,0],e=0;32>e;++e){var f=this._m[e][a[e/8|0]>>>4*(7-e%8)&15];b[0]^=f[0];b[1]^=f[1];b[2]^=f[2];b[3]^=f[3]}return b};h.gcm.prototype.ghash=function(a,b,e){b[0]^=e[0];b[1]^=e[1];b[2]^=e[2];b[3]^=e[3];return this.tableMultiply(b)};h.gcm.prototype.generateHashTable=function(a,b){var e=8/b,f=4*e;e*=16;for(var k=Array(e),d=0;d>>1,k=Array(e);k[f]=a.slice(0);for(var d=f>>>1;0>=1;for(d=2;de;++e)a[e]=e<<1,a[e+128]=e+128<<1^283;w=Array(256);k=Array(256);v=Array(4);c=Array(4);for(e=0;4>e;++e)v[e]=Array(256),c[e]=Array(256);var f=0,d=0;for(e=0;256>e;++e){var l=d^d<<1^d<<2^d<<3^d<<4;l=l>>8^l&255^99;w[f]=l;k[l]=f;var r=a[l];var n=a[f];var F=a[n];var m=
a[F];r^=r<<24^l<<16^l<<8^l;F=(n^F^m)<<24^(f^m)<<16^(f^F^m)<<8^f^n^m;for(var h=0;4>h;++h)v[h][f]=r,c[h][l]=F,r=r<<24|r>>>8,F=F<<24|F>>>8;0===f?f=d=1:(f=n^a[a[a[n^m]]],d^=a[a[d]])}}function G(a,b){for(var f=a.slice(0),k,l=1,r=f.length,n=e*(r+6+1),d=r;d>>16&255]<<24^w[k>>>8&255]<<16^w[k&255]<<8^w[k>>>24]^u[l]<<24,l++):6>>24]<<24^w[k>>>16&255]<<16^w[k>>>8&255]<<8^w[k&255]),f[d]=f[d-r]^k;if(b){l=c[0];r=c[1];var m=c[2],q=c[3],x=f.slice(0);n=f.length;d=
0;for(var I=n-e;d>>24]]^r[w[k>>>16&255]]^m[w[k>>>8&255]]^q[w[k&255]];f=x}return f}function h(a,b,e,f){var l=a.length/4-1;if(f){var r=c[0];var n=c[1];var d=c[2];var m=c[3];var q=k}else r=v[0],n=v[1],d=v[2],m=v[3],q=w;var A=b[0]^a[0];var I=b[f?3:1]^a[1];var x=b[2]^a[2];b=b[f?1:3]^a[3];for(var h=3,g=1;g>>24]^n[I>>>16&255]^d[x>>>8&255]^m[b&255]^a[++h];
var u=r[I>>>24]^n[x>>>16&255]^d[b>>>8&255]^m[A&255]^a[++h];var G=r[x>>>24]^n[b>>>16&255]^d[A>>>8&255]^m[I&255]^a[++h];b=r[b>>>24]^n[A>>>16&255]^d[I>>>8&255]^m[x&255]^a[++h];A=D;I=u;x=G}e[0]=q[A>>>24]<<24^q[I>>>16&255]<<16^q[x>>>8&255]<<8^q[b&255]^a[++h];e[f?3:1]=q[I>>>24]<<24^q[x>>>16&255]<<16^q[b>>>8&255]<<8^q[A&255]^a[++h];e[2]=q[x>>>24]<<24^q[b>>>16&255]<<16^q[A>>>8&255]<<8^q[I&255]^a[++h];e[f?1:3]=q[b>>>24]<<24^q[A>>>16&255]<<16^q[I>>>8&255]<<8^q[x&255]^a[++h]}function f(b){b=b||{};var c="AES-"+
(b.mode||"CBC").toUpperCase();var e=b.decrypt?a.cipher.createDecipher(c,b.key):a.cipher.createCipher(c,b.key);var f=e.start;e.start=function(b,c){var n=null;c instanceof a.util.ByteBuffer&&(n=c,c={});c=c||{};c.output=n;c.iv=b;f.call(e,c)};return e}a.aes=a.aes||{};a.aes.startEncrypting=function(a,b,c,e){a=f({key:a,output:c,decrypt:!1,mode:e});a.start(b);return a};a.aes.createEncryptionCipher=function(a,b){return f({key:a,output:null,decrypt:!1,mode:b})};a.aes.startDecrypting=function(a,b,c,e){a=f({key:a,
output:c,decrypt:!0,mode:e});a.start(b);return a};a.aes.createDecryptionCipher=function(a,b){return f({key:a,output:null,decrypt:!0,mode:b})};a.aes.Algorithm=function(a,c){b||d();var e=this;e.name=a;e.mode=new c({blockSize:16,cipher:{encrypt:function(a,b){return h(e._w,a,b,!1)},decrypt:function(a,b){return h(e._w,a,b,!0)}}});e._init=!1};a.aes.Algorithm.prototype.initialize=function(b){if(!this._init){var c=b.key;if("string"===typeof c&&(16===c.length||24===c.length||32===c.length))c=a.util.createBuffer(c);
else if(a.util.isArray(c)&&(16===c.length||24===c.length||32===c.length)){var e=c;c=a.util.createBuffer();for(var f=0;f>>=2,f=0;fh.length()){var b=Error("Too few bytes to parse DER.");b.bytes=h.length();throw b;}var e=h.getByte();b=e&192;var w=e&31,k=d(h);if(h.length()=e.length())f.putByte(e.length()&127);else{h=e.length();d="";do d+=String.fromCharCode(h&255),h>>>=8;while(0>>=7,b||(k|=128),e.push(k),b=!1;while(0b[a].length&&(f+="0"),f+=b[a];return f+"Z"};g.dateToGeneralizedTime=function(a){if("string"===typeof a)return a;var f="",b=[];b.push(""+a.getUTCFullYear());b.push(""+(a.getUTCMonth()+1));b.push(""+a.getUTCDate());b.push(""+
a.getUTCHours());b.push(""+a.getUTCMinutes());b.push(""+a.getUTCSeconds());for(a=0;ab[a].length&&(f+="0"),f+=b[a];return f+"Z"};g.integerToDer=function(d){var f=a.util.createBuffer();if(-128<=d&&128>d)return f.putSignedInt(d,8);if(-32768<=d&&32768>d)return f.putSignedInt(d,16);if(-8388608<=d&&8388608>d)return f.putSignedInt(d,24);if(-2147483648<=d&&2147483648>d)return f.putSignedInt(d,32);f=Error("Integer too large; max is 32-bits.");f.integer=d;throw f;};g.derToInteger=function(d){"string"===
typeof d&&(d=a.util.createBuffer(d));var f=8*d.length();if(32d;++d)e[d]=Math.floor(4294967296*Math.abs(Math.sin(d+1)));w=!0}function d(a,d,v){for(var c,k,x,g,A,l,r,n=v.length();64<=n;){k=a.h0;x=a.h1;g=a.h2;
A=a.h3;for(r=0;16>r;++r)d[r]=v.getInt32Le(),c=A^x&(g^A),c=k+c+e[r]+d[r],l=b[r],k=A,A=g,g=x,x+=c<>>32-l;for(;32>r;++r)c=g^A&(x^g),c=k+c+e[r]+d[f[r]],l=b[r],k=A,A=g,g=x,x+=c<>>32-l;for(;48>r;++r)c=x^g^A,c=k+c+e[r]+d[f[r]],l=b[r],k=A,A=g,g=x,x+=c<>>32-l;for(;64>r;++r)c=g^(x|~A),c=k+c+e[r]+d[f[r]],l=b[r],k=A,A=g,g=x,x+=c<>>32-l;a.h0=a.h0+k|0;a.h1=a.h1+x|0;a.h2=a.h2+g|0;a.h3=a.h3+A|0;n-=64}}var G=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=
G;G.create=function(){w||g();var b=null,e=a.util.createBuffer(),f=Array(16),c={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){c.messageLength=0;c.fullMessageLength=c.messageLength64=[];for(var f=c.messageLengthSize/4,d=0;d>>0,q>>>0];for(var A=c.fullMessageLength.length-1;0<=A;--A)c.fullMessageLength[A]+=q[1],q[1]=q[0]+(c.fullMessageLength[A]/4294967296>>>0),c.fullMessageLength[A]>>>=0,q[0]=q[1]/4294967296>>>0;e.putBytes(k);d(b,f,e);(2048>>0,k.putInt32Le(x>>>0);x={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3};d(x,f,k);k=a.util.createBuffer();k.putInt32Le(x.h0);k.putInt32Le(x.h1);k.putInt32Le(x.h2);k.putInt32Le(x.h3);return k};return c};var h=null,f=null,b=null,e=null,w=!1}if("function"!==typeof t)if("object"===typeof module&&module.exports){var B=!0;t=function(a,g){g(H,module)}}else return"undefined"===typeof forge&&(forge={}),p(forge);var y,
C=function(a,g){g.exports=function(d){var g=y.map(function(f){return a(f)}).concat(p);d=d||{};d.defined=d.defined||{};if(d.defined.md5)return d.md5;d.defined.md5=!0;for(var h=0;hh;++h)f=e.getInt32(),b[h]=f,x=c^g&(v^c),f=(d<<5|d>>>27)+x+q+1518500249+f,q=c,c=v,v=(g<<30|g>>>2)>>>0,g=d,d=f;for(;20>h;++h)f=b[h-3]^b[h-8]^b[h-14]^b[h-16],f=f<<1|f>>>31,b[h]=f,x=c^g&(v^c),f=(d<<5|d>>>27)+x+q+1518500249+f,q=c,c=v,v=(g<<30|g>>>2)>>>0,g=d,d=f;for(;32>h;++h)f=b[h-3]^b[h-8]^b[h-14]^b[h-16],f=f<<1|f>>>31,b[h]=f,x=g^v^c,f=(d<<5|d>>>27)+x+q+1859775393+
f,q=c,c=v,v=(g<<30|g>>>2)>>>0,g=d,d=f;for(;40>h;++h)f=b[h-6]^b[h-16]^b[h-28]^b[h-32],f=f<<2|f>>>30,b[h]=f,x=g^v^c,f=(d<<5|d>>>27)+x+q+1859775393+f,q=c,c=v,v=(g<<30|g>>>2)>>>0,g=d,d=f;for(;60>h;++h)f=b[h-6]^b[h-16]^b[h-28]^b[h-32],f=f<<2|f>>>30,b[h]=f,x=g&v|c&(g^v),f=(d<<5|d>>>27)+x+q+2400959708+f,q=c,c=v,v=(g<<30|g>>>2)>>>0,g=d,d=f;for(;80>h;++h)f=b[h-6]^b[h-16]^b[h-28]^b[h-32],f=f<<2|f>>>30,b[h]=f,x=g^v^c,f=(d<<5|d>>>27)+x+q+3395469782+f,q=c,c=v,v=(g<<30|g>>>2)>>>0,g=d,d=f;a.h0=a.h0+d|0;a.h1=a.h1+
g|0;a.h2=a.h2+v|0;a.h3=a.h3+c|0;a.h4=a.h4+q|0;A-=64}}var d=a.sha1=a.sha1||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha1=a.md.algorithms.sha1=d;d.create=function(){h||(G=String.fromCharCode(128),G+=a.util.fillString(String.fromCharCode(0),64),h=!0);var f=null,b=a.util.createBuffer(),e=Array(80),d={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){d.messageLength=0;d.fullMessageLength=d.messageLength64=[];for(var e=
d.messageLengthSize/4,g=0;g>>0,v>>>0];for(var c=d.fullMessageLength.length-1;0<=c;--c)d.fullMessageLength[c]+=v[1],v[1]=v[0]+(d.fullMessageLength[c]/4294967296>>>0),d.fullMessageLength[c]>>>=0,v[0]=v[1]/4294967296>>>0;b.putBytes(k);g(f,e,
b);(2048>>0,c+=v,k.putInt32(c>>>0),c=h>>>0;k.putInt32(c);h={h0:f.h0,h1:f.h1,h2:f.h2,h3:f.h3,h4:f.h4};g(h,e,k);k=a.util.createBuffer();k.putInt32(h.h0);
k.putInt32(h.h1);k.putInt32(h.h2);k.putInt32(h.h3);k.putInt32(h.h4);return k};return d};var G=null,h=!1}if("function"!==typeof t)if("object"===typeof module&&module.exports){var B=!0;t=function(a,g){g(H,module)}}else return"undefined"===typeof forge&&(forge={}),p(forge);var y,C=function(a,g){g.exports=function(d){var g=y.map(function(f){return a(f)}).concat(p);d=d||{};d.defined=d.defined||{};if(d.defined.sha1)return d.sha1;d.defined.sha1=!0;for(var h=0;hq;++q)e[q]=d.getInt32();for(;64>q;++q)b=e[q-2],b=(b>>>17|b<<15)^(b>>>19|b<<13)^b>>>10,g=
e[q-15],g=(g>>>7|g<<25)^(g>>>18|g<<14)^g>>>3,e[q]=b+e[q-7]+g+e[q-16]|0;x=a.h0;h=a.h1;A=a.h2;l=a.h3;r=a.h4;n=a.h5;F=a.h6;m=a.h7;for(q=0;64>q;++q)b=(r>>>6|r<<26)^(r>>>11|r<<21)^(r>>>25|r<<7),v=F^r&(n^F),g=(x>>>2|x<<30)^(x>>>13|x<<19)^(x>>>22|x<<10),c=x&h|A&(x^h),b=m+b+v+f[q]+e[q],g+=c,m=F,F=n,n=r,r=l+b>>>0,l=A,A=h,h=x,x=b+g>>>0;a.h0=a.h0+x|0;a.h1=a.h1+h|0;a.h2=a.h2+A|0;a.h3=a.h3+l|0;a.h4=a.h4+r|0;a.h5=a.h5+n|0;a.h6=a.h6+F|0;a.h7=a.h7+m|0;w-=64}}var d=a.sha256=a.sha256||{};a.md=a.md||{};a.md.algorithms=
a.md.algorithms||{};a.md.sha256=a.md.algorithms.sha256=d;d.create=function(){h||(G=String.fromCharCode(128),G+=a.util.fillString(String.fromCharCode(0),64),f=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,
666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],h=!0);var b=null,e=a.util.createBuffer(),d=Array(64),k={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,
start:function(){k.messageLength=0;k.fullMessageLength=k.messageLength64=[];for(var d=k.messageLengthSize/4,f=0;f>>0,c>>>0];for(var q=k.fullMessageLength.length-1;0<=q;--q)k.fullMessageLength[q]+=
c[1],c[1]=c[0]+(k.fullMessageLength[q]/4294967296>>>0),k.fullMessageLength[q]>>>=0,c[0]=c[1]/4294967296>>>0;e.putBytes(f);g(b,d,e);(2048>>
0,q+=c,f.putInt32(q>>>0),q=v>>>0;f.putInt32(q);v={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3,h4:b.h4,h5:b.h5,h6:b.h6,h7:b.h7};g(v,d,f);f=a.util.createBuffer();f.putInt32(v.h0);f.putInt32(v.h1);f.putInt32(v.h2);f.putInt32(v.h3);f.putInt32(v.h4);f.putInt32(v.h5);f.putInt32(v.h6);f.putInt32(v.h7);return f};return k};var G=null,h=!1,f=null}if("function"!==typeof t)if("object"===typeof module&&module.exports){var B=!0;t=function(a,g){g(H,module)}}else return"undefined"===typeof forge&&(forge={}),p(forge);var y,C=
function(a,g){g.exports=function(d){var g=y.map(function(f){return a(f)}).concat(p);d=d||{};d.defined=d.defined||{};if(d.defined.sha256)return d.sha256;d.defined.sha256=!0;for(var h=0;hS;++S)e[S][0]=f.getInt32()>>>0,e[S][1]=f.getInt32()>>>0;for(;80>S;++S)h=e[S-2],n=h[0],h=h[1],d=((n>>>19|h<<13)^(h>>>29|n<<3)^n>>>6)>>>0,c=((n<<13|h>>>19)^(h<<3|n>>>29)^(n<<26|h>>>6))>>>0,h=e[S-15],n=h[0],h=h[1],k=((n>>>1|h<<31)^(n>>>8|h<<24)^n>>>7)>>>0,g=((n<<31|h>>>1)^(n<<24|h>>>8)^(n<<25|h>>>7))>>>0,n=e[S-7],F=e[S-16],h=c+n[1]+g+F[1],e[S][0]=d+n[0]+k+F[0]+
(h/4294967296>>>0)>>>0,e[S][1]=h>>>0;n=a[0][0];F=a[0][1];m=a[1][0];N=a[1][1];u=a[2][0];I=a[2][1];Q=a[3][0];P=a[3][1];w=a[4][0];G=a[4][1];t=a[5][0];p=a[5][1];W=a[6][0];y=a[6][1];J=a[7][0];L=a[7][1];for(S=0;80>S;++S)d=((w>>>14|G<<18)^(w>>>18|G<<14)^(G>>>9|w<<23))>>>0,h=((w<<18|G>>>14)^(w<<14|G>>>18)^(G<<23|w>>>9))>>>0,c=(W^w&(t^W))>>>0,A=(y^G&(p^y))>>>0,k=((n>>>28|F<<4)^(F>>>2|n<<30)^(F>>>7|n<<25))>>>0,g=((n<<4|F>>>28)^(F<<30|n>>>2)^(F<<25|n>>>7))>>>0,l=(n&m|u&(n^m))>>>0,r=(F&N|I&(F^N))>>>0,h=L+h+A+
b[S][1]+e[S][1],d=J+d+c+b[S][0]+e[S][0]+(h/4294967296>>>0)>>>0,c=h>>>0,h=g+r,k=k+l+(h/4294967296>>>0)>>>0,g=h>>>0,J=W,L=y,W=t,y=p,t=w,p=G,h=P+c,w=Q+d+(h/4294967296>>>0)>>>0,G=h>>>0,Q=u,P=I,u=m,I=N,m=n,N=F,h=c+g,n=d+k+(h/4294967296>>>0)>>>0,F=h>>>0;h=a[0][1]+F;a[0][0]=a[0][0]+n+(h/4294967296>>>0)>>>0;a[0][1]=h>>>0;h=a[1][1]+N;a[1][0]=a[1][0]+m+(h/4294967296>>>0)>>>0;a[1][1]=h>>>0;h=a[2][1]+I;a[2][0]=a[2][0]+u+(h/4294967296>>>0)>>>0;a[2][1]=h>>>0;h=a[3][1]+P;a[3][0]=a[3][0]+Q+(h/4294967296>>>0)>>>0;
a[3][1]=h>>>0;h=a[4][1]+G;a[4][0]=a[4][0]+w+(h/4294967296>>>0)>>>0;a[4][1]=h>>>0;h=a[5][1]+p;a[5][0]=a[5][0]+t+(h/4294967296>>>0)>>>0;a[5][1]=h>>>0;h=a[6][1]+y;a[6][0]=a[6][0]+W+(h/4294967296>>>0)>>>0;a[6][1]=h>>>0;h=a[7][1]+L;a[7][0]=a[7][0]+J+(h/4294967296>>>0)>>>0;a[7][1]=h>>>0;T-=128}}var d=a.sha512=a.sha512||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha512=a.md.algorithms.sha512=d;var G=a.sha384=a.sha512.sha384=a.sha512.sha384||{};G.create=function(){return d.create("SHA-384")};
a.md.sha384=a.md.algorithms.sha384=G;a.sha512.sha256=a.sha512.sha256||{create:function(){return d.create("SHA-512/256")}};a.md["sha512/256"]=a.md.algorithms["sha512/256"]=a.sha512.sha256;a.sha512.sha224=a.sha512.sha224||{create:function(){return d.create("SHA-512/224")}};a.md["sha512/224"]=a.md.algorithms["sha512/224"]=a.sha512.sha224;d.create=function(d){f||(h=String.fromCharCode(128),h+=a.util.fillString(String.fromCharCode(0),128),b=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],
[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,
3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],
[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,
4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],e={"SHA-512":[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],"SHA-384":[[3418070365,
3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],"SHA-512/256":[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],"SHA-512/224":[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],
[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]]},f=!0);"undefined"===typeof d&&(d="SHA-512");if(!(d in e))throw Error("Invalid SHA-512 algorithm: "+d);for(var k=e[d],u=null,v=a.util.createBuffer(),c=Array(80),q=0;80>q;++q)c[q]=Array(2);var x={algorithm:d.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){x.messageLength=0;x.fullMessageLength=x.messageLength128=[];for(var b=x.messageLengthSize/
4,c=0;c>>0,l>>>0];for(var r=x.fullMessageLength.length-1;0<=r;--r)x.fullMessageLength[r]+=l[1],l[1]=l[0]+(x.fullMessageLength[r]/4294967296>>>0),x.fullMessageLength[r]>>>=0,l[0]=l[1]/4294967296>>>0;v.putBytes(b);g(u,c,v);(2048>>0,r+=l,b.putInt32(r>>>0),r=e>>>0;b.putInt32(r);e=Array(u.length);for(n=0;ng.blockLength&&(g.start(),g.update(b.bytes()),b=g.digest());d=a.util.createBuffer();G=a.util.createBuffer();k=b.length();for(h=0;h>>4^r)&252645135;r^=d;l^=d<<4;d=(l>>>16^r)&65535;r^=d;l^=d<<16;d=(r>>>2^l)&858993459;l^=d;r^=d<<2;d=(r>>>8^l)&16711935;l^=d;r^=d<<8;d=(l>>>1^r)&1431655765;r^=d;l^=d<<1;l=l<<1|l>>>31;r=r<<1|r>>>31;for(var n=0;n>>4|r<<28)^a[q+1];d=l;l=r;r=d^(f[x>>>24&63]|e[x>>>16&63]|k[x>>>
8&63]|v[x&63]|h[I>>>24&63]|b[I>>>16&63]|w[I>>>8&63]|u[I&63])}d=l;l=r;r=d}l=l>>>1|l<<31;r=r>>>1|r<<31;d=(l>>>1^r)&1431655765;r^=d;l^=d<<1;d=(r>>>8^l)&16711935;l^=d;r^=d<<8;d=(r>>>2^l)&858993459;l^=d;r^=d<<2;d=(l>>>16^r)&65535;r^=d;l^=d<<16;d=(l>>>4^r)&252645135;g[0]=l^d<<4;g[1]=r^d}function G(b){b=b||{};var c="DES-"+(b.mode||"CBC").toUpperCase();var e=b.decrypt?a.cipher.createDecipher(c,b.key):a.cipher.createCipher(c,b.key);var d=e.start;e.start=function(b,c){var l=null;c instanceof a.util.ByteBuffer&&
(l=c,c={});c=c||{};c.output=l;c.iv=b;d.call(e,c)};return e}a.des=a.des||{};a.des.startEncrypting=function(a,b,e,d){a=G({key:a,output:e,decrypt:!1,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createEncryptionCipher=function(a,b){return G({key:a,output:null,decrypt:!1,mode:b})};a.des.startDecrypting=function(a,b,e,d){a=G({key:a,output:e,decrypt:!0,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createDecryptionCipher=function(a,b){return G({key:a,output:null,decrypt:!0,mode:b})};
a.des.Algorithm=function(a,b){var c=this;c.name=a;c.mode=new b({blockSize:8,cipher:{encrypt:function(a,b){return d(c._keys,a,b,!1)},decrypt:function(a,b){return d(c._keys,a,b,!0)}}});c._init=!1};a.des.Algorithm.prototype.initialize=function(b){if(!this._init){b=a.util.createBuffer(b.key);if(0===this.name.indexOf("3DES")&&24!==b.length())throw Error("Invalid Triple-DES key size: "+8*b.length());for(var c=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,
536936960,536936964],e=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],d=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],f=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],l=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],r=[0,1024,32,1056,0,1024,32,1056,
33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],n=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],k=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],m=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],g=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,
1032,268436488,1024,268436480,1032,268436488],h=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],I=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],v=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],P=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],u=8>>4^L)&252645135;L^=p;J^=p<<4;p=(L>>>-16^J)&65535;J^=p;L^=p<<-16;p=(J>>>2^L)&858993459;L^=p;J^=p<<2;p=(L>>>-16^J)&65535;J^=p;L^=p<<-16;p=(J>>>1^L)&1431655765;L^=p;J^=p<<1;p=(L>>>8^J)&16711935;J^=p;L^=p<<8;p=(J>>>1^L)&1431655765;L^=p;J^=p<<1;p=J<<8|L>>>20&240;J=L<<24|L<<8&16711680|L>>>8&65280|L>>>24&240;L=p;for(var S=0;S>>26,L=L<<2|L>>>26):(J=J<<1|J>>>27,L=L<<1|L>>>27);J&=-15;L&=-15;var T=c[J>>>28]|
e[J>>>24&15]|d[J>>>20&15]|f[J>>>16&15]|l[J>>>12&15]|r[J>>>8&15]|n[J>>>4&15],O=k[L>>>28]|m[L>>>24&15]|g[L>>>20&15]|h[L>>>16&15]|I[L>>>12&15]|v[L>>>8&15]|P[L>>>4&15];p=(O>>>16^T)&65535;w[t++]=T^p;w[t++]=O^p<<16}}this._keys=w;this._init=!0}};g("DES-ECB",a.cipher.modes.ecb);g("DES-CBC",a.cipher.modes.cbc);g("DES-CFB",a.cipher.modes.cfb);g("DES-OFB",a.cipher.modes.ofb);g("DES-CTR",a.cipher.modes.ctr);g("3DES-ECB",a.cipher.modes.ecb);g("3DES-CBC",a.cipher.modes.cbc);g("3DES-CFB",a.cipher.modes.cfb);g("3DES-OFB",
a.cipher.modes.ofb);g("3DES-CTR",a.cipher.modes.ctr);var h=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],
f=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,
1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],b=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,
134348800,134218248,520,134348800,131592,8,134348808,131584],e=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],w=[256,34078976,34078720,1107296512,524288,256,1073741824,
34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,
34078976,1073742080],k=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,
541081600,536870912,4194320,536887312],u=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,
2048,2097154],v=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]}
if("function"!==typeof t)if("object"===typeof module&&module.exports){var B=!0;t=function(a,g){g(H,module)}}else return"undefined"===typeof forge&&(forge={}),p(forge);var y,C=function(a,g){g.exports=function(d){var g=y.map(function(d){return a(d)}).concat(p);d=d||{};d.defined=d.defined||{};if(d.defined.des)return d.des;d.defined.des=!0;for(var h=0;hq)return k(null,A);D.start(null,null);D.update(f);D.update(a.util.int32ToBytes(r));
n=l=D.digest().getBytes();F=2;v()}function v(){if(F<=b)return D.start(null,null),D.update(l),m=D.digest().getBytes(),n=a.util.xorBytes(n,m,c),l=m,++F,a.util.setImmediate(v);A+=r4294967295*c){g=Error("Derived key is too long.");if(k)return k(g);throw g;}var q=Math.ceil(e/c),x=e-(q-1)*c,D=a.hmac.create();
D.start(w,g);var A="",l;if(!k){for(var r=1;r<=q;++r){D.start(null,null);D.update(f);D.update(a.util.int32ToBytes(r));var n=l=D.digest().getBytes();for(var F=2;F<=b;++F){D.start(null,null);D.update(l);var m=D.digest().getBytes();n=a.util.xorBytes(n,m,c);l=m}A+=rc;++c)b=
31===b?2147483648:b<<2,0===b%e.reseeds&&(a.update(e.pools[c].digest().getBytes()),e.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();e.key=e.plugin.formatKey(b);e.seed=e.plugin.formatSeed(a);e.reseeds=4294967295===e.reseeds?0:e.reseeds+1;e.generated=0}function b(b){var e=null;if("undefined"!==typeof window){var c=window.crypto||window.msCrypto;c&&c.getRandomValues&&(e=function(a){return c.getRandomValues(a)})}var d=a.util.createBuffer();if(e)for(;d.length()<
b;){var f=Math.max(1,Math.min(b-d.length(),65536)/4),k=new Uint32Array(Math.floor(f));try{for(e(k),f=0;f>16),f+=(e&32767)<<16,f+=e>>15,f=(f&2147483647)+(f>>31),e=f&4294967295,f=0;3>f;++f)k=e>>>(f<<3),k^=Math.floor(256*Math.random()),d.putByte(String.fromCharCode(k&255));
return d.getBytes(b)}var e={plugin:g,key:null,seed:null,time:null,reseeds:0,generated:0};g=g.md;for(var w=Array(32),k=0;32>k;++k)w[k]=g.create();e.pools=w;e.pool=0;e.generate=function(b,d){function c(r){if(r)return d(r);if(l.length()>=b)return d(null,l.getBytes(b));1048575>
d&255);e.collect(c)};e.registerWorker=function(a){a===self?e.seedFile=function(a,b){function c(a){a=a.data;a.forge&&a.forge.prng&&(self.removeEventListener("message",c),b(a.forge.prng.err,a.forge.prng.bytes))}self.addEventListener("message",c);self.postMessage({forge:{prng:{needed:a}}})}:a.addEventListener("message",function(b){b=b.data;b.forge&&b.forge.prng&&e.seedFile(b.forge.prng.needed,function(b,e){a.postMessage({forge:{prng:{err:b,bytes:e}}})})})};return e}}if("function"!==typeof t)if("object"===
typeof module&&module.exports){var B=!0;t=function(a,g){g(H,module)}}else return"undefined"===typeof forge&&(forge={}),p(forge);var y,C=function(a,g){g.exports=function(d){var g=y.map(function(d){return a(d)}).concat(p);d=d||{};d.defined=d.defined||{};if(d.defined.prng)return d.prng;d.defined.prng=!0;for(var h=0;h>(h&7);var u;for(u=e;128>u;u++)b.putByte(g[b.at(u-1)+b.at(u-e)&255]);b.setAt(128-
k,g[b.at(128-k)&h]);for(u=127-k;0<=u;u--)b.setAt(u,g[b.at(u+1)^b.at(u+k)]);return b};var p=function(g,f,b){var e=!1,h=null,k=null,u=null,v,c,q=[];g=a.rc2.expandKey(g,f);for(v=0;64>v;v++)q.push(g.getInt16Le());if(b){var x=function(a){for(v=0;4>v;v++){a[v]+=q[c]+(a[(v+3)%4]&a[(v+2)%4])+(~a[(v+3)%4]&a[(v+1)%4]);var b=a[v],e=d[v];a[v]=b<>16-e;c++}};var D=function(a){for(v=0;4>v;v++)a[v]+=q[a[(v+3)%4]&63]}}else x=function(a){for(v=3;0<=v;v--){var b=a[v],e=d[v];a[v]=(b&65535)>>e|b<<16-
e&65535;a[v]-=q[c]+(a[(v+3)%4]&a[(v+2)%4])+(~a[(v+3)%4]&a[(v+1)%4]);c--}},D=function(a){for(v=3;0<=v;v--)a[v]-=q[a[(v+3)%4]&63]};var A=null;return A={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));e=!1;h=a.util.createBuffer();k=c||new a.util.createBuffer;u=b;A.output=k},update:function(a){for(e||h.putBuffer(a);8<=h.length();){a=[[5,x],[1,D],[6,x],[1,D],[5,x]];var d=[];for(v=0;4>v;v++){var n=h.getInt16Le();null!==u&&(b?n^=u.getInt16Le():u.putInt16Le(n));d.push(n&65535)}c=b?
0:63;for(n=0;nv;v++)null!==u&&(b?u.putInt16Le(d[v]):d[v]^=u.getInt16Le()),k.putInt16Le(d[v])}},finish:function(a){var c=!0;if(b)if(a)c=a(8,h,!b);else{var n=8===h.length()?8:8-h.length();h.fillWithByte(n,n)}c&&(e=!0,A.update());!b&&(c=0===h.length())&&(a?c=a(8,k,!b):(a=k.length(),n=k.at(a-1),n>a?c=!1:k.truncate(n)));return c}}};a.rc2.startEncrypting=function(d,f,b){d=a.rc2.createEncryptionCipher(d,128);d.start(f,b);return d};a.rc2.createEncryptionCipher=
function(a,d){return p(a,d,!0)};a.rc2.startDecrypting=function(d,f,b){d=a.rc2.createDecryptionCipher(d,128);d.start(f,b);return d};a.rc2.createDecryptionCipher=function(a,d){return p(a,d,!1)}}if("function"!==typeof t)if("object"===typeof module&&module.exports){var B=!0;t=function(a,g){g(H,module)}}else return"undefined"===typeof forge&&(forge={}),p(forge);var y,C=function(a,g){g.exports=function(d){var g=y.map(function(d){return a(d)}).concat(p);d=d||{};d.defined=d.defined||{};if(d.defined.rc2)return d.rc2;
d.defined.rc2=!0;for(var h=0;h>=15;0<=--d;){var m=this.data[a]&32767,f=this.data[a++]>>15,r=b*m+f*l;m=l*m+((r&32767)<<15)+c.data[e]+(n&1073741823);n=(m>>>30)+(r>>>15)+b*f+(n>>>30);c.data[e++]=m&1073741823}return n}function f(a,b,c,e,n,d){var l=b&16383;for(b>>=14;0<=--d;){var m=
this.data[a]&16383,f=this.data[a++]>>14,r=b*m+f*l;m=l*m+((r&16383)<<14)+c.data[e]+n;n=(m>>28)+(r>>14)+b*f;c.data[e++]=m&268435455}return n}function b(a,b){var c=F[a.charCodeAt(b)];return null==c?-1:c}function e(a){var b=d();b.fromInt(a);return b}function w(a){var b=1,c;0!=(c=a>>>16)&&(a=c,b+=16);0!=(c=a>>8)&&(a=c,b+=8);0!=(c=a>>4)&&(a=c,b+=4);0!=(c=a>>2)&&(a=c,b+=2);0!=a>>1&&(b+=1);return b}function k(a){this.m=a}function u(a){this.m=a;this.mp=a.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>
15;this.um=(1<=m;++m)F[n++]=m;n=97;for(m=10;36>m;++m)F[n++]=m;n=65;for(m=10;36>m;++m)F[n++]=m;k.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};k.prototype.revert=function(a){return a};k.prototype.reduce=function(a){a.divRemTo(this.m,
null,a)};k.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};k.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};u.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0>15)*this.mpl&this.um)<<15)&a.DM;c=b+this.m.t;for(a.data[c]+=this.m.am(0,e,a,b,0,this.m.t);a.data[c]>=a.DV;)a.data[c]-=a.DV,a.data[++c]++}a.clamp();a.drShiftTo(this.m.t,a);0<=a.compareTo(this.m)&&a.subTo(this.m,a)};u.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};u.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};g.prototype.copyTo=function(a){for(var b=this.t-1;0<=b;--b)a.data[b]=this.data[b];a.t=this.t;a.s=this.s};g.prototype.fromInt=function(a){this.t=
1;this.s=0>a?-1:0;0a?this.data[0]=a+this.DV:this.t=0};g.prototype.fromString=function(a,c){if(16==c)var e=4;else if(8==c)e=3;else if(256==c)e=8;else if(2==c)e=1;else if(32==c)e=5;else if(4==c)e=2;else{this.fromRadix(a,c);return}this.s=this.t=0;for(var n=a.length,d=!1,l=0;0<=--n;){var m=8==e?a[n]&255:b(a,n);0>m?"-"==a.charAt(n)&&(d=!0):(d=!1,0==l?this.data[this.t++]=m:l+e>this.DB?(this.data[this.t-1]|=(m&(1<>this.DB-l):this.data[this.t-1]|=
m<=this.DB&&(l-=this.DB))}8==e&&0!=(a[0]&128)&&(this.s=-1,0>e|l,l=(this.data[m]&n)<=this.t)b.t=0;else{var e=a%this.DB,n=this.DB-e,d=(1<>e;for(var l=c+1;l>e;0>=this.DB;if(a.t>=this.DB;e+=this.s}else{for(e+=this.s;c>=this.DB;e-=a.s}b.s=0>e?-1:0;-1>e?b.data[c++]=this.DV+e:0=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0=e.t)){var n=this.abs();if(n.t>this.F2:0),k=this.FV/r;r=(1<m&&g.ZERO.subTo(c,c)}}}};g.prototype.invDigit=function(){if(1>this.t)return 0;var a=this.data[0];if(0==(a&1))return 0;var b=a&3;b=b*(2-(a&15)*b)&15;b=b*(2-(a&255)*b)&
255;b=b*(2-((a&65535)*b&65535))&65535;b=b*(2-a*b%this.DV)%this.DV;return 0a)return g.ONE;var c=d(),e=d(),n=b.convert(this),l=w(a)-1;for(n.copyTo(c);0<=--l;)if(b.sqrTo(c,e),0<(a&1<this.s)return"-"+this.negate().toString(a);if(16==a)a=4;else if(8==a)a=3;else if(2==
a)a=1;else if(32==a)a=5;else if(4==a)a=2;else return this.toRadix(a);var b=(1<>d)&&(e=!0,n="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=l;)d>(d+=this.DB-a)):(c=this.data[l]>>(d-=a)&b,0>=d&&(d+=this.DB,--l)),0this.s?this.negate():this};g.prototype.compareTo=function(a){var b=this.s-a.s;if(0!=b)return b;var c=this.t;b=c-a.t;if(0!=b)return 0>this.s?-b:b;for(;0<=--c;)if(0!=(b=this.data[c]-a.data[c]))return b;return 0};g.prototype.bitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+w(this.data[this.t-1]^this.s&this.DM)};g.prototype.mod=function(a){var b=d();this.abs().divRemTo(a,null,b);0>this.s&&0a||b.isEven()?new k(b):new u(b);return this.exp(a,c)};g.ZERO=e(0);g.ONE=e(1);D.prototype.convert=A;D.prototype.revert=A;D.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};D.prototype.sqrTo=function(a,b){a.squareTo(b)};l.prototype.convert=function(a){if(0>a.s||a.t>2*this.m.t)return a.mod(this.m);if(0>a.compareTo(this.m))return a;var b=d();a.copyTo(b);this.reduce(b);return b};l.prototype.revert=function(a){return a};l.prototype.reduce=function(a){a.drShiftTo(this.m.t-1,this.r2);
a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp());this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>a.compareTo(this.r2);)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);0<=a.compareTo(this.m);)a.subTo(this.m,a)};l.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};l.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var N=[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],M=67108864/N[N.length-1];g.prototype.chunkSize=function(a){return Math.floor(Math.LN2*this.DB/Math.log(a))};g.prototype.toRadix=function(a){null==a&&(a=10);if(0==this.signum()||2>a||36r?"-"==a.charAt(f)&&0==this.signum()&&(l=!0):(m=c*m+r,++d>=e&&(this.dMultiply(n),this.dAddOffset(m,0),m=d=0))}0a)this.fromInt(1);else for(this.fromNumber(a,e),this.testBit(a-1)||this.bitwiseTo(g.ONE.shiftLeft(a-1),c,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(g.ONE.shiftLeft(a-1),this);else{e=[];var n=a&7;e.length=(a>>3)+1;b.nextBytes(e);e[0]=0>=this.DB;if(a.t>=this.DB;e+=this.s}else{for(e+=this.s;c>=this.DB;e+=a.s}b.s=0>e?-1:0;0e&&(b.data[c++]=this.DV+e);b.t=c;b.clamp()};g.prototype.dMultiply=function(a){this.data[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()};g.prototype.dAddOffset=function(a,b){if(0!=a){for(;this.t<=b;)this.data[this.t++]=0;for(this.data[b]+=a;this.data[b]>=this.DV;)this.data[b]-=this.DV,++b>=this.t&&(this.data[this.t++]=
0),++this.data[b]}};g.prototype.multiplyLowerTo=function(a,b,c){var e=Math.min(this.t+a.t,b);c.s=0;for(c.t=e;0=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0=c)return!1;for(var e=b.shiftRight(c),n=r(),l,d=0;d=l.compareTo(g.ONE)||0<=l.compareTo(b));l=l.modPow(e,this);if(0!=l.compareTo(g.ONE)&&0!=l.compareTo(b)){for(var m=1;m++this.s){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<>24};g.prototype.shortValue=
function(){return 0==this.t?this.s:this.data[0]<<16>>16};g.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this.data[0]?0:1};g.prototype.toByteArray=function(){var a=this.t,b=[];b[0]=this.s;var c=this.DB-a*this.DB%8,e,n=0;if(0>c)!=(this.s&this.DM)>>c&&(b[n++]=e|this.s<c?(e=(this.data[a]&(1<>(c+=this.DB-8)):(e=this.data[a]>>(c-=8)&255,0>=c&&(c+=this.DB,--a)),0!=(e&128)&&(e|=-256),0==n&&
(this.s&128)!=(e&128)&&++n,0this.compareTo(a)?this:a};g.prototype.max=function(a){return 0a?this.rShiftTo(-a,b):this.lShiftTo(a,b);return b};g.prototype.shiftRight=function(a){var b=d();0>a?this.lShiftTo(-a,b):this.rShiftTo(a,b);return b};g.prototype.getLowestSetBit=function(){for(var a=0;a>=16,c+=16);
0==(a&255)&&(a>>=8,c+=8);0==(a&15)&&(a>>=4,c+=4);0==(a&3)&&(a>>=2,c+=2);0==(a&1)&&++c;a=c}return b+a}return 0>this.s?this.t*this.DB:-1};g.prototype.bitCount=function(){for(var a=0,b=this.s&this.DM,c=0;c=this.t?0!=this.s:0!=(this.data[b]&1<=c)return n;var m=18>c?1:48>c?3:144>c?4:768>c?5:6;var f=8>c?new k(b):b.isEven()?new l(b):new u(b);var r=[],g=3,A=m-1,h=(1<=A)var v=a.data[F]>>c-A&h;else v=(a.data[F]&(1<>this.DB+c-A);for(g=m;0==(v&1);)v>>=1,--g;0>(c-=g)&&(c+=this.DB,
--F);if(q)r[v].copyTo(n),q=!1;else{for(;1--c&&(c=this.DB-1,--F)}return f.revert(n)};g.prototype.modInverse=function(a){var b=a.isEven();if(this.isEven()&&b||0==a.signum())return g.ZERO;for(var c=a.clone(),n=this.clone(),l=e(1),d=e(0),m=e(0),f=e(1);0!=c.signum();){for(;c.isEven();)c.rShiftTo(1,c),b?(l.isEven()&&d.isEven()||(l.addTo(this,l),d.subTo(a,d)),l.rShiftTo(1,
l)):d.isEven()||d.subTo(a,d),d.rShiftTo(1,d);for(;n.isEven();)n.rShiftTo(1,n),b?(m.isEven()&&f.isEven()||(m.addTo(this,m),f.subTo(a,f)),m.rShiftTo(1,m)):f.isEven()||f.subTo(a,f),f.rShiftTo(1,f);0<=c.compareTo(n)?(c.subTo(n,c),b&&l.subTo(m,l),d.subTo(f,d)):(n.subTo(c,n),b&&m.subTo(l,m),f.subTo(d,f))}if(0!=n.compareTo(g.ONE))return g.ZERO;if(0<=f.compareTo(a))return f.subtract(a);if(0>f.signum())f.addTo(a,f);else return f;return 0>f.signum()?f.add(a):f};g.prototype.pow=function(a){return this.exp(a,
new D)};g.prototype.gcd=function(a){var b=0>this.s?this.negate():this.clone();a=0>a.s?a.negate():a.clone();if(0>b.compareTo(a)){var c=b;b=a;a=c}c=b.getLowestSetBit();var e=a.getLowestSetBit();if(0>e)return b;c>24&255,h>>16&255,h>>8&255,h&255);f.start();f.update(d+k);b+=f.digest().getBytes()}return b.substring(0,g)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(d,h,f,b,e){if("string"===typeof f){var w=f;var k=b||void 0;var u=e||void 0}else if(f&&(w=f.label||void 0,k=f.seed||void 0,u=f.md||void 0,f.mgf1&&f.mgf1.md))var v=f.mgf1.md;u?u.start():
u=a.md.sha1.create();v||(v=u);d=Math.ceil(d.n.bitLength()/8);f=d-2*u.digestLength-2;if(h.length>f)throw v=Error("RSAES-OAEP input message length is too long."),v.length=h.length,v.maxLength=f,v;w||(w="");u.update(w,"raw");w=u.digest();b="";f-=h.length;for(e=0;eb&&(g=h(b,c));if(g.isProbablePrime(l))return k(null,g);g.dAddOffset(w[A++%8],0)}while(0>r||+new Date-nb&&(A=h(b,c));l=A.toString(16);a.target.postMessage({hex:l,workLoad:r});
A.dAddOffset(n,0)}}l=Math.max(1,l);for(var d=[],f=0;f=a?27:150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if(!a.prime){var b=a.prime=a.prime||{},e=a.jsbn.BigInteger,w=[6,4,2,4,2,4,6,2],k=new e(null);k.fromInt(30);var u=function(a,b){return a|b};b.generateProbablePrime=function(b,c,e){"function"===typeof c&&(e=c,c={});c=c||{};var d=c.algorithm||"PRIMEINC";"string"===typeof d&&(d={name:d});d.options=d.options||{};var f=c.prng||a.random;c={nextBytes:function(a){for(var b=f.getBytesSync(a.length),
c=0;cc-11)throw n=Error("Message is too long for PKCS#1 v1.5 padding."),
n.length=b.length,n.max=c-11,n;n.putByte(0);n.putByte(e);c=c-3-b.length;if(0===e||1===e){e=0===e?0:255;for(var d=0;db.p.compareTo(b.q)){var f=b.p;b.p=b.q;b.q=f}0!==b.p.subtract(k.ONE).gcd(b.e).compareTo(k.ONE)?(b.p=null,d()):0!==b.q.subtract(k.ONE).gcd(b.e).compareTo(k.ONE)?(b.q=null,n(b.qBits,l)):(b.p1=b.p.subtract(k.ONE),b.q1=b.q.subtract(k.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(k.ONE)?(b.p=b.q=null,d()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,n(b.qBits,l)):(f=b.e.modInverse(b.phi),b.keys={privateKey:v.rsa.setPrivateKey(b.n,
b.e,f,b.p,b.q,f.mod(b.p1),f.mod(b.q1),b.q.modInverse(b.p)),publicKey:v.rsa.setPublicKey(b.n,b.e)},e(null,b.keys))))}"function"===typeof c&&(e=c,c={});c=c||{};var f={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(f.prng=c.prng);d()}function h(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);b=a.util.hexToBytes(b);return 1=a?27:150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}function b(a){return"undefined"!==typeof window&&"object"===typeof window.crypto&&"object"===typeof window.crypto.subtle&&"function"===typeof window.crypto.subtle[a]}function e(a){return"undefined"!==typeof window&&"object"===typeof window.msCrypto&&"object"===typeof window.msCrypto.subtle&&"function"===typeof window.msCrypto.subtle[a]}function w(b){b=
a.util.hexToBytes(b.toString(16));for(var c=new Uint8Array(b.length),e=0;ed.compareTo(b);)d=d.add(c.p);b=d.subtract(b).multiply(c.qInv).mod(c.p).multiply(c.q).add(b);
return b=b.multiply(e.modInverse(c.n)).mod(c.n)};v.rsa.encrypt=function(b,c,e){var d=e,l=Math.ceil(c.n.bitLength()/8);!1!==e&&!0!==e?(d=2===e,e=g(b,c,e)):(e=a.util.createBuffer(),e.putBytes(b));b=new k(e.toHex(),16);c=r(b,c,d).toString(16);d=a.util.createBuffer();for(l-=Math.ceil(c.length/2);0>1,pBits:b-(b>>1),pqState:0,num:null,keys:null},b.e.fromInt(b.eInt);else throw Error("Invalid key generation algorithm: "+e);return b};v.rsa.stepKeyPairGenerationState=function(a,b){"algorithm"in a||(a.algorithm="PRIMEINC");var e=new k(null);e.fromInt(30);for(var d=0,l=function(a,b){return a|b},n=+new Date,r,g=0;null===a.keys&&
(0>=b||gr?a.pqState=0:a.num.isProbablePrime(f(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(c[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(k.ONE).gcd(a.e).compareTo(k.ONE)?3:0:3===a.pqState&&(a.pqState=0,null===a.p?a.p=a.num:a.q=a.num,
null!==a.p&&null!==a.q&&++a.state,a.num=null)}else 1===a.state?(0>a.p.compareTo(a.q)&&(a.num=a.p,a.p=a.q,a.q=a.num),++a.state):2===a.state?(a.p1=a.p.subtract(k.ONE),a.q1=a.q.subtract(k.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(k.ONE)?++a.state:(a.p=null,a.q=null,a.state=0):4===a.state?(a.n=a.p.multiply(a.q),a.n.bitLength()===a.bits?++a.state:(a.q=null,a.state=0)):5===a.state&&(r=a.e.modInverse(a.phi),a.keys={privateKey:v.rsa.setPrivateKey(a.n,a.e,r,a.p,a.q,
r.mod(a.p1),r.mod(a.q1),a.q.modInverse(a.p)),publicKey:v.rsa.setPublicKey(a.n,a.e)});r=+new Date;g+=r-n;n=r}return null!==a.keys};v.rsa.generateKeyPair=function(c,d,l,f){1===arguments.length?"object"===typeof c?(l=c,c=void 0):"function"===typeof c&&(f=c,c=void 0):2===arguments.length?"number"===typeof c?"function"===typeof d?(f=d,d=void 0):"number"!==typeof d&&(l=d,d=void 0):(l=c,f=d,d=c=void 0):3===arguments.length&&("number"===typeof d?"function"===typeof l&&(f=l,l=void 0):(f=l,l=d,d=void 0));l=
l||{};void 0===c&&(c=l.bits||2048);void 0===d&&(d=l.e||65537);if(!a.disableNativeCode&&f&&256<=c&&16384>=c&&(65537===d||3===d)){if(b("generateKey")&&b("exportKey"))return window.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:c,publicExponent:w(d),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(a){return window.crypto.subtle.exportKey("pkcs8",a.privateKey)})["catch"](function(a){f(a)}).then(function(b){b&&(b=v.privateKeyFromAsn1(u.fromDer(a.util.createBuffer(b))),f(null,
{privateKey:b,publicKey:v.setRsaPublicKey(b.n,b.e)}))});if(e("generateKey")&&e("exportKey")){var n=window.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:c,publicExponent:w(d),hash:{name:"SHA-256"}},!0,["sign","verify"]);n.oncomplete=function(b){b=window.msCrypto.subtle.exportKey("pkcs8",b.target.result.privateKey);b.oncomplete=function(b){b=v.privateKeyFromAsn1(u.fromDer(a.util.createBuffer(b.target.result)));f(null,{privateKey:b,publicKey:v.setRsaPublicKey(b.n,b.e)})};b.onerror=
function(a){f(a)}};n.onerror=function(a){f(a)};return}}n=v.rsa.createKeyPairGenerationState(c,d,l);if(!f)return v.rsa.stepKeyPairGenerationState(n,0),n.keys;p(n,l,f)};v.setRsaPublicKey=v.rsa.setPublicKey=function(b,c){var e={n:b,e:c,encrypt:function(b,c,d){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSAES-PKCS1-V1_5");if("RSAES-PKCS1-V1_5"===c)c={encode:function(a,b,c){return g(a,b,2).getBytes()}};else if("RSA-OAEP"===c||"RSAES-OAEP"===c)c={encode:function(b,c){return a.pkcs1.encode_rsa_oaep(c,
b,d)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(c))c={encode:function(a){return a}};else if("string"===typeof c)throw Error('Unsupported encryption scheme: "'+c+'".');b=c.encode(b,e,!0);return v.rsa.encrypt(b,e,!0)},verify:function(a,b,c){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSASSA-PKCS1-V1_5");if("RSASSA-PKCS1-V1_5"===c)c={verify:function(a,b){b=d(b,e,!0);var c=u.fromDer(b);return a===c.value[1].value}};else if("NONE"===c||"NULL"===c||null===c)c={verify:function(a,b){b=d(b,
e,!0);return a===b}};b=v.rsa.decrypt(b,e,!0,!1);return c.verify(a,b,e.n.bitLength())}};return e};v.setRsaPrivateKey=v.rsa.setPrivateKey=function(b,c,e,f,r,k,g,h){var n={n:b,e:c,d:e,p:f,q:r,dP:k,dQ:g,qInv:h,decrypt:function(b,c,e){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSAES-PKCS1-V1_5");b=v.rsa.decrypt(b,n,!1,!1);if("RSAES-PKCS1-V1_5"===c)c={decode:d};else if("RSA-OAEP"===c||"RSAES-OAEP"===c)c={decode:function(b,c){return a.pkcs1.decode_rsa_oaep(c,b,e)}};else if(-1!==["RAW","NONE",
"NULL",null].indexOf(c))c={decode:function(a){return a}};else throw Error('Unsupported encryption scheme: "'+c+'".');return c.decode(b,n,!1)},sign:function(a,b){var c=!1;"string"===typeof b&&(b=b.toUpperCase());if(void 0===b||"RSASSA-PKCS1-V1_5"===b)b={encode:l},c=1;else if("NONE"===b||"NULL"===b||null===b)b={encode:function(){return a}},c=1;var e=b.encode(a,n.n.bitLength());return v.rsa.encrypt(e,n,c)}};return n};v.wrapRsaPrivateKey=function(a){return u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,
[u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,u.integerToDer(0).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(v.oids.rsaEncryption).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.NULL,!1,"")]),u.create(u.Class.UNIVERSAL,u.Type.OCTETSTRING,!1,u.toDer(a).getBytes())])};v.privateKeyFromAsn1=function(b){var c={},e=[];u.validate(b,q,c,e)&&(b=u.fromDer(a.util.createBuffer(c.privateKey)));c={};e=[];if(!u.validate(b,x,c,e))throw c=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."),
c.errors=e,c;e=a.util.createBuffer(c.privateKeyModulus).toHex();b=a.util.createBuffer(c.privateKeyPublicExponent).toHex();var d=a.util.createBuffer(c.privateKeyPrivateExponent).toHex();var l=a.util.createBuffer(c.privateKeyPrime1).toHex();var f=a.util.createBuffer(c.privateKeyPrime2).toHex();var n=a.util.createBuffer(c.privateKeyExponent1).toHex();var r=a.util.createBuffer(c.privateKeyExponent2).toHex();c=a.util.createBuffer(c.privateKeyCoefficient).toHex();return v.setRsaPrivateKey(new k(e,16),new k(b,
16),new k(d,16),new k(l,16),new k(f,16),new k(n,16),new k(r,16),new k(c,16))};v.privateKeyToAsn1=v.privateKeyToRSAPrivateKey=function(a){return u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,u.integerToDer(0).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,h(a.n)),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,h(a.e)),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,h(a.d)),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,h(a.p)),u.create(u.Class.UNIVERSAL,
u.Type.INTEGER,!1,h(a.q)),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,h(a.dP)),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,h(a.dQ)),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,h(a.qInv))])};v.publicKeyFromAsn1=function(b){var c={},e=[];if(u.validate(b,A,c,e)){e=u.derToOid(c.publicKeyOid);if(e!==v.oids.rsaEncryption)throw c=Error("Cannot read public key. Unknown OID."),c.oid=e,c;b=c.rsaPublicKey}e=[];if(!u.validate(b,D,c,e))throw c=Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey."),
c.errors=e,c;e=a.util.createBuffer(c.publicKeyModulus).toHex();c=a.util.createBuffer(c.publicKeyExponent).toHex();return v.setRsaPublicKey(new k(e,16),new k(c,16))};v.publicKeyToAsn1=v.publicKeyToSubjectPublicKeyInfo=function(a){return u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(v.oids.rsaEncryption).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.NULL,!1,"")]),u.create(u.Class.UNIVERSAL,u.Type.BITSTRING,
!1,[v.publicKeyToRSAPublicKey(a)])])};v.publicKeyToRSAPublicKey=function(a){return u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,h(a.n)),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,h(a.e))])}}if("function"!==typeof t)if("object"===typeof module&&module.exports){var B=!0;t=function(a,g){g(H,module)}}else return"undefined"===typeof forge&&(forge={}),p(forge);var y,C=function(a,g){g.exports=function(d){var g=y.map(function(d){return a(d)}).concat(p);d=d||
{};d.defined=d.defined||{};if(d.defined.rsa)return d.rsa;d.defined.rsa=!0;for(var h=0;h>=8,p+=v.at(r)+D.at(r),D.setAt(r,p&255);w.putBuffer(D)}h=w;m.putBuffer(q)}m.truncate(m.length()-f);
return m};b.pbe.getCipher=function(a,c,e){switch(a){case b.oids.pkcs5PBES2:return b.pbe.getCipherForPBES2(a,c,e);case b.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case b.oids["pbewithSHAAnd40BitRC2-CBC"]:return b.pbe.getCipherForPKCS12PBE(a,c,e);default:throw c=Error("Cannot read encrypted PBE data block. Unsupported OID."),c.oid=a,c.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],c;}};b.pbe.getCipherForPBES2=function(e,c,g){var h={};e=[];if(!f.validate(c,k,
h,e)){var q=Error("Cannot read pdw-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");q.errors=e;throw q;}e=f.derToOid(h.kdfOid);if(e!==b.oids.pkcs5PBKDF2)throw q=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),q.oid=e,q.supportedOids=["pkcs5PBKDF2"],q;e=f.derToOid(h.encOid);if(e!==b.oids["aes128-CBC"]&&e!==b.oids["aes192-CBC"]&&e!==b.oids["aes256-CBC"]&&e!==b.oids["des-EDE3-CBC"]&&e!==b.oids.desCBC)throw q=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),
q.oid=e,q.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],q;c=h.kdfSalt;var A=a.util.createBuffer(h.kdfIterationCount);A=A.getInt(A.length()<<3);switch(b.oids[e]){case "aes128-CBC":var l=16;q=a.aes.createDecryptionCipher;break;case "aes192-CBC":l=24;q=a.aes.createDecryptionCipher;break;case "aes256-CBC":l=32;q=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":l=24;q=a.des.createDecryptionCipher;break;case "desCBC":l=8,q=a.des.createDecryptionCipher}e=d(h.prfOid);
g=a.pkcs5.pbkdf2(g,c,A,l,e);h=h.encIv;q=q(g);q.start(h);return q};b.pbe.getCipherForPKCS12PBE=function(e,c,k){var g={},h=[];if(!f.validate(c,u,g,h))throw k=Error("Cannot read pdw-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),k.errors=h,k;h=a.util.createBuffer(g.salt);c=a.util.createBuffer(g.iterations);c=c.getInt(c.length()<<3);switch(e){case b.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:var A=24;var l=8;e=a.des.startDecrypting;break;case b.oids["pbewithSHAAnd40BitRC2-CBC"]:A=
5;l=8;e=function(b,c){var e=a.rc2.createDecryptionCipher(b,40);e.start(c,null);return e};break;default:throw k=Error("Cannot read PKCS #12 PBE data block. Unsupported OID."),k.oid=e,k;}g=d(g.prfOid);A=b.pbe.generatePkcs12Key(k,h,1,c,A,g);g.start();k=b.pbe.generatePkcs12Key(k,h,2,c,l,g);return e(A,k)};b.pbe.opensslDeriveBytes=function(b,c,e,d){if("undefined"===typeof d||null===d)d=a.md.md5.create();null===c&&(c="");for(var f=[g(d,b+c)],k=16,l=1;k>8*v-u&255;q=String.fromCharCode(q.charCodeAt(0)&~u)+q.substr(1);return q+c+String.fromCharCode(188)},verify:function(e,f,g){var k=g-1;g=Math.ceil(k/8);f=f.substr(-g);if(g>8*g-k&255;if(0!==(q.charCodeAt(0)&x))throw Error("Bits beyond keysize not zero as expected.");var u=p.generate(f,c),A="";for(k=0;kl.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");m.validity.notBefore=l[0];m.validity.notAfter=l[1];
m.tbsCertificate=f.tbsCertificate;if(d){m.md=null;if(m.signatureOid in k)switch(l=k[m.signatureOid],l){case "sha1WithRSAEncryption":m.md=a.md.sha1.create();break;case "md5WithRSAEncryption":m.md=a.md.md5.create();break;case "sha256WithRSAEncryption":m.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":m.md=a.md.sha512.create();break;case "RSASSA-PSS":m.md=a.md.sha256.create()}if(null===m.md)throw f=Error("Could not compute certificate digest. Unknown signature OID."),f.signatureOid=m.signatureOid,
f;l=e.toDer(m.tbsCertificate);m.md.update(l.getBytes())}l=a.md.sha1.create();m.issuer.getField=function(a){return g(m.issuer,a)};m.issuer.addField=function(a){p([a]);m.issuer.attributes.push(a)};m.issuer.attributes=w.RDNAttributesAsArray(f.certIssuer,l);f.certIssuerUniqueId&&(m.issuer.uniqueId=f.certIssuerUniqueId);m.issuer.hash=l.digest().toHex();l=a.md.sha1.create();m.subject.getField=function(a){return g(m.subject,a)};m.subject.addField=function(a){p([a]);m.subject.attributes.push(a)};m.subject.attributes=
w.RDNAttributesAsArray(f.certSubject,l);f.certSubjectUniqueId&&(m.subject.uniqueId=f.certSubjectUniqueId);m.subject.hash=l.digest().toHex();m.extensions=f.certExtensions?w.certificateExtensionsFromAsn1(f.certExtensions):[];m.publicKey=w.publicKeyFromAsn1(f.subjectPublicKeyInfo);return m};w.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;ch.validity.notAfter)g={message:"Certificate is not valid yet or has expired.",error:w.certificateError.certificate_expired,notBefore:h.validity.notBefore,notAfter:h.validity.notAfter,now:f};
if(null===g){r=c[0]||b.getIssuer(h);null===r&&h.isIssuer(h)&&(q=!0,r=h);if(r){var x=r;a.util.isArray(x)||(x=[x]);for(var v=!1;!v&&0l.pathLenConstraint&&(g={message:"Certificate basicConstraints pathLenConstraint violated.",error:w.certificateError.bad_certificate}));h=null===g?!0:g.error;l=e?e(h,k,d):h;if(!0===l)g=null;else{!0===h&&(g={message:"The application rejected the certificate.",
error:w.certificateError.bad_certificate});if(l||0===l)"object"!==typeof l||a.util.isArray(l)?"string"===typeof l&&(g.error=l):(l.message&&(g.message=l.message),l.error&&(g.error=l.error));throw g;}l=!1;++k}while(0>1,g=l+(b.length&1),k=b.substr(0,g);g=b.substr(l,g);b=a.util.createBuffer();l=a.hmac.create();e=c+e;var m=Math.ceil(d/16);c=Math.ceil(d/20);l.start("MD5",k);k=a.util.createBuffer();b.putBytes(e);
for(var h=0;hd)c.error(c,{message:l?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:b.Alert.Level.fatal,description:b.Alert.Description.illegal_parameter}});else{e=e.fragment;var g=e.length();f={version:{major:e.getByte(),minor:e.getByte()},random:a.util.createBuffer(e.getBytes(32)),session_id:h(e,1),extensions:[]};l?(f.cipher_suite=e.getBytes(2),f.compression_method=e.getByte()):(f.cipher_suites=h(e,2),f.compression_methods=
h(e,1));g=d-(g-e.length());if(0e.version.minor)d=null,f="";0===f.length&&(f=a.random.getBytes(32));c.session.id=f;c.session.clientHelloVersion=
e.version;c.session.sp={};if(d)c.version=c.session.version=d.version,c.session.sp=d.sp;else{for(f=1;fd)return c.error(c,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:b.Alert.Level.fatal,description:b.Alert.Description.illegal_parameter}});d=h(e.fragment,3);e=[];try{for(;0d)return c.error(c,{message:"Invalid key parameters. Only RSA is supported.",
send:!0,alert:{level:b.Alert.Level.fatal,description:b.Alert.Description.unsupported_certificate}});e=h(e.fragment,2).getBytes();d=null;if(c.getPrivateKey)try{d=c.getPrivateKey(c,c.session.serverCertificate),d=a.pki.privateKeyFromPem(d)}catch(R){c.error(c,{message:"Could not get private key.",cause:R,send:!0,alert:{level:b.Alert.Level.fatal,description:b.Alert.Description.internal_error}})}if(null===d)return c.error(c,{message:"No private key set.",send:!0,alert:{level:b.Alert.Level.fatal,description:b.Alert.Description.internal_error}});
try{var f=c.session.sp;f.pre_master_secret=d.decrypt(e);var g=c.session.clientHelloVersion;if(g.major!==f.pre_master_secret.charCodeAt(0)||g.minor!==f.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(R){f.pre_master_secret=a.random.getBytes(48)}c.expect=r;null!==c.session.clientCertificate&&(c.expect=l);c.process()};b.handleCertificateRequest=function(a,c,e){if(3>e)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:b.Alert.Level.fatal,
description:b.Alert.Description.illegal_parameter}});c=c.fragment;c={certificate_types:h(c,1),certificate_authorities:h(c,2)};a.session.certificateRequest=c;a.expect=u;a.process()};b.handleCertificateVerify=function(c,e,d){if(2>d)return c.error(c,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:b.Alert.Level.fatal,description:b.Alert.Description.illegal_parameter}});d=e.fragment;d.read-=4;e=d.bytes();d.read+=4;d=h(d,2).getBytes();var f=a.util.createBuffer();f.putBuffer(c.session.md5.digest());
f.putBuffer(c.session.sha1.digest());f=f.getBytes();try{if(!c.session.clientCertificate.publicKey.verify(f,d,"NONE"))throw Error("CertificateVerify signature does not match.");c.session.md5.update(e);c.session.sha1.update(e)}catch(O){return c.error(c,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:b.Alert.Level.fatal,description:b.Alert.Description.handshake_failure}})}c.expect=r;c.process()};b.handleServerHelloDone=function(c,e,d){if(0d.length())return c.fragmented=e,e.fragment=a.util.createBuffer(),d.read-=4,c.process();c.fragmented=null;d.read-=4;var g=d.bytes(l+
4);d.read+=4;f in C[c.entity][c.expect]?(c.entity!==b.ConnectionEnd.server||c.open||c.fail||(c.handshaking=!0,c.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:a.md.md5.create(),sha1:a.md.sha1.create()}),f!==b.HandshakeType.hello_request&&f!==b.HandshakeType.certificate_verify&&f!==b.HandshakeType.finished&&(c.session.md5.update(g),c.session.sha1.update(g)),C[c.entity][c.expect][f](c,e,l)):
b.handleUnexpected(c,e)};b.handleApplicationData=function(a,b){a.data.putBuffer(b.fragment);a.dataReady(a);a.process()};b.handleHeartbeat=function(c,e){var d=e.fragment,f=d.getByte(),l=d.getInt16();d=d.getBytes(l);if(f===b.HeartbeatMessageType.heartbeat_request){if(c.handshaking||l>d.length)return c.process();b.queue(c,b.createRecord(c,{type:b.ContentType.heartbeat,data:b.createHeartbeat(b.HeartbeatMessageType.heartbeat_response,d)}));b.flush(c)}else if(f===b.HeartbeatMessageType.heartbeat_response){if(d!==
c.expectedHeartbeatPayload)return c.process();c.heartbeatReceived&&c.heartbeatReceived(c,a.util.createBuffer(d))}c.process()};var e=1,w=2,k=3,u=4,v=5,c=6,q=7,x=8,D=1,A=2,l=3,r=4,n=5,F=6,m=b.handleUnexpected,t=b.handleChangeCipherSpec,M=b.handleAlert,I=b.handleHandshake,Q=b.handleApplicationData,y=b.handleHeartbeat,z=[];z[b.ConnectionEnd.client]=[[m,M,I,m,y],[m,M,I,m,y],[m,M,I,m,y],[m,M,I,m,y],[m,M,I,m,y],[t,M,m,m,y],[m,M,I,m,y],[m,M,I,Q,y],[m,M,I,m,y]];z[b.ConnectionEnd.server]=[[m,M,I,m,y],[m,M,
I,m,y],[m,M,I,m,y],[m,M,I,m,y],[t,M,m,m,y],[m,M,I,m,y],[m,M,I,Q,y],[m,M,I,m,y]];t=b.handleHelloRequest;M=b.handleCertificate;I=b.handleServerKeyExchange;Q=b.handleCertificateRequest;y=b.handleServerHelloDone;var B=b.handleFinished,C=[];C[b.ConnectionEnd.client]=[[m,m,b.handleServerHello,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m],[t,m,m,m,m,m,m,m,m,m,m,M,I,Q,y,m,m,m,m,m,m],[t,m,m,m,m,m,m,m,m,m,m,m,I,Q,y,m,m,m,m,m,m],[t,m,m,m,m,m,m,m,m,m,m,m,m,Q,y,m,m,m,m,m,m],[t,m,m,m,m,m,m,m,m,m,m,m,m,m,y,m,m,m,m,m,m],
[t,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m],[t,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,B],[t,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m],[t,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m]];C[b.ConnectionEnd.server]=[[m,b.handleClientHello,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m],[m,m,m,m,m,m,m,m,m,m,m,M,m,m,m,m,m,m,m,m,m],[m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,b.handleClientKeyExchange,m,m,m,m],[m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,b.handleCertificateVerify,m,m,m,m,m],[m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m],[m,m,m,m,m,
m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,B],[m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m],[m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m]];b.generateKeys=function(a,c){var e=c.client_random+c.server_random;a.session.resuming||(c.master_secret=g(c.pre_master_secret,"master secret",e,48).bytes(),c.pre_master_secret=null);e=c.server_random+c.client_random;var d=2*c.mac_key_length+2*c.enc_key_length,f=a.version.major===b.Versions.TLS_1_0.major&&a.version.minor===b.Versions.TLS_1_0.minor;f&&(d+=2*c.fixed_iv_length);e=
g(c.master_secret,"key expansion",e,d);d={client_write_MAC_key:e.getBytes(c.mac_key_length),server_write_MAC_key:e.getBytes(c.mac_key_length),client_write_key:e.getBytes(c.enc_key_length),server_write_key:e.getBytes(c.enc_key_length)};f&&(d.client_write_IV=e.getBytes(c.fixed_iv_length),d.server_write_IV=e.getBytes(c.fixed_iv_length));return d};b.createConnectionState=function(a){var c=a.entity===b.ConnectionEnd.client,e=function(){var a={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,
cipherState:null,cipherFunction:function(a){return!0},compressionState:null,compressFunction:function(a){return!0},updateSequenceNumber:function(){4294967295===a.sequenceNumber[1]?(a.sequenceNumber[1]=0,++a.sequenceNumber[0]):++a.sequenceNumber[1]}};return a},f={read:e(),write:e()};f.read.update=function(a,c){f.read.cipherFunction(c,f.read)?f.read.compressFunction(a,c,f.read)||a.error(a,{message:"Could not decompress record.",send:!0,alert:{level:b.Alert.Level.fatal,description:b.Alert.Description.decompression_failure}}):
a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:b.Alert.Level.fatal,description:b.Alert.Description.bad_record_mac}});return!a.fail};f.write.update=function(a,c){f.write.compressFunction(a,c,f.write)?f.write.cipherFunction(c,f.write)||a.error(a,{message:"Could not encrypt record.",send:!1,alert:{level:b.Alert.Level.fatal,description:b.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:b.Alert.Level.fatal,description:b.Alert.Description.internal_error}});
return!a.fail};if(a.session)switch(e=a.session.sp,a.session.cipherSuite.initSecurityParameters(e),e.keys=b.generateKeys(a,e),f.read.macKey=c?e.keys.server_write_MAC_key:e.keys.client_write_MAC_key,f.write.macKey=c?e.keys.client_write_MAC_key:e.keys.server_write_MAC_key,a.session.cipherSuite.initConnectionState(f,a,e),e.compression_algorithm){case b.CompressionMethod.none:break;case b.CompressionMethod.deflate:f.read.compressFunction=p;f.write.compressFunction=d;break;default:throw Error("Unsupported compression algorithm.");
}return f};b.createRandom=function(){var b=new Date;b=+b+6E4*b.getTimezoneOffset();var c=a.util.createBuffer();c.putInt32(b);c.putBytes(a.random.getBytes(28));return c};b.createRecord=function(a,b){return b.data?{type:b.type,version:{major:a.version.major,minor:a.version.minor},length:b.data.length(),fragment:b.data}:null};b.createAlert=function(c,e){var d=a.util.createBuffer();d.putByte(e.level);d.putByte(e.description);return b.createRecord(c,{type:b.ContentType.alert,data:d})};b.createClientHello=
function(c){c.session.clientHelloVersion={major:c.version.major,minor:c.version.minor};for(var e=a.util.createBuffer(),d=0;db.MaxFragment;)d.push(b.createRecord(c,{type:e.type,data:a.util.createBuffer(f.slice(0,b.MaxFragment))})),f=f.slice(b.MaxFragment);0d?e=5-d:(g.record={type:c.getByte(),version:{major:c.getByte(),minor:c.getByte()},length:c.getInt16(),fragment:a.util.createBuffer(),ready:!1},(c=g.record.version.major===
g.version.major)&&g.session&&g.session.version&&(c=g.record.version.minor===g.version.minor),c||g.error(g,{message:"Incompatible TLS version.",send:!0,alert:{level:b.Alert.Level.fatal,description:b.Alert.Description.protocol_version}}))}if(!g.fail&&null!==g.record&&!g.record.ready){e=g;c=0;d=e.input;var f=d.length();f=b.Versions.TLS_1_1.minor&&c.output.putBytes(g);c.update(e.fragment);c.finish(p)&&(e.fragment=c.output,e.length=e.fragment.length(),f=!0);return f}function p(a,b,e){e||(a-=b.length()%
a,b.fillWithByte(a-1,a));return!0}function h(a,b,e){a=!0;if(e){e=b.length();for(var d=b.last(),c=e-1-d;c=c?(d.fragment=k.output.getBytes(x-c),q=k.output.getBytes(c)):
d.fragment=k.output.getBytes();d.fragment=a.util.createBuffer(d.fragment);d.length=d.fragment.length();c=f.macFunction(f.macKey,f.sequenceNumber,d);f.updateSequenceNumber();k=f.macKey;x=a.hmac.create();x.start("SHA1",k);x.update(q);q=x.digest().getBytes();x.start(null,null);x.update(c);c=x.digest().getBytes();return q===c&&g}var b=a.tls;b.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=b.BulkCipherAlgorithm.aes;
a.cipher_type=b.CipherType.block;a.enc_key_length=16;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=b.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:g};b.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=b.BulkCipherAlgorithm.aes;a.cipher_type=b.CipherType.block;a.enc_key_length=32;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=
16;a.mac_algorithm=b.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:g};var e=0}if("function"!==typeof t)if("object"===typeof module&&module.exports){var B=!0;t=function(a,g){g(H,module)}}else return"undefined"===typeof forge&&(forge={}),p(forge);var y,C=function(a,g){g.exports=function(d){var g=y.map(function(d){return a(d)}).concat(p);d=d||{};d.defined=d.defined||{};if(d.defined.aesCipherSuites)return d.aesCipherSuites;d.defined.aesCipherSuites=!0;for(var h=0;h=c&&db.contentInfo.value.length)throw Error("Could not sign PKCS#7 message; there is no content to sign.");g=k.derToOid(b.contentInfo.value[0].value);e=b.contentInfo.value[1];e=e.value[0];var p=k.toDer(e);p.getByte();k.getBerValueLength(p);p=p.getBytes();for(var l in c)c[l].start().update(p);l=new Date;for(e=0;e"+C("B",a.length),a)}function p(a){return B(">"+C("H",a.length),a)}function H(a){return B(">"+C("L",a.length),a)}function t(a,b,e){var d=Object.keys(a).length,f=B(">H",[d]);d=-1<["0th","1st"].indexOf(b)?12*d+6:2+12*d;var g="",v="",c;for(c in a)if("string"==typeof c&&(c=parseInt(c)),!("0th"==b&&-1<[34665,34853].indexOf(c)||"Exif"==b&&40965==c||"1st"==b&&-1<[513,514].indexOf(c))){var q=a[c],x=B(">H",[c]),t=h[b][c].type,A=B(">H",[G[t]]);"number"==typeof q&&(q=[q]);
var l,r=void 0,n=t;t=8+d+e+v.length;var F=l="";if("Byte"==n)r=q.length,4>=r?F=E(q)+C("\x00",4-r):(F=B(">L",[t]),l=E(q));else if("Short"==n)r=q.length,2>=r?F=p(q)+C("\x00\x00",2-r):(F=B(">L",[t]),l=p(q));else if("Long"==n)r=q.length,1>=r?F=H(q):(F=B(">L",[t]),l=H(q));else if("Ascii"==n)n=q+"\x00",r=n.length,4L",[t]),l=n):F=n+C("\x00",4-r);else if("Rational"==n){if("number"==typeof q[0])r=1,F=q[0],l=q[1],n=B(">L",[F])+B(">L",[l]);else{r=q.length;n="";for(var m=0;mL",[F])+B(">L",[l])}F=B(">L",[t]);l=n}else if("SRational"==n){if("number"==typeof q[0])r=1,F=q[0],l=q[1],n=B(">l",[F])+B(">l",[l]);else for(r=q.length,n="",m=0;ml",[F])+B(">l",[l]);F=B(">L",[t]);l=n}else"Undefined"==n&&(r=q.length,4L",[t]),l=q):F=q+C("\x00",4-r));r=[B(">L",[r]),F,l];q=r[2];g+=x+A+r[0]+r[1];v+=q}return[f+g,v]}function K(a){if("\u00ff\u00d8"==a.slice(0,2)){a=z(a);a:{for(var b,e=0;e"==a[0])e=!1;else throw"";for(var d="",f=1,g,h;h=
a[f];){if("b"==h.toLowerCase()){g=b[f-1];"b"==h&&0>g&&(g+=256);if(255g)throw"'pack' error.";g=String.fromCharCode(g)}else if("H"==h){g=b[f-1];if(65535g)throw"'pack' error.";g=String.fromCharCode(Math.floor(g%65536/256))+String.fromCharCode(g%256);e&&(g=g.split("").reverse().join(""))}else if("l"==h.toLowerCase()){g=b[f-1];"l"==h&&0>g&&(g+=4294967296);if(4294967295g)throw"'pack' error.";g=String.fromCharCode(Math.floor(g/16777216))+String.fromCharCode(Math.floor(g%16777216/65536))+
String.fromCharCode(Math.floor(g%65536/256))+String.fromCharCode(g%256);e&&(g=g.split("").reverse().join(""))}else throw"'pack' error.";d+=g;f+=1}return d}function y(a,b){if("string"!=typeof b)throw"'unpack' error. Got invalid type argument.";for(var e=0,d=1;d"==a[0])e=!1;else throw"'unpack' error.";d=[];for(var f=0,g=1,h,c,q;c=a[g];){if("b"==c.toLowerCase())q=1,h=b.slice(f,f+q),h=h.charCodeAt(0),"b"==c&&128<=h&&(h-=256);else if("H"==c)q=2,h=b.slice(f,f+q),e&&(h=h.split("").reverse().join("")),h=256*h.charCodeAt(0)+h.charCodeAt(1);else if("l"==c.toLowerCase())q=4,h=b.slice(f,f+q),e&&(h=h.split("").reverse().join("")),h=16777216*h.charCodeAt(0)+65536*h.charCodeAt(1)+256*h.charCodeAt(2)+h.charCodeAt(3),"l"==c&&
2147483648<=h&&(h-=4294967296);else throw"'unpack' error. "+c;d.push(h);f+=q;g+=1}return d}function C(a,b){for(var e="",d=0;dH",a.slice(b+2,b+4))[0];d=b+d+2;e.push(a.slice(b,d));b=d}if(b>=a.length)throw"Wrong JPEG data.";}return e}var a={version:"1.03",remove:function(a){var b=!1;if("\u00ff\u00d8"!=
a.slice(0,2))if("data:image/jpeg;base64,"==a.slice(0,23)||"data:image/jpg;base64,"==a.slice(0,22))a=d(a.split(",")[1]),b=!0;else throw"Given data is not jpeg.";a=z(a);if("\u00ff\u00e1"==a[1].slice(0,2)&&"Exif\x00\x00"==a[1].slice(4,10))a=[a[0]].concat(a.slice(2));else if("\u00ff\u00e1"==a[2].slice(0,2)&&"Exif\x00\x00"==a[2].slice(4,10))a=a.slice(0,2).concat(a.slice(3));else throw"Exif not found.";a=a.join("");b&&(a="data:image/jpeg;base64,"+g(a));return a},insert:function(a,b){var e=!1;if("Exif\x00\x00"!=
a.slice(0,6))throw"Given data is not exif.";if("\u00ff\u00d8"!=b.slice(0,2))if("data:image/jpeg;base64,"==b.slice(0,23)||"data:image/jpg;base64,"==b.slice(0,22))b=d(b.split(",")[1]),e=!0;else throw"Given data is not jpeg.";var f="\u00ff\u00e1"+B(">H",[a.length+2])+a,h=z(b);"\u00ff\u00e0"==h[1].slice(0,2)&&"\u00ff\u00e1"==h[2].slice(0,2)&&"Exif\x00\x00"==h[2].slice(4,10)?f?(h[2]=f,h=["\u00ff\u00d8"].concat(h.slice(2))):h=null==f?h.slice(0,2).concat(h.slice(3)):h.slice(0).concat(h.slice(2)):"\u00ff\u00e0"==
h[1].slice(0,2)?f&&(h[1]=f):"\u00ff\u00e1"==h[1].slice(0,2)&&"Exif\x00\x00"==h[1].slice(4,10)?f?h[1]=f:null==f&&(h=h.slice(0).concat(h.slice(2))):f&&(h=[h[0],f].concat(h.slice(1)));f=h.join("");e&&(f="data:image/jpeg;base64,"+g(f));return f},load:function(a){if("string"==typeof a)if("\u00ff\u00d8"==a.slice(0,2))var b=a;else if("data:image/jpeg;base64,"==a.slice(0,23)||"data:image/jpg;base64,"==a.slice(0,22))b=d(a.split(",")[1]);else if("Exif"==a.slice(0,4))b=a.slice(6);else throw"'load' gots invalid file data.";
else throw"'load' gots invalid type argument.";a={"0th":{},Exif:{},GPS:{},Interop:{},"1st":{},thumbnail:null};b=new K(b);if(null===b.tiftag)return a;"II"==b.tiftag.slice(0,2)?b.endian_mark="<":b.endian_mark=">";var e=y(b.endian_mark+"L",b.tiftag.slice(4,8))[0];a["0th"]=b.get_ifd(e,"0th");var f=a["0th"].first_ifd_pointer;delete a["0th"].first_ifd_pointer;34665 in a["0th"]&&(e=a["0th"][34665],a.Exif=b.get_ifd(e,"Exif"));34853 in a["0th"]&&(e=a["0th"][34853],a.GPS=b.get_ifd(e,"GPS"));40965 in a.Exif&&
(e=a.Exif[40965],a.Interop=b.get_ifd(e,"Interop"));"\x00\x00\x00\x00"!=f&&(e=y(b.endian_mark+"L",f)[0],a["1st"]=b.get_ifd(e,"1st"),513 in a["1st"]&&514 in a["1st"]&&(b=b.tiftag.slice(a["1st"][513],a["1st"][513]+a["1st"][514]),a.thumbnail=b));return a},dump:function(d){var b=JSON.parse(JSON.stringify(d)),e=d=!1,f=!1,g=!1,h="0th"in b?b["0th"]:{};if("Exif"in b&&Object.keys(b.Exif).length||"Interop"in b&&Object.keys(b.Interop).length){h[34665]=1;d=!0;var p=b.Exif;if("Interop"in b&&Object.keys(b.Interop).length){p[40965]=
1;f=!0;var c=b.Interop}else-1=M[1].slice(0,2);)M=[M[0]].concat(M.slice(2));M=M.join("");if(64E3L",[8+A]);var P=B(">H",[34665]),
U=B(">H",[G.Long]),C=B(">L",[1]);b=P+U+C+q}e&&(q=B(">L",[8+A+l]),P=B(">H",[34853]),U=B(">H",[G.Long]),C=B(">L",[1]),c=P+U+C+q);f&&(q=B(">L",[8+A+l+n]),P=B(">H",[40965]),U=B(">H",[G.Long]),C=B(">L",[1]),x=P+U+C+q);g&&(e=8+A+l+n+m,p=B(">L",[e]),e="\u0002\u0001\x00\u0004\x00\x00\x00\u0001"+B(">L",[e+y[0].length+24+4+y[1].length]),f="\u0002\u0002\x00\u0004\x00\x00\x00\u0001"+B(">L",[M.length]),N=y[0]+e+f+"\x00\x00\x00\x00"+y[1]+M);y=D[0]+b+c+p+D[1];d&&(h=I[0]+x+I[1]);return"Exif\x00\x00MM\x00*\x00\x00\x00\b"+
y+h+r+F+N}};K.prototype={get_ifd:function(a,b){for(var e={},d=y(this.endian_mark+"H",this.tiftag.slice(a,a+2))[0],f=a+2,g=-1<["0th","1st"].indexOf(b)?"Image":b,p=0;p>2,d=(d&3)<<4|f>>4,p=(f&15)<<2|g>>6,c=g&63,isNaN(f)?p=c=64:isNaN(g)&&(c=64),b=b+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(p)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c);
return b});if("undefined"!==typeof window&&"function"===typeof window.atob)var d=window.atob;"undefined"===typeof d&&(d=function(a){var b="",d=0;for(a=a.replace(/[^A-Za-z0-9\+\/=]/g,"");d>4;g=(g&15)<<4|h>>2;var c=(h&3)<<6|p;b+=String.fromCharCode(f);64!=h&&(b+=String.fromCharCode(g));64!=p&&(b+=String.fromCharCode(c))}return b});var G={Byte:1,Ascii:2,Short:3,Long:4,Rational:5,Undefined:7,SLong:9,SRational:10},h={Image:{11:{name:"ProcessingSoftware",type:"Ascii"},254:{name:"NewSubfileType",type:"Long"},255:{name:"SubfileType",type:"Short"},256:{name:"ImageWidth",type:"Long"},257:{name:"ImageLength",type:"Long"},258:{name:"BitsPerSample",type:"Short"},259:{name:"Compression",
type:"Short"},262:{name:"PhotometricInterpretation",type:"Short"},263:{name:"Threshholding",type:"Short"},264:{name:"CellWidth",type:"Short"},265:{name:"CellLength",type:"Short"},266:{name:"FillOrder",type:"Short"},269:{name:"DocumentName",type:"Ascii"},270:{name:"ImageDescription",type:"Ascii"},271:{name:"Make",type:"Ascii"},272:{name:"Model",type:"Ascii"},273:{name:"StripOffsets",type:"Long"},274:{name:"Orientation",type:"Short"},277:{name:"SamplesPerPixel",type:"Short"},278:{name:"RowsPerStrip",
type:"Long"},279:{name:"StripByteCounts",type:"Long"},282:{name:"XResolution",type:"Rational"},283:{name:"YResolution",type:"Rational"},284:{name:"PlanarConfiguration",type:"Short"},290:{name:"GrayResponseUnit",type:"Short"},291:{name:"GrayResponseCurve",type:"Short"},292:{name:"T4Options",type:"Long"},293:{name:"T6Options",type:"Long"},296:{name:"ResolutionUnit",type:"Short"},301:{name:"TransferFunction",type:"Short"},305:{name:"Software",type:"Ascii"},306:{name:"DateTime",type:"Ascii"},315:{name:"Artist",
type:"Ascii"},316:{name:"HostComputer",type:"Ascii"},317:{name:"Predictor",type:"Short"},318:{name:"WhitePoint",type:"Rational"},319:{name:"PrimaryChromaticities",type:"Rational"},320:{name:"ColorMap",type:"Short"},321:{name:"HalftoneHints",type:"Short"},322:{name:"TileWidth",type:"Short"},323:{name:"TileLength",type:"Short"},324:{name:"TileOffsets",type:"Short"},325:{name:"TileByteCounts",type:"Short"},330:{name:"SubIFDs",type:"Long"},332:{name:"InkSet",type:"Short"},333:{name:"InkNames",type:"Ascii"},
334:{name:"NumberOfInks",type:"Short"},336:{name:"DotRange",type:"Byte"},337:{name:"TargetPrinter",type:"Ascii"},338:{name:"ExtraSamples",type:"Short"},339:{name:"SampleFormat",type:"Short"},340:{name:"SMinSampleValue",type:"Short"},341:{name:"SMaxSampleValue",type:"Short"},342:{name:"TransferRange",type:"Short"},343:{name:"ClipPath",type:"Byte"},344:{name:"XClipPathUnits",type:"Long"},345:{name:"YClipPathUnits",type:"Long"},346:{name:"Indexed",type:"Short"},347:{name:"JPEGTables",type:"Undefined"},
351:{name:"OPIProxy",type:"Short"},512:{name:"JPEGProc",type:"Long"},513:{name:"JPEGInterchangeFormat",type:"Long"},514:{name:"JPEGInterchangeFormatLength",type:"Long"},515:{name:"JPEGRestartInterval",type:"Short"},517:{name:"JPEGLosslessPredictors",type:"Short"},518:{name:"JPEGPointTransforms",type:"Short"},519:{name:"JPEGQTables",type:"Long"},520:{name:"JPEGDCTables",type:"Long"},521:{name:"JPEGACTables",type:"Long"},529:{name:"YCbCrCoefficients",type:"Rational"},530:{name:"YCbCrSubSampling",type:"Short"},
531:{name:"YCbCrPositioning",type:"Short"},532:{name:"ReferenceBlackWhite",type:"Rational"},700:{name:"XMLPacket",type:"Byte"},18246:{name:"Rating",type:"Short"},18249:{name:"RatingPercent",type:"Short"},32781:{name:"ImageID",type:"Ascii"},33421:{name:"CFARepeatPatternDim",type:"Short"},33422:{name:"CFAPattern",type:"Byte"},33423:{name:"BatteryLevel",type:"Rational"},33432:{name:"Copyright",type:"Ascii"},33434:{name:"ExposureTime",type:"Rational"},34377:{name:"ImageResources",type:"Byte"},34665:{name:"ExifTag",
type:"Long"},34675:{name:"InterColorProfile",type:"Undefined"},34853:{name:"GPSTag",type:"Long"},34857:{name:"Interlace",type:"Short"},34858:{name:"TimeZoneOffset",type:"Long"},34859:{name:"SelfTimerMode",type:"Short"},37387:{name:"FlashEnergy",type:"Rational"},37388:{name:"SpatialFrequencyResponse",type:"Undefined"},37389:{name:"Noise",type:"Undefined"},37390:{name:"FocalPlaneXResolution",type:"Rational"},37391:{name:"FocalPlaneYResolution",type:"Rational"},37392:{name:"FocalPlaneResolutionUnit",
type:"Short"},37393:{name:"ImageNumber",type:"Long"},37394:{name:"SecurityClassification",type:"Ascii"},37395:{name:"ImageHistory",type:"Ascii"},37397:{name:"ExposureIndex",type:"Rational"},37398:{name:"TIFFEPStandardID",type:"Byte"},37399:{name:"SensingMethod",type:"Short"},40091:{name:"XPTitle",type:"Byte"},40092:{name:"XPComment",type:"Byte"},40093:{name:"XPAuthor",type:"Byte"},40094:{name:"XPKeywords",type:"Byte"},40095:{name:"XPSubject",type:"Byte"},50341:{name:"PrintImageMatching",type:"Undefined"},
50706:{name:"DNGVersion",type:"Byte"},50707:{name:"DNGBackwardVersion",type:"Byte"},50708:{name:"UniqueCameraModel",type:"Ascii"},50709:{name:"LocalizedCameraModel",type:"Byte"},50710:{name:"CFAPlaneColor",type:"Byte"},50711:{name:"CFALayout",type:"Short"},50712:{name:"LinearizationTable",type:"Short"},50713:{name:"BlackLevelRepeatDim",type:"Short"},50714:{name:"BlackLevel",type:"Rational"},50715:{name:"BlackLevelDeltaH",type:"SRational"},50716:{name:"BlackLevelDeltaV",type:"SRational"},50717:{name:"WhiteLevel",
type:"Short"},50718:{name:"DefaultScale",type:"Rational"},50719:{name:"DefaultCropOrigin",type:"Short"},50720:{name:"DefaultCropSize",type:"Short"},50721:{name:"ColorMatrix1",type:"SRational"},50722:{name:"ColorMatrix2",type:"SRational"},50723:{name:"CameraCalibration1",type:"SRational"},50724:{name:"CameraCalibration2",type:"SRational"},50725:{name:"ReductionMatrix1",type:"SRational"},50726:{name:"ReductionMatrix2",type:"SRational"},50727:{name:"AnalogBalance",type:"Rational"},50728:{name:"AsShotNeutral",
type:"Short"},50729:{name:"AsShotWhiteXY",type:"Rational"},50730:{name:"BaselineExposure",type:"SRational"},50731:{name:"BaselineNoise",type:"Rational"},50732:{name:"BaselineSharpness",type:"Rational"},50733:{name:"BayerGreenSplit",type:"Long"},50734:{name:"LinearResponseLimit",type:"Rational"},50735:{name:"CameraSerialNumber",type:"Ascii"},50736:{name:"LensInfo",type:"Rational"},50737:{name:"ChromaBlurRadius",type:"Rational"},50738:{name:"AntiAliasStrength",type:"Rational"},50739:{name:"ShadowScale",
type:"SRational"},50740:{name:"DNGPrivateData",type:"Byte"},50741:{name:"MakerNoteSafety",type:"Short"},50778:{name:"CalibrationIlluminant1",type:"Short"},50779:{name:"CalibrationIlluminant2",type:"Short"},50780:{name:"BestQualityScale",type:"Rational"},50781:{name:"RawDataUniqueID",type:"Byte"},50827:{name:"OriginalRawFileName",type:"Byte"},50828:{name:"OriginalRawFileData",type:"Undefined"},50829:{name:"ActiveArea",type:"Short"},50830:{name:"MaskedAreas",type:"Short"},50831:{name:"AsShotICCProfile",
type:"Undefined"},50832:{name:"AsShotPreProfileMatrix",type:"SRational"},50833:{name:"CurrentICCProfile",type:"Undefined"},50834:{name:"CurrentPreProfileMatrix",type:"SRational"},50879:{name:"ColorimetricReference",type:"Short"},50931:{name:"CameraCalibrationSignature",type:"Byte"},50932:{name:"ProfileCalibrationSignature",type:"Byte"},50934:{name:"AsShotProfileName",type:"Byte"},50935:{name:"NoiseReductionApplied",type:"Rational"},50936:{name:"ProfileName",type:"Byte"},50937:{name:"ProfileHueSatMapDims",
type:"Long"},50938:{name:"ProfileHueSatMapData1",type:"Float"},50939:{name:"ProfileHueSatMapData2",type:"Float"},50940:{name:"ProfileToneCurve",type:"Float"},50941:{name:"ProfileEmbedPolicy",type:"Long"},50942:{name:"ProfileCopyright",type:"Byte"},50964:{name:"ForwardMatrix1",type:"SRational"},50965:{name:"ForwardMatrix2",type:"SRational"},50966:{name:"PreviewApplicationName",type:"Byte"},50967:{name:"PreviewApplicationVersion",type:"Byte"},50968:{name:"PreviewSettingsName",type:"Byte"},50969:{name:"PreviewSettingsDigest",
type:"Byte"},50970:{name:"PreviewColorSpace",type:"Long"},50971:{name:"PreviewDateTime",type:"Ascii"},50972:{name:"RawImageDigest",type:"Undefined"},50973:{name:"OriginalRawFileDigest",type:"Undefined"},50974:{name:"SubTileBlockSize",type:"Long"},50975:{name:"RowInterleaveFactor",type:"Long"},50981:{name:"ProfileLookTableDims",type:"Long"},50982:{name:"ProfileLookTableData",type:"Float"},51008:{name:"OpcodeList1",type:"Undefined"},51009:{name:"OpcodeList2",type:"Undefined"},51022:{name:"OpcodeList3",
type:"Undefined"}},Exif:{33434:{name:"ExposureTime",type:"Rational"},33437:{name:"FNumber",type:"Rational"},34850:{name:"ExposureProgram",type:"Short"},34852:{name:"SpectralSensitivity",type:"Ascii"},34855:{name:"ISOSpeedRatings",type:"Short"},34856:{name:"OECF",type:"Undefined"},34864:{name:"SensitivityType",type:"Short"},34865:{name:"StandardOutputSensitivity",type:"Long"},34866:{name:"RecommendedExposureIndex",type:"Long"},34867:{name:"ISOSpeed",type:"Long"},34868:{name:"ISOSpeedLatitudeyyy",type:"Long"},
34869:{name:"ISOSpeedLatitudezzz",type:"Long"},36864:{name:"ExifVersion",type:"Undefined"},36867:{name:"DateTimeOriginal",type:"Ascii"},36868:{name:"DateTimeDigitized",type:"Ascii"},37121:{name:"ComponentsConfiguration",type:"Undefined"},37122:{name:"CompressedBitsPerPixel",type:"Rational"},37377:{name:"ShutterSpeedValue",type:"SRational"},37378:{name:"ApertureValue",type:"Rational"},37379:{name:"BrightnessValue",type:"SRational"},37380:{name:"ExposureBiasValue",type:"SRational"},37381:{name:"MaxApertureValue",
type:"Rational"},37382:{name:"SubjectDistance",type:"Rational"},37383:{name:"MeteringMode",type:"Short"},37384:{name:"LightSource",type:"Short"},37385:{name:"Flash",type:"Short"},37386:{name:"FocalLength",type:"Rational"},37396:{name:"SubjectArea",type:"Short"},37500:{name:"MakerNote",type:"Undefined"},37510:{name:"UserComment",type:"Ascii"},37520:{name:"SubSecTime",type:"Ascii"},37521:{name:"SubSecTimeOriginal",type:"Ascii"},37522:{name:"SubSecTimeDigitized",type:"Ascii"},40960:{name:"FlashpixVersion",
type:"Undefined"},40961:{name:"ColorSpace",type:"Short"},40962:{name:"PixelXDimension",type:"Long"},40963:{name:"PixelYDimension",type:"Long"},40964:{name:"RelatedSoundFile",type:"Ascii"},40965:{name:"InteroperabilityTag",type:"Long"},41483:{name:"FlashEnergy",type:"Rational"},41484:{name:"SpatialFrequencyResponse",type:"Undefined"},41486:{name:"FocalPlaneXResolution",type:"Rational"},41487:{name:"FocalPlaneYResolution",type:"Rational"},41488:{name:"FocalPlaneResolutionUnit",type:"Short"},41492:{name:"SubjectLocation",
type:"Short"},41493:{name:"ExposureIndex",type:"Rational"},41495:{name:"SensingMethod",type:"Short"},41728:{name:"FileSource",type:"Undefined"},41729:{name:"SceneType",type:"Undefined"},41730:{name:"CFAPattern",type:"Undefined"},41985:{name:"CustomRendered",type:"Short"},41986:{name:"ExposureMode",type:"Short"},41987:{name:"WhiteBalance",type:"Short"},41988:{name:"DigitalZoomRatio",type:"Rational"},41989:{name:"FocalLengthIn35mmFilm",type:"Short"},41990:{name:"SceneCaptureType",type:"Short"},41991:{name:"GainControl",
type:"Short"},41992:{name:"Contrast",type:"Short"},41993:{name:"Saturation",type:"Short"},41994:{name:"Sharpness",type:"Short"},41995:{name:"DeviceSettingDescription",type:"Undefined"},41996:{name:"SubjectDistanceRange",type:"Short"},42016:{name:"ImageUniqueID",type:"Ascii"},42032:{name:"CameraOwnerName",type:"Ascii"},42033:{name:"BodySerialNumber",type:"Ascii"},42034:{name:"LensSpecification",type:"Rational"},42035:{name:"LensMake",type:"Ascii"},42036:{name:"LensModel",type:"Ascii"},42037:{name:"LensSerialNumber",
type:"Ascii"},42240:{name:"Gamma",type:"Rational"}},GPS:{0:{name:"GPSVersionID",type:"Byte"},1:{name:"GPSLatitudeRef",type:"Ascii"},2:{name:"GPSLatitude",type:"Rational"},3:{name:"GPSLongitudeRef",type:"Ascii"},4:{name:"GPSLongitude",type:"Rational"},5:{name:"GPSAltitudeRef",type:"Byte"},6:{name:"GPSAltitude",type:"Rational"},7:{name:"GPSTimeStamp",type:"Rational"},8:{name:"GPSSatellites",type:"Ascii"},9:{name:"GPSStatus",type:"Ascii"},10:{name:"GPSMeasureMode",type:"Ascii"},11:{name:"GPSDOP",type:"Rational"},
12:{name:"GPSSpeedRef",type:"Ascii"},13:{name:"GPSSpeed",type:"Rational"},14:{name:"GPSTrackRef",type:"Ascii"},15:{name:"GPSTrack",type:"Rational"},16:{name:"GPSImgDirectionRef",type:"Ascii"},17:{name:"GPSImgDirection",type:"Rational"},18:{name:"GPSMapDatum",type:"Ascii"},19:{name:"GPSDestLatitudeRef",type:"Ascii"},20:{name:"GPSDestLatitude",type:"Rational"},21:{name:"GPSDestLongitudeRef",type:"Ascii"},22:{name:"GPSDestLongitude",type:"Rational"},23:{name:"GPSDestBearingRef",type:"Ascii"},24:{name:"GPSDestBearing",
type:"Rational"},25:{name:"GPSDestDistanceRef",type:"Ascii"},26:{name:"GPSDestDistance",type:"Rational"},27:{name:"GPSProcessingMethod",type:"Undefined"},28:{name:"GPSAreaInformation",type:"Undefined"},29:{name:"GPSDateStamp",type:"Ascii"},30:{name:"GPSDifferential",type:"Short"},31:{name:"GPSHPositioningError",type:"Rational"}},Interop:{1:{name:"InteroperabilityIndex",type:"Ascii"}}};h["0th"]=h.Image;h["1st"]=h.Image;a.TAGS=h;a.ImageIFD={ProcessingSoftware:11,NewSubfileType:254,SubfileType:255,ImageWidth:256,
ImageLength:257,BitsPerSample:258,Compression:259,PhotometricInterpretation:262,Threshholding:263,CellWidth:264,CellLength:265,FillOrder:266,DocumentName:269,ImageDescription:270,Make:271,Model:272,StripOffsets:273,Orientation:274,SamplesPerPixel:277,RowsPerStrip:278,StripByteCounts:279,XResolution:282,YResolution:283,PlanarConfiguration:284,GrayResponseUnit:290,GrayResponseCurve:291,T4Options:292,T6Options:293,ResolutionUnit:296,TransferFunction:301,Software:305,DateTime:306,Artist:315,HostComputer:316,
Predictor:317,WhitePoint:318,PrimaryChromaticities:319,ColorMap:320,HalftoneHints:321,TileWidth:322,TileLength:323,TileOffsets:324,TileByteCounts:325,SubIFDs:330,InkSet:332,InkNames:333,NumberOfInks:334,DotRange:336,TargetPrinter:337,ExtraSamples:338,SampleFormat:339,SMinSampleValue:340,SMaxSampleValue:341,TransferRange:342,ClipPath:343,XClipPathUnits:344,YClipPathUnits:345,Indexed:346,JPEGTables:347,OPIProxy:351,JPEGProc:512,JPEGInterchangeFormat:513,JPEGInterchangeFormatLength:514,JPEGRestartInterval:515,
JPEGLosslessPredictors:517,JPEGPointTransforms:518,JPEGQTables:519,JPEGDCTables:520,JPEGACTables:521,YCbCrCoefficients:529,YCbCrSubSampling:530,YCbCrPositioning:531,ReferenceBlackWhite:532,XMLPacket:700,Rating:18246,RatingPercent:18249,ImageID:32781,CFARepeatPatternDim:33421,CFAPattern:33422,BatteryLevel:33423,Copyright:33432,ExposureTime:33434,ImageResources:34377,ExifTag:34665,InterColorProfile:34675,GPSTag:34853,Interlace:34857,TimeZoneOffset:34858,SelfTimerMode:34859,FlashEnergy:37387,SpatialFrequencyResponse:37388,
Noise:37389,FocalPlaneXResolution:37390,FocalPlaneYResolution:37391,FocalPlaneResolutionUnit:37392,ImageNumber:37393,SecurityClassification:37394,ImageHistory:37395,ExposureIndex:37397,TIFFEPStandardID:37398,SensingMethod:37399,XPTitle:40091,XPComment:40092,XPAuthor:40093,XPKeywords:40094,XPSubject:40095,PrintImageMatching:50341,DNGVersion:50706,DNGBackwardVersion:50707,UniqueCameraModel:50708,LocalizedCameraModel:50709,CFAPlaneColor:50710,CFALayout:50711,LinearizationTable:50712,BlackLevelRepeatDim:50713,
BlackLevel:50714,BlackLevelDeltaH:50715,BlackLevelDeltaV:50716,WhiteLevel:50717,DefaultScale:50718,DefaultCropOrigin:50719,DefaultCropSize:50720,ColorMatrix1:50721,ColorMatrix2:50722,CameraCalibration1:50723,CameraCalibration2:50724,ReductionMatrix1:50725,ReductionMatrix2:50726,AnalogBalance:50727,AsShotNeutral:50728,AsShotWhiteXY:50729,BaselineExposure:50730,BaselineNoise:50731,BaselineSharpness:50732,BayerGreenSplit:50733,LinearResponseLimit:50734,CameraSerialNumber:50735,LensInfo:50736,ChromaBlurRadius:50737,
AntiAliasStrength:50738,ShadowScale:50739,DNGPrivateData:50740,MakerNoteSafety:50741,CalibrationIlluminant1:50778,CalibrationIlluminant2:50779,BestQualityScale:50780,RawDataUniqueID:50781,OriginalRawFileName:50827,OriginalRawFileData:50828,ActiveArea:50829,MaskedAreas:50830,AsShotICCProfile:50831,AsShotPreProfileMatrix:50832,CurrentICCProfile:50833,CurrentPreProfileMatrix:50834,ColorimetricReference:50879,CameraCalibrationSignature:50931,ProfileCalibrationSignature:50932,AsShotProfileName:50934,NoiseReductionApplied:50935,
ProfileName:50936,ProfileHueSatMapDims:50937,ProfileHueSatMapData1:50938,ProfileHueSatMapData2:50939,ProfileToneCurve:50940,ProfileEmbedPolicy:50941,ProfileCopyright:50942,ForwardMatrix1:50964,ForwardMatrix2:50965,PreviewApplicationName:50966,PreviewApplicationVersion:50967,PreviewSettingsName:50968,PreviewSettingsDigest:50969,PreviewColorSpace:50970,PreviewDateTime:50971,RawImageDigest:50972,OriginalRawFileDigest:50973,SubTileBlockSize:50974,RowInterleaveFactor:50975,ProfileLookTableDims:50981,ProfileLookTableData:50982,
OpcodeList1:51008,OpcodeList2:51009,OpcodeList3:51022,NoiseProfile:51041};a.ExifIFD={ExposureTime:33434,FNumber:33437,ExposureProgram:34850,SpectralSensitivity:34852,ISOSpeedRatings:34855,OECF:34856,SensitivityType:34864,StandardOutputSensitivity:34865,RecommendedExposureIndex:34866,ISOSpeed:34867,ISOSpeedLatitudeyyy:34868,ISOSpeedLatitudezzz:34869,ExifVersion:36864,DateTimeOriginal:36867,DateTimeDigitized:36868,ComponentsConfiguration:37121,CompressedBitsPerPixel:37122,ShutterSpeedValue:37377,ApertureValue:37378,
BrightnessValue:37379,ExposureBiasValue:37380,MaxApertureValue:37381,SubjectDistance:37382,MeteringMode:37383,LightSource:37384,Flash:37385,FocalLength:37386,SubjectArea:37396,MakerNote:37500,UserComment:37510,SubSecTime:37520,SubSecTimeOriginal:37521,SubSecTimeDigitized:37522,FlashpixVersion:40960,ColorSpace:40961,PixelXDimension:40962,PixelYDimension:40963,RelatedSoundFile:40964,InteroperabilityTag:40965,FlashEnergy:41483,SpatialFrequencyResponse:41484,FocalPlaneXResolution:41486,FocalPlaneYResolution:41487,
FocalPlaneResolutionUnit:41488,SubjectLocation:41492,ExposureIndex:41493,SensingMethod:41495,FileSource:41728,SceneType:41729,CFAPattern:41730,CustomRendered:41985,ExposureMode:41986,WhiteBalance:41987,DigitalZoomRatio:41988,FocalLengthIn35mmFilm:41989,SceneCaptureType:41990,GainControl:41991,Contrast:41992,Saturation:41993,Sharpness:41994,DeviceSettingDescription:41995,SubjectDistanceRange:41996,ImageUniqueID:42016,CameraOwnerName:42032,BodySerialNumber:42033,LensSpecification:42034,LensMake:42035,
LensModel:42036,LensSerialNumber:42037,Gamma:42240};a.GPSIFD={GPSVersionID:0,GPSLatitudeRef:1,GPSLatitude:2,GPSLongitudeRef:3,GPSLongitude:4,GPSAltitudeRef:5,GPSAltitude:6,GPSTimeStamp:7,GPSSatellites:8,GPSStatus:9,GPSMeasureMode:10,GPSDOP:11,GPSSpeedRef:12,GPSSpeed:13,GPSTrackRef:14,GPSTrack:15,GPSImgDirectionRef:16,GPSImgDirection:17,GPSMapDatum:18,GPSDestLatitudeRef:19,GPSDestLatitude:20,GPSDestLongitudeRef:21,GPSDestLongitude:22,GPSDestBearingRef:23,GPSDestBearing:24,GPSDestDistanceRef:25,GPSDestDistance:26,
GPSProcessingMethod:27,GPSAreaInformation:28,GPSDateStamp:29,GPSDifferential:30,GPSHPositioningError:31};a.InteropIFD={InteroperabilityIndex:1};a.GPSHelper={degToDmsRational:function(a){var b=a%1*60;return[[Math.floor(a),1],[Math.floor(b),1],[Math.round(b%1*6E3),100]]},dmsRationalToDeg:function(a,b){return("S"===b||"W"===b?-1:1)*a[0][0]/a[0][1]+a[1][0]/a[1][1]/60+a[2][0]/a[2][1]/3600}};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=a),exports.piexif=
a):window.piexif=a})();var twcaLib=new twidCryptoLibSync,twcaCryptoLibAlertDialog=new TwcaCryptoLibAlertDialog,twcaDialogParams;
function twidCryptoLibSync(){function E(){var a=!1;try{window.opener&&window.opener.twcaLib&&window.location.hostname===window.opener.location.hostname&&(window.opener.twcaLib.setOpenWindowObject(window),a=!0)}catch(r){a=!1}return a}function p(a,c,e,f){function g(a,b,c,d,e,f){var g=forge.pkcs7.createSignedData();switch(c){case 0:g.content=forge.util.createBuffer(z(a),"raw");break;case 1:g.content=forge.util.createBuffer(a,"utf8");break;case 2:g.content="undefined"==typeof Big5Encoding?forge.util.createBuffer(a,
"utf8"):forge.util.createBuffer(Big5Encoding.getBig5Encoding(a),"raw");break;default:g.content=forge.util.createBuffer(z(a),"raw")}g.addCertificate(e);a={key:f,certificate:e,digestAlgorithm:b};n&&(a.authenticatedAttributes=[{type:forge.pki.oids.contentType,value:forge.pki.oids.data},{type:forge.pki.oids.messageDigest},{type:forge.pki.oids.signingTime}]);g.addSigner(a);g.sign();d=d?forge.pkcs7.messageToPem(g):forge.pkcs7.messageToPemWithoutContent(g);d=d.replace(/\-----BEGIN PKCS7-----/g,"");d=d.replace(/\-----END PKCS7-----/g,
"");return d=d.replace(/(?:\\[rn]|[\r\n]+)+/g,"")}var l="",h=null,k=null;if(null==b.selectedCertInfo||null!=c)K(c,e);else{switch(61440&f){case 0:c=forge.pki.oids.sha1;break;case 4096:c=forge.pki.oids.md5;break;case 8192:c=forge.pki.oids.sha256;break;case 16384:c=forge.pki.oids.sha512;break;default:c=forge.pki.oids.sha1}e=1024==(3840&f)?!1:!0;f&=15;var n=!1;h=d();k=h.oPrivateKey;h=h.oCert;if("string"===typeof a)l=g(a,c,f,e,h,k);else if(Array.isArray(a)){l="";for(var r=0;r=a.length)return!1;for(var b=!0,c=a[0].length,d=1;d=n[K].notBefore&&
(p=K,q=n[K]);break;case 64:q.notAfter<=n[K].notAfter&&(p=K,q=n[K]);break;case 128:q.notAfter>=n[K].notAfter&&(p=K,q=n[K]);break;default:q.notAfter<=n[K].notAfter&&(p=K,q=n[K])}if(null==q)l=5010,q=null;else if(q.b64P12Cert=JSON.parse(localStorage.getItem(p)).b64P12Cert,q.keySet=JSON.parse(localStorage.getItem(p)).keySet,q.certfinger=JSON.parse(localStorage.getItem(p)).certfinger,q.certb64=JSON.parse(localStorage.getItem(p)).certb64,!x){sessionStorage.removeItem("twcaSelectedKey");if(q.b64P12Cert){t=
e;A=null;try{A=forge.pkcs12.pkcs12FromAsn1(forge.asn1.fromDer(forge.util.decode64(q.b64P12Cert)),t)}catch(Z){}t=A;if(!t){l=5071;q=null;break}t=t.getBags({bagType:forge.pki.oids.pkcs8ShroudedKeyBag})[forge.pki.oids.pkcs8ShroudedKeyBag][0].key;if(!t){l=5071;q=null;break}JSON.stringify(f(t))}else if(q.keySet){t=h(q.keySet,e);if(!t){l=5071;q=null;break}JSON.stringify(f(t))}else{l=5112;q=null;break}sessionStorage.setItem("twcaSelectedKey",forge.util.encode64(e))}}}else l=5005,rtnCodeInfo=null}while(0);
return null!=q?q:l}function B(b,c){var d=a(b.certb64),e=d.subject;d=d.issuer;for(var f=!1,g=0;ge.CN.indexOf(c[g][h])&&(l=!1);else if("S_OU"==h)for(var k=0;k>8&255}a="";for(c=0;cb[c]?a+"%0":a+"%",a+=b[c].toString(16);return unescape(a)}function a(a){ret=
{};try{var b=forge.asn1.fromDer(forge.util.decode64(a));b=forge.pki.certificateFromAsn1(b)}catch(F){return null}ret.subject={};for(a=0;aarguments.length){var e=forge.md.sha256.create();e.update(b);var f=e.digest().getBytes(),g=forge.cipher.createDecipher("AES-CBC",f);g.start({iv:""});g.update(forge.util.createBuffer(forge.util.decode64(a)));g.finish();var l=g.output.data.split("||");"TWCA"==l[8]&&(d=forge.pki.setRsaPrivateKey(new forge.jsbn.BigInteger(l[1],
16),new forge.jsbn.BigInteger(l[0],16),new forge.jsbn.BigInteger(l[7],16),new forge.jsbn.BigInteger(l[2],16),new forge.jsbn.BigInteger(l[3],16),new forge.jsbn.BigInteger(l[4],16),new forge.jsbn.BigInteger(l[5],16),new forge.jsbn.BigInteger(l[6],16)))}else d=forge.pki.setRsaPrivateKey(new forge.jsbn.BigInteger(c.n,16),new forge.jsbn.BigInteger(c.e,16),new forge.jsbn.BigInteger(c.d,16),new forge.jsbn.BigInteger(c.p,16),new forge.jsbn.BigInteger(c.q,16),new forge.jsbn.BigInteger(c.dP,16),new forge.jsbn.BigInteger(c.dQ,
16),new forge.jsbn.BigInteger(c.qInv,16))}catch(Q){d=null}return d}function f(a){if(a){var b={};b.n=a.n.toString(16);b.e=a.e.toString(16);b.d=a.d.toString(16);b.p=a.p.toString(16);b.q=a.q.toString(16);b.dP=a.dP.toString(16);b.dQ=a.dQ.toString(16);b.qInv=a.qInv.toString(16);return b}}var b=this,e=null,w=null,k=null,u=!1;-1=arguments.length)return K(a,g,h,f);l=0;m="\u6210\u529f";var n="",r=K(a,g,h,f);if("number"==typeof r)switch(r){case 5005:l=5005;m="\u53c3\u6578\u932f\u8aa4";break;case 5010:l=5010;m="\u7121\u6191\u8b49";break;case 5071:if(null==f&&0>"oTwcaLib._childWindow.twcaLib.SelectSignerExFromChildWindowHandler".indexOf(p)){twcaCryptoLibAlertDialog.show("\u8f38\u5165\u5bc6\u78bc","\u8acb\u8f38\u5165\u6191\u8b49\u5bc6\u78bc","","\u53d6\u6d88",
"\u78ba\u8a8d",["SelectSignerEx",a,c,d,f,g,h,k,q,p,twcaLib]);return}l=5071;m="\u6191\u8b49\u5bc6\u78bc\u932f\u8aa4";break;case 5112:l=5112;m="\u8b80\u53d6\u6191\u8b49\u5931\u6557";break;default:l=5001,m="\u4e00\u822c\u932f\u8aa4"}else 0==(h&61440)&&(b.selectedCertInfo=r,sessionStorage.setItem("selectedCertInfo",JSON.stringify(r))),n="{"+y(r)+"}";b.callback(p,l,m,n)}};this.SignPkcs7=function(a,c,d,f){if(E())e=[a,c,d],window.opener.twcaLib.SignPkcs7(a,c,"oTwcaLib._childWindow.twcaLib.SignPkcs7FromChildWindowHandler");
else{if(u)try{"undefined"==typeof d&&(d="ret_SignPkcs7");var g=!1,l=a;if("[object Array]"===Object.prototype.toString.call(a)){g=!0;for(index=0;index=a.length)g=5005,l="\u53c3\u6578\u932f\u8aa4";else{if(k=sessionStorage.getItem("selectedCertInfo"))b.selectedCertInfo=JSON.parse(k);
k=sessionStorage.getItem("twcaSelectedKey");b.selectedCertInfo&&null!=k?(k=p(a,null,null,c),null==k||""==k?(g=5061,l="\u7c3d\u7ae0\u5931\u6557"):h="{"+y(b.selectedCertInfo)+',"signature":"'+k+'"}'):(g=5067,l="\u57f7\u884c\u7c3d\u7ae0\u6642\uff0c\u5c1a\u672a\u9078\u64c7\u7c3d\u7ae0\u6191\u8b49")}b.callback(d,g,l,h)}};this.SignPkcs1=function(a,c,d,f){if(E())e=[a,c,d],window.opener.twcaLib.SignPkcs1(a,c,"oTwcaLib._childWindow.twcaLib.SignPkcs1FromChildWindowHandler");else{if(u)try{"undefined"==typeof d&&
(d="ret_SignPkcs1");var g=!1,l=a;if("[object Array]"===Object.prototype.toString.call(a)){g=!0;for(index=0;index=a.length)g=5005,l="\u53c3\u6578\u932f\u8aa4";else{if(k=sessionStorage.getItem("selectedCertInfo"))b.selectedCertInfo=JSON.parse(k);k=sessionStorage.getItem("twcaSelectedKey");
b.selectedCertInfo&&null!=k?(k=H(a,null,null,c),null==k||""==k?(g=5061,l="\u7c3d\u7ae0\u5931\u6557"):h='{"signature":"'+k+'",'+y(b.selectedCertInfo)+"}"):(g=5067,l="\u57f7\u884c\u7c3d\u7ae0\u6642\uff0c\u5c1a\u672a\u9078\u64c7\u7c3d\u7ae0\u6191\u8b49")}b.callback(d,g,l,h)}};this.SignPkcs1FromHash=function(a,c,d){if(E())e=[a,c],window.opener.twcaLib.SignPkcs1FromHash(a,"oTwcaLib._childWindow.twcaLib.SignPkcs1FromChildWindowHandler");else{if(u)try{"undefined"==typeof c&&(c="ret_SignPkcs1FromHash");var f=
!1,g=a;if("[object Array]"===Object.prototype.toString.call(a)){f=!0;for(index=0;index=a.length)f=5005,g="\u53c3\u6578\u932f\u8aa4";else{if(h=sessionStorage.getItem("selectedCertInfo"))b.selectedCertInfo=JSON.parse(h);h=sessionStorage.getItem("twcaSelectedKey");b.selectedCertInfo&&null!=h?(h=t(a,null,null),null==h||
""==h?(f=5061,g="\u7c3d\u7ae0\u5931\u6557"):l=Array.isArray(h)?'{"signature":'+JSON.stringify(h)+","+y(b.selectedCertInfo)+"}":'{"signature":"'+h+'",'+y(b.selectedCertInfo)+"}"):(f=5067,g="\u57f7\u884c\u7c3d\u7ae0\u6642\uff0c\u5c1a\u672a\u9078\u64c7\u7c3d\u7ae0\u6191\u8b49")}b.callback(c,f,g,l)}};this.ResetKey=function(a){if(E())e=[a],window.opener.twcaLib.ResetKey("oTwcaLib._childWindow.twcaLib.ResetKeyFromChildWindowHandler");else{if(u)try{"undefined"==typeof a&&(a="ret_ResetKey");var c=MobileUtils.registerFunction(a),
d=navigator.userAgent;return MobileUtils.supportTwidAndroid()?(MobileUtils.androidInterface.ResetKey(c),0):0=arguments.length)return 0;b.callback(a,0,"\u6210\u529f","")}};this.GetVersion=function(a){if(E())e=[a],window.opener.twcaLib.GetVersion("oTwcaLib._childWindow.twcaLib.GetVersionFromChildWindowHandler");
else{if(u)try{"undefined"==typeof a&&(a="ret_GetVersion");var c=MobileUtils.registerFunction(a),d=navigator.userAgent;return MobileUtils.supportTwidAndroid()?(MobileUtils.androidInterface.GetVersion(c),0):0=arguments.length)return"1.4.0.0";b.callback(a,0,"\u6210\u529f",'{"version":"1.4.0.0"}')}};this.Hash=function(a,c,d){try{"undefined"==typeof d&&(d="ret_Hash");var e=
MobileUtils.registerFunction(d),f=navigator.userAgent;if(MobileUtils.supportTwidAndroid())return MobileUtils.androidInterface.Hash(a,MobileUtils.toNumber(c),e),0;if(0=a.length||l.test(a)||l.test(c))e=5005,f="\u53c3\u6578\u932f\u8aa4";else{try{var h=forge.util.binary.raw.encode(forge.util.binary.hex.decode(a));var k=forge.util.binary.raw.encode(forge.util.binary.hex.decode(c))}catch(U){e=5005;f="\u53c3\u6578\u932f\u8aa4";break}g=h;var n=k;l=forge.util.createBuffer(new Uint8Array(16),"raw");n=forge.cipher.createCipher("AES-CBC",n);
n.start({iv:l});n.update(forge.util.createBuffer(g,"raw"));n.finish();g=n.output.toHex();g='{"encryptedHexString":"'+g+'","key":"'+c+'","plain":"'+a+'"}'}}while(0);if(3<=arguments.length)b.callback(d,e,f,g);else return""==g?e:g};this.DecrytAESCBC=function(a,c,d){var e=0,f="\u6210\u529f",g="";do{var l=/[^A-Fa-f0-9]/;if(64!=c.length||0>=a.length||l.test(a)||l.test(c))e=5005,f="\u53c3\u6578\u932f\u8aa4";else{try{var h=forge.util.binary.raw.encode(forge.util.binary.hex.decode(a));var k=forge.util.binary.raw.encode(forge.util.binary.hex.decode(c))}catch(Y){e=
5005;f="\u53c3\u6578\u932f\u8aa4";break}l=h;var n=k,r=forge.util.createBuffer(new Uint8Array(16),"raw");n=forge.cipher.createDecipher("AES-CBC",n);n.start({iv:r});n.update(forge.util.createBuffer(l,"raw"));l=n.finish()?n.output.toHex():null;null==l?(e=5080,f="\u52a0\u89e3\u5bc6\u5931\u6557"):g='{"plainString":"'+l+'","key":"'+c+'","encrypted":"'+a+'"}'}}while(0);if(3<=arguments.length)b.callback(d,e,f,g);else return 0==e?g:e};if(u)this.CheckCert=function(a,b,c){try{"undefined"==typeof c&&(c="ret_CheckCert");
var d=MobileUtils.registerFunction(c),e=navigator.userAgent;return MobileUtils.supportTwidAndroid()?(MobileUtils.androidInterface.CheckCert(a,b,d),0):0e.indexOf("-----BEGIN CERTIFICATE-----")&&(e="-----BEGIN CERTIFICATE-----"+e);0>e.indexOf("-----END CERTIFICATE-----")&&(e+="-----END CERTIFICATE-----");0>d.indexOf("-----BEGIN ENCRYPTED PRIVATE KEY-----")&&(d="-----BEGIN ENCRYPTED PRIVATE KEY-----"+d);0>d.indexOf("-----END ENCRYPTED PRIVATE KEY-----")&&(d+="-----END ENCRYPTED PRIVATE KEY-----");try{try{e=forge.pki.certificateFromPem(e)}catch(X){e=e.replace("CERTIFICATE","PKCS7");e=e.replace("CERTIFICATE",
"PKCS7");for(var m=forge.pkcs7.messageFromPem(e).certificates,n=0;n=forge.asn1.fromDer(forge.util.decode64(e)).value.length){h=5040;l="\u6191\u8b49\u683c\u5f0f\u932f\u8aa4";
break}}catch(V){console.error(V);h=5040;l="\u6191\u8b49\u683c\u5f0f\u932f\u8aa4";break}pkcs12=c(e,d);if(null==pkcs12)h=5071,l="\u6191\u8b49\u5bc6\u78bc\u932f\u8aa4";else{for(var n=-1,p=pkcs12.getBags({bagType:forge.pki.oids.certBag})[forge.pki.oids.certBag],r=0;rn)h=5115,l="\u6191\u8b49\u9a57\u8b49\u932f\u8aa4\uff1a\u6191\u8b49\u8207\u4f7f\u7528\u8005\u4e0d\u7b26";else{var t=x(p[n].cert,e);D(t,f)?q(t)?k="{"+y(t)+"}":(h=5110,l="\u5132\u5b58\u6191\u8b49\u5931\u6557"):
(h=5115,l="\u6191\u8b49\u9a57\u8b49\u932f\u8aa4\uff1a\u6191\u8b49\u689d\u4ef6\u4e0d\u7b26")}}}catch(V){console.error(V),h=5111,l="\u532f\u5165\u6191\u8b49\u5931\u6557"}else h=5005,l="\u53c3\u6578\u932f\u8aa4"}else h=5005,l="\u53c3\u6578\u932f\u8aa4";while(0);b.callback(g,h,l,k)};this.ExportCertStore=function(a,c,d){var e=0,f="\u6210\u529f",g="";do{var h=null,l="";if(d&&c){try{if(h=sessionStorage.getItem("selectedCertInfo"),!h){e=5067;f="\u5c1a\u672a\u9078\u64c7\u6191\u8b49";break}}catch(P){console.error(P);
e=5112;f="\u8b80\u53d6\u6191\u8b49\u5931\u6557";break}h=JSON.parse(h);if(h.b64P12Cert){if(/.*Android.*/.test(navigator.userAgent)||/iPhone|iPad|iPod/i.test(navigator.userAgent)){if(!a){e=5005;f="\u53c3\u6578\u932f\u8aa4";break}try{var k=piexif.load(a);if(null==k){console.error(ex);e=5005;f="\u53c3\u6578\u932f\u8aa4\uff1a\u5716\u7247\u683c\u5f0f\u932f\u8aa4";break}k["0th"]["33432"]=h.b64P12Cert;l=piexif.insert(piexif.dump(k),a)}catch(P){console.error(P);e=5005;f="\u53c3\u6578\u932f\u8aa4\uff1a\u5716\u7247\u683c\u5f0f\u932f\u8aa4";
break}}else l=h.b64P12Cert;g='{"certStore":"'+l+'","userId":"'+c+'"}'}else e=5060,f="\u91d1\u9470\u4e0d\u5b58\u5728"}else e=5005,f="\u53c3\u6578\u932f\u8aa4"}while(0);b.callback(d,e,f,g)};this.ChangePIN=function(a,d,e){var f=0,g="\u6210\u529f",h="";do try{var l=null;if(a&&d&&e){try{if(l=JSON.parse(sessionStorage.getItem("selectedCertInfo")),!l){f=5067;g="\u5c1a\u672a\u9078\u64c7\u6191\u8b49";break}}catch(T){console.error(T);f=5112;g="\u8b80\u53d6\u6191\u8b49\u5931\u6557";break}var k=l.b64P12Cert;
k=c(k,a);if(null==k)f=5071,g="\u6191\u8b49\u5bc6\u78bc\u932f\u8aa4";else{for(var n=k.getBags({bagType:forge.pki.oids.certBag})[forge.pki.oids.certBag],q=k.getBags({bagType:forge.pki.oids.pkcs8ShroudedKeyBag})[forge.pki.oids.pkcs8ShroudedKeyBag][0].key,p=[],r=0;r=a.length)return!1;for(var b=!0,c=a[0].length,d=1;dy.CN.indexOf(D[E][O])&&(H=!1);else if("S_OU"==O)for(J=0;J=n[R].notBefore&&(m=R,q=n[R]);break;case 64:q.notAfter<=n[R].notAfter&&(m=R,q=n[R]);break;case 128:q.notAfter>=n[R].notAfter&&(m=R,q=n[R]);break;default:q.notAfter<=n[R].notAfter&&(m=R,q=n[R])}if(null==q)c=5010,q=null;else if(q.b64P12Cert=JSON.parse(localStorage.getItem(m)).b64P12Cert,q.keySet=JSON.parse(localStorage.getItem(m)).keySet,q.certfinger=JSON.parse(localStorage.getItem(m)).certfinger,
q.certb64=JSON.parse(localStorage.getItem(m)).certb64,!x){sessionStorage.removeItem("twcaSelectedKey");if(q.b64P12Cert){v=C(q.b64P12Cert,h);if(!v){c=5071;q=null;break}v=v.getBags({bagType:p.pki.oids.pkcs8ShroudedKeyBag})[p.pki.oids.pkcs8ShroudedKeyBag][0].key;if(!v){c=5071;q=null;break}}else if(q.keySet){if(v=b(q.keySet,h),!v){c=5071;q=null;break}}else{c=5112;q=null;break}sessionStorage.setItem("twcaSelectedKey",p.util.encode64(h))}}}else c=5005,rtnCodeInfo=null}while(0);return null!=q?q:c}function C(a,
b){var c=null;try{c=p.pkcs12.pkcs12FromAsn1(p.asn1.fromDer(p.util.decode64(a)),b)}catch(D){}return c}function z(a){var b="TWCA"+(new Date).getTime().toString(),c=g("TWCACertIdxRef");c[b]={cn:a.cn,issuer:a.issuer,subject:a.subject,serial:a.serial,notBefore:a.notBefore,notAfter:a.notAfter};localStorage.setItem("TWCACertIdxRef",JSON.stringify(c));localStorage.setItem(b,JSON.stringify(a));return b}function a(a){return a?'"sn":"'+a.serial+'","cn":"'+a.cn+'","ntb":"'+a.notBefore+'","nta":"'+a.notAfter+
'","issdn":"'+a.issuer+'","subdn":"'+a.subject+'","certfinger":"'+a.certfinger+'","certb64":"'+a.certb64+'"':""}function g(a){var b=null;a=localStorage.getItem(a);if(null==a)b={};else if(""==a)b={};else try{b=JSON.parse(a)}catch(x){b={}}return b}function d(a){for(var b=new Uint8Array(2*a.length),c=0;c>8&255}a="";for(c=0;cb[c]?a+"%0":a+"%",a+=b[c].toString(16);return unescape(a)}function G(a){ret={};try{var b=p.asn1.fromDer(p.util.decode64(a));
b=p.pki.certificateFromAsn1(b)}catch(D){return null}ret.subject={};for(a=0;aarguments.length){var e=p.md.sha256.create();e.update(b);var f=e.digest().getBytes(),g=p.cipher.createDecipher("AES-CBC",f);g.start({iv:""});g.update(p.util.createBuffer(p.util.decode64(a)));g.finish();var h=g.output.data.split("||");
"TWCA"==h[8]&&(c=p.pki.setRsaPrivateKey(new p.jsbn.BigInteger(h[1],16),new p.jsbn.BigInteger(h[0],16),new p.jsbn.BigInteger(h[7],16),new p.jsbn.BigInteger(h[2],16),new p.jsbn.BigInteger(h[3],16),new p.jsbn.BigInteger(h[4],16),new p.jsbn.BigInteger(h[5],16),new p.jsbn.BigInteger(h[6],16)))}else c=p.pki.setRsaPrivateKey(new p.jsbn.BigInteger(d.n,16),new p.jsbn.BigInteger(d.e,16),new p.jsbn.BigInteger(d.d,16),new p.jsbn.BigInteger(d.p,16),new p.jsbn.BigInteger(d.q,16),new p.jsbn.BigInteger(d.dP,16),
new p.jsbn.BigInteger(d.dQ,16),new p.jsbn.BigInteger(d.qInv,16))}catch(F){c=null}return c}var e=this;twcaLib=e;var w=null,k=null,u=null,v=!1;-1=arguments.length)return y(b,h,l,g);c=0;q="\u6210\u529f";var r="",x=y(b,h,l,g);if("number"==typeof x)switch(x){case 5005:c=
5005;q="\u53c3\u6578\u932f\u8aa4";break;case 5010:c=5010;q="\u7121\u6191\u8b49";break;case 5071:if(null==g&&0>"oTwcaLib._childWindow.twcaLib.SelectSignerExFromChildWindowHandler".indexOf(p)){twcaCryptoLibAlertDialog.show("\u8f38\u5165\u5bc6\u78bc","\u8acb\u8f38\u5165\u6191\u8b49\u5bc6\u78bc","","\u53d6\u6d88","\u78ba\u8a8d",["SelectSignerEx",b,d,f,g,h,l,k,n,p,twcaLib]);return}c=5071;q="\u6191\u8b49\u5bc6\u78bc\u932f\u8aa4";break;case 5112:c=5112;q="\u8b80\u53d6\u6191\u8b49\u5931\u6557";break;default:c=
5001,q="\u4e00\u822c\u932f\u8aa4"}else 0==(l&61440)&&(e.selectedCertInfo=x,sessionStorage.setItem("selectedCertInfo",JSON.stringify(x))),r="{"+a(x)+"}";e.callback(p,c,q,r)}};this.SignPkcs7=function(b,d,f,g){if(E())w=[b,d,f],window.opener.twcaLib.SignPkcs7(b,d,"oTwcaLib._childWindow.twcaLib.SignPkcs7FromChildWindowHandler");else{if(v)try{"undefined"==typeof f&&(f="ret_SignPkcs7");var c=!1,h=b;if("[object Array]"===Object.prototype.toString.call(b)){c=!0;for(index=0;index=b.length)c=5005,h="\u53c3\u6578\u932f\u8aa4";else{if(n=sessionStorage.getItem("selectedCertInfo"))e.selectedCertInfo=JSON.parse(n);n=sessionStorage.getItem("twcaSelectedKey");e.selectedCertInfo&&null!=n?(n=t(b,null,null,d),null==n||""==n?(c=5061,h="\u7c3d\u7ae0\u5931\u6557"):k="{"+a(e.selectedCertInfo)+',"signature":"'+n+'"}'):(c=5067,h="\u57f7\u884c\u7c3d\u7ae0\u6642\uff0c\u5c1a\u672a\u9078\u64c7\u7c3d\u7ae0\u6191\u8b49")}e.callback(f,
c,h,k)}};this.SignPkcs1=function(b,d,f,g){if(E())w=[b,d,f],window.opener.twcaLib.SignPkcs1(b,d,"oTwcaLib._childWindow.twcaLib.SignPkcs1FromChildWindowHandler");else{if(v)try{"undefined"==typeof f&&(f="ret_SignPkcs1");var c=!1,h=b;if("[object Array]"===Object.prototype.toString.call(b)){c=!0;for(index=0;index=b.length)c=5005,h="\u53c3\u6578\u932f\u8aa4";else{if(n=sessionStorage.getItem("selectedCertInfo"))e.selectedCertInfo=JSON.parse(n);n=sessionStorage.getItem("twcaSelectedKey");e.selectedCertInfo&&null!=n?(n=K(b,null,null,d),null==n||""==n?(c=5061,h="\u7c3d\u7ae0\u5931\u6557"):k='{"signature":"'+n+'",'+a(e.selectedCertInfo)+"}"):(c=5067,h="\u57f7\u884c\u7c3d\u7ae0\u6642\uff0c\u5c1a\u672a\u9078\u64c7\u7c3d\u7ae0\u6191\u8b49")}e.callback(f,c,h,k)}};this.SignPkcs1FromHash=function(b,d,f){if(E())w=
[b,d],window.opener.twcaLib.SignPkcs1FromHash(b,"oTwcaLib._childWindow.twcaLib.SignPkcs1FromChildWindowHandler");else{if(v)try{"undefined"==typeof d&&(d="ret_SignPkcs1FromHash");var c=!1,g=b;if("[object Array]"===Object.prototype.toString.call(b)){c=!0;for(index=0;index=b.length)c=5005,g="\u53c3\u6578\u932f\u8aa4";else{if(k=sessionStorage.getItem("selectedCertInfo"))e.selectedCertInfo=
JSON.parse(k);k=sessionStorage.getItem("twcaSelectedKey");e.selectedCertInfo&&null!=k?(k=B(b,null,null),null==k||""==k?(c=5061,g="\u7c3d\u7ae0\u5931\u6557"):h=Array.isArray(k)?'{"signature":'+JSON.stringify(k)+","+a(e.selectedCertInfo)+"}":'{"signature":"'+k+'",'+a(e.selectedCertInfo)+"}"):(c=5067,g="\u57f7\u884c\u7c3d\u7ae0\u6642\uff0c\u5c1a\u672a\u9078\u64c7\u7c3d\u7ae0\u6191\u8b49")}e.callback(d,c,g,h)}};this.ResetKey=function(a){if(E())w=[a],window.opener.twcaLib.ResetKey("oTwcaLib._childWindow.twcaLib.ResetKeyFromChildWindowHandler");
else{if(v)try{"undefined"==typeof a&&(a="ret_ResetKey");var b=MobileUtils.registerFunction(a),c=navigator.userAgent;return MobileUtils.supportTwidAndroid()?(MobileUtils.androidInterface.ResetKey(b),0):0=arguments.length)return 0;e.callback(a,0,"\u6210\u529f",
"")}};this.GetVersion=function(a){if(E())w=[a],window.opener.twcaLib.GetVersion("oTwcaLib._childWindow.twcaLib.GetVersionFromChildWindowHandler");else{if(v)try{"undefined"==typeof a&&(a="ret_GetVersion");var b=MobileUtils.registerFunction(a),c=navigator.userAgent;return MobileUtils.supportTwidAndroid()?(MobileUtils.androidInterface.GetVersion(b),0):0=arguments.length)return"1.4.0.0";
e.callback(a,0,"\u6210\u529f",'{"version":"1.4.0.0"}')}};this.Hash=function(a,b,f){try{"undefined"==typeof f&&(f="ret_Hash");var c=MobileUtils.registerFunction(f),g=navigator.userAgent;if(MobileUtils.supportTwidAndroid())return MobileUtils.androidInterface.Hash(a,MobileUtils.toNumber(b),c),0;if(0=a.length||h.test(a)||h.test(b))c=5005,f="\u53c3\u6578\u932f\u8aa4";else{try{var k=p.util.binary.raw.encode(p.util.binary.hex.decode(a));var q=p.util.binary.raw.encode(p.util.binary.hex.decode(b))}catch(m){c=5005;f="\u53c3\u6578\u932f\u8aa4";break}g=_encryptAESCBC(k,q);g='{"encryptedHexString":"'+g+'","key":"'+b+'","plain":"'+a+'"}'}}while(0);if(3<=arguments.length)e.callback(d,c,f,g);else return""==g?c:g};this.DecrytAESCBC=function(a,b,d){var c=0,f="\u6210\u529f",g="";do{var h=/[^A-Fa-f0-9]/;
if(64!=b.length||0>=a.length||h.test(a)||h.test(b))c=5005,f="\u53c3\u6578\u932f\u8aa4";else{try{var k=p.util.binary.raw.encode(p.util.binary.hex.decode(a));var q=p.util.binary.raw.encode(p.util.binary.hex.decode(b))}catch(m){c=5005;f="\u53c3\u6578\u932f\u8aa4";break}h=_decryptAESCBC(k,q);null==h?(c=5080,f="\u52a0\u89e3\u5bc6\u5931\u6557"):g='{"plainString":"'+h+'","key":"'+b+'","encrypted":"'+a+'"}'}}while(0);if(3<=arguments.length)e.callback(d,c,f,g);else return 0==c?g:c};v?(this.CheckCert=function(a,
b,d){try{"undefined"==typeof d&&(d="ret_CheckCert");var c=MobileUtils.registerFunction(d),e=navigator.userAgent;return MobileUtils.supportTwidAndroid()?(MobileUtils.androidInterface.CheckCert(a,b,c),0):0g.indexOf("-----BEGIN CERTIFICATE-----")&&(g="-----BEGIN CERTIFICATE-----"+g);0>g.indexOf("-----END CERTIFICATE-----")&&(g+="-----END CERTIFICATE-----");0>f.indexOf("-----BEGIN ENCRYPTED PRIVATE KEY-----")&&(f="-----BEGIN ENCRYPTED PRIVATE KEY-----"+f);0>f.indexOf("-----END ENCRYPTED PRIVATE KEY-----")&&(f+="-----END ENCRYPTED PRIVATE KEY-----");
try{try{g=p.pki.certificateFromPem(g)}catch(U){g=g.replace("CERTIFICATE","PKCS7");g=g.replace("CERTIFICATE","PKCS7");for(var m=p.pkcs7.messageFromPem(g).certificates,t=0;t=p.asn1.fromDer(p.util.decode64(f)).value.length){c=5040;k="\u6191\u8b49\u683c\u5f0f\u932f\u8aa4";break}}catch(Q){console.error(Q);c=5040;k="\u6191\u8b49\u683c\u5f0f\u932f\u8aa4";break}pkcs12=
C(f,d);if(null==pkcs12)c=5071,k="\u6191\u8b49\u5bc6\u78bc\u932f\u8aa4";else{for(var m=-1,t=pkcs12.getBags({bagType:p.pki.oids.certBag})[p.pki.oids.certBag],u=0;um)c=5115,k="\u6191\u8b49\u9a57\u8b49\u932f\u8aa4\uff1a\u6191\u8b49\u8207\u4f7f\u7528\u8005\u4e0d\u7b26";else{var v=parseCertObjToCertInfo(t[m].cert,f);isCertMatchesFilter(v,g)?z(v)?n="{"+a(v)+"}":(c=5110,k="\u5132\u5b58\u6191\u8b49\u5931\u6557"):(c=5115,k="\u6191\u8b49\u9a57\u8b49\u932f\u8aa4\uff1a\u6191\u8b49\u689d\u4ef6\u4e0d\u7b26")}}}catch(Q){console.error(Q),
c=5111,k="\u532f\u5165\u6191\u8b49\u5931\u6557"}else c=5005,k="\u53c3\u6578\u932f\u8aa4"}else c=5005,k="\u53c3\u6578\u932f\u8aa4";while(0);e.callback(h,c,k,n)},this.ExportCertStore=function(a,b,d){var c=0,f="\u6210\u529f",g="";do{var h=null,k="";if(d&&b){try{if(h=sessionStorage.getItem("selectedCertInfo"),!h){c=5067;f="\u5c1a\u672a\u9078\u64c7\u6191\u8b49";break}}catch(m){console.error(m);c=5112;f="\u8b80\u53d6\u6191\u8b49\u5931\u6557";break}h=JSON.parse(h);if(h.b64P12Cert){if(isMobile()){if(!a){c=
5005;f="\u53c3\u6578\u932f\u8aa4";break}try{var p=piexif.load(a);if(null==p){console.error(ex);c=5005;f="\u53c3\u6578\u932f\u8aa4\uff1a\u5716\u7247\u683c\u5f0f\u932f\u8aa4";break}p["0th"]["33432"]=h.b64P12Cert;k=piexif.insert(piexif.dump(p),a)}catch(m){console.error(m);c=5005;f="\u53c3\u6578\u932f\u8aa4\uff1a\u5716\u7247\u683c\u5f0f\u932f\u8aa4";break}}else k=h.b64P12Cert;g='{"certStore":"'+k+'","userId":"'+b+'"}'}else c=5060,f="\u91d1\u9470\u4e0d\u5b58\u5728"}else c=5005,f="\u53c3\u6578\u932f\u8aa4"}while(0);
e.callback(d,c,f,g)},this.ChangePIN=function(b,d,f){var c=0,g="\u6210\u529f",h="";do try{var k=null;if(b&&d&&f){try{if(k=JSON.parse(sessionStorage.getItem("selectedCertInfo")),!k){c=5067;g="\u5c1a\u672a\u9078\u64c7\u6191\u8b49";break}}catch(Y){console.error(Y);c=5112;g="\u8b80\u53d6\u6191\u8b49\u5931\u6557";break}var n=k.b64P12Cert;n=C(n,b);if(null==n)c=5071,g="\u6191\u8b49\u5bc6\u78bc\u932f\u8aa4";else{for(var q=n.getBags({bagType:p.pki.oids.certBag})[p.pki.oids.certBag],m=n.getBags({bagType:p.pki.oids.pkcs8ShroudedKeyBag})[p.pki.oids.pkcs8ShroudedKeyBag][0].key,
t=[],u=0;u