1!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.jose=e()}}(function(){var e;return function t(e,r,n){function i(o,s){if(!r[o]){if(!e[o]){var u="function"==typeof require&&require;if(!s&&u)return u(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[o]={exports:{}};e[o][0].call(l.exports,function(t){var r=e[o][1][t];return i(r?r:t)},l,l.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t,r){(function(r){"use strict";function n(e){if(16!==e.length)throw new Error("invalid iv")}function i(e){var t=function(e,t,r){try{n(r)}catch(i){return Promise.reject(i)}var a=Promise.resolve();return a=a.then(function(){var n=y.cipher.createCipher("AES-CBC",new v(e));if(n.start({iv:new v(r)}),n.update(new v(t)),!n.finish())return Promise.reject(new Error("encryption failed"));var i=n.output["native"]();return i})},i=function(e,t,i){try{n(i)}catch(a){return Promise.reject(a)}var o=Promise.resolve();return o=o.then(function(){var t={name:"AES-CBC"};return p.subtleCrypto.importKey("raw",e,t,!0,["encrypt"])}),o=o.then(function(e){var r={name:"AES-CBC",iv:i};return p.subtleCrypto.encrypt(r,e,t)}),o=o.then(function(e){return e=new Uint8Array(e),e=r._augment(e)})},a=function(t,i,a){try{n(a)}catch(o){return Promise.reject(o)}var s=Promise.resolve(i);return s=s.then(function(n){var i="AES-"+e+"-CBC",o=p.nodeCrypto.createCipheriv(i,t,a),s=r.concat([o.update(n),o["final"]()]);return s})};return p.setupFallback(a,i,t)}function a(e){var t=function(e,t,r){try{n(r)}catch(i){return Promise.reject(i)}var a=Promise.resolve();return a=a.then(function(){var n=y.cipher.createDecipher("AES-CBC",new v(e));if(n.start({iv:new v(r)}),n.update(new v(t)),!n.finish())return Promise.reject(new Error("encryption failed"));var i=n.output["native"]();return i})},i=function(e,t,i){try{n(i)}catch(a){return Promise.reject(a)}var o=Promise.resolve();return o=o.then(function(){var t={name:"AES-CBC"};return p.subtleCrypto.importKey("raw",e,t,!0,["decrypt"])}),o=o.then(function(e){var r={name:"AES-CBC",iv:i};return p.subtleCrypto.decrypt(r,e,t)}),o=o.then(function(e){return e=new Uint8Array(e),e=r._augment(e)})},a=function(t,i,a){try{n(a)}catch(o){return Promise.reject(o)}var s=Promise.resolve();return s=s.then(function(){var n="AES-"+e+"-CBC",o=p.nodeCrypto.createDecipheriv(n,t,a),s=r.concat([o.update(i),o["final"]()]);return s})};return p.setupFallback(a,i,t)}function o(e,t){if(t<<1!==e.length<<3)throw new Error("invalid encryption key size")}function s(e){var t=i(e);return function(n,i,a){try{o(n,e)}catch(s){return Promise.reject(s)}var u=n.slice(e/8),c=n.slice(0,e/8),l=a.iv||new r(0),f=a.aad||a.adata||new r(0),h=t(u,i,l);return h=h.then(function(t){var n,i=r.concat([f,l,t,p.int64ToBuffer(8*f.length)]);return n=d["HS"+2*e].sign(c,i,{loose:!0}),n=n.then(function(r){var n=r.mac.slice(0,e/8);return{data:t,tag:n}})})}}function u(e){var t=a(e);return function(n,i,a){try{o(n,e)}catch(s){return Promise.reject(s)}var u=n.slice(e/8),c=n.slice(0,e/8),l=a.iv||new r(0),f=a.aad||a.adata||new r(0),h=a.tag||a.mac||new r(0),g=Promise.resolve();return g=g.then(function(){var t,n=r.concat([f,l,i,p.int64ToBuffer(8*f.length)]);return t=d["HS"+2*e].verify(c,n,h,{loose:!0}),t=t.then(function(){return i},function(){throw new Error("mac check failed")})}),g=g.then(function(){return t(u,i,l)})}}function c(e,t,n,i){var a=8*e.length,o=a/2,s=Promise.resolve();return s=s.then(function(){var a=r.concat([p.int32ToBuffer(1),e,p.int32ToBuffer(o),new r(t,"utf8"),n,i,b]);return a}),s=s.then(function(e){return g["SHA-"+a].digest(e).then(function(e){return e.slice(0,o/8)})}),s=Promise.resolve(s)}function l(e,t,n,i){var a=8*e.length,o=a,s=Promise.resolve();return s=s.then(function(){var a=r.concat([p.int32ToBuffer(1),e,p.int32ToBuffer(o),new r(t,"utf8"),n,i,E]);return a}),s=s.then(function(e){return g["SHA-"+a].digest(e).then(function(e){return e.slice(0,o/8)})}),s=Promise.resolve(s)}function f(e,t){var n=i(e);return function(i,a,o){var s,u,f=o.epu||p.int32ToBuffer(0),h=o.epv||p.int32ToBuffer(0),g=
1o.iv||new r(0),y=o.aad||o.adata||new r(0),v=o.kdata||new r(0),b=[c(i,t,f,h),l(i,t,f,h)],E=Promise.all(b).then(function(e){s=e[0],u=e[1]});return E=E.then(function(){return n(s,a,g)}),E=E.then(function(t){var n=r.concat([y,_,new r(v),_,new r(m.base64url.encode(g),"utf8"),_,new r(m.base64url.encode(t),"utf8")]);return Promise.all([Promise.resolve(t),d["HS"+2*e].sign(u,n,{loose:!1})])}),E=E.then(function(e){return{data:e[0],tag:e[1].mac}})}}function h(e,t){var n=a(e);return function(i,a,o){var s,u,f=o.epu||p.int32ToBuffer(0),h=o.epv||p.int32ToBuffer(0),g=o.iv||new r(0),y=o.aad||o.adata||new r(0),v=o.kdata||new r(0),b=o.tag||o.mac||new r(0),E=[c(i,t,f,h),l(i,t,f,h)],w=Promise.all(E).then(function(e){s=e[0],u=e[1]});return w=w.then(function(){var t=r.concat([y,_,new r(v),_,new r(m.base64url.encode(g),"utf8"),_,new r(m.base64url.encode(a),"utf8")]);try{return d["HS"+2*e].verify(u,t,b,{loose:!1})}catch(n){throw new Error("mac check failed")}}),w=w.then(function(){return n(s,a,g)})}}var p=e("./helpers.js"),d=e("./hmac.js"),g=e("./sha.js"),y=e("../deps/forge.js"),v=e("../util/databuffer.js"),m=e("../util"),b=new r("Encryption","utf8"),E=new r("Integrity","utf8"),_=new r(".","utf8"),w={};["A128CBC-HS256","A192CBC-HS384","A256CBC-HS512"].forEach(function(e){var t=parseInt(/A(\d+)CBC-HS(\d+)?/g.exec(e)[1]);w[e]={encrypt:s(t),decrypt:u(t)}}),["A128CBC+HS256","A192CBC+HS384","A256CBC+HS512"].forEach(function(e){var t=parseInt(/A(\d+)CBC\+HS(\d+)?/g.exec(e)[1]);w[e]={encrypt:f(t,e),decrypt:h(t,e)}}),t.exports=w}).call(this,e("buffer").Buffer)},{"../deps/forge.js":27,"../util":52,"../util/databuffer.js":51,"./helpers.js":10,"./hmac.js":12,"./sha.js":18,buffer:70}],2:[function(e,t,r){(function(r){"use strict";function n(e){function t(t,r){if(e!==t.length<<3)throw new Error("invalid key size");if(12!==r.length)throw new Error("invalid iv")}var n=function(e,n,i){var a,u,c=i.iv||new r(0),l=i.aad||i.adata||new r(0);try{t(e,c,l)}catch(f){return Promise.reject(f)}a=s.createCipher({key:e,iv:c,additionalData:l}),u=new r(n.length);var h=new Promise(function(e,t){var r=o.CHUNK_SIZE,i=0,s=0;!function c(){var o=Math.min(r,n.length-s);if(i+=a.update(n,s,o,u,i),s+=o,n.length>s)return void setTimeout(c,0);if(i+=a.finish(u,i),i!==n.length)return void t(new Error("encryption failed"));var l=a.tag;e({data:u,tag:l})}()});return h},i=function(e,n,i){var o=i.iv||new r(0),s=i.aad||i.adata||new r(0);try{t(e,o,s)}catch(u){return Promise.reject(u)}var c,l={name:"AES-GCM"};return c=a.subtleCrypto.importKey("raw",e,l,!0,["encrypt"]),c=c.then(function(e){return l.iv=o,l.tagLength=128,s.length&&(l.additionalData=s),a.subtleCrypto.encrypt(l,e,n)}),c=c.then(function(e){var t=e.byteLength-16,n=e.slice(t);n=new Uint8Array(n),n=r._augment(n);var i=e.slice(0,t);return i=new Uint8Array(i),i=r._augment(i),{data:i,tag:n}})},u=function(e,n,i){var o=i.iv||new r(0),s=i.aad||i.adata||new r(0);try{t(e,o,s)}catch(u){return Promise.reject(u)}var c,l="aes-"+8*e.length+"-gcm";try{c=a.nodeCrypto.createCipheriv(l,e,o)}catch(u){throw new Error("unsupported algorithm: "+l)}if("function"!=typeof c.setAAD)throw new Error("unsupported algorithm: "+l);s.length&&c.setAAD(s);var f=r.concat([c.update(n),c["final"]()]),h=c.getAuthTag();return{data:f,tag:h}};return a.setupFallback(u,i,n)}function i(e){function t(t,r,n){if(e!==t.length<<3)throw new Error("invalid key size");if(12!==r.length)throw new Error("invalid iv");if(16!==n.length)throw new Error("invalid tag length")}var n=function(e,n,i){var a,u,c=i.aad||i.adata||new r(0),l=i.iv||new r(0),f=i.tag||i.mac||new r(0);try{t(e,l,f)}catch(h){return Promise.reject(h)}a=s.createDecipher({key:e,iv:l,additionalData:c,tag:f}),u=new r(n.length);var p=new Promise(function(e,t){var r=o.CHUNK_SIZE,i=0,s=0;!function c(){var o=Math.min(r,n.length-s);if(i+=a.update(n,s,o,u,i),s+=o,n.length>s)return void setTimeout(c,0);try{i+=a.finish(u,i)}catch(l){return void t(new Error("decryption failed"))}return i!==n.length?void t(new Error("decryption failed")):void e(u)}()});return p},i=function(e,n,i){var o=i.aad||i.adata||new r(0),s=i.iv||new r(0),u=i.tag||i.mac||new r(0);try{t(e,s,u)}catch(c){return Promise.reject(c)}var l,f={name:"AES-GCM"};return l=a.subtleCrypto.importKey("raw",e,f,!0,["decrypt"]),l=l.then(function(e){return f.iv=s,f.tagLength=128,o.length&&(f.additionalData=o),n=r.concat([n,u],n.length+u.length),a.subtleCrypto.decrypt(f,e,n)}),l=l.then(function(e){return e=new Uint8Array(e),e=r._augment(e)})},u=function(e,n,i){var o=i.aad||i.adata||new r(0),s=i.iv||new r(0),u=i.tag||i.mac||new r(0);try{t(e,s,u)}catch(c){return Promise.reject(c)}var l,f="aes-"+8*e.length+"-gcm";try{l=a.nodeCrypto.createDecipheriv(f,e,s)}catch(c){throw new Error("unsupported algorithm: "+f)}if("function"!=typeof l.setAAD)throw new Error("unsupported algorithm: "+f);l.setAuthTag(u),o.length&&l.setAAD(o);try{var h=r.concat([l.update(n),l["final"]()]);return h}catch(c){throw new Error("decryption failed")}};return a.setupFallback(u,i,n)}var a=e("./helpers.js"),o=e("./constants.js"),s=e("../deps/ciphermodes/gcm"),u={};["A128GCM","A192GCM","A256GCM","A128GCMKW","A192GCMKW","A256GCMKW"].forEach(function(e){var t=parseInt(/A(\d+)GCM(?:KW)?/g.exec(e)[1]);u[e]={encrypt:n(t),decrypt:i(t)}}),t.exports=u}).call(this,e("buffer").Buffer)},{"../deps/ciphermodes/gcm":20,"./constants.js":5,"./helpers.js":10,buffer:70}],3:[function(e,t,r){(function(r){"use strict";function n(e,t){for(var n=Math.max(e.length,t.length),i=new r(n),a=0;n>a;a++)i[a]=(e[a]||0)^(t[a]||0);return i}function i(e,t){for(var r=[],n=0;e.length>n;n+=t)r.push(e.slice(n,n+t));return r}function a(e){var t=Math.floor(e/4294967296),n=e%4294967296,i=new r(8);return i[0]=255&t>>>24,i[1]=255&t>>>16,i[2]=255&t>>>8,i[3]=255&t>>>0,i[4]=255&n>>>24,i[5]=255&n>>>16,i[6]=255&n>>>8,i[7]=255&n>>>0,i}function o(e){function t(t,r){if(e!==t.length<<3)throw new Error("invalid key size");if(0<r.length&&0!==r.length%8)throw new Error("invalid data length")}var o=function(e,o){try{t(e,o)}catch(s){return Promise.reject(s)}var u,h,p,d=c.cipher.createCipher("AES",new l(e)),g=i(o,8);u=f;for(var y=0;6>y;y++)for(var v=0;g.length>v;
1v++)p=g.length*y+v+1,h=r.concat([u,g[v]]),d.start(),d.update(new l(h)),d.finish(),h=d.output["native"](),u=n(h.slice(0,8),a(p)),g[v]=h.slice(8,16);g=[u].concat(g);var m=r.concat(g);return Promise.resolve({data:m})},s=function(e,n){try{t(e,n)}catch(i){return Promise.reject(i)}var a={name:"AES-KW"},o=[u.subtleCrypto.importKey("raw",n,{name:"HMAC",hash:"SHA-256"},!0,["sign"]),u.subtleCrypto.importKey("raw",e,a,!0,["wrapKey"])];return o=Promise.all(o),o=o.then(function(e){return u.subtleCrypto.wrapKey("raw",e[0],e[1],a)}),o=o.then(function(e){return e=new Uint8Array(e),e=r._augment(e),{data:e}})};return u.setupFallback(null,s,o)}function s(e){function t(t,r){if(e!==t.length<<3)throw new Error("invalid key size");if(0<r.length-8&&0!==r.length%8)throw new Error("invalid data length")}var o=function(e,o){try{t(e,o)}catch(s){return Promise.reject(s)}var u,h,p,d=c.cipher.createDecipher("AES",new l(e)),g=i(o,8);u=g[0],g=g.slice(1);for(var y=5;y>=0;--y)for(var v=g.length-1;v>=0;--v)p=g.length*y+v+1,h=n(u,a(p)),h=r.concat([h,g[v]]),d.start(),d.update(new l(h)),d.finish(),h=d.output["native"](),u=h.slice(0,8),g[v]=h.slice(8,16);if(u.toString()!==f.toString())return Promise.reject(new Error("decryption failed"));var m=r.concat(g);return Promise.resolve(m)},s=function(e,n){try{t(e,n)}catch(i){return Promise.reject(i)}var a={name:"AES-KW"},o=u.subtleCrypto.importKey("raw",e,a,!0,["unwrapKey"]);return o=o.then(function(e){return u.subtleCrypto.unwrapKey("raw",n,e,a,{name:"HMAC",hash:"SHA-256"},!0,["sign"])}),o=o.then(function(e){return u.subtleCrypto.exportKey("raw",e)}),o=o.then(function(e){return e=new Uint8Array(e),e=r._augment(e)})};
1return u.setupFallback(null,s,o)}var u=e("./helpers.js"),c=e("../deps/forge.js"),l=e("../util/databuffer.js"),f=new r("a6a6a6a6a6a6a6a6","hex"),h={};["A128KW","A192KW","A256KW"].forEach(function(e){var t=parseInt(/A(\d+)KW/g.exec(e)[1]);h[e]={encrypt:o(t),decrypt:s(t)}}),t.exports=h}).call(this,e("buffer").Buffer)},{"../deps/forge.js":27,"../util/databuffer.js":51,"./helpers.js":10,buffer:70}],4:[function(e,t,r){(function(r){"use strict";function n(e){e=e.replace("CONCAT-","");var t=function(t,n){function o(){if(f===h++)return r.concat(p).slice(0,s);var e=new r(4+t.length+c.length);return e.writeUInt32BE(h,0),t.copy(e,4),c.copy(e,4+t.length),l(e).then(function(e){return p.push(e),o()})}n=n||{};var s=n.length,u=i.HASHLENGTH[e];if(!s)return Promise.reject(new Error("invalid key length"));if(!n.otherInfo)return Promise.reject(new Error("invalid otherInfo"));var c=n.otherInfo,l=a[e].digest,f=Math.ceil(s/u),h=0,p=[];return o()};return t}var i=e("./constants.js"),a=e("./sha.js"),o={};["CONCAT-SHA-1","CONCAT-SHA-256","CONCAT-SHA-384","CONCAT-SHA-512"].forEach(function(e){o[e]={derive:n(e)}}),t.exports=o}).call(this,e("buffer").Buffer)},{"./constants.js":5,"./sha.js":18,buffer:70}],5:[function(e,t,r){"use strict";t.exports={CHUNK_SIZE:1024,HASHLENGTH:{"SHA-1":160,"SHA-256":256,"SHA-384":384,"SHA-512":512},ENCLENGTH:{"AES-128-CBC":128,"AES-192-CBC":192,"AES-256-CBC":256,"AES-128-KW":128,"AES-192-KW":192,"AES-256-KW":256},KEYLENGTH:{"A128CBC-HS256":256,"A192CBC-HS384":384,"A256CBC-HS512":512,"A128CBC+HS256":256,"A192CBC+HS384":384,"A256CBC+HS512":512,A128GCM:128,A192GCM:192,A256GCM:256,A128KW:128,A192KW:192,A256KW:256,"ECDH-ES+A128KW":128,"ECDH-ES+A192KW":192,"ECDH-EC+A256KW":256},NONCELENGTH:{"A128CBC-HS256":128,"A192CBC-HS384":128,"A256CBC-HS512":128,"A128CBC+HS256":128,"A192CBC+HS384":128,"A256CBC+HS512":128,A128GCM:96,A192GCM:96,A256GCM:96}}},{}],6:[function(e,t,r){"use strict";function n(e){return Promise.resolve({data:e,once:!0,direct:!0})}function i(e){return Promise.resolve(e)}var a={dir:{encrypt:n,decrypt:i}};t.exports=a},{}],7:[function(e,t,r){(function(r){"use strict";function n(e,t){var r=t?["x","y"]:["d"];r=r.map(function(t){return new l.jsbn.BigInteger(e[t].toString("hex"),16)}),r=[e.crv].concat(r);var n=t?c.asPublicKey:c.asPrivateKey;return n.apply(c,r)}function i(e,t){var r=u(e),n=t?["x","y"]:["x","y","d"];return n.forEach(function(e){r[e]=f.base64url.encode(r[e])}),delete r.key_ops,delete r.use,delete r.alg,t&&delete r.d,r}function a(e,t){var r=u(e),n=t?["x","y"]:["d"];return n.forEach(function(e){r[e]=f.asBuffer(r[e],"base64url")}),r}function o(e,t){e=a(e,t);var n=t?r.concat([p,e.x,e.y]):e.d;return n}function s(e){return h[e||""]||NaN}var u=e("lodash.clone"),c=e("../deps/ecc"),l=e("../deps/forge.js"),f=e("../util"),h={"P-256":256,"P-384":384,"P-521":521},p=new r([4]);t.exports={convertToForge:n,convertToJWK:i,convertToObj:a,convertToBuffer:o,curveSize:s}}).call(this,e("buffer").Buffer)},{"../deps/ecc":25,"../deps/forge.js":27,"../util":52,buffer:70,"lodash.clone":95}],8:[function(e,t,r){(function(r){"use strict";function n(e){switch(e){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new Error("unsupported curve: "+e)}}function i(){var e={name:"ECDH"},t=function(e,t){t=t||{};var r=t.length||0,n=v.convertToForge(e,!1);if(!t["public"])return Promise.reject(new Error("invalid EC public key"));var i=v.convertToForge(t["public"],!0),a=n.computeSecret(i);if(r){if(a.length<r)return Promise.reject(new Error("key length too large: "+r));a=a.slice(0,r)}return Promise.resolve(a)},n=function(t,n){t=t||{},n=n||{};var i=n.length||0,a=p(h(e),{namedCurve:t.crv});i||(i=t.d.length);var o=v.convertToJWK(t,!1);if(o=_.subtleCrypto.importKey("jwk",o,a,!1,["deriveBits"]),!n["public"])return Promise.reject(new Error("invalid EC public key"));var s=v.convertToJWK(n["public"],!0);s=_.subtleCrypto.importKey("jwk",s,a,!1,[]);var u=Promise.all([o,s]);return u=u.then(function(t){var r=t[0],n=t[1],a=p(h(e),{"public":n});return _.subtleCrypto.deriveBits(a,r,8*i)}),u=u.then(function(e){return e=new Uint8Array(e),r._augment(e),e})},i=function(e,t){if("function"!=typeof _.nodeCrypto.createECDH)throw new Error("unsupported algorithm: ECDH");t=t||{};var r,n=t.length||0;switch(e.crv){case"P-256":r="prime256v1";break;case"P-384":r="secp384r1";break;case"P-521":r="secp521r1";break;default:return Promise.reject(new Error("invalid curve: "+r))}var i=v.convertToBuffer(e,!1),a=v.convertToBuffer(t["public"],!0),o=_.n
1odeCrypto.createECDH(r);o.generateKeys(),o.setPrivateKey(i);var s=o.computeSecret(a);if(n){if(s.length<n)return Promise.reject(new Error("key length too large: "+n));s=s.slice(0,n)}return Promise.resolve(s)};return _.setupFallback(i,n,t)}function a(){var e=function(e,t){t=t||{};var r;try{if(r=t.hash||n(e.crv),!r)throw new Error("invalid hash: "+r);r.toUpperCase()}catch(i){return Promise.reject(i)}var a=["public"],o=C.ECDH.derive(e,g(t,a));return o=o.then(function(e){return b["CONCAT-"+r].derive(e,d(t,a))})};return e}function o(){var e=function(e,t){t=t||{};var r;try{if(r=t.hash||n(e.crv),!r)throw new Error("invalid hash: "+r);r.toUpperCase()}catch(i){return Promise.reject(i)}var a=["public"],o=C.ECDH.derive(e,g(t,a));return o=o.then(function(e){return m["HKDF-"+r].derive(e,d(t,a))})};return e}function s(e,t,n){function i(e){return r.concat([_.int32ToBuffer(e.length),e])}var a=n.algorithm||"",o=w.KEYLENGTH[a],s=y.asBuffer(n.apu||"","base64url"),u=y.asBuffer(n.apv||"","base64url"),c=r.concat([i(new r(a,"utf8")),i(s),i(u),_.int32ToBuffer(o)]),l={"public":t,length:o/8,hash:"SHA-256",otherInfo:c};return C["ECDH-CONCAT"].derive(e,l)}function u(){var e=function(e,t,r){if(r=r||{},!r.epk||!r.epk.d)return Promise.reject(new Error("missing ephemeral private key"));var n=v.convertToObj(r.epk,!1);if(!e||!e.x||!e.y)return Promise.reject(new Error("missing static public key"));var i=v.convertToObj(e,!0),a=s(n,i,{algorithm:r.enc,apu:r.apu,apv:r.apv});return a=a.then(function(e){return{data:e,once:!0,direct:!0}})};return e}function c(){var e=function(e,t,r){if(r=r||{},!r.epk||!r.epk.x||!r.epk.y)return Promise.reject(new Error("missing ephemeral public key"));var n=v.convertToObj(r.epk,!0);if(!e||!e.d)return Promise.reject(new Error("missing static private key"));var i=v.convertToObj(e,!1),a=s(i,n,{algorithm:r.enc,apu:r.apu,apv:r.apv});return a=a.then(function(e){return e})};return e}function l(e){var t=function(t,r,n){if(n=n||{},!n.epk||!n.epk.d)return Promise.reject(new Error("missing ephemeral private key"));var i=v.convertToObj(n.epk,!1);if(!t||!t.x||!t.y)return Promise.reject(new Error("missing static public key"));var a=v.convertToObj(t,!0),o=s(i,a,{algorithm:n.alg,apu:n.apu,apv:n.apv});return o=o.then(function(t){return e(t,r)})};return t}function f(e){var t=function(t,r,n){if(n=n||{},!n.epk||!n.epk.x||!n.epk.y)return Promise.reject(new Error("missing ephemeral public key"));var i=v.convertToObj(n.epk,!0);if(!t||!t.d)return Promise.reject(new Error("missing static private key"));var a=v.convertToObj(t,!1),o=s(a,i,{algorithm:n.alg,apu:n.apu,apv:n.apv});return o=o.then(function(t){return e(t,r)})};return t}var h=e("lodash.clone"),p=e("../util/merge"),d=e("lodash.omit"),g=e("lodash.pick"),y=e("../util"),v=e("./ec-util.js"),m=e("./hkdf.js"),b=e("./concat.js"),E=e("./aes-kw.js"),_=e("./helpers.js"),w=e("./constants.js"),C=t.exports={};["ECDH","ECDH-HKDF","ECDH-CONCAT"].forEach(function(e){var t=/^ECDH(?:-(\w+))?$/g.exec(e||"")[1],r=C[e]=C[e]||{};switch(t||""){case"CONCAT":r.derive=a();break;case"HKDF":r.derive=o();break;case"":r.derive=i();break;default:r.derive=null}}),["ECDH-ES","ECDH-ES+A128KW","ECDH-ES+A192KW","ECDH-ES+A256KW"].forEach(function(e){var t=/^ECDH-ES(?:\+(.+))?/g.exec(e||"")[1],r=C[e]=C[e]||{};t?(t=E[t],t?(r.encrypt=l(t.encrypt),r.decrypt=f(t.decrypt)):r.ecrypt=r.decrypt=null):(r.encrypt=u(),r.decrypt=c())})}).call(this,e("buffer").Buffer)},{"../util":52,"../util/merge":53,"./aes-kw.js":3,"./concat.js":4,"./constants.js":5,"./ec-util.js":7,"./helpers.js":10,"./hkdf.js":11,buffer:70,"lodash.clone":95,"lodash.omit":110,"lodash.pick":119}],9:[function(e,t,r){(function(r){"use strict";function n(e){switch(e){case"SHA-256":return"P-256";case"SHA-384":return"P-384";case"SHA-512":return"P-521";default:throw new Error("unsupported hash: "+e)}}function i(e){var t=n(e),i=function(n,i){if(t!==n.crv)return Promise.reject(new Error("invalid curve"));var a,s=o.convertToForge(n,!1);return a=u[e].digest(i),a=a.then(function(e){return e=s.sign(e),e=r.concat([e.r,e.s]),{data:i,mac:e}})},a=function(n,i){if(t!==n.crv)return Promise.reject(new Error("invalid curve"));var a,u=o.convertToJWK(n,!1),c={name:"ECDSA",namedCurve:u.crv,hash:{name:e}};return a=s.subtleCrypto.importKey("jwk",u,c,!0,["sign"]),a=a.then(function(e){return s.subtleCrypto.sign(c,e,i)}),a=a.then(function(e){return e=new Uint8Array(e),e=r._augment(e),{data:i,mac:e}})};return s.setupFallback(null,a,i)}function a(e){var t=n(e),r=function(r,n,i){if(t!==r.crv)return Promise.reject(new Error("invalid curve"));var a,s=o.convertToForge(r,!0);return a=u[e].digest(n),a=a.then(function(e){var t=i.length/2,r={r:i.slice(0,t),s:i.slice(t)};return s.verify(e,r)?{data:n,mac:i,valid:!0}:Promise.reject(new Error("verification failed"))})},i=function(r,n,i){if(t!==r.crv)return Promise.reject(new Error("invalid curve"));var a,u=o.convertToJWK(r,!0),c={name:"ECDSA",namedCurve:u.crv,hash:{name:e}};return a=s.subtleCrypto.importKey("jwk",u,c,!0,["verify"]),a=a.then(function(e){return s.subtleCrypto.verify(c,e,i,n)}),a=a.then(function(e){return e?{data:n,mac:i,valid:!0}:Promise.reject(new Error("verification failed"))})};return s.setupFallback(null,i,r)}var o=e("./ec-util.js"),s=e("./helpers.js"),u=e("./sha.js"),c={};["ES256","ES384","ES512"].forEach(function(e){var t=e.replace(/ES(\d+)/g,function(e,t){return"SHA-"+t});c[e]={sign:i(t),verify:a(t)}}),t.exports=c}).call(this,e("buffer").Buffer)},{"./ec-util.js":7,"./helpers.js":10,"./sha.js":18,buffer:70}],10:[function(e,t,r){(function(t){"use strict";function n(){if("undefined"!=typeof crypto){if("undefined"!=typeof crypto.subtle)return crypto.subtle;if("undefined"!=typeof crypto.webkitSubtle)return crypto.webkitSubtle}}function i(){var t;try{var r="crypto";t=e(r)}catch(n){return}return t}"undefined"==typeof Promise&&e("es6-promise").polyfill(),r.int32ToBuffer=function(e,r){return r=r||new t(4),r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r};var a=Math.pow(2,32);
1r.int64ToBuffer=function(e,n){n=n||new t(8);var i=Math.floor(e/a),o=e%a;return i=r.int32ToBuffer(i),o=r.int32ToBuffer(o),n=t.concat([i,o])};var o={};Object.defineProperty(r,"subtleCrypto",{get:function(){var e;return e="subtleCrypto"in o?o.subtleCrypto:o.subtleCrypto=n()},enumerable:!0}),Object.defineProperty(r,"nodeCrypto",{get:function(){var e;return e="nodeCrypto"in o?o.nodeCrypto:o.nodeCrypto=i()},enumerable:!0}),r.setupFallback=function(e,t,n){var i;return i=e&&r.nodeCrypto?function(){function t(e){return 0===e.message.indexOf("unsupported algorithm:")?(i=n,i.apply(null,a)):Promise.reject(e)}var r,a=arguments;try{r=Promise.resolve(e.apply(null,a))}catch(o){r=t(o)}return r}:t&&r.subtleCrypto?function(){function e(e){return e.code!==DOMException.NOT_SUPPORTED_ERR&&"Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData"!==e.message&&e instanceof Error?Promise.reject(e):(i=n,i.apply(null,a))}var r,a=arguments;try{r=t.apply(null,a),r=r["catch"](e)}catch(o){r=e(o)}return r}:n}}).call(this,e("buffer").Buffer)},{buffer:70,"es6-promise":90}],11:[function(e,t,r){(function(r){"use strict";function n(e){var t=e.replace("HKDF-",""),n=e.replace("HKDF-SHA-","HS"),o=function(e,o){function s(e,t){return p===g++?r.concat(d).slice(0,h):(t||(t=new r(0)),t=r.concat([t,f,new r([g])]),t=n(e,t,{loose:!0}),t=t.then(function(r){return t=r.mac,d.push(t),s(e,t)}))}var u=i.HASHLENGTH[t]/8;"string"==typeof n&&(n=a[n].sign),o=o||{};var c=o.salt;c&&0!==c.length||(c=new r(u),c.fill(0));var l,f=o.info||new r(0),h=o.length||u,p=Math.ceil(h/u),d=[],g=0;return l=n(c,e,{loose:!0}),l=l.then(function(e){return s(e.mac)})};return o}var i=e("./constants.js"),a=e("./hmac.js"),o={};["HKDF-SHA-1","HKDF-SHA-256","HKDF-SHA-384","HKDF-SHA-512"].forEach(function(e){o[e]={derive:n(e)}}),t.exports=o}).call(this,e("buffer").Buffer)},{"./constants.js":5,"./hmac.js":12,buffer:70}],12:[function(e,t,r){(function(r){"use strict";function n(e){var t=e.replace("HS","SHA").toLowerCase(),n=e.replace("HS","SHA-"),i=function(e,r,i){if(i=i||{},!i.loose&&a.HASHLENGTH[n]>e.length<<3)return Promise.reject(new Error("invalid key length"));var s=o.hmac.create();return s.start(t,e.toString("binary")),s.update(r),s=s.digest()["native"](),Promise.resolve({data:r,mac:s})},s=function(e,t,i){if(i=i||{},!i.loose&&a.HASHLENGTH[n]>e.length<<3)return Promise.reject(new Error("invalid key length"));var o,s={name:"HMAC",hash:{name:n}};return o=u.subtleCrypto.importKey("raw",e,s,!0,["sign"]),o=o.then(function(e){return u.subtleCrypto.sign(s,e,t)}),o=o.then(function(e){var n=new Uint8Array(e);return n=r._augment(n),{data:t,mac:n}})},c=function(e,r,i){if(i=i||{},!i.loose&&a.HASHLENGTH[n]>e.length<<3)return Promise.reject(new Error("invalid key length"));var o=u.nodeCrypto.createHmac(t,e);o.update(r);var s=o.digest();return{data:r,mac:s}};return u.setupFallback(c,s,i)}function i(e){function t(e,t,r){for(var n=e?t.length:a.HASHLENGTH[i]/8,o=!0,s=0;n>s;s++)o=o&&t[s]===r[s];return o}var n=e.replace("HS","SHA").toLowerCase(),i=e.replace("HS","SHA-"),c=function(e,r,u,c){if(c=c||{},!c.loose&&a.HASHLENGTH[i]>e.length<<3)return Promise.reject(new Error("invalid key length"));var l=o.hmac.create();return l.start(n,new s(e)),l.update(r),l=l.digest()["native"](),t(c.loose,u,l)?Promise.resolve({data:r,mac:u,valid:!0}):Promise.reject(new Error("verification failed"))},l=function(e,n,o,s){if(s=s||{},!s.loose&&a.HASHLENGTH[i]>e.length<<3)return Promise.reject(new Error("invalid key length"));var c,l={name:"HMAC",hash:{name:i}};return s.loose?(c=u.subtleCrypto.importKey("raw",e,l,!0,["sign"]),c=c.then(function(e){return u.subtleCrypto.sign(l,e,n)}),c=c.then(function(e){var n=new Uint8Array(e);return n=r._augment(n),t(!0,o,n)})):(c=u.subtleCrypto.importKey("raw",e,l,!0,["verify"]),c=c.then(function(e){return u.subtleCrypto.verify(l,e,o,n)})),c=c.then(function(e){return e?{data:n,mac:o,valid:!0}:Promise.reject(new Error("verifaction failed"))})},f=function(e,r,o,s){if(s=s||{},!s.loose&&a.HASHLENGTH[i]>e.length<<3)return Promise.reject(new Error("invalid key length"));var c=u.nodeCrypto.createHmac(n,e);c.update(r);var l=c.digest();if(!t(s.loose,o,l))throw new Error("verification failed");return{data:r,mac:l,valid:!0}};return u.setupFallback(f,l,c)}var a=e("./constants"),o=e("../deps/forge.js"),s=e("../util/databuffer.js"),u=e("./helpers.js"),c={};["HS1","HS256","HS384","HS512"].forEach(function(e){c[e]={sign:n(e),verify:i(e)}}),t.exports=c}).call(this,e("buffer").Buffer)},{"../deps/forge.js":27,"../util/databuffer.js":51,"./constants":5,"./helpers.js":10,buffer:70}],13:[function(e,t,r){"use strict";var n=[e("./aes-cbc-hmac-sha2.js"),e("./aes-gcm.js"),e("./aes-kw.js"),e("./concat.js"),e("./dir.js"),e("./ecdh.js"),e("./ecdsa.js"),e("./hkdf.js"),e("./hmac.js"),e("./pbes2.js"),e("./rsaes.js"),e("./rsassa.js"),e("./sha.js")],i={},a={},o={},s={},u={},c={};
1n.forEach(function(e){Object.keys(e).forEach(function(t){var r=e[t];"function"==typeof r.encrypt&&(u[t]=r.encrypt),"function"==typeof r.decrypt&&(c[t]=r.decrypt),"function"==typeof r.sign&&(o[t]=r.sign),"function"==typeof r.verify&&(s[t]=r.verify),"function"==typeof r.digest&&(i[t]=r.digest),"function"==typeof r.derive&&(a[t]=r.derive)})}),r.digest=function(e,t,r){var n=i[e];return n?n(t,r):Promise.reject(new Error("unsupported algorithm: "+e))},r.derive=function(e,t,r){var n=a[e];return n?n(t,r):Promise.reject(new Error("unsupported algorithm: "+e))},r.sign=function(e,t,r,n){var i=o[e];return i?i(t,r,n||{}):Promise.reject(new Error("unsupported algorithm: "+e))},r.verify=function(e,t,r,n,i){var a=s[e];return a?a(t,r,n,i||{}):Promise.reject(new Error("unsupported algorithm: "+e))},r.encrypt=function(e,t,r,n){var i=u[e];return i?i(t,r,n||{}):Promise.reject(new Error("unsupported algorithm: "+e))},r.decrypt=function(e,t,r,n){var i=c[e];return i?i(t,r,n||{}):Promise.reject(new Error("unsupported algorithm: "+e))}},{"./aes-cbc-hmac-sha2.js":1,"./aes-gcm.js":2,"./aes-kw.js":3,"./concat.js":4,"./dir.js":6,"./ecdh.js":8,"./ecdsa.js":9,"./hkdf.js":11,"./hmac.js":12,"./pbes2.js":14,"./rsaes.js":16,"./rsassa.js":17,"./sha.js":18}],14:[function(e,t,r){(function(r){"use strict";function n(e,t,n){var i="PBES2-"+e+"+"+t,a=[new r(i,"utf8"),f,n];return r.concat(a)}function i(e,t){var i=c.KEYLENGTH[t]/8,a=function(a,u,c){c=c||{};var f=s.asBuffer(c.p2s||new r(0),"base64url"),h=c.p2c||0;if(0>=h)return Promise.reject(new Error("invalid iteration count"));if(8>f.length)return Promise.reject(new Error("salt too small"));f=n(e,t,f);var p;return p=new Promise(function(t,n){var s=o.md[e.replace("HS","SHA").toLowerCase()].create(),u=function(e,i){e?n(e):(i=new r(i,"binary"),t(i))};o.pkcs5.pbkdf2(a.toString("binary"),f.toString("binary"),h,i,s,u)}),p=p.then(function(e){return l[t].encrypt(e,u)})},f=null,h=function(a,o,c){if(6>u.nodeCrypto.pbkdf2.length)throw new Error("unsupported algorithm: PBES2-"+e+"+"+t);c=c||{};var f=s.asBuffer(c.p2s||new r(0),"base64url"),h=c.p2c||0;if(0>=h)return Promise.reject(new Error("invalid iteration count"));if(8>f.length)return Promise.reject(new Error("salt too small"));f=n(e,t,f);var p,d=e.replace("HS","SHA");return p=new Promise(function(e,t){function r(r,n){r?t(r):e(n)}u.nodeCrypto.pbkdf2(a,f,h,i,d,r)}),p=p.then(function(e){return l[t].encrypt(e,o)})};return u.setupFallback(h,f,a)}function a(e,t){var i=c.KEYLENGTH[t]/8,a=function(a,u,c){c=c||{};var f=s.asBuffer(c.p2s||new r(0),"base64url"),h=c.p2c||0;if(0>=h)return Promise.reject(new Error("invalid iteration count"));if(8>f.length)return Promise.reject(new Error("salt too small"));f=n(e,t,f);var p;return p=new Promise(function(t,n){var s=o.md[e.replace("HS","SHA").toLowerCase()].create(),u=function(e,i){e?n(e):(i=new r(i,"binary"),t(i))};o.pkcs5.pbkdf2(a.toString("binary"),f.toString("binary"),h,i,s,u)}),p=p.then(function(e){return l[t].decrypt(e,u)})},f=null,h=function(a,o,c){if(6>u.nodeCrypto.pbkdf2.length)throw new Error("unsupported algorithm: PBES2-"+e+"+"+t);c=c||{};var f=s.asBuffer(c.p2s||new r(0),"base64url"),h=c.p2c||0;if(0>=h)return Promise.reject(new Error("invalid iteration count"));if(8>f.length)return Promise.reject(new Error("salt too small"));f=n(e,t,f);var p,d=e.replace("HS","SHA");return p=new Promise(function(e,t){function r(r,n){r?t(r):e(n)}u.nodeCrypto.pbkdf2(a,f,h,i,d,r)}),p=p.then(function(e){return l[t].decrypt(e,o)})};return u.setupFallback(h,f,a)}var o=e("../deps/forge.js"),s=e("../util"),u=e("./helpers.js"),c=e("./constants.js"),l=e("./aes-kw.js"),f=new r([0]),h={};["PBES2-HS256+A128KW","PBES2-HS384+A192KW","PBES2-HS512+A256KW"].forEach(function(e){var t=/PBES2-(HS\d+)\+(A\d+KW)/g.exec(e),r=t[1],n=t[2];h[e]={encrypt:i(r,n),decrypt:a(r,n)}}),t.exports=h}).call(this,e("buffer").Buffer)},{"../deps/forge.js":27,"../util":52,"./aes-kw.js":3,"./constants.js":5,"./helpers.js":10,buffer:70}],15:[function(e,t,r){"use strict";function n(e,t){var r=t?["n","e"]:["n","e","d","p","q","dp","dq","qi"];r=r.map(function(t){return new o.jsbn.BigInteger(e[t].toString("hex"),16)});var n=t?o.pki.rsa.setPublicKey:o.pki.rsa.setPrivateKey;return n.apply(o.pki.rsa,r)}function i(e,t){var r=a(e),n=t?["n","e"]:["n","e","d","p","q","dp","dq","qi"];
1return n.forEach(function(e){r[e]=s.base64url.encode(r[e])}),delete r.key_ops,delete r.use,delete r.alg,t&&(delete r.d,delete r.p,delete r.q,delete r.dp,delete r.dq,delete r.qi),r}var a=e("lodash.clone"),o=e("../deps/forge.js"),s=e("../util");t.exports={convertToForge:n, 2convertToJWK:i}},{"../deps/forge.js":27,"../util":52,"lodash.clone":95}],16:[function(e,t,r){(function(r){"use strict";function n(e){var t={name:e};"RSA-OAEP-256"===e?(t.name="RSA-OAEP",t.hash={name:"SHA-256"}):"RSA-OAEP"===e?t.hash={name:"SHA-1"}:t.name="RSAES-PKCS1-v1_5";var n,i=function(e,r){r=new s(r).bytes();var n=u.convertToForge(e,!0),i={};"RSA-OAEP"===t.name&&(i.md=t.hash.name.toLowerCase().replace(/\-/g,""),i.md=a.md[i.md].create());var o=n.encrypt(r,t.name.toUpperCase(),i);return o=new s(o)["native"](),Promise.resolve({data:o})};return n="RSAES-PKCS1-v1_5"!==t.name?function(e,n){e=u.convertToJWK(e,!0);var i;return i=o.subtleCrypto.importKey("jwk",e,t,!0,["encrypt"]),i=i.then(function(e){return o.subtleCrypto.encrypt(t,e,n)}),i=i.then(function(e){var t=new Uint8Array(e);return t=r._augment(t),{data:t}})}:null,o.setupFallback(null,n,i)}function i(e){var t={name:e};"RSA-OAEP-256"===e?(t.name="RSA-OAEP",t.hash={name:"SHA-256"}):"RSA-OAEP"===e?t.hash={name:"SHA-1"}:t.name="RSAES-PKCS1-v1_5";var n,i=function(e,r){r=new s(r).bytes();var n=u.convertToForge(e,!1),i={};"RSA-OAEP"===t.name&&(i.md=t.hash.name.toLowerCase().replace(/\-/g,""),i.md=a.md[i.md].create());var o=n.decrypt(r,t.name.toUpperCase(),i);return o=new s(o)["native"](),Promise.resolve(o)};return n="RSAES-PKCS1-v1_5"!==t.name?function(e,n){e=u.convertToJWK(e,!1);var i;return i=o.subtleCrypto.importKey("jwk",e,t,!0,["decrypt"]),i=i.then(function(e){return o.subtleCrypto.decrypt(t,e,n)}),i=i.then(function(e){var t=new Uint8Array(e);return t=r._augment(t)})}:null,o.setupFallback(null,n,i)}var a=e("../deps/forge.js"),o=e("./helpers.js"),s=e("../util/databuffer.js"),u=e("./rsa-util.js"),c={};["RSA-OAEP","RSA-OAEP-256","RSA1_5"].forEach(function(e){c[e]={encrypt:n(e),decrypt:i(e)}}),t.exports=c}).call(this,e("buffer").Buffer)},{"../deps/forge.js":27,"../util/databuffer.js":51,"./helpers.js":10,"./rsa-util.js":15,buffer:70}],17:[function(e,t,r){(function(r){"use strict";function n(e){var t=e.replace("RS","SHA").toLowerCase(),n=e.replace("RS","SHA-"),i={name:"RSASSA-PKCS1-V1_5",hash:{name:n}},a=function(e,n){var i=s.md[t].create();i.start(),i.update(n);var a=l.convertToForge(e,!1),o=a.sign(i,"RSASSA-PKCS1-V1_5");return o=new r(o,"binary"),Promise.resolve({data:n,mac:o})},o=function(e,t){e=l.convertToJWK(e,!1);var n;return n=c.subtleCrypto.importKey("jwk",e,i,!0,["sign"]),n=n.then(function(e){return c.subtleCrypto.sign(i,e,t)}),n=n.then(function(e){var n=new Uint8Array(e);return n=r._augment(n),{data:t,mac:n}})};return c.setupFallback(null,o,a)}function i(e){var t=e.replace("RS","SHA").toLowerCase(),r=e.replace("RS","SHA-"),n={name:"RSASSA-PKCS1-V1_5",hash:{name:r}},i=function(e,r,n){var i=s.md[t].create();i.start(),i.update(r),i=i.digest().bytes();var a=l.convertToForge(e,!0),o=n.toString("binary"),u=a.verify(i,o,"RSASSA-PKCS1-V1_5");return u?Promise.resolve({data:r,mac:n,valid:!0}):Promise.reject(new Error("verification failed"))},a=function(e,t,r){e=l.convertToJWK(e,!0);var i;return i=c.subtleCrypto.importKey("jwk",e,n,!0,["verify"]),i=i.then(function(e){return c.subtleCrypto.verify(n,e,r,t)}),i=i.then(function(e){return e?{data:t,mac:r,valid:!0}:Promise.reject(new Error("verification failed"))})};return c.setupFallback(null,a,i)}function a(e){var t=e.replace("PS","SHA").toLowerCase(),n=e.replace("PS","SHA-");return function(e,i){var a=s.md[t].create();a.start(),a.update(i);var o=s.pss.create({md:s.md[t].create(),mgf:s.mgf.mgf1.create(s.md[t].create()),saltLength:u.HASHLENGTH[n]/8}),c=l.convertToForge(e,!1),f=c.sign(a,o);return f=new r(f,"binary"),Promise.resolve({data:i,mac:f})}}function o(e){var t=e.replace("PS","SHA").toLowerCase(),r=e.replace("PS","SHA-");return function(e,n,i){var a=s.md[t].create();a.start(),a.update(n),a=a.digest().bytes();var o=s.pss.create({md:s.md[t].create(),mgf:s.mgf.mgf1.create(s.md[t].create()),saltLength:u.HASHLENGTH[r]/8}),c=l.convertToForge(e,!0),f=i.toString("binary"),h=c.verify(a,f,o);return h?Promise.resolve({data:n,mac:i,valid:!0}):Promise.reject(new Error("verification failed"))}}var s=e("../deps/forge.js"),u=e("./constants"),c=e("./helpers.js"),l=e("./rsa-util.js"),f={};["PS256","PS384","PS512"].forEach(function(e){f[e]={sign:a(e),verify:o(e)}}),["RS256","RS384","RS512"].forEach(function(e){f[e]={sign:n(e),verify:i(e)}}),t.exports=f}).call(this,e("buffer").Buffer)},{"../deps/forge.js":27,"./constants":5,"./helpers.js":10,"./rsa-util.js":15,buffer:70}],18:[function(e,t,r){(function(r){"use strict";function n(e){var t=e.replace("SHA-","SHA").toLowerCase(),n={name:e},o=function(e){var r=i.md[t].create();return r.update(e),r=r.digest()["native"](),Promise.resolve(r)},s=function(e){var t;return t=a.subtleCrypto.digest(n,e),t=t.then(function(e){return e=new Uint8Array(e),e=r._augment(e)})},u=function(e){var r=a.nodeCrypto.createHash(t);return r.update(e),r.digest()};return a.setupFallback(u,s,o)}var i=e("../deps/forge.js"),a=e("./helpers.js"),o={};["SHA-1","SHA-256","SHA-384","SHA-512"].forEach(function(e){o[e]={digest:n(e)}}),t.exports=o}).call(this,e("buffer").Buffer)},{"../deps/forge.js":27,"./helpers.js":10,buffer:70}],19:[function(e,t,r){(function(r){"use strict";function n(){for(var e=[],t=0;256>t;++t){for(var r=0,n=7;n>=0;--n)0!==(t&1<<n)&&(r^=s>>>7-n);e.push(r)}return e}var i=e("long"),a=e("lodash.fill"),o=e("../pack.js"),s=3774873600,u=225,c=new i(s>>8),l=t.exports={E1:s,E1B:u,E1L:c,LOOKUP:n(),arrayCopy:function(e,t,r,n,i){if(0>t||0>n||0>i)throw new TypeError("Invalid input.");if(r instanceof Uint8Array){if(n>=r.length||n+i>r.length)throw new TypeError("Invalid input.");(0!==t||i<e.length)&&(e=e instanceof Uint8Array?e.subarray(t,t+i):e.slice(t,t+i)),r.set(e,n)}else for(var a=0;i>a;++a)r[n+a]=e[t+a]},arrayEqual:function(e,t){e=e||[],t=t||[];for(var r=Math.min(e.length,t.length),n=e.length===t.length,i=0;r>i;i++)n=n&&"undefined"!=typeof e[i]&&"undefined"!=typeof t[i]&&e[i]===t[i];return n},asBytes:function(e,t){switch(arguments.length){case 1:return t=new r(16),t.fill(0),o.intToBigEndian(e,t,0),t;case 2:o.intToBigEndian(e,t,0);break;default:throw new TypeError("Expected 1 or 2 arguments.")}},asInts:function(e,t){switch(arguments.length){case 1:return t=[],a(t,0,0,4),o.bigEndianToInt(e,0,t),t;case 2:o.bigEndianToInt(e,0,t);break;default:throw new TypeError("Expected 1 or 2 arguments.")}},oneAsInts:function(){for(var e=[],t=0;4>t;++t)e.push(1<<31);return e},shiftRight:function(e,t){var r,n;switch(arguments.length){case 1:return r=e[0],e[0]=r>>>1,n=r<<31,r=e[1],e[1]=r>>>
21|n,n=r<<31,r=e[2],e[2]=r>>>1|n,n=r<<31,r=e[3],e[3]=r>>>1|n,r<<31&4294967295;case 2:return r=e[0],t[0]=r>>>1,n=r<<31,r=e[1],t[1]=r>>>1|n,n=r<<31,r=e[2],t[2]=r>>>1|n,n=r<<31,r=e[3],t[3]=r>>>1|n,r<<31&4294967295;default:throw new TypeError("Expected 1 or 2 arguments.")}},shiftRightN:function(e,t,r){var n,i,a;switch(arguments.length){case 2:return i=e[0],n=32-t,e[0]=i>>>t,a=i<<n,i=e[1],e[1]=i>>>t|a,a=i<<n,i=e[2],e[2]=i>>>t|a,a=i<<n,i=e[3],e[3]=i>>>t|a,i<<n;case 3:return i=e[0],n=32-t,r[0]=i>>>t,a=i<<n,i=e[1],r[1]=i>>>t|a,a=i<<n,i=e[2],r[2]=i>>>t|a,a=i<<n,i=e[3],r[3]=i>>>t|a,i<<n;default:throw new TypeError("Expected 2 or 3 arguments.")}},xor:function(e,t,r){switch(arguments.length){case 2:e[0]^=t[0],e[1]^=t[1],e[2]^=t[2],e[3]^=t[3];break;case 3:r[0]=e[0]^t[0],r[1]=e[1]^t[1],r[2]=e[2]^t[2],r[3]=e[3]^t[3];break;default:throw new TypeError("Expected 2 or 3 arguments.")}},multiply:function(e,t){for(var r=e.slice(),n=[],i=0;4>i;++i)for(var a=t[i],o=31;o>=0;--o)0!==(a&1<<o)&&l.xor(n,r),0!==l.shiftRight(r)&&(r[0]^=l.E1);l.arrayCopy(n,0,e,0,4)},multiplyP:function(e,t){switch(arguments.length){case 1:0!==l.shiftRight(e)&&(e[0]^=l.E1);break;case 2:0!==l.shiftRight(e,t)&&(t[0]^=l.E1);break;default:throw new TypeError("Expected 1 or 2 arguments.")}},multiplyP8:function(e,t){var r;switch(arguments.length){case 1:r=l.shiftRightN(e,8),e[0]^=l.LOOKUP[r>>>24];break;case 2:r=l.shiftRightN(e,8,t),t[0]^=l.LOOKUP[r>>>24];break;default:throw new TypeError("Expected 1 or 2 arguments.")}}}}).call(this,e("buffer").Buffer)},{"../pack.js":23,buffer:70,"lodash.fill":97,"long":126}],20:[function(e,t,r){(function(r){"use strict";function n(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=this.blockSize||16}var i=e("long"),a=e("../../../deps/forge.js"),o=e("./multipliers.js"),s=e("./helpers.js"),u=e("../pack.js"),c=e("../../../util/databuffer.js"),l=e("../helpers.js"),f=16;t.exports={createCipher:function(e){var t=new a.aes.Algorithm("AES-GCM",n);return t.initialize({key:new c(e.key)}),t.mode.start(e),t.mode},createDecipher:function(e){var t=new a.aes.Algorithm("AES-GCM",n);return t.initialize({key:new c(e.key)}),t.mode._decrypt=!0,t.mode.start(e),t.mode}},n.prototype.start=function(e){if(this.tag=null,e=e||{},!("iv"in e))throw new Error("Gcm needs ParametersWithIV or AEADParameters");if(this.nonce=e.iv,null==this.nonce||this.nonce.length<1)throw new Error("IV must be at least 1 byte");this.tagLength=16,"tag"in e&&(this.tag=new r(e.tag));var t=this._decrypt?this.blockSize+this.tagLength:this.blockSize;this.bufBlock=new r(t),this.bufBlock.fill(0);var n=e.multiplier;if(null==n&&(n=new o["8k"]),this.multiplier=n,this.H=this.zeroBlock(),l.encrypt(this.cipher,this.H,0,this.H,0),this.multiplier.init(this.H),this.exp=null,this.J0=this.zeroBlock(),12===this.nonce.length)this.nonce.copy(this.J0,0,0,this.nonce.length),this.J0[this.blockSize-1]=1;else{this.gHASH(this.J0,this.nonce,this.nonce.length);var a=this.zeroBlock();u.longToBigEndian(new i(this.nonce.length).multiply(8),a,8),this.gHASHBlock(this.J0,a)}this.S=this.zeroBlock(),this.SAt=this.zeroBlock(),this.SAtPre=this.zeroBlock(),this.atBlock=this.zeroBlock(),this.atBlockPos=0,this.atLength=i.ZERO,this.atLengthPre=i.ZERO,this.counter=new r(this.J0),this.bufOff=0,this.totalLength=i.ZERO,"additionalData"in e&&this.processAADBytes(e.additionalData,0,e.additionalData.length)},n.prototype.update=function(e,t,r,n,i){for(var a=0;r>0;){var o=Math.min(r,this.bufBlock.length-this.bufOff);e.copy(this.bufBlock,this.bufOff,t,t+o),r-=o,t+=o,this.bufOff+=o,this.bufOff===this.bufBlock.length&&(this.outputBlock(n,i+a),a+=this.blockSize)}return a},n.prototype.finish=function(e,t){var n=0;this._decrypt&&(n+=this.update(this.tag,0,this.tag.length,e,t)),this.totalLength.isZero()&&this.initCipher();var i=this.bufOff;if(this._decrypt){if(i<this.tagLength)throw new Error("data too short");i-=this.tagLength}i>0&&(this.gCTRPartial(this.bufBlock,0,i,e,t+n),n+=i),this.atLength=this.atLength.add(this.atBlockPos);var a=this.zeroBlock();u.longToBigEndian(this.atLength.multiply(8),a,0),u.longToBigEndian(this.totalLength.multiply(8),a,8),this.gHASHBlock(this.S,a);var o=new r(this.blockSize);if(o.fill(0),l.encrypt(this.cipher,this.J0,0,o,0),this.xor(o,this.S),this._decrypt){if(!s.arrayEqual(this.tag,o))throw new Error("mac check in Gcm failed")}else this.tag=new r(this.tagLength),o.copy(this.tag,0,0,this.tagLength);return n},n.prototype.initCipher=function(){this.atLength.greaterThan(i.ZERO)&&(this.SAt.copy(this.SAtPre,0,0,this.blockSize),this.atLengthPre=this.atLength.add(i.ZERO)),this.atBlockPos>0&&(this.gHASHPartial(this.SAtPre,this.atBlock,0,this.atBlockPos),this.atLengthPre=this.atLengthPre.add(this.atBlockPos)),this.atLengthPre.greaterThan(i.ZERO)&&this.SAtPre.copy(this.S,0,0,this.blockSize)},n.prototype.outputBlock=function(e,t){this.totalLength.isZero()&&this.initCipher(),this.gCTRBlock(this.bufBlock,e,t),this._decrypt?(this.bufBlock.copy(this.bufBlock,0,this.blockSize,this.blockSize+this.tagLength),this.bufOff=this.tagLength):this.bufOff=0},n.prototype.processAADBytes=function(e,t,r){for(var n=0;r>n;++n)this.atBlock[this.atBlockPos]=e[t+n],++this.atBlockPos===this.blockSize&&(this.gHASHBlock(this.SAt,this.atBlock),this.atBlockPos=0,this.atLength=this.atLength.add(this.blockSize))},n.prototype.getNextCounterBlock=function(){for(var e=15;e>=12;--e){var t=this.counter[e]+1&255;if(this.counter[e]=t,0!==t)break}var n=new r(this.blockSize);return n.fill(0),l.encrypt(this.cipher,this.counter,0,n,0),n},n.prototype.gCTRBlock=function(e,t,r){var n=this.getNextCounterBlock();this.xor(n,e),n.copy(t,r,0,this.blockSize),this.gHASHBlock(this.S,this._decrypt?e:n),this.totalLength=this.totalLength.add(this.blockSize)},n.prototype.gCTRPartial=function(e,t,r,n,i){var a=this.getNextCounterBlock();this.xor(a,e,t,r),a.copy(n,i,0,r),this.gHASHPartial(this.S,this._decrypt?e:a,0,r),this.totalLength=this.totalLength.add(r)},n.prototype.gHASHBlock=function(e,t){this.xor(e,t),this.multiplier.multiplyH(e)},n.prototype.gHASHPartial=function(e,t,r,n){this.xor(e,t,r,n),this.multiplier.multiplyH(e)},n.prototype.xor=function(e,t,r,n){switch(arguments.length){case 2:for(var i=15;i>=0;--i)e[i]^=t[i];break;case 4:for(;n-- >0;)e[n]^=t[r+n];break;default:throw new TypeError("Expected 2 or 4 arguments.")}return e},n.prototype.zeroBlock=function(){var e=new r(f);return e.fill(0),e}}).call(this,e("buffer").Buffer)},{"../../../deps/forge.js":27,"../../../util/databuffer.js":51,"../helpers.js":22,"../pack.js":23,"./helpers.js":19,"./multipliers.js":21,buffer:70,"long":126}],21:[function(e,t,r){"use strict";function n(){this.H=[],this.M=null}var i=e("./helpers.js"),a=e("../pack.js");n.prototype.init=function(e){var t,r,n;if(null==this.M)for(this.M=[],t=0;32>t;++t)for(this.M[t]=[],r=0;16>r;++r)for(this.M[t][r]=[],n=0;4>n;++n)this.M[t][r][n]=0;else if(i.arrayEqual(this.H,e))return;for(this.H=e.slice(),i.asInts(e,this.M[1][8]),r=4;r>=1;r>>=1)i.multiplyP(this.M[1][r+r],this.M[1][r]);for(i.multiplyP(this.M[1][1],this.M[0][8]),r=4;r>=1;r>>=1)i.multiplyP(this.M[0][r+r],this.M[0][r]);for(t=0;;){for(r=2;16>r;r+=r)for(n=1;r>n;++n)i.xor(this.M[t][r],this.M[t][n],this.M[t][r+n]);if(32===++t)return;if(t>1)for(r=8;r>0;r>>=1)i.multiplyP8(this.M[t-2][r],this.M[t][r])}},n.prototype.multiplyH=function(e){for(var t=[],r=15;r>=0;--r){var n=this.M[r+r][15&e[r]];t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3],n=this.M[r+r+1][(240&e[r])>>>4],t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3]}a.intToBigEndian(t,e,0)},t.exports={"8k":n}},{"../pack.js":23,"./helpers.js":19}],22:[function(e,t,r){"use strict";function n(e,t,r,n,a){var o=new Array(4),s=new Array(4);i.bigEndianToInt(t,r,o),e.encrypt(o,s),i.intToBigEndian(s,n,a)}var i=e("./pack.js");t.exports={encrypt:n}},{"./pack.js":23}],23:[function(e,t,r){(function(r){"use strict";var n=e("long"),i=t.exports={intToBigEndian:function(e,t,n){if("number"==typeof e)switch(arguments.length){case 1:t=new r(4),t.fill(0),i.intToBigEndian(e,t,0);break;case 3:t[n]=255&e>>>24,t[++n]=255&e>>>16,t[++n]=255&e>>>8,t[++n]=255&e;break;default:throw new TypeError("Expected 1 or 3 arguments.")}else switch(arguments.length){case 1:t=new r(4*e.length),t.fill(0),i.intToBigEndian(e,t,0);break;case 3:for(var a=0;a<e.length;++a)i.intToBigEndian(e[a],t,n),n+=4;break;default:throw new TypeError("Expected 1 or 3 arguments.")}return t},longToBigEndian:function(e,t,n){if(Array.isArray(e))switch(arguments.length){case 1:t=new r(8*e.length),t.fill(0),i.longToBigEndian(e,t,0);break;case 3:for(var a=0;a<e.length;++a)i.longToBigEndian(e[a],t,n),n+=8;break;default:throw new TypeError("Expected 1 or 3 arguments.")}else switch(arguments.length){case 1:t=new r(8),t.fill(0),i.longToBigEndian(e,t,0);break;case 3:var o=e.low,s=e.high;i.intToBigEndian(s,t,n),i.intToBigEndian(o,t,n+4);break;default:throw new TypeError("Expected 1 or 3 arguments.")}return t},bigEndianToInt:function(e,t,r){switch(arguments.length){case 2:var n=e[t]<<24;return n|=(255&e[++t])<<16,n|=(255&e[++t])<<8,n|=255&e[++t];case 3:for(var a=0;a<r.length;++a)r[a]=i.bigEndianToInt(e,t),t+=4;break;default:throw new TypeError("Expected 2 or 3 arguments.")}},bigEndianToLong:function(e,t,r){switch(arguments.length){case 2:var a=i.bigEndianToInt(e,t),o=i.bigEndianToInt(e,t+4),s=new n(o,a);return s;case 3:for(var u=0;u<r.length;++u)r[u]=i.bigEndianToLong(e,t),t+=8;break;default:throw new TypeError("Expected 2 or 3 arguments.")}}}}).call(this,e("buffer").Buffer)},{buffer:70,"long":126}],24:[function(e,t,r){"use strict";function n(e,t,r,n){this.curve=e,this.g=t,this.n=r,this.h=n}function i(){return this.curve}function a(){return this.g}function o(){return this.n}function s(){return this.h}function u(e){return new h(e,16)}function c(){var e=u("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF"),t=u("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC"),r=u("5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B"),i=u("FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551"),a=h.ONE,o=new p.ECCurveFp(e,t,r),s=o.decodePointHex("046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5");return new n(o,s,i,a)}function l(){var e=u("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF"),t=u("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC"),r=u("B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF"),i=u("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973"),a=h.ONE,o=new p.ECCurveFp(e,t,r),s=o.decodePointHex("04AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB73617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A147CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F");return new n(o,s,i,a)}function f(){var e=u("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"),t=u("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC"),r=u("0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00"),i=u("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409"),a=h.ONE,o=new p.ECCurveFp(e,t,r),s=o.decodePointHex("0400C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD16650");return new n(o,s,i,a)}var h=e("jsbn").BigInteger,p=e("./math.js");n.prototype.getCurve=i,n.prototype.getG=a,n.prototype.getN=o,n.prototype.getH=s;var d=t.exports={secp256r1:c(),secp384r1:l(),secp521r1:f()};d["P-256"]=d.secp256r1,d["P-384"]=d.secp384r1,d["P-521"]=d.secp521r1},{"./math.js":26,jsbn:91}],25:[function(e,t,r){(function(t){"use strict";function n(e){return new h(e,16)}function i(e,r){r||(r=Math.ceil(e.bitLength()/8)),r=2*r;var n=e.toString(16);for(n=n.substring(Math.max(n.length-r,0));r>n.length;)n="0"+n;return new t(n,"hex")}function a(e){return"string"==typeof e&&(e=new t(e,"binary")),n(e.toString("hex"))}function o(e){return Math.ceil(e.getN().bitLength()/8)}function s(e){var t=d[e];if(!t)throw new TypeError("unsupported named curve: "+e);return t}function u(e,t){var r=e.getN().bitLength(),n=8*t.length,i=a(t);return n>r&&(i=i.shiftRight(n-r)),i}
2function c(e,t,r){var n=s(e),a=n.getCurve(),u=new p.ECPointFp(a,a.fromBigInteger(t),a.fromBigInteger(r));this.curve=e,this.params=n,this.point=u;var c=o(n);this.x=i(t,c),this.y=i(r,c)}function l(e,t){var r=s(e);this.curve=e,this.params=r;var n=o(r);this.d=i(t,n)}var f=e("../../deps/forge"),h=e("jsbn").BigInteger,p=e("./math.js"),d=e("./curves.js");c.prototype.verify=function(e,t){var r=this.params.getN(),n=this.params.getG(),i=a(t.r),o=a(t.s);if(i.compareTo(h.ONE)<0||i.compareTo(r)>=0)return!1;if(o.compareTo(h.ONE)<0||i.compareTo(r)>=0)return!1;var s=u(this.params,e),c=o.modInverse(r),l=s.multiply(c).mod(r),f=i.multiply(c).mod(r),p=n.multiplyTwo(l,this.point,f).getX().toBigInteger();return p=p.mod(r),p.equals(i)},l.prototype.toPublicKey=function(){var e=a(this.d),t=this.params.getG().multiply(e);return new c(this.curve,t.getX().toBigInteger(),t.getY().toBigInteger())},l.prototype.sign=function(e){var t,r,n,s,c,l=o(this.params),p=this.params.getN(),d=this.params.getG(),g=u(this.params,e),y=a(this.d);do{do{do n=a(f.random.getBytes(l));while(n.equals(h.ZERO)||n.compareTo(p)>=0);s=d.multiply(n).getX().toBigInteger(),t=s.mod(p)}while(t.equals(h.ZERO));c=y.multiply(t),c=g.add(c),r=n.modInverse(p).multiply(c).mod(p)}while(r.equals(h.ONE));var v=o(this.params);return t=i(t,v),r=i(r,v),{r:t,s:r}},l.prototype.computeSecret=function(e){var t=a(this.d),r=e.point.multiply(t).getX().toBigInteger();return r=i(r,o(this.params))},r.generateKeyPair=function(e){var t=s(e),r=t.getN(),n=f.random.getBytes(o(t));n=a(n);var i=r.subtract(h.ONE),u=n.mod(i).add(h.ONE),c=new l(e,u),p=c.toPublicKey();return{"private":c,"public":p}},r.asPublicKey=function(e,r,i){"string"==typeof r?r=n(r):t.isBuffer(r)&&(r=a(r)),"string"==typeof i?i=n(i):t.isBuffer(i)&&(i=a(i));var o=new c(e,r,i);return o},r.asPrivateKey=function(e,r){"string"==typeof r?r=n(r):t.isBuffer(r)&&(r=a(r));var i=new l(e,r);return i}}).call(this,e("buffer").Buffer)},{"../../deps/forge":27,"./curves.js":24,"./math.js":26,buffer:70,jsbn:91}],26:[function(e,t,r){"use strict";function n(e,t){this.x=t,this.q=e}function i(e){return e===this?!0:this.q.equals(e.q)&&this.x.equals(e.x)}function a(){return this.x}function o(){return new n(this.q,this.x.negate().mod(this.q))}function s(e){return new n(this.q,this.x.add(e.toBigInteger()).mod(this.q))}function u(e){return new n(this.q,this.x.subtract(e.toBigInteger()).mod(this.q))}function c(e){return new n(this.q,this.x.multiply(e.toBigInteger()).mod(this.q))}function l(){return new n(this.q,this.x.square().mod(this.q))}function f(e){return new n(this.q,this.x.multiply(e.toBigInteger().modInverse(this.q)).mod(this.q))}function h(e,t,r,n){this.curve=e,this.x=t,this.y=r,n?this.z=n:this.z=j.ONE,this.zinv=null}function p(){this.zinv||(this.zinv=this.z.modInverse(this.curve.q));var e=this.x.toBigInteger().multiply(this.zinv);return this.curve.reduce(e),this.curve.fromBigInteger(e)}function d(){this.zinv||(this.zinv=this.z.modInverse(this.curve.q));var e=this.y.toBigInteger().multiply(this.zinv);return this.curve.reduce(e),this.curve.fromBigInteger(e)}function g(e){if(e===this)return!0;if(this.isInfinity())return e.isInfinity();if(e.isInfinity())return this.isInfinity();var t,r;return t=e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q),t.equals(j.ZERO)?(r=e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q),r.equals(j.ZERO)):!1}function y(){return null==this.x&&null==this.y?!0:this.z.equals(j.ZERO)&&!this.y.toBigInteger().equals(j.ZERO)}function v(){return new h(this.curve,this.x,this.y.negate(),this.z)}function m(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q),r=e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q);if(j.ZERO.equals(r))return j.ZERO.equals(t)?this.twice():this.curve.getInfinity();var n=new j("3"),i=this.x.toBigInteger(),a=this.y.toBigInteger(),o=r.square(),s=o.multiply(r),u=i.multiply(o),c=t.square().multiply(this.z),l=c.subtract(u.shiftLeft(1)).multiply(e.z).subtract(s).multiply(r).mod(this.curve.q),f=u.multiply(n).multiply(t).subtract(a.multiply(s)).subtract(c.multiply(t)).multiply(e.z).add(t.multiply(s)).mod(this.curve.q),p=s.multiply(this.z).multiply(e.z).mod(this.curve.q);return new h(this.curve,this.curve.fromBigInteger(l),this.curve.fromBigInteger(f),p)}function b(){if(this.isInfinity())return this;if(0===this.y.toBigInteger().signum())return this.curve.getInfinity();var e=new j("3"),t=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),i=n.multiply(r).mod(this.curve.q),a=this.curve.a.toBigInteger(),o=t.square().multiply(e);j.ZERO.equals(a)||(o=o.add(this.z.square().multiply(a))),o=o.mod(this.curve.q);var s=o.square().subtract(t.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),u=o.multiply(e).multiply(t).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(o.square().multiply(o)).mod(this.curve.q),c=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new h(this.curve,this.curve.fromBigInteger(s),this.curve.fromBigInteger(u),c)}function E(e){if(this.isInfinity())return this;if(0===e.signum())return this.curve.getInfinity();var t,r=e,n=r.multiply(new j("3")),i=this.negate(),a=this;for(t=n.bitLength()-2;t>0;--t){a=a.twice();var o=n.testBit(t),s=r.testBit(t);o!==s&&(a=a.add(o?this:i))}return a}function _(e,t,r){var n;n=e.bitLength()>r.bitLength()?e.bitLength()-1:r.bitLength()-1;for(var i=this.curve.getInfinity(),a=this.add(t);n>=0;)i=i.twice(),e.testBit(n)?i=r.testBit(n)?i.add(a):i.add(this):r.testBit(n)&&(i=i.add(t)),--n;return i}function w(e,t,r){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(r),this.infinity=new h(this,null,null),this.reducer=new P(this.q)}function C(){return this.q}function S(){return this.a}function A(){return this.b}function T(e){return e===this?!0:this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}function k(){return this.infinity}function B(e){return new n(this.q,e)}function I(e){this.reducer.reduce(e)}function R(e){switch(parseInt(e.substring(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var t=(e.length-2)/2,r=e.substr(2,t),n=e.substr(t+2,t);return new h(this,this.fromBigInteger(new j(r,16)),this.fromBigInteger(new j(n,16)));default:return null}}function F(e){if(e.isInfinity())return"00";var t=e.getX().toBigInteger().toString(16),r=e.getY().toBigInteger().toString(16),n=this.getQ().toString(16).length;for(n%2!==0&&n++;t.length<n;)t="0"+t;for(;r.length<n;)r="0"+r;return"04"+t+r}var N=e("jsbn"),j=N.BigInteger,P=j.prototype.Barrett;n.prototype.equals=i,n.prototype.toBigInteger=a,n.prototype.negate=o,n.prototype.add=s,n.prototype.subtract=u,n.prototype.multiply=c,n.prototype.square=l,n.prototype.divide=f,h.prototype.getX=p,h.prototype.getY=d,h.prototype.equals=g,h.prototype.isInfinity=y,h.prototype.negate=v,h.prototype.add=m,h.prototype.twice=b,h.prototype.multiply=E,h.prototype.multiplyTwo=_,w.prototype.getQ=C,w.prototype.getA=S,w.prototype.getB=A,w.prototype.equals=T,w.prototype.getInfinity=k,w.prototype.fromBigInteger=B,w.prototype.reduce=I,w.prototype.decodePointHex=R,w.prototype.encodePointHex=F,t.exports={ECFieldElementFp:n,ECPointFp:h,ECCurveFp:w}},{jsbn:91}],27:[function(e,t,r){"use strict";function n(e){e=e||{},this.name="",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._blocks=this.blockSize/4,this._inBlock=new Array(this._blocks),this._outBlock=new Array(this._blocks)}var i={aes:e("node-forge/js/aes"),asn1:e("node-forge/js/asn1"),cipher:e("node-forge/js/cipher"),hmac:e("node-forge/js/hmac"),jsbn:e("node-forge/js/jsbn"),md:e("node-forge/js/md"),mgf:e("node-forge/js/mgf"),pem:e("node-forge/js/pem"),pkcs1:e("node-forge/js/pkcs1"),pkcs5:e("node-forge/js/pkcs5"),pkcs7:e("node-forge/js/pkcs7"),pki:e("node-forge/js/x509"),prime:e("node-forge/js/prime"),prng:e("node-forge/js/prng"),pss:e("node-forge/js/pss"),random:e("node-forge/js/random"),util:e("node-forge/js/util")};e("node-forge/js/sha1"),e("node-forge/js/sha256"),e("node-forge/js/sha512"),e("node-forge/js/cipherModes"),e("node-forge/js/aesCipherSuites"),n.prototype.start=function(){},n.prototype.encrypt=function(e,t){var r;for(r=0;r<this._blocks;++r)this._inBlock[r]=e.getInt32();for(this.cipher.encrypt(this._inBlock,this._outBlock),r=0;r<this._blocks;++r)t.putInt32(this._outBlock[r])},n.prototype.decrypt=function(e,t){var r;for(r=0;r<this._blocks;++r)this._inBlock[r]=e.getInt32();for(this.cipher.decrypt(this._inBlock,this._outBlock),r=0;r<this._blocks;++r)t.putInt32(this._outBlock[r])},function(){var e,t="AES",r=n;e=function(){return new i.aes.Algorithm(t,r)},i.cipher.registerAlgorithm(t,e)}(),"function"==typeof setImmediate&&(i.util.setImmediate=i.util.nextTick=function(e){setImmediate(e)}),t.exports=i},{"node-forge/js/aes":127,"node-forge/js/aesCipherSuites":128,"node-forge/js/asn1":129,"no
2de-forge/js/cipher":130,"node-forge/js/cipherModes":131,"node-forge/js/hmac":133,"node-forge/js/jsbn":134,"node-forge/js/md":135,"node-forge/js/mgf":137,"node-forge/js/pem":141,"node-forge/js/pkcs1":142,"node-forge/js/pkcs5":143,"node-forge/js/pkcs7":144,"node-forge/js/prime":147,"node-forge/js/prng":148,"node-forge/js/pss":149,"node-forge/js/random":150,"node-forge/js/sha1":152,"node-forge/js/sha256":153,"node-forge/js/sha512":154,"node-forge/js/util":156,"node-forge/js/x509":157}],28:[function(e,t,r){"use strict";"undefined"==typeof Promise&&e("es6-promise").polyfill(),t.exports={JWA:e("./algorithms"),JWE:e("./jwe"),JWK:e("./jwk"),JWS:e("./jws"),util:e("./util"),parse:e("./parse")}},{"./algorithms":13,"./jwe":33,"./jwk":38,"./jws":44,"./parse":48,"./util":52,"es6-promise":90}],29:[function(e,t,r){(function(r){"use strict";function n(e,t){var n,i;if(o.isKey(e))n=e,i=n.keystore;else{if(!o.isKeyStore(e))throw new TypeError("Keystore must be provided");i=e}t=s({},t),Object.defineProperty(this,"decrypt",{value:function(e,c){c=s({},t,c||{});var l=c.handlers||{},f=Object.keys(l);if("string"==typeof e)e=e.split("."),e={"protected":e[0],recipients:[{encrypted_key:e[1]}],iv:e[2],ciphertext:e[3],tag:e[4]};else if(!e||"object"!=typeof e)throw new Error("invalid input");"encrypted_key"in e&&(e.recipients=[{encrypted_key:e.encrypted_key}]);var h,p=e.recipients||[{}];h=Promise.resolve(p);var d,g;h.then(function(t){if(e["protected"]){g=a.decode(e["protected"],"utf8"),g=JSON.parse(g);var r=g.crit;if(r){if(!Array.isArray(r))return Promise.reject(new Error("Invalid 'crit' header"));for(var n=0;r.length>n;n++)if(-1===f.indexOf(r[n]))return Promise.reject(new Error("Critical extension is not supported: "+r[n]))}d=g,g=Object.keys(g)}else d={},g=[];return d=s(e.unprotected||{},d),t=t.map(function(e){var t=Promise.resolve(),r=e.header||{};return r=s(r,d),e.header=r,e["protected"]=g,r.epk&&(t=t.then(function(){return o.asKey(r.epk)}),t=t.then(function(e){r.epk=e.toObject(!1)})),t.then(function(){return e})}),Promise.all(t)});var y,v,m;return h=h.then(function(e){var t={};return new Promise(function(r,s){var u=function(){var c=e.shift();if(!c)return void s(new Error("no key found"));var l=Promise.resolve(c);l=l.then(function(e){var t=m=e.encrypted_key||"";return t=a.decode(t),y=n||i.get({use:"enc",alg:e.header.alg,kid:e.header.kid}),y?y.unwrap(e.header.alg,t,e.header):Promise.reject()}),l=l.then(function(e){v={kty:"oct",k:a.encode(e)},v=o.asKey(v),t.key=y,t.header=c.header,t["protected"]=c["protected"],r(t)}),l["catch"](u)};u()})}),h=h.then(function(t){return t.iv=e.iv,t.tag=e.tag,t.ciphertext=e.ciphertext,t}),h=h.then(function(e){var t=[];return f.forEach(function(r){r=l[r];var n;"function"==typeof r?n=r(e):"object"==typeof r&&"function"==typeof r.prepare&&(n=r.prepare(e)),n&&t.push(Promise.resolve(n))}),Promise.all(t).then(function(){return e})}),h=h.then(function(e){return r.isBuffer(e.ciphertext)||(e.ciphertext=a.decode(e.ciphertext)),e}),h=h.then(function(t){var r=e["protected"];"aad"in e&&null!=e.aad&&(r+="."+e.aad);var n={iv:t.iv,adata:r,tag:t.tag,kdata:m,epu:t.epu,epv:t.epv},i=t.ciphertext;return delete t.iv,delete t.tag,delete t.ciphertext,v.then(function(e){return e.decrypt(t.header.enc,i,n).then(function(e){return t.payload=t.plaintext=e,t})})}),h=h.then(function(e){return"DEF"===e.header.zip?new Promise(function(t,n){u.inflateRaw(new r(e.plaintext),function(r,i){r?n(r):(e.payload=e.plaintext=i,t(e))})}):e}),h=h.then(function(e){var t=[];return f.forEach(function(r){r=l[r];var n;"object"==typeof r&&"function"==typeof r.complete&&(n=r.complete(e)),n&&t.push(Promise.resolve(n))}),Promise.all(t).then(function(){return e})})}})}function i(e,t){var r=new n(e,t);return r}var a=e("../util/base64url"),o=e("../jwk"),s=e("../util/merge"),u=e("zlib");t.exports={decrypter:n,createDecrypt:i 3}}).call(this,e("buffer").Buffer)},{"../jwk":38,"../util/base64url":50,"../util/merge":53,buffer:70,zlib:69}],30:[function(e,t,r){"use strict";var n={zip:!1,format:"general",contentAlg:"A128CBC-HS256",protect:"*"};t.exports=n},{}],31:[function(e,t,r){(function(r){"use strict";function n(e,t,n){var i=!1,l=e.format||"general",p=!!e.protectAll,d=new r(0);Object.defineProperty(this,"zip",{get:function(){return t.zip||""},enumerable:!0}),Object.defineProperty(this,"compact",{get:function(){return"compact"===l},enumerable:!0}),Object.defineProperty(this,"format",{get:function(){return l},enumerable:!0}),Object.defineProperty(this,"protected",{get:function(){return o(e.protect)},enumerable:!0}),Object.defineProperty(this,"header",{get:function(){return o(t)},enumerable:!0}),Object.defineProperty(this,"update",{value:function(e,t){if(i)throw new Error("already final");return null!=e&&(e=s.asBuffer(e,t),d=d.length?r.concat([d,e],d.length+e.length):e),this}}),Object.defineProperty(this,"final",{value:function(g,y){if(i)return Promise.reject(new Error("already final"));this.update(g,y),i=!0;var v,m=Promise.resolve({}),b=t.enc;m=m.then(function(t){return e.cek&&(v=c.asKey(e.cek)),t}),m=m.then(function(r){var i=function(r,n){var i={};i=a(i,t),i=a(i,r.header);var l,f,h=r.key,p=i.alg;return 0===i.alg.indexOf("ECDH-ES")?(l=h.keystore.temp(),f=r.epk?Promise.resolve(r.epk).then(function(e){r.header.epk=e.toJSON(!1,["kid"]),i.epk=e.toObject(!0,["kid"])}):l.generate("EC",h.get("crv")).then(function(e){r.header.epk=e.toJSON(!1,["kid"]),i.epk=e.toObject(!0,["kid"])})):f=Promise.resolve(),f=f.then(function(){var r,a;return"dir"===p&&n?(v=Promise.resolve(h),a=v.then(function(e){return b||(i.enc=t.enc=b=e.algorithms(c.MODE_ENCRYPT)[0]),{once:!0,direct:!0}})):(v||(b||(i.enc=t.enc=b=e.contentAlg),v=u(b)),a=v.then(function(e){return r=e.get("k",!0),h}),a=a.then(function(e){return e.wrap(p,r,i)})),a}),f=f.then(function(e){if(e.once&&!n)return Promise.reject(new Error("cannot use 'alg':'"+p+"' with multiple recipients"));var t,i={};return e.data&&(t=e.data,t=s.base64url.encode(t)),e.direct&&t?v=c.asKey({kty:"oct",k:t}):t&&(i.encrypted_key=t),r.header&&Object.keys(r.header).length&&(i.header=o(r.header||{})),e.header&&(i.header=a(i.header||{},e.header)),i})},l=Promise.all(n);return l=l.then(function(e){var t=1===e.length;return e=e.map(function(e){return i(e,t)}),Promise.all(e)}),l=l.then(function(e){return r.recipients=e.filter(function(e){return!!e}),r})});var E={};switch(m=m.then(function(r){var n,i,u,c;return u=o(t),p&&1===r.recipients.length||"compact"===l?(n=a(r.recipients[0].header||{},u),i=Object.keys(n).length,u=void 0,c=0,delete r.recipients[0].header,0===Object.keys(r.recipients[0]).length&&r.recipients.splice(0,1)):(n={},i=0,c=Object.keys(u).length,e.protect.forEach(function(e){e in u&&(n[e]=u[e],i++,delete u[e],c--)})),r.recipients&&0!==r.recipients.length||delete r.recipients,u&&c>0&&(E=a(E,u),r.unprotected=u),n&&i>0&&(E=a(E,n),n=JSON.stringify(n),r["protected"]=s.base64url.encode(n,"utf8")),r}),m=m.then(function(e){var t=d;return E.zip?"DEF"===E.zip?new Promise(function(n,i){f.deflateRaw(new r(t,"binary"),function(t,r){t?i(t):(e.plaintext=r,n(e))})}):Promise.reject(new Error("unsupported 'zip' mode")):(e.plaintext=t,e)}),m=m.then(function(t){E.adata=t["protected"],"aad"in e&&null!=e.aad&&(E.adata+="."+e.aad,E.adata=new r(E.adata,"utf8"));var n=e.iv||s.randomBytes(h.NONCELENGTH[b]/8);"string"==typeof n&&(n=s.base64url.decode(n)),E.iv=n,"recipients"in t&&1===t.recipients.length&&(E.kdata=t.recipients[0].encrypted_key),"epu"in e&&null!=e.epu&&(E.epu=e.epu),"epv"in e&&null!=e.epv&&(E.epv=e.epv);var i=t.plaintext;
3return delete t.plaintext,v.then(function(r){var a=r.encrypt(b,i,E);return a=a.then(function(r){return t.iv=s.base64url.encode(n,"binary"),"aad"in e&&null!=e.aad&&(t.aad=e.aad),t.ciphertext=s.base64url.encode(r.data,"binary"),t.tag=s.base64url.encode(r.tag,"binary"),t})})}),l){case"compact":m=m.then(function(e){var t=new Array(5);return t[0]=e["protected"],e.recipients&&e.recipients[0]&&(t[1]=e.recipients[0].encrypted_key),t[2]=e.iv,t[3]=e.ciphertext,t[4]=e.tag,t=t.join(".")});break;case"flattened":m=m.then(function(e){var t={},r=e.recipients&&e.recipients[0];return e["protected"]&&(t["protected"]=e["protected"]),e.unprotected&&(t.unprotected=e.unprotected),["header","encrypted_key"].forEach(function(e){r&&e in r&&(t[e]=r[e])}),e.aad&&(t.aad=e.aad),t.iv=e.iv,t.ciphertext=e.ciphertext,t.tag=e.tag,t})}return m}})}function i(e,t){var r=e,i=1,u=t;if(0===arguments.length)throw new Error("at least one recipient must be provided");1===arguments.length?(u=e,i=0,r={}):c.isKey(e)||e&&"kty"in e||e&&"key"in e&&(c.isKey(e.key)||"kty"in e.key)?(u=e,i=0,r={}):r=o(e),Array.isArray(u)||(u=l(arguments,i)),r=a(o(p),r);var f=o(r.fields||{});switch(r.zip&&(f.zip="boolean"==typeof r.zip?r.zip?"DEF":!1:r.zip),r.format=(r.compact?"compact":r.format)||"general",r.format){case"compact":if("aad"in e)throw new Error("additional authenticated data cannot be used for compact serialization");case"flattened":if(u.length>1)throw new Error("too many recipients for compact serialization")}var h=!1;if("compact"===r.format||"*"===r.protect)h=!0,r.protect=Object.keys(f).concat("enc");else if("string"==typeof r.protect)r.protect=[r.protect];else if(Array.isArray(r.protect))r.protect=r.protect.concat();else{if(r.protect)throw new Error("protect must be a list of fields");r.protect=[]}if(h&&1<u.length)throw new Error("too many recipients to protect all header parameters");u=u.map(function(e,t){var r;return e&&"kty"in e?(r=c.asKey(e),r=r.then(function(e){return{key:e}})):e?(r=c.asKey(e.key),r=r.then(function(t){return{header:e.header,reference:e.reference,key:t}})):r=Promise.reject(new Error("missing key for recipient "+t)),e.epk&&(r=r.then(function(t){return c.asKey(e.epk).then(function(e){return t.epk=e,t})})),r=r.then(function(e){var t=e.key,r=e.header||{};e.header=r;var n={};n=a(n,f),n=a(n,e.header),n.alg||(n.alg=t.algorithms(c.MODE_WRAP)[0]),r.alg=n.alg;var i=e.reference;delete e.reference,void 0===i?(i=["kid","jku","x5c","x5t","x5u"].some(function(e){return e in r}),i=i?null:"kid"):"boolean"==typeof i&&(i=i?"kid":null);var o;return i&&(o=t.toJSON(),"jwk"===i?r.jwk=o:i in o&&(r[i]=o[i])),e=Object.freeze(e)})});var d={aad:"aad"in r?s.base64url.encode(r.aad||""):null,contentAlg:r.contentAlg,format:r.format,protect:r.protect,cek:r.cek,iv:r.iv,protectAll:h},g=new n(d,f,u);return g}var a=e("lodash.assign"),o=e("lodash.clone"),s=e("../util"),u=e("./helpers").generateCEK,c=e("../jwk"),l=e("./helpers").slice,f=e("zlib"),h=e("../algorithms/constants"),p=e("./defaults");t.exports={encrypter:n,createEncrypt:i}}).call(this,e("buffer").Buffer)},{"../algorithms/constants":5,"../jwk":38,"../util":52,"./defaults":30,"./helpers":32,buffer:70,"lodash.assign":92,"lodash.clone":95,zlib:69}],32:[function(e,t,r){"use strict";var n=e("../algorithms/constants"),i=e("../jwk");t.exports={slice:function(e,t){return Array.prototype.slice.call(e,t||0)},generateCEK:function(e){var t=i.createKeyStore(),r=n.KEYLENGTH[e];if(r)return t.generate("oct",r);throw new Error("unsupported encryption algorithm")}}},{"../algorithms/constants":5,"../jwk":38}],33:[function(e,t,r){"use strict";var n={createEncrypt:e("./encrypt").createEncrypt,createDecrypt:e("./decrypt").createDecrypt};t.exports=n},{"./decrypt":29,"./encrypt":31}],34:[function(e,t,r){(function(r){"use strict";var n=e("lodash.assign"),i=e("lodash.clone"),a=e("lodash.flatten"),o=e("lodash.intersection"),s=e("../util/merge"),u=e("lodash.omit"),c=e("lodash.pick"),l=e("lodash.uniq"),f=e("uuid"),h=e("../algorithms"),p=e("./constants.js"),d=e("./helpers.js"),g=e("../util"),y=function(e,t,y,v){if(!e)throw new Error("kty cannot be null");if(!t)throw new Error("keystore cannot be null");if(!y)throw new Error("props cannot be null");if("string"==typeof y&&(y=JSON.parse(y)),!v)throw new Error("cfg cannot be null");var m,b,E=[],_={},w={};y=i(y),m=n({},y[d.INTERNALS.THUMBPRINT_KEY]||{}),delete y[d.INTERNALS.THUMBPRINT_KEY],Object.keys(m).forEach(function(e){var t=m[e];b||(b=t,r.isBuffer(b)&&(b=g.base64url.encode(b))),r.isBuffer(t)||(t=g.base64url.decode(t),m[e]=t)}),y.kty=e,y.kid=y.kid||b||f();var C=Object.keys(d.COMMON_PROPS).map(function(e){return d.COMMON_PROPS[e].name});w.base=c(y,C),E=E.concat(Object.keys(w.base)),w["public"]=i(y),_["public"]=v.publicKey(w["public"]),_["public"]&&(E=E.concat(Object.keys(w["public"]))),w["private"]=i(y),_["private"]=v.privateKey(w["private"]),_["private"]&&(E=E.concat(Object.keys(w["private"]))),w.extra=u(y,E);var S;S=_["public"]&&"length"in _["public"]?_["public"].length:_["private"]&&"length"in _["private"]?_["private"].length:NaN,Object.defineProperty(this,"keystore",{value:t,enumerable:!0}),Object.defineProperty(this,"length",{value:S,enumerable:!0}),Object.defineProperty(this,"kty",{value:e,enumerable:!0}),Object.defineProperty(this,"kid",{value:w.base.kid,enumerable:!0}),Object.defineProperty(this,"use",{value:w.base.use||"",enumerable:!0}),Object.defineProperty(this,"alg",{value:w.base.alg||"",enumerable:!0}),Object.defineProperty(this,"thumbprint",{value:function(e){if(e=(e||d.INTERNALS.THUMBPRINT_HASH).toUpperCase(),m[e])return Promise.resolve(m[e]);var t=d.thumbprint(v,w,e);return t=t.then(function(t){return t&&(m[e]=t),t})}}),Object.defineProperty(this,"algorithms",{value:function(t){var r=[];this.use&&"sig"!==this.use||(t&&p.MODE_SIGN!==t||r.push(p.MODE_SIGN),t&&p.MODE_VERIFY!==t||r.push(p.MODE_VERIFY)),this.use&&"enc"!==this.use||(t&&p.MODE_ENCRYPT!==t||r.push(p.MODE_ENCRYPT),t&&p.MODE_DECRYPT!==t||r.push(p.MODE_DECRYPT),t&&p.MODE_WRAP!==t||r.push(p.MODE_WRAP),t&&p.MODE_UNWRAP!==t||r.push(p.MODE_UNWRAP));var n=this,i=r.map(function(e){return v.algorithms.call(n,_,e)});if(i=a(i),i=l(i),this.alg){var s;s="oct"===e?[this.alg,"dir"]:[this.alg],i=o(i,s)}return i}}),Object.defineProperty(this,"supports",{value:function(e,t){return-1!==this.algorithms(t).indexOf(e)}}),Object.defineProperty(this,"has",{value:function(e,t){var r=!1;return r=r||!!(w.base&&e in w.base),r=r||!!(_["public"]&&e in _["public"]),r=r||!!(w.extra&&e in w.extra),r=r||!!(t&&_["private"]&&e in _["private"])}}),Object.defineProperty(this,"get",{value:function(e,t){var r;return w.base&&e in w.base?r=w.base:_["public"]&&e in _["public"]?r=_["public"]:w.extra&&e in w.extra?r=w.extra:t&&_["private"]&&e in _["private"]&&(r=_["private"]),r&&r[e]||null}}),Object.defineProperty(this,"toJSON",{value:function(e,t){Array.isArray(e)&&(t=e,e=!1);var r={};return r=s(r,w.base,w["public"],"boolean"==typeof e&&e?w["private"]:{},w.extra),r=u(r,t||[])}}),Object.defineProperty(this,"toPEM",{value:function(e){if(null===e&&(e=!1),!v.convertToPEM)throw new Error("Unsupported key type for PEM encoding");var t=e?_["private"]:_["public"];if(!t)throw new Error("Invalid key");return v.convertToPEM.call(this,t,e)}}),Object.defineProperty(this,"toObject",{value:function(e,t){Array.isArray(e)&&(t=e,e=!1);var r={};return r=s(r,w.base,_["public"],"boolean"==typeof e&&e?_["private"]:{},w.extra),r=u(r,(t||[]).concat("length"))}}),Object.defineProperty(this,"sign",{value:function(e,t,r){if(-1===this.algorithms("sign").indexOf(e))return Promise.reject(new Error("unsupported algorithm"));var n=v.signKey.call(this,e,_);return n?(r=r?i(r):{},v.signProps&&(r=s(r,v.signProps.call(this,e,r))),h.sign(e,n,t,r)):Promise.reject(new Error("improper key"))}}),Object.defineProperty(this,"verify",{value:function(e,t,r,n){if(-1===this.algorithms("verify").indexOf(e))return Promise.reject(new Error("unsupported algorithm"));var a=v.verifyKey.call(this,e,_);return a?(n=n?i(n):{},v.verifyProps&&(n=s(n,v.verifyProps.call(this,e,n))),h.verify(e,a,t,r,n)):Promise.reject(new Error("improper key"))}}),Object.defineProperty(this,"encrypt",{value:function(e,t,r){if(-1===this.algorithms("encrypt").indexOf(e))return Promise.reject(new Error("unsupported algorithm"));
3var n=v.encryptKey.call(this,e,_);return n?(r=r?i(r):{},v.encryptProps&&(r=s(r,v.encryptProps.call(this,e,r))),h.encrypt(e,n,t,r)):Promise.reject(new Error("improper key"))}}),Object.defineProperty(this,"decrypt",{value:function(e,t,r){if(-1===this.algorithms("decrypt").indexOf(e))return Promise.reject(new Error("unsupported algorithm"));var n=v.decryptKey.call(this,e,_);return n?(r=r?i(r):{},v.decryptProps&&(r=s(r,v.decryptProps.call(this,e,r))),h.decrypt(e,n,t,r)):Promise.reject(new Error("improper key"))}}),Object.defineProperty(this,"wrap",{value:function(e,t,r){if(-1===this.algorithms("wrap").indexOf(e))return Promise.reject(new Error("unsupported algorithm"));var n=v.wrapKey.call(this,e,_);return n?(r=r?i(r):{},v.wrapProps&&(r=s(r,v.wrapProps.call(this,e,r))),h.encrypt(e,n,t,r)):Promise.reject(new Error("improper key"))}}),Object.defineProperty(this,"unwrap",{value:function(e,t,r){if(-1===this.algorithms("unwrap").indexOf(e))return Promise.reject(new Error("unsupported algorithm"));var n=v.unwrapKey.call(this,e,_);return n?(r=r?i(r):{},v.unwrapProps&&(r=s(r,v.unwrapProps.call(this,e,r))),h.decrypt(e,n,t,r)):Promise.reject(new Error("improper key"))}})};t.exports=y}).call(this,{isBuffer:e("../../node_modules/browserify/node_modules/insert-module-globals/node_modules/is-buffer/index.js")})},{"../../node_modules/browserify/node_modules/insert-module-globals/node_modules/is-buffer/index.js":76,"../algorithms":13,"../util":52,"../util/merge":53,"./constants.js":35,"./helpers.js":37,"lodash.assign":92,"lodash.clone":95,"lodash.flatten":98,"lodash.intersection":100,"lodash.omit":110,"lodash.pick":119,"lodash.uniq":122,uuid:162}],35:[function(e,t,r){"use strict";t.exports={MODE_SIGN:"sign",MODE_VERIFY:"verify",MODE_ENCRYPT:"encrypt",MODE_DECRYPT:"decrypt",MODE_WRAP:"wrap",MODE_UNWRAP:"unwrap"}},{}],36:[function(e,t,r){(function(r){"use strict";function n(e){switch(e){case"1.2.840.10045.3.1.7":return"P-256";case"1.3.132.0.34":return"P-384";case"1.3.132.0.35":return"P-521";default:return null}}function i(e){switch(e){case"P-256":return"1.2.840.10045.3.1.7";case"P-384":return"1.3.132.0.34";case"P-521":return"1.3.132.0.35";default:return null}}var a=e("../algorithms/ec-util.js"),o=e("../deps/forge"),s=e("../deps/ecc"),u={BaseKey:e("./basekey.js"),helpers:e("./helpers.js")},c=["ES256","ES384","ES512"],l=["ECDH-ES","ECDH-ES+A128KW","ECDH-ES+A192KW","ECDH-ES+A256KW"],f="1.2.840.10045.2.1",h={publicKey:function(e){var t=u.helpers.COMMON_PROPS.concat([{name:"crv",type:"string"},{name:"x",type:"binary"},{name:"y",type:"binary"}]),r=u.helpers.unpackProps(e,t);return r&&r.crv&&r.x&&r.y?r.length=a.curveSize(r.crv):(delete r.crv,delete r.x,delete r.y),r},privateKey:function(e){var t=u.helpers.COMMON_PROPS.concat([{name:"crv",type:"string"},{name:"x",type:"binary"},{name:"y",type:"binary"},{name:"d",type:"binary"}]),r=u.helpers.unpackProps(e,t);return r&&r.crv&&r.x&&r.y&&r.d?r.length=a.curveSize(r.crv):r=void 0,r},thumbprint:function(e){e["public"]&&(e=e["public"]);var t={crv:e.crv,kty:"EC",x:e.x,y:e.y};return t},algorithms:function(e,t){var r=e["public"]&&e["public"].length||e["private"]&&e["private"].length||0;switch(521===r&&(r=512),t){case"encrypt":case"decrypt":return[];case"wrap":return e["public"]&&l||[];case"unwrap":return e["private"]&&l||[];case"sign":return e["private"]?c.filter(function(e){return e==="ES"+r}):[];case"verify":return e["public"]?c.filter(function(e){return e==="ES"+r}):[]}},encryptKey:function(e,t){return t["public"]},decryptKey:function(e,t){return t["private"]},wrapKey:function(e,t){return t["public"]},unwrapKey:function(e,t){return t["private"]},signKey:function(e,t){return t["private"]},verifyKey:function(e,t){return t["public"]},convertToPEM:function(e,t){var n=e.crv;n=i(n),n=o.asn1.oidToDer(n);var a,s,u;t?(a="EC PRIVATE KEY",s=r.concat([new r([0,4]),e.x,e.y]).toString("binary"),e=e.d.toString("binary"),u=o.asn1.create(o.asn1.Class.UNIVERSAL,o.asn1.Type.SEQUENCE,!0,[o.asn1.create(o.asn1.Class.UNIVERSAL,o.asn1.Type.INTEGER,!1,"�"),o.asn1.create(o.asn1.Class.UNIVERSAL,o.asn1.Type.OCTETSTRING,!1,e),o.asn1.create(o.asn1.Class.CONTEXT_SPECIFIC,0,!0,[o.asn1.create(o.asn1.Class.UNIVERSAL,o.asn1.Type.OID,!1,n.bytes())]),o.asn1.create(o.asn1.Class.CONTEXT_SPECIFIC,1,!0,[o.asn1.create(o.asn1.Class.UNIVERSAL,o.asn1.Type.BITSTRING,!1,s)])])):(a="PUBLIC KEY",e=r.concat([new r([0,4]),e.x,e.y]).toString("binary"),u=o.asn1.create(o.asn1.Class.UNIVERSAL,o.asn1.Type.SEQUENCE,!0,[o.asn1.create(o.asn1.Class.UNIVERSAL,o.asn1.Type.SEQUENCE,!0,[o.asn1.create(o.asn1.Class.UNIVERSAL,o.asn1.Type.OID,!1,o.asn1.oidToDer(f).bytes()),o.asn1.create(o.asn1.Class.UNIVERSAL,o.asn1.Type.OID,!1,n.bytes())]),o.asn1.create(o.asn1.Class.UNIVERSAL,o.asn1.Type.BITSTRING,!1,e)])),u=o.asn1.toDer(u).bytes();var c=o.pem.encode({type:a,body:u});return c}},p={oid:f,privateKey:{name:"ECPrivateKey",tagClass:o.asn1.Class.UNIVERSAL,type:o.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"ECPrivateKey.version",tagClass:o.asn1.Class.UNIVERSAL,type:o.asn1.Type.INTEGER,c
3onstructed:!1},{name:"ECPrivateKey.private",tagClass:o.asn1.Class.UNIVERSAL,type:o.asn1.Type.OCTETSTRING,constructed:!1,capture:"d"},{tagClass:o.asn1.Class.CONTEXT_SPECIFIC,name:"ECPrivateKey.parameters",constructed:!0,value:[{name:"ECPrivateKey.namedCurve",tagClass:o.asn1.Class.UNIVERSAL,type:o.asn1.Type.OID,constructed:!1,capture:"crv"}]},{name:"ECPrivateKey.publicKey",tagClass:o.asn1.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"ECPrivateKey.point",tagClass:o.asn1.Class.UNIVERSAL,type:o.asn1.Type.BITSTRING,constructed:!1,capture:"point"}]}]},embeddedPrivateKey:{name:"ECPrivateKey",tagClass:o.asn1.Class.UNIVERSAL,type:o.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"ECPrivateKey.version",tagClass:o.asn1.Class.UNIVERSAL,type:o.asn1.Type.INTEGER,constructed:!1},{name:"ECPrivateKey.private",tagClass:o.asn1.Class.UNIVERSAL,type:o.asn1.Type.OCTETSTRING,constructed:!1,capture:"d"},{name:"ECPrivateKey.publicKey",tagClass:o.asn1.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"ECPrivateKey.point",tagClass:o.asn1.Class.UNIVERSAL,type:o.asn1.Type.BITSTRING,constructed:!1,capture:"point"}]}]}},d={kty:"EC",validators:p,prepare:function(e){var t=h,r=Promise.resolve(e);return r=r.then(function(e){return u.helpers.thumbprint(t,e)}),r=r.then(function(r){var n={};return n[u.helpers.INTERNALS.THUMBPRINT_HASH]=r,e[u.helpers.INTERNALS.THUMBPRINT_KEY]=n,t})},generate:function(e){var t=s.generateKeyPair(e),r={crv:e,x:t["public"].x,y:t["public"].y,d:t["private"].d};return Promise.resolve(r)},"import":function(e){if(p.oid!==e.keyOid)return null;var t;if(e.keyParams&&o.asn1.Type.OID===e.keyParams.type?(t=o.asn1.derToOid(e.keyParams.value),t=n(t)):e.crv&&(t=o.asn1.derToOid(e.crv),t=n(t)),!t)return null;if(!e.parsed){var i={},a=[];if("private"===e.type){if("string"==typeof e.keyValue?e.keyValue=o.asn1.fromDer(e.keyValue):Array.isArray(e.keyValue)&&(e.keyValue=e.keyValue[0]),!o.asn1.validate(e.keyValue,p.embeddedPrivateKey,i,a))return null}else i.point=e.keyValue;e=i}var s={kty:"EC",crv:t};if(e.d&&(s.d=new r(e.d,"binary")),e.point){var u=new r(e.point,"binary");if(4!==u.readUInt16BE(0))return null;u=u.slice(2);var c=u.length/2;s.x=u.slice(0,c),s.y=u.slice(c)}return s}};t.exports=Object.freeze({config:h,factory:d}),function(e){e.register(d)}(e("./keystore").registry)}).call(this,e("buffer").Buffer)},{"../algorithms/ec-util.js":7,"../deps/ecc":25,"../deps/forge":27,"./basekey.js":34,"./helpers.js":37,"./keystore":39,buffer:70}],37:[function(e,t,r){(function(r){"use strict";var n=e("lodash.clone"),i=e("../util"),a=e("../deps/forge"),o=e("../algorithms"),s={name:"PrivateKeyInfo",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.INTEGER,constructed:!1,capture:"keyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.OID,constructed:!1,capture:"keyOid"},{name:"AlgorithmIdentifier.parameters",captureAsn1:"keyParams"}]},{name:"PrivateKeyInfo",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.OCTETSTRING,constructed:!1,capture:"keyValue"}]},u={name:"SubjectPublicKeyInfo",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.OID,constructed:!1,capture:"keyOid"},{name:"AlgorithmIdentifier.parameters",captureAsn1:"keyParams"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.BITSTRING,constructed:!1,capture:"keyValue"}]},c={name:"Certificate",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,captureAsn1:"certificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:a.asn1.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.INTEGER,c
3onstructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:a.asn1.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},u,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:a.asn1.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.BITSTRING,constructed:!1,capture:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:a.asn1.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.BITSTRING,constructed:!1,capture:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:a.asn1.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:a.asn1.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:a.asn1.Class.UNIVERSAL,type:a.asn1.Type.BITSTRING,constructed:!1,capture:"certSignature"}]},l={THUMBPRINT_KEY:"internal\x00thumbprint",THUMBPRINT_HASH:"SHA-256"};t.exports={validators:{privateKey:s,publicKey:u,certificate:c},thumbprint:function(e,t,n){if("function"!=typeof e.thumbprint)return Promise.reject(new Error("thumbprint not supported"));n=(n||l.THUMBPRINT_HASH).toUpperCase();var a=e.thumbprint(t),s=Object.keys(a).sort().map(function(e){var t=a[e];return r.isBuffer(t)&&(t=i.base64url.encode(t)),JSON.stringify(e)+":"+JSON.stringify(t)});s="{"+s.join(",")+"}";try{return o.digest(n,new r(s,"utf8"))}catch(u){return Promise.reject(u)}},unpackProps:function(e,t){var a;t.forEach(function(t){if(t.name in e){a=a||{};var o=e[t.name];switch(t.type){case"binary":r.isBuffer(o)?(o=o,e[t.name]=i.base64url.encode(o)):o=i.base64url.decode(o);break;case"string":case"number":case"boolean":o=o;break;case"array":o=[].concat(o);break;case"object":o=n(o);break;default:o=o}a[t.name]=o}});var o=a||{};return Object.keys(e).forEach(function(t){t in o||delete e[t]}),a},COMMON_PROPS:[{name:"kty",type:"string"},{name:"kid",type:"string"},{name:"use",type:"string"},{name:"alg",type:"string"},{name:"x5c",type:"array"},{name:"x5t",type:"binary"},{name:"x5u",type:"string"},{name:"key_ops",type:"array"}],INTERNALS:l}}
3).call(this,e("buffer").Buffer)},{"../algorithms":13,"../deps/forge":27,"../util":52,buffer:70,"lodash.clone":95}],38:[function(e,t,r){"use strict";var n=e("./keystore.js");Object.keys(n.KeyStore).forEach(function(e){r[e]=n.KeyStore[e]});var i=e("./constants.js");Object.keys(i).forEach(function(e){r[e]=i[e]}),e("./octkey.js"),e("./rsakey.js"),e("./eckey.js")},{"./constants.js":35,"./eckey.js":36,"./keystore.js":39,"./octkey.js":40,"./rsakey.js":41}],39:[function(e,t,r){(function(r){"use strict";function n(e){return["certIssuer","certSubject"].forEach(function(t){var r=u.pki.RDNAttributesAsArray(e[t]),n=e[t]={};r.forEach(function(e){n[e.name||e.type]=e.value})}),e}function i(e){var t={},r=u.pem.decode(e),n=r.some(function(e){switch(e.type){case"CERTIFICATE":t.form="pkix";break;case"PUBLIC KEY":t.form="spki";break;case"PRIVATE KEY":t.form="pkcs8";break;case"EC PRIVATE KEY":case"RSA PRIVATE KEY":t.form="private";break;default:return!1}return t.body=e.body,!0});if(!n)throw new Error("supported PEM type not found");return t}function a(e,t){var i,a={},o=[],s=t.form,f=t.body,p=null;switch(t=u.asn1.fromDer(f),s){case"private":e.all().some(function(e){if(i)return!1;if(!e.validators)return!1;var r=e.validators.oid,n=e.validators.privateKey;return n?(a={},o=[],i=u.asn1.validate(t,n,a,o),i&&(a.keyOid=u.asn1.oidToDer(r),a.parsed=!0),i):!1}),a.type="private";break;case"pkcs8":i=u.asn1.validate(t,l.helpers.validators.privateKey,a,o),a.type="private";break;case"public":case"spki":i=u.asn1.validate(t,l.helpers.validators.publicKey,a,o),a.type="public";break;case"pkix":case"x509":if(i=u.asn1.validate(t,l.helpers.validators.certificate,a,o)){a=n(a);var d=u.md.sha1.create();d.update(f),p=c.base64url.encode(new r(d.digest().toHex(),"hex"))}a.type="public"}return i?(a.keyOid&&(a.keyOid=u.asn1.derToOid(a.keyOid)),i=null,h.all().forEach(function(e){i||e&&"function"==typeof e["import"]&&(i=e["import"](a))}),i&&a.certSubject&&a.certSubject.commonName&&(i.kid=a.certSubject.commonName),i&&p&&(i.x5t=p),i):null}var o=e("lodash.clone"),s=e("../util/merge"),u=e("../deps/forge"),c=e("../util"),l={BaseKey:e("./basekey.js"),helpers:e("./helpers.js")},f=function(){var e={};Object.defineProperty(this,"register",{value:function(t){if(!t||"string"!=typeof t.kty||!t.kty)throw new Error("invalid Key factory");var r=t.kty;return e[r]=t,this}}),Object.defineProperty(this,"unregister",{value:function(t){if(!t||"string"!=typeof t.kty||!t.kty)throw new Error("invalid Key factory");var r=t.kty;return t===e[r]&&delete e[r],this}}),Object.defineProperty(this,"get",{value:function(t){return e[t||""]||void 0}}),Object.defineProperty(this,"all",{value:function(){return Object.keys(e).map(function(t){return e[t]})}})},h=new f,p=function(e,t){var n={};Object.defineProperty(this,"generate",{value:function(t,r,n){var i=e.get(t);if(!i)return Promise.reject(new Error("unsupported key type"));n=o(n||{}),n.kty=t;var a=this,u=i.generate(r);return u.then(function(e){return e=s(n,e,{kty:t}),a.add(e)})}}),Object.defineProperty(this,"add",{value:function(t,o,s){s=s||{};var u;if(r.isBuffer(t)||"string"==typeof t)if(o=(o||"json").toLowerCase(),"json"===o)t=JSON.parse(t.toString("utf8"));else try{if(u="pem"===o?i(t):{body:t.toString("binary"),form:o},t=a(e,u),!t)throw new Error("no importer for key");Object.keys(s).forEach(function(e){t[e]=s[e]})}catch(c){return Promise.reject(c)}else p.isKey(t)&&(t=t.toJSON(!0));var f=e.get(t.kty);if(!f)return Promise.reject(new Error("unsupported key type"));var h=this,d=f.prepare(t);return d.then(function(e){return new l.BaseKey(t.kty,h,t,e)}).then(function(e){var t=e.kid||"",r=n[t]=n[t]||[];return r.push(e),e})}}),Object.defineProperty(this,"remove",{value:function(e){if(e){var t=n[e.kid];if(t){var r=t.indexOf(e);-1!==r&&(t.splice(r,1),t.length||delete n[e.kid])}}}}),Object.defineProperty(this,"all",{value:function(e,r){e=e||{};var i=[],a=function(t){return e.kty&&t.kty&&e.kty!==t.kty?!1:e.use&&t.use&&e.use!==t.use?!1:e.alg?"dir"!==e.alg&&t.alg&&e.alg!==t.alg?!1:t.supports(e.alg):!0};return Object.keys(n).forEach(function(t){if(!e.kid||e.kid===t){var r=n[t].filter(a);r.length&&(i=i.concat(r))}}),!r&&t&&(i=i.concat(t.all(e))),i}}),Object.defineProperty(this,"get",{value:function(e,r,n){"boolean"==typeof e?(n=e,r=e=null):"object"==typeof e&&(n=r,r=e,e=null),r=r||{},e&&(r.kid=e);var i=this.all(r,!0);return i.length||!t||n||(i=t.get(r,n)),i[0]||null}}),Object.defineProperty(this,"temp",{value:function(){return new p(e,this)}}),Object.defineProperty(this,"toJSON",{value:function(e){var t=[];
3return Object.keys(n).forEach(function(r){var i=n[r].map(function(t){return t.toJSON(e)});t=t.concat(i)}),{keys:t}}})};p.isKeyStore=function(e){return e?"object"!=typeof e?!1:"function"==typeof e.get&&"function"==typeof e.all&&"function"==typeof e.generate&&"function"==typeof e.add&&"function"==typeof e.remove:!1},p.createKeyStore=function(){return new p(h)},p.asKeyStore=function(e){if(p.isKeyStore(e))return Promise.resolve(e);var t,r=p.createKeyStore();if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e))t=e;else{if(!("keys"in e))return Promise.reject(new Error("invalid keystore"));t=e.keys}t=t.map(function(e){return r.add(e)});var n=Promise.all(t);return n=n.then(function(){return r})},p.isKey=function(e){return e?"object"!=typeof e?!1:p.isKeyStore(e.keystore)?"string"==typeof e.kty&&"number"==typeof e.length&&"function"==typeof e.algorithms&&"function"==typeof e.supports&&"function"==typeof e.encrypt&&"function"==typeof e.decrypt&&"function"==typeof e.wrap&&"function"==typeof e.unwrap&&"function"==typeof e.sign&&"function"==typeof e.verify:!1:!1},p.asKey=function(e,t,r){if(p.isKey(e))return Promise.resolve(e);var n=p.createKeyStore();return e=n.add(e,t,r)},t.exports={KeyRegistry:f,KeyStore:p,registry:h}}).call(this,e("buffer").Buffer)},{"../deps/forge":27,"../util":52,"../util/merge":53,"./basekey.js":34,"./helpers.js":37,buffer:70,"lodash.clone":95}],40:[function(e,t,r){(function(r){"use strict";function n(e,t){return"iv"in t&&(t.iv=r.isBuffer(t.iv)?t.iv:a.base64url.decode(t.iv||"")),"adata"in t&&(t.adata=r.isBuffer(t.adata)?t.adata:new r(t.adata||"","utf8")),"mac"in t&&(t.mac=r.isBuffer(t.mac)?t.mac:a.base64url.decode(t.mac||"")),"tag"in t&&(t.tag=r.isBuffer(t.tag)?t.tag:a.base64url.decode(t.tag||"")),t}function i(e,t){return"iv"in t&&(t.iv=r.isBuffer(t.iv)?t.iv:a.base64url.decode(t.iv||"")),"adata"in t&&(t.adata=r.isBuffer(t.adata)?t.adata:new r(t.adata||"","utf8")),t}var a=e("../util"),o={BaseKey:e("./basekey.js"),helpers:e("./helpers.js")},s=["HS256","HS384","HS512"],u=["A128GCM","A192GCM","A256GCM","A128CBC-HS256","A192CBC-HS384","A256CBC-HS512","A128CBC+HS256","A192CBC+HS384","A256CBC+HS512"],c=["A128KW","A192KW","A256KW","A128GCMKW","A192GCMKW","A256GCMKW","PBES2-HS256+A128KW","PBES2-HS384+A192KW","PBES2-HS512+A256KW","dir"],l={ 4publicKey:function(e){var t,r=o.helpers.COMMON_PROPS.concat([]);return t=o.helpers.unpackProps(e,r)},privateKey:function(e){var t,r=o.helpers.COMMON_PROPS.concat([{name:"k",type:"binary"}]);return t=o.helpers.unpackProps(e,r),t&&t.k?t.length=8*t.k.length:t=void 0,t},thumbprint:function(e){e["private"]&&(e=e["private"]);var t;return t={k:e.k||"",kty:"oct"}},algorithms:function(e,t){var r=e["private"]&&8*e["private"].k.length,n=[256,384,512];if(!r)return[];switch(t){case"encrypt":case"decrypt":return u.filter(function(e){return e==="A"+r/2+"CBC-HS"+r||e==="A"+r/2+"CBC+HS"+r||e==="A"+r+"GCM"});case"sign":case"verify":return s.filter(function(e){var t=!1;return n.forEach(function(n){n>r||(t|=e==="HS"+n)}),t});case"wrap":case"unwrap":return c.filter(function(e){return e==="A"+r+"KW"||e==="A"+r+"GCMKW"||0===e.indexOf("PBES2-")||"dir"===e})}return[]},encryptKey:function(e,t){return t["private"]&&t["private"].k},encryptProps:i,decryptKey:function(e,t){return t["private"]&&t["private"].k},decryptProps:n,wrapKey:function(e,t){return t["private"]&&t["private"].k},wrapProps:i,unwrapKey:function(e,t){return t["private"]&&t["private"].k},unwrapProps:n,signKey:function(e,t){return t["private"]&&t["private"].k},verifyKey:function(e,t){return t["private"]&&t["private"].k}},f={kty:"oct",prepare:function(e){var t=l,r=Promise.resolve(e);return r=r.then(function(e){return o.helpers.thumbprint(t,e)}),r=r.then(function(r){var n={};return n[o.helpers.INTERNALS.THUMBPRINT_HASH]=r,e[o.helpers.INTERNALS.THUMBPRINT_KEY]=n,t})},generate:function(e){var t=a.randomBytes(e/8);return Promise.resolve({k:t})}};t.exports=Object.freeze({config:l,factory:f}),function(e){e.register(f)}(e("./keystore").registry)}).call(this,e("buffer").Buffer)},{"../util":52,"./basekey.js":34,"./helpers.js":37,"./keystore":39,buffer:70}],41:[function(e,t,r){(function(r){"use strict";function n(e){return e=e.toString(16),e.length%2&&(e="0"+e),new r(e,"hex")}var i=e("../deps/forge.js"),a=e("../algorithms/rsa-util"),o={BaseKey:e("./basekey.js"),helpers:e("./helpers.js")},s=["RS256","RS384","RS512","PS256","PS384","PS512"],u=["RSA-OAEP","RSA-OAEP-256","RSA1_5"],c={publicKey:function(e){var t,r=o.helpers.COMMON_PROPS.concat([{name:"n",type:"binary"},{name:"e",type:"binary"}]);return t=o.helpers.unpackProps(e,r),t&&t.n&&t.e?t.length=8*t.n.length:(delete t.e,delete t.n),t},privateKey:function(e){var t,r=o.helpers.COMMON_PROPS.concat([{name:"n",type:"binary"},{name:"e",type:"binary"},{name:"d",type:"binary"},{name:"p",type:"binary"},{name:"q",type:"binary"},{name:"dp",type:"binary"},{name:"dq",type:"binary"},{name:"qi",type:"binary"}]);return t=o.helpers.unpackProps(e,r),t&&t.d&&t.n&&t.e&&t.p&&t.q&&t.dp&&t.dq&&t.qi?t.length=8*t.d.length:t=void 0,t},thumbprint:function(e){e["public"]&&(e=e["public"]);var t={e:e.e,kty:"RSA",n:e.n};return t},algorithms:function(e,t){switch(t){case"encrypt":case"decrypt":return[];case"wrap":return e["public"]&&u.slice()||[];case"unwrap":return e["private"]&&u.slice()||[];case"sign":return e["private"]&&s.slice()||[];case"verify":return e["public"]&&s.slice()||[]}return[]},wrapKey:function(e,t){return t["public"]},unwrapKey:function(e,t){return t["private"]},signKey:function(e,t){return t["private"]},verifyKey:function(e,t){return t["public"]},convertToPEM:function(e,t){var r=a.convertToForge(e,!t);return t?i.pki.privateKeyToPem(r):i.pki.publicKeyToPem(r)}},l={oid:"1.2.840.113549.1.1.1",privateKey:{name:"RSAPrivateKey",tagClass:i.asn1.Class.UNIVERSAL,type:i.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:i.asn1.Class.UNIVERSAL,type:i.asn1.Type.INTEGER,c
4onstructed:!1,capture:"version"},{name:"RSAPrivateKey.modulus",tagClass:i.asn1.Class.UNIVERSAL,type:i.asn1.Type.INTEGER,constructed:!1,capture:"n"},{name:"RSAPrivateKey.publicExponent",tagClass:i.asn1.Class.UNIVERSAL,type:i.asn1.Type.INTEGER,constructed:!1,capture:"e"},{name:"RSAPrivateKey.privateExponent",tagClass:i.asn1.Class.UNIVERSAL,type:i.asn1.Type.INTEGER,constructed:!1,capture:"d"},{name:"RSAPrivateKey.prime1",tagClass:i.asn1.Class.UNIVERSAL,type:i.asn1.Type.INTEGER,constructed:!1,capture:"p"},{name:"RSAPrivateKey.prime2",tagClass:i.asn1.Class.UNIVERSAL,type:i.asn1.Type.INTEGER,constructed:!1,capture:"q"},{name:"RSAPrivateKey.exponent1",tagClass:i.asn1.Class.UNIVERSAL,type:i.asn1.Type.INTEGER,constructed:!1,capture:"dp"},{name:"RSAPrivateKey.exponent2",tagClass:i.asn1.Class.UNIVERSAL,type:i.asn1.Type.INTEGER,constructed:!1,capture:"dq"},{name:"RSAPrivateKey.coefficient",tagClass:i.asn1.Class.UNIVERSAL,type:i.asn1.Type.INTEGER,constructed:!1,capture:"qi"}]},publicKey:{name:"RSAPublicKey",tagClass:i.asn1.Class.UNIVERSAL,type:i.asn1.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:i.asn1.Class.UNIVERSAL,type:i.asn1.Type.INTEGER,constructed:!1,capture:"n"},{name:"RSAPublicKey.exponent",tagClass:i.asn1.Class.UNIVERSAL,type:i.asn1.Type.INTEGER,constructed:!1,capture:"e"}]}},f={kty:"RSA",validators:l,prepare:function(e){var t=c,r=Promise.resolve(e);return r=r.then(function(e){return o.helpers.thumbprint(t,e)}),r=r.then(function(r){var n={};return n[o.helpers.INTERNALS.THUMBPRINT_HASH]=r,e[o.helpers.INTERNALS.THUMBPRINT_KEY]=n,t})},generate:function(e){var t=i.pki.rsa.generateKeyPair({bits:e,e:65537});t=t.privateKey;var r={};return["e","n","d","p","q",{incoming:"dP",outgoing:"dp"},{incoming:"dQ",outgoing:"dq"},{incoming:"qInv",outgoing:"qi"}].forEach(function(e){var i,a;"string"==typeof e?i=a=e:(i=e.incoming,a=e.outgoing),i in t&&(r[a]=n(t[i]))}),Promise.resolve(r)},"import":function(e){if(l.oid!==e.keyOid)return null;if(!e.parsed){"string"==typeof e.keyValue?e.keyValue=i.asn1.fromDer(e.keyValue):Array.isArray(e.keyValue)&&(e.keyValue=e.keyValue[0]);var t="private"===e.type?l.privateKey:l.publicKey,n={},a=[];if(!i.asn1.validate(e.keyValue,t,n,a))return null;e=n}var o={kty:"RSA"};return["n","e","d","p","q","dp","dq","qi"].forEach(function(t){if(t in e){var n=new r(e[t],"binary");0===n[0]&&(n=n.slice(1)),o[t]=n}}),o}};t.exports=Object.freeze({config:c,factory:f}),function(e){e.register(f)}(e("./keystore").registry)}).call(this,e("buffer").Buffer)},{"../algorithms/rsa-util":15,"../deps/forge.js":27,"./basekey.js":34,"./helpers.js":37,"./keystore":39,buffer:70}],42:[function(e,t,r){"use strict";var n={compact:!1,protect:"*"};t.exports=n},{}],43:[function(e,t,r){"use strict";t.exports={slice:function(e,t){return Array.prototype.slice.call(e,t||0)}}},{}],44:[function(e,t,r){"use strict";var n={createSign:e("./sign").createSign,createVerify:e("./verify").createVerify};t.exports=n},{"./sign":45,"./verify":46}],45:[function(e,t,r){(function(r){"use strict";function n(e,t){var r=e,n=1,s=t;if(0===arguments.length)throw new Error("at least one signatory must be provided");1===arguments.length?(s=e,n=0,r={}):u.isKey(e)||e&&"kty"in e||e&&"key"in e&&(u.isKey(e.key)||"kty"in e.key)?(s=e,n=0,r={}):r=i(e),Array.isArray(s)||(s=c(arguments,n)),r=a(i(l),r);var h=r.fields||{},p=r.format;if(p||(p=r.compact?"compact":"general"),("compact"===p||"flattened"===p)&&1<s.length)throw new Error("too many signatories for compact or flattened JSON serialization");var d="*"===r.protect;r.compact&&(d=!0),s=s.map(function(e,t){var r;return e&&"kty"in e?(r=u.asKey(e),r=r.then(function(e){return{key:e}})):e?(r=u.asKey(e.key),r=r.then(function(t){return{header:e.header,reference:e.reference,protect:e.protect,key:t}})):r=Promise.reject(new Error("missing key for signatory "+t)),r=r.then(function(e){var t=e.key,r=e.header||{};r=a(a({},h),r),e.header=r,r.alg||(r.alg=t.algorithms(u.MODE_SIGN)[0]||"");var n=e.reference;delete e.reference,void 0===n?(n=["kid","jku","x5c","x5t","x5u"].some(function(e){return e in r}),n=n?null:"kid"):"boolean"==typeof n&&(n=n?"kid":null);var i;n&&(i=t.toJSON(),"jwk"===n?r.jwk=i:n in i&&(r[n]=i[n]));var s=e.protect;if(d||"*"===s)s=Object.keys(r);else if("string"===s)s=[s];else if(Array.isArray(s))s=s.concat();else{if(s)return Promise.reject(new Error("protect must be a list of fields"));s=[]}return s=o(s),e["protected"]=s,e=Object.freeze(e)})});var g={format:p};return new f(g,s)}var i=e("lodash.clone"),a=e("../util/merge"),o=e("lodash.uniq"),s=e("../util"),u=e("../jwk"),c=e("./helpers").slice,l=e("./defaults"),f=function(e,t){var n=!1,a=e.format||"general",o=new r(0);Object.defineProperty(this,"compact",{get:function(){return"compact"===a},enumerable:!0}),Object.defineProperty(this,"format",{get:function(){return a},enumerable:!0}),Object.defineProperty(this,"update",{value:function(e,t){if(n)throw new Error("already final");return null!=e&&(e=s.asBuffer(e,t),o=o.length?r.concat([o,e],o.length+e.length):e),this}}),Object.defineProperty(this,"final",{value:function(e,u){if(n)return Promise.reject(new Error("already final"));this.update(e,u),n=!0;var c;switch(c=Promise.all(t),c=c.then(function(e){return o=s.base64url.encode(o),e=e.map(function(e){var t={},n=0,a=i(e.header),u=Object.keys(a).length;e["protected"].forEach(function(e){e in a&&(t[e]=a[e],n++,delete a[e],u--)}),n>0?(t=JSON.stringify(t),t=s.base64url.encode(t)):t="";var c=new r(t+"."+o,"ascii");return e=e.key.sign(e.header.alg,c,e.header),e=e.then(function(e){var r={};return n>0&&(r["protected"]=t),u>0&&(r.unprotected=a),r.signature=s.base64url.encode(e.mac),r})}),e=[Promise.resolve(o)].concat(e),Promise.all(e)}),c=c.then(function(e){var t=e[0];return{payload:t,signatures:e.slice(1)}}),a){case"compact":c=c.then(function(e){var t=[e.signatures[0]["protected"],e.payload,e.signatures[0].signature];return t=t.join(".")});break;case"flattened":c=c.then(function(e){var t={};t.payload=e.payload;var r=e.signatures[0];return r["protected"]&&(t["protected"]=r["protected"]),r.header&&(t.header=r.header),t.signature=r.signature,t})}return c}})};t.exports={signer:f,createSign:n}}).call(this,e("buffer").Buffer)},{"../jwk":38,"../util":52,"../util/merge":53,"./defaults":42,"./helpers":43,buffer:70,"lodash.clone":95,"lodash.uniq":122}],46:[function(e,t,r){(function(r){"use strict";function n(e){var t=new u(e);return t}var i=e("lodash.clone"),a=e("../util/merge"),o=e("../util/base64url"),s=e("../jwk"),u=function(e,t){var n,u;if(s.isKey(e))n=e,u=n.keystore;
4else{if(!s.isKeyStore(e))throw new TypeError("Keystore must be provided");u=e}t=a({},t),Object.defineProperty(this,"verify",{value:function(e,s){s=a({},t,s||{});var c=s.handlers||{},l=Object.keys(c);if("string"==typeof e)e=e.split("."),e={payload:e[1],signatures:[{"protected":e[0],signature:e[2]}]};else if(!e||"object"===e)throw new Error("invalid input");e.signature&&(e.signatures=[{"protected":e["protected"]||void 0,header:e.header||void 0,signature:e.signature}]);var f=e.signatures||[{}];f=f.map(function(e){var t=i(e.header||{}),r=e["protected"]?JSON.parse(o.decode(e["protected"],"utf8")):{};t=a(t,r);var n=o.decode(e.signature),s=r.crit;if(s){if(!Array.isArray(s))return Promise.reject(new Error("Invalid 'crit' header"));for(var u=0;s.length>u;u++)if(-1===l.indexOf(s[u]))return Promise.reject(new Error("Critical extension is not supported: "+s[u]))}return r=Object.keys(r),{"protected":r,aad:e["protected"]||"",header:t,signature:n}});var h=new Promise(function(t,i){var s=function(){var h=f.shift();if(!h)return void i(new Error("no key found"));h=a({},h,{payload:e.payload});var p=Promise.resolve(h);p=p.then(function(e){var t=n||u.get({use:"sig",alg:e.header.alg,kid:e.header.kid});return t?(e.key=t,e):Promise.reject(new Error("key does not match"))}),p=p.then(function(e){var t=[];return l.forEach(function(r){r=c[r];var n;"function"==typeof r?n=r(e):"object"==typeof r&&"function"==typeof r.prepare&&(n=r.prepare(e)),n&&t.push(Promise.resolve(n))}),Promise.all(t).then(function(){return e})}),p=p.then(function(e){var t=e.aad||"",n=e.payload||"",i=new r(1+t.length+n.length),a=0;return i.write(t,a,"ascii"),a+=t.length,i.write(".",a,"ascii"),a++,r.isBuffer(n)?n.copy(i,a):i.write(n,a,"binary"),e.content=i,e}),p=p.then(function(e){return e.key.verify(e.header.alg,e.content,e.signature)}),p=p.then(function(e){var t=h.payload;return t=o.decode(t),{"protected":h["protected"],header:h.header,payload:t,signature:e.mac,key:h.key}}),p=p.then(function(e){var t=[];return l.forEach(function(r){r=c[r];var n;"object"==typeof r&&"function"==typeof r.complete&&(n=r.complete(e)),n&&t.push(Promise.resolve(n))}),Promise.all(t).then(function(){return e})}),p.then(t,s)};s()});return h}})};t.exports={verifier:u,createVerify:n}}).call(this,e("buffer").Buffer)},{"../jwk":38,"../util/base64url":50,"../util/merge":53,buffer:70,"lodash.clone":95}],47:[function(e,t,r){"use strict";function n(e){var t,r,n=e.split(".");if(3===n.length)t="JWS",r=function(t){return i.JWS.createVerify(t).verify(e)};else{if(5!==n.length)throw new TypeError("invalid jose serialization");t="JWE",r=function(t){return i.JWE.createDecrypt(t).decrypt(e)}}var a;return a=i.util.base64url.decode(n[0],"utf8"),a=JSON.parse(a),{type:t,format:"compact",input:e,header:a,perform:r}}var i={JWE:e("../jwe"),JWS:e("../jws"),util:e("../util")};t.exports=n},{"../jwe":33,"../jws":44,"../util":52}],48:[function(e,t,r){(function(r){"use strict";var n=e("./compact"),i=e("./json"),a=t.exports=function(e){if(r.isBuffer(e))return n(e.toString("ascii"));if("string"==typeof e)return n(e);if(e)return i(e);throw new TypeError("invalid input")};a.compact=n,a.json=i}).call(this,{isBuffer:e("../../node_modules/browserify/node_modules/insert-module-globals/node_modules/is-buffer/index.js")})},{"../../node_modules/browserify/node_modules/insert-module-globals/node_modules/is-buffer/index.js":76,"./compact":47,"./json":49}],49:[function(e,t,r){"use strict";function n(e){var t,r,n;if("signatures"in e||"signature"in e)t="JWS",r=function(t){return a.JWS.createVerify(t).verify(e)},n=e.signatures||[{"protected":e["protected"],header:e.header,signature:e.signature}],n=n.map(function(e){var t={};e.header&&(t=i(t,e.header));var r;return e["protected"]&&(r=e["protected"],r=a.util.base64url.decode(r,"utf8"),r=JSON.parse(r),t=i(t,r)),t});else if("ciphertext"in e){t="JWE",r=function(t){return a.JWE.createDecrypt(t).decrypt(e)};var o={};e["protected"]&&(o["protected"]=e["protected"],o["protected"]=a.util.base64url.decode(o["protected"],"utf8"),o["protected"]=JSON.parse(o["protected"])),e.unprotected&&(o.unprotected=e.unprotected),n=e.recipients||[{}],n=n.map(function(e){var t={};return e.header&&(t=i(t,e.header)),o.unprotected&&(t=i(t,o.unprotected)),o["protected"]&&(t=i(t,o["protected"])),t})}return{type:t,format:"json",input:e,all:n,perform:r}}var i=e("../util/merge"),a={JWE:e("../jwe"),JWS:e("../jws"),util:e("../util")};t.exports=n},{"../jwe":33,"../jws":44,"../util":52,"../util/merge":53}],50:[function(e,t,r){"use strict";var n=e("urlsafe-base64"),i={encode:n.encode,decode:n.decode};t.exports=i},{"urlsafe-base64":159}],51:[function(e,t,r){(function(r){"use strict";
4function n(e,t){t=t||{},r.isBuffer(e)?this.data=e:i.util.isArrayBuffer(e)?(e=new Uint8Array(e),this.data=new r(e)):i.util.isArrayBufferView(e)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),this.data=new r(e)),this.data&&(this.write=this.data.length,e=void 0),this.growSize=t.growSize||n.DEFAULT_GROW_SIZE,this.write=this.write||0,this.read=this.read||0,e?this.putBytes(e):this.data||this.accommodate(0),t.readOffset="readOffset"in t?t.readOffset:this.read,this.write="writeOffset"in t?t.writeOffset:this.write,this.read=Math.min(t.readOffset,this.write)}var i=e("../deps/forge.js"),a=e("./base64url.js");n.DEFAULT_GROW_SIZE=16,n.prototype.length=function(){return this.write-this.read},n.prototype.available=function(){return this.data.length-this.write},n.prototype.isEmpty=function(){return this.length()<=0},n.prototype.accommodate=function(e){if(this.data){if(this.available()<e){e=Math.max(e,this.growSize);var t=this.data,n=new r(t.length+e);t.copy(n,0),this.data=n}}else e=Math.max(this.write+e,this.growSize),this.data=new r(e);return this.data.fill(0,this.write),this},n.prototype.clear=function(){return this.read=this.write=0,this.data=new r(0),this},n.prototype.truncate=function(e){return this.write=this.read+Math.max(0,this.length()-e),this.data.fill(0,this.write),this},n.prototype.compact=function(){return this.read>0&&(this.write===this.read?this.read=this.write=0:(this.data.copy(this.data,0,this.read,this.write),this.write=this.write-this.read,this.read=0),this.data.fill(0,this.write)),this},n.prototype.copy=function(){return new n(this,{readOffset:this.read,writeOffset:this.write,growSize:this.growSize})},n.prototype.equals=function(e){if(!n.isBuffer(e))return!1;if(e.length()!==this.length())return!1;for(var t=!0,r=this.read-e.read,i=e.read;e.write>i;i++)t=t&&this.data[i+r]===e.data[i];return t},n.prototype.at=function(e){return this.data[this.read+e]},n.prototype.setAt=function(e,t){return this.data[this.read+e]=t,this},n.prototype.last=function(){return this.data[this.write-1]},n.prototype.bytes=function(e){var t;if(void 0===e?e=this.length():e&&(e=Math.min(e,this.length())),0===e)t="";else{var r=this.read,n=r+e,i=this.data.slice(r,n);t=String.fromCharCode.apply(null,i)}return t},n.prototype.buffer=function(e){var t;if(void 0===e?e=this.length():e&&(e=Math.min(e,this.length())),0===e)t=new ArrayBuffer(0);else{var r=this.read,n=r+e,i=this.data.slice(r,n);t=new Uint8Array(n-r),t.set(i)}return t},n.prototype["native"]=function(e){var t;if("undefined"==typeof e?e=this.length():e&&(e=Math.min(e,this.length())),0===e)t=new r(0);else{var n=this.read,i=n+e;t=this.data.slice(n,i)}return t},n.prototype.toHex=function(){return this.toString("hex")},n.prototype.toString=function(e){if(0===this.length())return"";var t=this.data.slice(this.read,this.write);switch(e=e||"utf8"){case"raw":return t.toString("binary");case"base64url":return a.encode(t);case"utf16":return t.toString("ucs2");default:return t.toString(e)}},n.prototype.fillWithByte=function(e,t){return t||(t=this.available()),this.accommodate(t),this.data.fill(e,this.write,this.write+t),this.write+=t,this},n.prototype.getBuffer=function(e){var t=this.buffer(e);return this.read+=t.byteLength,t},n.prototype.putBuffer=function(e){return this.putBytes(e)},n.prototype.getBytes=function(e){var t=this.bytes(e);return this.read+=t.length,t},n.prototype.putBytes=function(e,t){function o(e){return r._augment?r._augment(e):new r(e)}if("string"==typeof e){switch(t=t||"binary"){case"utf16":t="ucs-2";break;case"raw":t="binary";break;case"base64url":e=a.decode(e)}r.isBuffer(e)||(e=new r(e,t))}var s,u;if(e instanceof n){var c=e;e=c.data.slice(c.read,c.write),c.read=c.write}else e instanceof i.util.ByteStringBuffer&&(e=e.getBytes());if(r.isBuffer(e))s=e;else if(Array.isArray(e))s=new r(e);else if(i.util.isArrayBuffer(e))s=new Uint8Array(e),s=o(s);else{if(!i.util.isArrayBufferView(e))throw new TypeError("invalid source type");s=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=o(s)}return this.accommodate(s.length),u=this.data,s.copy(u,this.write),this.write+=s.length,this},n.prototype.getNative=function(e){var t=this["native"](e);return this.read+=t.length,t},n.prototype.putNative=n.prototype.putBuffer,n.prototype.getByte=function(){var e=this.data[this.read];return this.read=Math.min(this.read+1,this.write),e},n.prototype.putByte=function(e){return this.accommodate(1),this.data[this.write]=255&e,this.write++,this},n.prototype.getInt16=function(){var e=this.data[this.read]<<8^this.data[this.read+1];return this.read=Math.min(this.read+2,this.write),e},n.prototype.putInt16=function(e){return this.accommodate(2),this.data[this.write]=e>>>8&255,this.data[this.write+1]=255&e,this.write+=2,this},n.prototype.getInt24=function(){var e=this.data[this.read]<<16^this.data[this.read+1]<<8^this.data[this.read+2];return this.read=Math.min(this.read+3,this.write),e},n.prototype.putInt24=function(e){return this.accommodate(3),this.data[this.write]=e>>>16&255,this.data[this.write+1]=e>>>8&255,this.data[this.write+2]=255&e,this.write+=3,this},n.prototype.getInt32=function(){var e=this.data[this.read]<<24^this.data[this.read+1]<<16^this.data[this.read+2]<<8^this.data[this.read+3];return this.read=Math.min(this.read+4,this.write),e},n.prototype.putInt32=function(e){return this.accommodate(4),this.data[this.write]=e>>>24&255,this.data[this.write+1]=e>>>16&255,this.data[this.write+2]=e>>>8&255,this.data[this.write+3]=255&e,this.write+=4,this},n.prototype.getInt16Le=function(){var e=this.data[this.read+1]<<8^this.data[this.read];return this.read=Math.min(this.read+2,this.write),e},n.prototype.putInt16Le=function(e){return this.accommodate(2),this.data[this.write+1]=e>>>8&255,this.data[this.write]=255&e,this.write+=2,this},n.prototype.getInt24Le=function(){var e=this.data[this.read+2]<<16^this.data[this.read+1]<<8^this.data[this.read];return this.read=Math.min(this.read+3,this.write),e},n.prototype.putInt24Le=function(e){return this.accommodate(3),this.data[this.write+2]=e>>>16&255,this.data[this.write+1]=e>>>8&255,this.data[this.write]=255&e,this.write+=3,this},n.prototype.getInt32Le=function(){var e=this.data[this.read+3]<<24^this.data[this.read+2]<<16^this.data[this.read+1]<<8^this.data[this.read];return this.read=Math.min(this.read+4,this.write),e},n.prototype.putInt32Le=function(e){return this.accommodate(4),this.data[this.write+3]=e>>>24&255,this.data[this.write+2]=e>>>16&255,this.data[this.write+1]=e>>>8&255,this.data[this.write]=255&e,this.write+=4,this},n.prototype.getInt=function(e){var t=0;do t=t<<8|this.getByte(),e-=8;while(e>0);return t},n.prototype.putInt=function(e,t){this.accommodate(Math.ceil(t/8));do t-=8,this.putByte(e>>t&255);while(t>0);return this},n.prototype.putSignedInt=function(e,t){return 0>e&&(e+=2<<t-1),this.putInt(e,t)},n.prototype.putString=function(e){return this.putBytes(e,"utf16")},n.isBuffer=function(e){return e instanceof n},n.asBuffer=function(e){return n.isBuffer(e)?e:e?new n(e):new n},t.exports=i.util.ByteBuffer=n}).call(this,e("buffer").Buffer)},{"../deps/forge.js":27,"./base64url.js":50,buffer:70}],52:[function(e,t,r){(function(r){"use strict";function n(e,t){if(r.isBuffer(e))return e;if("string"==typeof e)return t=t||"binary","base64url"===t?a.base64url.decode(e):new r(e,t);o.util.isArrayBufferView(e)?e=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteOffset+e.byteLength):o.util.isArrayBuffer(e)&&(e=new Uint8Array(e));var n;return n=new r(e)}function i(e){return new r(o.random.getBytes(e),"binary")}var a,o=e("../deps/forge.js");a={base64url:e("./base64url.js"),utf8:e("./utf8.js"),asBuffer:n,randomBytes:i},t.exports=a}).call(this,e("buffer").Buffer)},{"../deps/forge.js":27,"./base64url.js":50,"./utf8.js":54,buffer:70}],53:[function(e,t,r){(function(r){"use strict";function n(e){for(var t,r=0;!t&&s.length>r;r++)e instanceof s[r]&&(t=s[r]);return t}
4function i(e,t){if(r.isBuffer(t))t=new r(t);else{var i=n(t);t=i?new i(t,t.byteOffset,t.byteLength):void 0}return e=t,t}var a=e("lodash.partialright"),o=e("lodash.merge"),s=function(){var e=[];return"undefined"!=typeof Uint8ClampedArray&&e.push(Uint8ClampedArray),"undefined"!=typeof Uint8Array&&e.push(Uint8Array),"undefined"!=typeof Uint16Array&&e.push(Uint16Array),"undefined"!=typeof Uint32Array&&e.push(Uint32Array),"undefined"!=typeof Float32Array&&e.push(Float32Array),"undefined"!=typeof Float64Array&&e.push(Float64Array),e}();t.exports=a(o,i)}).call(this,e("buffer").Buffer)},{buffer:70,"lodash.merge":104,"lodash.partialright":116}],54:[function(e,t,r){"use strict";var n=r;n.encode=function(e){var t=encodeURIComponent(e||"");return t=t.replace(/\%([0-9a-fA-F]{2})/g,function(e,t){return t=parseInt(t,16),String.fromCharCode(t)})},n.decode=function(e){var t=(e||"").replace(/[\u0080-\u00ff]/g,function(e){var t=(256|e.charCodeAt(0)).toString(16).substring(1);return"%"+t});return t=decodeURIComponent(t)}},{}],55:[function(e,t,r){function n(e,t){return p.isUndefined(t)?""+t:p.isNumber(t)&&!isFinite(t)?t.toString():p.isFunction(t)||p.isRegExp(t)?t.toString():t}function i(e,t){return p.isString(e)?e.length<t?e:e.slice(0,t):e}function a(e){return i(JSON.stringify(e.actual,n),128)+" "+e.operator+" "+i(JSON.stringify(e.expected,n),128)}function o(e,t,r,n,i){throw new y.AssertionError({message:r,actual:e,expected:t,operator:n,stackStartFunction:i})}function s(e,t){e||o(e,!0,t,"==",y.ok)}function u(e,t){if(e===t)return!0;if(p.isBuffer(e)&&p.isBuffer(t)){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return p.isDate(e)&&p.isDate(t)?e.getTime()===t.getTime():p.isRegExp(e)&&p.isRegExp(t)?e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase:p.isObject(e)||p.isObject(t)?l(e,t):e==t}function c(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function l(e,t){if(p.isNullOrUndefined(e)||p.isNullOrUndefined(t))return!1;if(e.prototype!==t.prototype)return!1;if(p.isPrimitive(e)||p.isPrimitive(t))return e===t;var r=c(e),n=c(t);if(r&&!n||!r&&n)return!1;if(r)return e=d.call(e),t=d.call(t),u(e,t);var i,a,o=v(e),s=v(t);if(o.length!=s.length)return!1;for(o.sort(),s.sort(),a=o.length-1;a>=0;a--)if(o[a]!=s[a])return!1;for(a=o.length-1;a>=0;a--)if(i=o[a],!u(e[i],t[i]))return!1;return!0}function f(e,t){return e&&t?"[object RegExp]"==Object.prototype.toString.call(t)?t.test(e):e instanceof t?!0:t.call({},e)===!0:!1}function h(e,t,r,n){var i;p.isString(r)&&(n=r,r=null);try{t()}catch(a){i=a}if(n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&o(i,r,"Missing expected exception"+n),!e&&f(i,r)&&o(i,r,"Got unwanted exception"+n),e&&i&&r&&!f(i,r)||!e&&i)throw i}var p=e("util/"),d=Array.prototype.slice,g=Object.prototype.hasOwnProperty,y=t.exports=s;y.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=a(this),this.generatedMessage=!0);var t=e.stackStartFunction||o;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=t.name,s=n.indexOf("\n"+i);if(s>=0){var u=n.indexOf("\n",s+1);n=n.substring(u+1)}this.stack=n}}},p.inherits(y.AssertionError,Error),y.fail=o,y.ok=s,y.equal=function(e,t,r){e!=t&&o(e,t,r,"==",y.equal)},y.notEqual=function(e,t,r){e==t&&o(e,t,r,"!=",y.notEqual)},y.deepEqual=function(e,t,r){u(e,t)||o(e,t,r,"deepEqual",y.deepEqual)},y.notDeepEqual=function(e,t,r){u(e,t)&&o(e,t,r,"notDeepEqual",y.notDeepEqual)},y.strictEqual=function(e,t,r){e!==t&&o(e,t,r,"===",y.strictEqual)},y.notStrictEqual=function(e,t,r){e===t&&o(e,t,r,"!==",y.notStrictEqual)},y["throws"]=function(e,t,r){h.apply(this,[!0].concat(d.call(arguments)))},y.doesNotThrow=function(e,t){h.apply(this,[!1].concat(d.call(arguments)))},y.ifError=function(e){if(e)throw e};var v=Object.keys||function(e){var t=[];for(var r in e)g.call(e,r)&&t.push(r);return t}},{"util/":89}],56:[function(e,t,r){},{}],57:[function(e,t,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;r.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1
vendor: 12,028 bytes, lines 4-5
4);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])}}return e},r.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)return void e.set(t.subarray(r,r+n),i);for(var a=0;n>a;a++)e[i+a]=t[r+a]},flattenChunks:function(e){var t,r,n,i,a,o;for(n=0,t=0,r=e.length;r>t;t++)n+=e[t].length;for(o=new Uint8Array(n),i=0,t=0,r=e.length;r>t;t++)a=e[t],o.set(a,i),i+=a.length;return o}},a={arraySet:function(e,t,r,n,i){for(var a=0;n>a;a++)e[i+a]=t[r+a]},flattenChunks:function(e){return[].concat.apply([],e)}};r.setTyped=function(e){e?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,i)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,a))},r.setTyped(n)},{}],58:[function(e,t,r){"use strict";function n(e,t,r,n){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;0!==r;){o=r>2e3?2e3:r,r-=o;do i=i+t[n++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0}t.exports=n},{}],59:[function(e,t,r){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],60:[function(e,t,r){"use strict";function n(){for(var e,t=[],r=0;256>r;r++){e=r;for(var n=0;8>n;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}function i(e,t,r,n){var i=a,o=n+r;e=-1^e;for(var s=n;o>s;s++)e=e>>>8^i[255&(e^t[s])];return-1^e}var a=n();t.exports=i},{}],61:[function(e,t,r){"use strict";function n(e,t){return e.msg=N[t],t}function i(e){return(e<<1)-(e>4?9:0)}function a(e){for(var t=e.length;--t>=0;)e[t]=0}function o(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(B.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function s(e,t){I._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,o(e.strm)}function u(e,t){e.pending_buf[e.pending++]=t}function c(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function l(e,t,r,n){var i=e.avail_in;return i>n&&(i=n),0===i?0:(e.avail_in-=i,B.arraySet(t,e.input,e.next_in,i,r),1===e.state.wrap?e.adler=R(e.adler,t,i,r):2===e.state.wrap&&(e.adler=F(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)}function f(e,t){var r,n,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-ce?e.strstart-(e.w_size-ce):0,c=e.window,l=e.w_mask,f=e.prev,h=e.strstart+ue,p=c[a+o-1],d=c[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do if(r=t,c[r+o]===d&&c[r+o-1]===p&&c[r]===c[a]&&c[++r]===c[a+1]){a+=2,r++;do;while(c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&h>a);if(n=ue-(h-a),a=h-ue,n>o){if(e.match_start=t,o=n,n>=s)break;p=c[a+o-1],d=c[a+o]}}while((t=f[t&l])>u&&0!==--i);return o<=e.lookahead?o:e.lookahead}function h(e){var t,r,n,i,a,o=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=o+(o-ce)){B.arraySet(e.window,e.window,o,o,0),e.match_start-=o,e.strstart-=o,e.block_start-=o,r=e.hash_size,t=r;do n=e.head[--t],e.head[t]=n>=o?n-o:0;while(--r);r=o,t=r;do n=e.prev[--t],e.prev[t]=n>=o?n-o:0;while(--r);i+=o}if(0===e.strm.avail_in)break;if(r=l(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=r,e.lookahead+e.insert>=se)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+se-1])&e.hash_mask,e.prev[a&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=a,a++,e.insert--,!(e.lookahead+e.insert<se)););}while(e.lookahead<ce&&0!==e.strm.avail_in)}function p(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(h(e),0===e.lookahead&&t===j)return me;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,s(e,!1),0===e.strm.avail_out))return me;if(e.strstart-e.block_start>=e.w_size-ce&&(s(e,!1),0===e.strm.avail_out))return me}return e.insert=0,t===O?(s(e,!0),0===e.strm.avail_out?Ee:_e):e.strstart>e.block_start&&(s(e,!1),0===e.strm.avail_out)?me:me}function d(e,t){for(var r,n;;){if(e.lookahead<ce){if(h(e),e.lookahead<ce&&t===j)return me;if(0===e.lookahead)break}if(r=0,e.lookahead>=se&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+se-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-ce&&(e.match_length=f(e,r)),e.match_length>=se)if(n=I._tr_tally(e,e.strstart-e.match_start,e.match_length-se), 5e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=se){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+se-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(0!==--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=I._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(s(e,!1),0===e.strm.avail_out))return me}return e.insert=e.strstart<se-1?e.strstart:se-1,t===O?(s(e,!0),0===e.strm.avail_out?Ee:_e):e.last_lit&&(s(e,!1),0===e.strm.avail_out)?me:be}function g(e,t){for(var r,n,i;;){if(e.lookahead<ce){if(h(e),e.lookahead<ce&&t===j)return me;if(0===e.lookahead)break}if(r=0,e.lookahead>=se&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+se-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=se-1,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-ce&&(e.match_length=f(e,r),e.match_length<=5&&(e.strategy===q||e.match_length===se&&e.strstart-e.match_start>4096)&&(e.match_length=se-1)),e.prev_length>=se&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-se,n=I._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-se),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+se-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(0!==--e.prev_length);if(e.match_available=0,e.match_length=se-1,e.strstart++,n&&(s(e,!1),0===e.strm.avail_out))return me}else if(e.match_available){if(n=I._tr_tally(e,0,e.window[e.strstart-1]),n&&s(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return me}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=I._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<se-1?e.strstart:se-1,t===O?(s(e,!0),0===e.strm.avail_out?Ee:_e):e.last_lit&&(s(e,!1),0===e.strm.avail_out)?me:be}function y(e,t){for(var r,n,i,a,o=e.window;;){if(e.lookahead<=ue){if(h(e),e.lookahead<=ue&&t===j)return me;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=se&&e.strstart>0&&(i=e.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=e.strstart+ue;do;while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&a>i);e.match_length=ue-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=se?(r=I._tr_tally(e,1,e.match_length-se),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=I._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(s(e,!1),0===e.strm.avail_out))return me}return e.insert=0,t===O?(s(e,!0),0===e.strm.avail_out?Ee:_e):e.last_lit&&(s(e,!1),0===e.strm.avail_out)?me:be}function v(e,t){for(var r;;){if(0===e.lookahead&&(h(e),0===e.lookahead)){if(t===j)return me;break}if(e.match_length=0,r=I._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(s(e,!1),0===e.strm.avail_out))return me}return e.insert=0,t===O?(s(e,!0),0===e.strm.avail_out?Ee:_e):e.last_lit&&(s(e,!1),0===e.strm.avail_out)?me:be}function m(e){e.window_size=2*e.w_size,a(e.head),e.max_lazy_match=k[e.level].max_lazy,e.good_match=k[e.level].good_length,e.nice_match=k[e.level].nice_length,e.max_chain_length=k[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=se-1,e.match_available=0,e.ins_h=0}function b(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Y,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new B.Buf16(2*ae),this.dyn_dtree=new B.Buf16(2*(2*ne+1)),this.bl_tree=new B.Buf16(2*(2*ie+1)),a(this.dyn_ltree),a(this.dyn_dtree),a(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new B.Buf16(oe+1),this.heap=new B.Buf16(2*re+1),a(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new B.Buf16(2*re+1),a(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function E(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=Q,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?fe:ye,e.adler=2===t.wrap?0:1,t.last_flush=j,I._tr_init(t),D):n(e,M)}function _(e){var t=E(e);return t===D&&m(e.state),t}function w(e,t){return e&&e.state?2!==e.state.wrap?M:(e.state.gzhead=t,D):M}function C(e,t,r,i,a,o){if(!e)return M;var s=1;if(t===H&&(t=6),0>i?(s=0,i=-i):i>15&&(s=2,i-=16),1>a||a>X||r!==Y||8>i||i>15||0>t||t>9||0>o||o>W)return n(e,M);8===i&&(i=9);var u=new b;return e.state=u,u.strm=e,u.wrap=s,u.gzhead=null,u.w_bits=i,u.w_size=1<<u.w_bits,u.w_mask=u.w_size-1,u.hash_bits=a+7,u.hash_size=1<<u.hash_bits,u.hash_mask=u.hash_size-1,u.hash_shift=~~((u.hash_bits+se-1)/se),u.window=new B.Buf8(2*u.w_size),u.head=new B.Buf16(u.hash_size),u.prev=new B.Buf16(u.w_size),u.lit_bufsize=1<<a+6,u.pending_buf_size=4*u.lit_bufsize,u.pending_buf=new B.Buf8(u.pending_buf_size),u.d_buf=u.lit_bufsize>>1,u.l_buf=3*u.lit_bufsize,u.level=t,u.strategy=o,u.method=r,_(e)}function S(e,t){return C(e,t,Y,J,$,Z)}function A(e,t){var r,s,l,f;if(!e||!e.state||t>x||0>t)return e?n(e,M):M;if(s=e.state,!e.output||!e.input&&0!==e.avail_in||s.status===ve&&t!==O)return n(e,0===e.avail_out?V:M);if(s.strm=e,r=s.last_flush,s.last_flush=t,s.status===fe)if(2===s.wrap)e.adler=0,u(s,31),u(s,139),u(s,8),s.gzhead?(u(s,(s.gzhead.text?1:0)+(s.gzhead.hcrc?2:0)+(s.gzhead.extra?4:0)+(s.gzhead.name?8:0)+(s.gzhead.comment?16:0)),u(s,255&s.gzhead.time),u(s,s.gzhead.time>>8&255),u(s,s.gzhead.time>>16&255),u(s,s.gzhead.time>>24&255),u(s,9===s.level?2:s.strategy>=z||s.level<2?4:0),u(s,255&s.gzhead.os),s.gzhead.extra&&s.gzhead.extra.length&&(u(s,255&s.gzhead.extra.length),u(s,s.gzhead.extra.length>>8&255)),s.gzhead.hcrc&&(e.adler=F(e.adler,s.pending_buf,s.pending,0)),s.gzindex=0,s.status=he):(u(s,0),u(s,0),u(s,0),u(s,0),u(s,0),u(s,9===s.level?2:s.strategy>=z||s.level<2?4:0),u(s,we),s.status=ye);else{var h=Y+(s.w_bits-8<<4)<<8,p=-1;p=s.strategy>=z||s.level<2?0:s.level<6?1:6===s.level?2:3,h|=p<<6,0!==s.strstart&&(h|=le),h+=31-h%31,s.status=ye,c(s,h),0!==s.strstart&&(c(s,e.adler>>>16),c(s,65535&e.adler)),e.adler=1}if(s.status===he)if(s.gzhead.extra){for(l=s.pending;
5s.gzindex<(65535&s.gzhead.extra.length)&&(s.pending!==s.pending_buf_size||(s.gzhead.hcrc&&s.pending>l&&(e.adler=F(e.adler,s.pending_buf,s.pending-l,l)),o(e),l=s.pending,s.pending!==s.pending_buf_size));)u(s,255&s.gzhead.extra[s.gzindex]),s.gzindex++;s.gzhead.hcrc&&s.pending>l&&(e.adler=F(e.adler,s.pending_buf,s.pending-l,l)),s.gzindex===s.gzhead.extra.length&&(s.gzindex=0,s.status=pe)}else s.status=pe;if(s.status===pe)if(s.gzhead.name){l=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>l&&(e.adler=F(e.adler,s.pending_buf,s.pending-l,l)),o(e),l=s.pending,s.pending===s.pending_buf_size)){f=1;break}f=s.gzindex<s.gzhead.name.length?255&s.gzhead.name.charCodeAt(s.gzindex++):0,u(s,f)}while(0!==f);s.gzhead.hcrc&&s.pending>l&&(e.adler=F(e.adler,s.pending_buf,s.pending-l,l)),0===f&&(s.gzindex=0,s.status=de)}else s.status=de;if(s.status===de)if(s.gzhead.comment){l=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>l&&(e.adler=F(e.adler,s.pending_buf,s.pending-l,l)),o(e),l=s.pending,s.pending===s.pending_buf_size)){f=1;break}f=s.gzindex<s.gzhead.comment.length?255&s.gzhead.comment.charCodeAt(s.gzindex++):0,u(s,f)}while(0!==f);s.gzhead.hcrc&&s.pending>l&&(e.adler=F(e.adler,s.pending_buf,s.pending-l,l)),0===f&&(s.status=ge)}else s.status=ge;if(s.status===ge&&(s.gzhead.hcrc?(s.pending+2>s.pending_buf_size&&o(e),s.pending+2<=s.pending_buf_size&&(u(s,255&e.adler),u(s,e.adler>>8&255),e.adler=0,s.status=ye)):s.status=ye),0!==s.pending){if(o(e),0===e.avail_out)return s.last_flush=-1,D}else if(0===e.avail_in&&i(t)<=i(r)&&t!==O)return n(e,V);if(s.status===ve&&0!==e.avail_in)return n(e,V);if(0!==e.avail_in||0!==s.lookahead||t!==j&&s.status!==ve){var d=s.strategy===z?v(s,t):s.strategy===G?y(s,t):k[s.level].func(s,t);if(d!==Ee&&d!==_e||(s.status=ve),d===me||d===Ee)return 0===e.avail_out&&(s.last_flush=-1),D;if(d===be&&(t===P?I._tr_align(s):t!==x&&(I._tr_stored_block(s,0,0,!1),t===L&&(a(s.head),0===s.lookahead&&(s.strstart=0,s.block_start=0,s.insert=0))),o(e),0===e.avail_out))return s.last_flush=-1,D}return t!==O?D:s.wrap<=0?U:(2===s.wrap?(u(s,255&e.adler),u(s,e.adler>>8&255),u(s,e.adler>>16&255),u(s,e.adler>>24&255),u(s,255&e.total_in),u(s,e.total_in>>8&255),u(s,e.total_in>>16&255),u(s,e.total_in>>24&255)):(c(s,e.adler>>>16),c(s,65535&e.adler)),o(e),s.wrap>0&&(s.wrap=-s.wrap),0!==s.pending?D:U)}function T(e){var t;return e&&e.state?(t=e.state.status,t!==fe&&t!==he&&t!==pe&&t!==de&&t!==ge&&t!==ye&&t!==ve?n(e,M):(e.state=null,t===ye?n(e,K):D)):M}var k,B=e("../utils/common"),I=e("./trees"),R=e("./adler32"),F=e("./crc32"),N=e("./messages"),j=0,P=1,L=3,O=4,x=5,D=0,U=1,M=-2,K=-3,V=-5,H=-1,q=1,z=2,G=3,W=4,Z=0,Q=2,Y=8,X=9,J=15,$=8,ee=29,te=256,re=te+1+ee,ne=30,ie=19,ae=2*re+1,oe=15,se=3,ue=258,ce=ue+se+1,le=32,fe=42,he=69,pe=73,de=91,ge=103,ye=113,ve=666,me=1,be=2,Ee=3,_e=4,we=3,Ce=function(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i};k=[new Ce(0,0,0,0,p),new Ce(4,4,8,4,d),new Ce(4,5,16,8,d),new Ce(4,6,32,32,d),new Ce(4,4,16,16,g),new Ce(8,16,32,32,g),new Ce(8,16,128,128,g),new Ce(8,32,128,256,g),new Ce(32,128,258,1024,g),new Ce(32,258,258,4096,g)],r.deflateInit=S,r.deflateInit2=C,r.deflateReset=_,r.deflateResetKeep=E,r.deflateSetHeader=w,r.deflate=A,r.deflateEnd=T,r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":57,"./adler32":58,"./crc32":60,"./messages":65,"./trees":66}],62:[function(e,t,r){"use strict";var n=30,i=12;t.exports=function(e,t){var r,a,o,s,u,c,l,f,h,p,d,g,y,v,m,b,E,_,w,C,S,A,T,k,B;r=e.state,a=e.next_in,k=e.input,o=a+(e.avail_in-5),s=e.next_out,B=e.output,u=s-(t-e.avail_out),c=s+(e.avail_out-257),l=r.dmax,f=r.wsize,h=r.whave,p=r.wnext,d=r.window,g=r.hold,y=r.bits,v=r.lencode,m=r.distcode,b=(1<<r.lenbits)-1,E=(1<<r.distbits)-1;e:do{15>y&&(g+=k[a++]<<y,y+=8,g+=k[a++]<<y,y+=8),_=v[g&b];t:for(;;){if(w=_>>>24,g>>>=w,y-=w,w=_>>>16&255,0===w)B[s++]=65535&_;else{if(!(16&w)){if(0===(64&w)){_=v[(65535&_)+(g&(1<<w)-1)];continue t}if(32&w){r.mode=i;break e}e.msg="invalid literal/length code",r.mode=n;break e}C=65535&_,w&=15,w&&(w>y&&(g+=k[a++]<<y,y+=8),C+=g&(1<<w)-1,g>>>=w,y-=w),15>y&&(g+=k[a++]<<y,y+=8,g+=k[a++]<<y,y+=8),_=m[g&E];r:for(;;){if(w=_>>>24,g>>>=w,y-=w,w=_>>>16&255,!(16&w)){if(0===(64&w)){_=m[(65535&_)+(g&(1<<w)-1)];continue r}e.msg="invalid distance code",r.mode=n;break e}if(S=65535&_,w&=15,w>y&&(g+=k[a++]<<y,y+=8,w>y&&(g+=k[a++]<<y,y+=8)),S+=g&(1<<w)-1,S>l){e.msg="invalid distance too far back",r.mode=n;break e}if(g>>>=w,y-=w,w=s-u,S>w){if(w=S-w,w>h&&r.sane){e.msg="invalid distance too far back",r.mode=n;break e}if(A=0,T=d,0===p){if(A+=f-w,C>w){C-=w;do B[s++]=d[A++];while(--w);A=s-S,T=B}}else if(w>
vendor: 13,142 bytes, line 5
5p){if(A+=f+p-w,w-=p,C>w){C-=w;do B[s++]=d[A++];while(--w);if(A=0,C>p){w=p,C-=w;do B[s++]=d[A++];while(--w);A=s-S,T=B}}}else if(A+=p-w,C>w){C-=w;do B[s++]=d[A++];while(--w);A=s-S,T=B}for(;C>2;)B[s++]=T[A++],B[s++]=T[A++],B[s++]=T[A++],C-=3;C&&(B[s++]=T[A++],C>1&&(B[s++]=T[A++]))}else{A=s-S;do B[s++]=B[A++],B[s++]=B[A++],B[s++]=B[A++],C-=3;while(C>2);C&&(B[s++]=B[A++],C>1&&(B[s++]=B[A++]))}break}}break}}while(o>a&&c>s);C=y>>3,a-=C,y-=C<<3,g&=(1<<y)-1,e.next_in=a,e.next_out=s,e.avail_in=o>a?5+(o-a):5-(a-o),e.avail_out=c>s?257+(c-s):257-(s-c),r.hold=g,r.bits=y}},{}],63:[function(e,t,r){"use strict";function n(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function i(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new v.Buf16(320),this.work=new v.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function a(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=O,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new v.Buf32(de),t.distcode=t.distdyn=new v.Buf32(ge),t.sane=1,t.back=-1,B):F}function o(e){var t;return e&&e.state?(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,a(e)):F}function s(e,t){var r,n;return e&&e.state?(n=e.state,0>t?(r=0,t=-t):(r=(t>>4)+1,48>t&&(t&=15)),t&&(8>t||t>15)?F:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,o(e))):F}function u(e,t){var r,n;return e?(n=new i,e.state=n,n.window=null,r=s(e,t),r!==B&&(e.state=null),r):F}function c(e){return u(e,ve)}function l(e){if(me){var t;for(g=new v.Buf32(512),y=new v.Buf32(32),t=0;144>t;)e.lens[t++]=8;for(;256>t;)e.lens[t++]=9;for(;280>t;)e.lens[t++]=7;for(;288>t;)e.lens[t++]=8;for(_(C,e.lens,0,288,g,0,e.work,{bits:9}),t=0;32>t;)e.lens[t++]=5;_(S,e.lens,0,32,y,0,e.work,{bits:5}),me=!1}e.lencode=g,e.lenbits=9,e.distcode=y,e.distbits=5}function f(e,t,r,n){var i,a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new v.Buf8(a.wsize)),n>=a.wsize?(v.arraySet(a.window,t,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),v.arraySet(a.window,t,r-n,i,a.wnext),n-=i,n?(v.arraySet(a.window,t,r-n,n,0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0}function h(e,t){var r,i,a,o,s,u,c,h,p,d,g,y,de,ge,ye,ve,me,be,Ee,_e,we,Ce,Se,Ae,Te=0,ke=new v.Buf8(4),Be=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return F;r=e.state,r.mode===W&&(r.mode=Z),s=e.next_out,a=e.output,c=e.avail_out,o=e.next_in,i=e.input,u=e.avail_in,h=r.hold,p=r.bits,d=u,g=c,Ce=B;e:for(;;)switch(r.mode){case O:if(0===r.wrap){r.mode=Z;break}for(;16>p;){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}if(2&r.wrap&&35615===h){r.check=0,ke[0]=255&h,ke[1]=h>>>8&255,r.check=b(r.check,ke,2,0),h=0,p=0,r.mode=x;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&h)<<8)+(h>>8))%31){e.msg="incorrect header check",r.mode=fe;break}if((15&h)!==L){e.msg="unknown compression method",r.mode=fe;break}if(h>>>=4,p-=4,we=(15&h)+8,0===r.wbits)r.wbits=we;else if(we>r.wbits){e.msg="invalid window size",r.mode=fe;break}r.dmax=1<<we,e.adler=r.check=1,r.mode=512&h?z:W,h=0,p=0;break;case x:for(;16>p;){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}if(r.flags=h,(255&r.flags)!==L){e.msg="unknown compression method",r.mode=fe;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=fe;break}r.head&&(r.head.text=h>>8&1),512&r.flags&&(ke[0]=255&h,ke[1]=h>>>8&255,r.check=b(r.check,ke,2,0)),h=0,p=0,r.mode=D;case D:for(;32>p;){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}r.head&&(r.head.time=h),512&r.flags&&(ke[0]=255&h,ke[1]=h>>>8&255,ke[2]=h>>>16&255,ke[3]=h>>>24&255,r.check=b(r.check,ke,4,0)),h=0,p=0,r.mode=U;case U:for(;16>p;){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}r.head&&(r.head.xflags=255&h,r.head.os=h>>8),512&r.flags&&(ke[0]=255&h,ke[1]=h>>>8&255,r.check=b(r.check,ke,2,0)),h=0,p=0,r.mode=M;case M:if(1024&r.flags){for(;16>p;){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}r.length=h,r.head&&(r.head.extra_len=h),512&r.flags&&(ke[0]=255&h,ke[1]=h>>>8&255,r.check=b(r.check,ke,2,0)),h=0,p=0}else r.head&&(r.head.extra=null);r.mode=K;case K:if(1024&r.flags&&(y=r.length,y>u&&(y=u),y&&(r.head&&(we=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),v.arraySet(r.head.extra,i,o,y,we)),512&r.flags&&(r.check=b(r.check,i,y,o)),u-=y,o+=y,r.length-=y),r.length))break e;r.length=0,r.mode=V;case V:if(2048&r.flags){if(0===u)break e;y=0;do we=i[o+y++],r.head&&we&&r.length<65536&&(r.head.name+=String.fromCharCode(we));while(we&&u>y);if(512&r.flags&&(r.check=b(r.check,i,y,o)),u-=y,o+=y,we)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=H;case H:if(4096&r.flags){if(0===u)break e;y=0;do we=i[o+y++],r.head&&we&&r.length<65536&&(r.head.comment+=String.fromCharCode(we));while(we&&u>y);if(512&r.flags&&(r.check=b(r.check,i,y,o)),u-=y,o+=y,we)break e}else r.head&&(r.head.comment=null);r.mode=q;case q:if(512&r.flags){for(;16>p;){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}if(h!==(65535&r.check)){e.msg="header crc mismatch",r.mode=fe;break}h=0,p=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=W;break;case z:for(;32>p;){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}e.adler=r.check=n(h),h=0,p=0,r.mode=G;case G:if(0===r.havedict)return e.next_out=s,e.avail_out=c,e.next_in=o,e.avail_in=u,r.hold=h,r.bits=p,R;e.adler=r.check=1,r.mode=W;case W:if(t===T||t===k)break e;case Z:if(r.last){h>>>=7&p,p-=7&p,r.mode=ue;break}for(;3>p;){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}switch(r.last=1&h,h>>>=1,p-=1,3&h){case 0:r.mode=Q;break;case 1:if(l(r),r.mode=te,t===k){h>>>=2,p-=2;break e}break;case 2:r.mode=J;break;case 3:e.msg="invalid block type",r.mode=fe}h>>>=2,p-=2;break;case Q:for(h>>>=7&p,p-=7&p;32>p;){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}if((65535&h)!==(h>>>16^65535)){e.msg="invalid stored block lengths",r.mode=fe;break}if(r.length=65535&h,h=0,p=0,r.mode=Y,t===k)break e;case Y:r.mode=X;case X:if(y=r.length){if(y>u&&(y=u),y>c&&(y=c),0===y)break e;v.arraySet(a,i,o,y,s),u-=y,o+=y,c-=y,s+=y,r.length-=y;break}r.mode=W;break;case J:for(;14>p;){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}if(r.nlen=(31&h)+257,h>>>=5,p-=5,r.ndist=(31&h)+1,h>>>=5,p-=5,r.ncode=(15&h)+4,h>>>=4,p-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=fe;break}r.have=0,r.mode=$;case $:for(;r.have<r.ncode;){for(;3>p;){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}r.lens[Be[r.have++]]=7&h,h>>>=3,p-=3}for(;r.have<19;)r.lens[Be[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,Se={bits:r.lenbits},Ce=_(w,r.lens,0,19,r.lencode,0,r.work,Se),r.lenbits=Se.bits,Ce){e.msg="invalid code lengths set",r.mode=fe;break}r.have=0,r.mode=ee;case ee:for(;r.have<r.nlen+r.ndist;){for(;Te=r.lencode[h&(1<<r.lenbits)-1],ye=Te>>>24,ve=Te>>>16&255,me=65535&Te,!(p>=ye);){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}if(16>me)h>>>=ye,p-=ye,r.lens[r.have++]=me;else{if(16===me){for(Ae=ye+2;Ae>p;){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}if(h>>>=ye,p-=ye,0===r.have){e.msg="invalid bit length repeat",r.mode=fe;break}we=r.lens[r.have-1],y=3+(3&h),h>>>=2,p-=2}else if(17===me){for(Ae=ye+3;Ae>p;){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}h>>>=ye,p-=ye,we=0,y=3+(7&h),h>>>=3,p-=3}else{for(Ae=ye+7;Ae>p;){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}h>>>=ye,p-=ye,we=0,y=11+(127&h),h>>>=7,p-=7}if(r.have+y>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=fe;break}for(;y--;)r.lens[r.have++]=we}}if(r.mode===fe)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=fe;break}if(r.lenbits=9,Se={bits:r.lenbits},Ce=_(C,r.lens,0,r.nlen,r.lencode,0,r.work,Se),r.lenbits=Se.bits,Ce){e.msg="invalid literal/lengths set",r.mode=fe;break}if(r.distbits=6,r.distcode=r.distdyn,Se={bits:r.distbits},Ce=_(S,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,Se),r.distbits=Se.bits,Ce){e.msg="invalid distances set",r.mode=fe;break}if(r.mode=te,t===k)break e;case te:r.mode=re;case re:if(u>=6&&c>=258){e.next_out=s,e.avail_out=c,e.next_in=o,e.avail_in=u,r.hold=h,r.bits=p,E(e,g),s=e.next_out,a=e.output,c=e.avail_out,o=e.next_in,i=e.input,u=e.avail_in,h=r.hold,p=r.bits,r.mode===W&&(r.back=-1);break}for(r.back=0;Te=r.lencode[h&(1<<r.lenbits)-1],ye=Te>>>24,ve=Te>>>16&255,me=65535&Te,!(p>=ye);){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}if(ve&&0===(240&ve)){for(be=ye,Ee=ve,_e=me;Te=r.lencode[_e+((h&(1<<be+Ee)-1)>>be)],ye=Te>>>24,ve=Te>>>16&255,me=65535&Te,!(p>=be+ye);){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}h>>>=be,p-=be,r.back+=be}if(h>>>=ye,p-=ye,r.back+=ye,r.length=me,0===ve){r.mode=se;break}if(32&ve){r.back=-1,r.mode=W;break}if(64&ve){e.msg="invalid literal/length code",r.mode=fe;break}r.extra=15&ve,r.mode=ne;case ne:if(r.extra){for(Ae=r.extra;Ae>p;){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}r.length+=h&(1<<r.extra)-1,h>>>=r.extra,p-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=ie;case ie:for(;Te=r.distcode[h&(1<<r.distbits)-1],ye=Te>>>24,ve=Te>>>16&255,me=65535&Te,!(p>=ye);){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}if(0===(240&ve)){for(be=ye,Ee=ve,_e=me;Te=r.distcode[_e+((h&(1<<be+Ee)-1)>>be)],ye=Te>>>24,ve=Te>>>16&255,me=65535&Te,!(p>=be+ye);){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}h>>>=be,p-=be,r.back+=be}if(h>>>=ye,p-=ye,r.back+=ye,64&ve){e.msg="invalid distance code",r.mode=fe;break}r.offset=me,r.extra=15&ve,r.mode=ae;case ae:if(r.extra){for(Ae=r.extra;Ae>p;){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}r.offset+=h&(1<<r.extra)-1,h>>>=r.extra,p-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=fe;break}r.mode=oe;case oe:if(0===c)break e;if(y=g-c,r.offset>y){if(y=r.offset-y,y>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=fe;break}y>r.wnext?(y-=r.wnext,de=r.wsize-y):de=r.wnext-y,y>r.length&&(y=r.length),ge=r.window}else ge=a,de=s-r.offset,y=r.length;y>c&&(y=c),c-=y,r.length-=y;do a[s++]=ge[de++];while(--y);0===r.length&&(r.mode=re);break;case se:if(0===c)break e;a[s++]=r.length,c--,r.mode=re;break;case ue:if(r.wrap){for(;32>p;){if(0===u)break e;u--,h|=i[o++]<<p,p+=8}if(g-=c,e.total_out+=g,r.total+=g,g&&(e.adler=r.check=r.flags?b(r.check,a,g,s-g):m(r.check,a,g,s-g)),g=c,(r.flags?h:n(h))!==r.check){e.msg="incorrect data check",r.mode=fe;break}h=0,p=0}r.mode=ce;case ce:if(r.wrap&&r.flags){for(;32>p;){if(0===u)break e;u--,h+=i[o++]<<p,p+=8}if(h!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=fe;break}h=0,p=0}r.mode=le;case le:Ce=I;break e;case fe:Ce=N;break e;case he:return j;case pe:default:return F}return e.next_out=s,e.avail_out=c,e.next_in=o,e.avail_in=u,r.hold=h,r.bits=p,(r.wsize||g!==e.avail_out&&r.mode<fe&&(r.mode<ue||t!==A))&&f(e,e.output,e.next_out,g-e.avail_out)?(r.mode=he,j):(d-=e.avail_in,g-=e.avail_out,e.total_in+=d,e.total_out+=g,r.total+=g,r.wrap&&g&&(e.adler=r.check=r.flags?b(r.check,a,g,e.next_out-g):m(r.check,a,g,e.next_out-g)),e.data_type=r.bits+(r.last?64:0)+(r.mode===W?128:0)+(r.mode===te||r.mode===Y?256:0),(0===d&&0===g||t===A)&&Ce===B&&(Ce=P),Ce)}function p(e){if(!e||!e.state)return F;var t=e.state;return t.window&&(t.window=null),e.state=null,B}function d(e,t){var r;return e&&e.state?(r=e.state,0===(2&r.wrap)?F:(r.head=t,t.done=!1,B)):F}var g,y,v=e("../utils/common"),m=e("./adler32"),b=e("./crc32"),E=e("./inffast"),_=e("./inftrees"),w=0,C=1,S=2,A=4,T=5,k=6,B=0,I=1,R=2,F=-2,N=-3,j=-4,P=-5,L=8,O=1,x=2,D=3,U=4,M=5,K=6,V=7,H=8,q=9,z=10,G=11,W=12,Z=13,Q=14,Y=15,X=16,J=17,$=18,ee=19,te=20,re=21,ne=22,ie=23,ae=24,oe=25,se=26,ue=27,ce=28,le=29,fe=30,he=31,pe=32,de=852,ge=592,ye=15,ve=ye,me=!0;r.inflateReset=o,r.inflateReset2=s,r.inflateResetKeep=a,r.inflateInit=c,r.inflateInit2=u,r.inflate=h,r.inflateEnd=p,r.inflateGetHeader=d,r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":57,"./adler32":58,"./crc32":60,"./inffast":62,"./inftrees":64}],64:[function(e,t,r){"use strict";var n=e("../utils/common"),i=15,a=852,o=592,s=0,u=1,c=2,l=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],f=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],h=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],p=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,r,d,g,y,v,m){var b,E,_,w,C,S,A,T,k,B=m.bits,I=0,R=0,F=0,N=0,j=0,P=0,L=0,O=0,x=0,D=0,U=null,M=0,K=new n.Buf16(i+1),V=new n.Buf16(i+1),H=null,q=0;for(I=0;i>=I;I++)K[I]=0;for(R=0;d>R;R++)K[t[r+R]]++;for(j=B,N=i;N>=1&&0===K[N];N--);if(j>N&&(j=N),0===N)return g[y++]=20971520,g[y++]=20971520,m.bits=1,0;for(F=1;N>F&&0===K[F];F++);for(F>j&&(j=F),O=1,I=1;i>=I;I++)if(O<<=1,O-=K[I],0>O)return-1;if(O>0&&(e===s||1!==N))return-1;for(V[1]=0,I=1;i>I;I++)V[I+1]=V[I]+K[I];for(R=0;d>R;R++)0!==t[r+R]&&(v[V[t[r+R]]++]=R);
5if(e===s?(U=H=v,S=19):e===u?(U=l,M-=257,H=f,q-=257,S=256):(U=h,H=p,S=-1),D=0,R=0,I=F,C=y,P=j,L=0,_=-1,x=1<<j,w=x-1,e===u&&x>a||e===c&&x>o)return 1;for(var z=0;;){z++,A=I-L,v[R]<S?(T=0,k=v[R]):v[R]>S?(T=H[q+v[R]],k=U[M+v[R]]):(T=96,k=0),b=1<<I-L,E=1<<P,F=E;do E-=b,g[C+(D>>L)+E]=A<<24|T<<16|k|0;while(0!==E);for(b=1<<I-1;D&b;)b>>=1;if(0!==b?(D&=b-1,D+=b):D=0,R++,0===--K[I]){if(I===N)break;I=t[r+v[R]]}if(I>j&&(D&w)!==_){for(0===L&&(L=j),C+=F,P=I-L,O=1<<P;N>P+L&&(O-=K[P+L],!(0>=O));)P++,O<<=1;if(x+=1<<P,e===u&&x>a||e===c&&x>o)return 1;_=D&w,g[_]=j<<24|P<<16|C-y|0}}return 0!==D&&(g[C+D]=I-L<<24|64<<16|0),m.bits=j,0}},{"../utils/common":57}],65:[function(e,t,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],66:[function(e,t,r){"use strict";function n(e){for(var t=e.length;--t>=0;)e[t]=0}function i(e){return 256>e?oe[e]:oe[256+(e>>>7)]}function a(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function o(e,t,r){e.bi_valid>W-r?(e.bi_buf|=t<<e.bi_valid&65535,a(e,e.bi_buf),e.bi_buf=t>>W-e.bi_valid,e.bi_valid+=r-W):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function s(e,t,r){o(e,r[2*t],r[2*t+1])}function u(e,t){var r=0;do r|=1&e,e>>>=1,r<<=1;while(--t>0);return r>>>1}function c(e){16===e.bi_valid?(a(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}function l(e,t){var r,n,i,a,o,s,u=t.dyn_tree,c=t.max_code,l=t.stat_desc.static_tree,f=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,d=t.stat_desc.max_length,g=0;for(a=0;G>=a;a++)e.bl_count[a]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;z>r;r++)n=e.heap[r],a=u[2*u[2*n+1]+1]+1,a>d&&(a=d,g++),u[2*n+1]=a,n>c||(e.bl_count[a]++,o=0,n>=p&&(o=h[n-p]),s=u[2*n],e.opt_len+=s*(a+o),f&&(e.static_len+=s*(l[2*n+1]+o)));if(0!==g){do{for(a=d-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[d]--,g-=2}while(g>0);for(a=d;0!==a;a--)for(n=e.bl_count[a];0!==n;)i=e.heap[--r],i>c||(u[2*i+1]!==a&&(e.opt_len+=(a-u[2*i+1])*u[2*i],u[2*i+1]=a),n--)}}function f(e,t,r){var n,i,a=new Array(G+1),o=0;for(n=1;G>=n;n++)a[n]=o=o+r[n-1]<<1;for(i=0;t>=i;i++){var s=e[2*i+1];0!==s&&(e[2*i]=u(a[s]++,s))}}function h(){var e,t,r,n,i,a=new Array(G+1);for(r=0,n=0;M-1>n;n++)for(ue[n]=r,e=0;e<1<<$[n];e++)se[r++]=n;for(se[r-1]=n,i=0,n=0;16>n;n++)for(ce[n]=i,e=0;e<1<<ee[n];e++)oe[i++]=n;for(i>>=7;H>n;n++)for(ce[n]=i<<7,e=0;e<1<<ee[n]-7;e++)oe[256+i++]=n;for(t=0;G>=t;t++)a[t]=0;for(e=0;143>=e;)ie[2*e+1]=8,e++,a[8]++;for(;255>=e;)ie[2*e+1]=9,e++,a[9]++;for(;279>=e;)ie[2*e+1]=7,e++,a[7]++;for(;287>=e;)ie[2*e+1]=8,e++,a[8]++;for(f(ie,V+1,a),e=0;H>e;e++)ae[2*e+1]=5,ae[2*e]=u(e,5);le=new pe(ie,$,K+1,V,G),fe=new pe(ae,ee,0,H,G),he=new pe(new Array(0),te,0,q,Z)}function p(e){var t;for(t=0;V>t;t++)e.dyn_ltree[2*t]=0;for(t=0;H>t;t++)e.dyn_dtree[2*t]=0;for(t=0;q>t;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*Q]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function d(e){e.bi_valid>8?a(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function g(e,t,r,n){d(e),n&&(a(e,r),a(e,~r)),R.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function y(e,t,r,n){var i=2*t,a=2*r;return e[i]<e[a]||e[i]===e[a]&&n[t]<=n[r]}function v(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&y(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!y(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function m(e,t,r){var n,a,u,c,l=0;if(0!==e.last_lit)do n=e.pending_buf[e.d_buf+2*l]<<8|e.pending_buf[e.d_buf+2*l+1],a=e.pending_buf[e.l_buf+l],l++,0===n?s(e,a,t):(u=se[a],s(e,u+K+1,t),c=$[u],0!==c&&(a-=ue[u],o(e,a,c)),n--,u=i(n),s(e,u,r),c=ee[u],0!==c&&(n-=ce[u],o(e,n,c)));while(l<e.last_lit);s(e,Q,t)}function b(e,t){var r,n,i,a=t.dyn_tree,o=t.stat_desc.static_tree,s=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=z,r=0;u>r;r++)0!==a[2*r]?(e.heap[++e.heap_len]=c=r,e.depth[r]=0):a[2*r+1]=0;for(;e.heap_len<2;)i=e.heap[++e.heap_len]=2>c?++c:0,a[2*i]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=o[2*i+1]);for(t.max_code=c,r=e.heap_len>>1;r>=1;r--)v(e,a,r);i=u;do r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],v(e,a,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.hea
5p[--e.heap_max]=n,a[2*i]=a[2*r]+a[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,a[2*r+1]=a[2*n+1]=i,e.heap[1]=i++,v(e,a,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],l(e,t),f(a,c,e.bl_count)}function E(e,t,r){var n,i,a=-1,o=t[1],s=0,u=7,c=4;for(0===o&&(u=138,c=3),t[2*(r+1)+1]=65535,n=0;r>=n;n++)i=o,o=t[2*(n+1)+1],++s<u&&i===o||(c>s?e.bl_tree[2*i]+=s:0!==i?(i!==a&&e.bl_tree[2*i]++,e.bl_tree[2*Y]++):10>=s?e.bl_tree[2*X]++:e.bl_tree[2*J]++,s=0,a=i,0===o?(u=138,c=3):i===o?(u=6,c=3):(u=7,c=4))}function _(e,t,r){var n,i,a=-1,u=t[1],c=0,l=7,f=4;for(0===u&&(l=138,f=3),n=0;r>=n;n++)if(i=u,u=t[2*(n+1)+1],!(++c<l&&i===u)){if(f>c){do s(e,i,e.bl_tree);while(0!==--c)}else 0!==i?(i!==a&&(s(e,i,e.bl_tree),c--),s(e,Y,e.bl_tree),o(e,c-3,2)):10>=c?(s(e,X,e.bl_tree),o(e,c-3,3)):(s(e,J,e.bl_tree),o(e,c-11,7));c=0,a=i,0===u?(l=138,f=3):i===u?(l=6,f=3):(l=7,f=4)}}function w(e){var t;for(E(e,e.dyn_ltree,e.l_desc.max_code),E(e,e.dyn_dtree,e.d_desc.max_code),b(e,e.bl_desc),t=q-1;t>=3&&0===e.bl_tree[2*re[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}function C(e,t,r,n){var i;for(o(e,t-257,5),o(e,r-1,5),o(e,n-4,4),i=0;n>i;i++)o(e,e.bl_tree[2*re[i]+1],3);_(e,e.dyn_ltree,t-1),_(e,e.dyn_dtree,r-1)}function S(e){var t,r=4093624447;for(t=0;31>=t;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return N;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return j;for(t=32;K>t;t++)if(0!==e.dyn_ltree[2*t])return j;return N}function A(e){ge||(h(),ge=!0),e.l_desc=new de(e.dyn_ltree,le),e.d_desc=new de(e.dyn_dtree,fe),e.bl_desc=new de(e.bl_tree,he),e.bi_buf=0,e.bi_valid=0,p(e)}function T(e,t,r,n){o(e,(L<<1)+(n?1:0),3),g(e,t,r,!0)}function k(e){o(e,O<<1,3),s(e,Q,ie),c(e)}function B(e,t,r,n){var i,a,s=0;e.level>0?(e.strm.data_type===P&&(e.strm.data_type=S(e)),b(e,e.l_desc),b(e,e.d_desc),s=w(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,i>=a&&(i=a)):i=a=r+5,i>=r+4&&-1!==t?T(e,t,r,n):e.strategy===F||a===i?(o(e,(O<<1)+(n?1:0),3),m(e,ie,ae)):(o(e,(x<<1)+(n?1:0),3),C(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),m(e,e.dyn_ltree,e.dyn_dtree)),p(e),n&&d(e)}function I(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(se[r]+K+1)]++,e.dyn_dtree[2*i(t)]++),e.last_lit===e.lit_bufsize-1}var R=e("../utils/common"),F=4,N=0,j=1,P=2,L=0,O=1,x=2,D=3,U=258,M=29,K=256,V=K+1+M,H=30,q=19,z=2*V+1,G=15,W=16,Z=7,Q=256,Y=16,X=17,J=18,$=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ee=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],te=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],re=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ne=512,ie=new Array(2*(V+2));n(ie);var ae=new Array(2*H);n(ae);var oe=new Array(ne);n(oe);var se=new Array(U-D+1); 6n(se);var ue=new Array(M);n(ue);var ce=new Array(H);n(ce);var le,fe,he,pe=function(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length},de=function(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t},ge=!1;r._tr_init=A,r._tr_stored_block=T,r._tr_flush_block=B,r._tr_tally=I,r._tr_align=k},{"../utils/common":57}],67:[function(e,t,r){"use strict";function n(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}t.exports=n},{}],68:[function(e,t,r){(function(t,n){function i(e){if(e<r.DEFLATE||e>r.UNZIP)throw new TypeError("Bad argument");this.mode=e,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}function a(e,t){for(var r=0;r<e.length;r++)this[t+r]=e[r]}var o=e("pako/lib/zlib/messages"),s=e("pako/lib/zlib/zstream"),u=e("pako/lib/zlib/deflate.js"),c=e("pako/lib/zlib/inflate.js"),l=e("pako/lib/zlib/constants");for(var f in l)r[f]=l[f];r.NONE=0,r.DEFLATE=1,r.INFLATE=2,r.GZIP=3,r.GUNZIP=4,r.DEFLATERAW=5,r.INFLATERAW=6,r.UNZIP=7,i.prototype.init=function(e,t,n,i,a){switch(this.windowBits=e,this.level=t,this.memLevel=n,this.strategy=i,this.mode!==r.GZIP&&this.mode!==r.GUNZIP||(this.windowBits+=16),this.mode===r.UNZIP&&(this.windowBits+=32),this.mode!==r.DEFLATERAW&&this.mode!==r.INFLATERAW||(this.windowBits=-this.windowBits),this.strm=new s,this.mode){case r.DEFLATE:case r.GZIP:case r.DEFLATERAW:var o=u.deflateInit2(this.strm,this.level,r.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case r.INFLATE:case r.GUNZIP:case r.INFLATERAW:case r.UNZIP:var o=c.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}return o!==r.Z_OK?void this._error(o):(this.write_in_progress=!1,void(this.init_done=!0))},i.prototype.params=function(){throw new Error("deflateParams Not supported")},i.prototype._writeCheck=function(){if(!this.init_done)throw new Error("write before init");if(this.mode===r.NONE)throw new Error("already finalized");if(this.write_in_progress)throw new Error("write already in progress");if(this.pending_close)throw new Error("close is pending")},i.prototype.write=function(e,r,n,i,a,o,s){this._writeCheck(),this.write_in_progress=!0;var u=this;return t.nextTick(function(){u.write_in_progress=!1;var t=u._write(e,r,n,i,a,o,s);u.callback(t[0],t[1]),u.pending_close&&u.close()}),this},i.prototype.writeSync=function(e,t,r,n,i,a,o){return this._writeCheck(),this._write(e,t,r,n,i,a,o)},i.prototype._write=function(e,t,i,o,s,l,f){if(this.write_in_progress=!0,e!==r.Z_NO_FLUSH&&e!==r.Z_PARTIAL_FLUSH&&e!==r.Z_SYNC_FLUSH&&e!==r.Z_FULL_FLUSH&&e!==r.Z_FINISH&&e!==r.Z_BLOCK)throw new Error("Invalid flush value");
6null==t&&(t=new n(0),o=0,i=0),s._set?s.set=s._set:s.set=a;var h=this.strm;switch(h.avail_in=o,h.input=t,h.next_in=i,h.avail_out=f,h.output=s,h.next_out=l,this.mode){case r.DEFLATE:case r.GZIP:case r.DEFLATERAW:var p=u.deflate(h,e);break;case r.UNZIP:case r.INFLATE:case r.GUNZIP:case r.INFLATERAW:var p=c.inflate(h,e);break;default:throw new Error("Unknown mode "+this.mode)}return p!==r.Z_STREAM_END&&p!==r.Z_OK&&this._error(p),this.write_in_progress=!1,[h.avail_in,h.avail_out]},i.prototype.close=function(){return this.write_in_progress?void(this.pending_close=!0):(this.pending_close=!1,this.mode===r.DEFLATE||this.mode===r.GZIP||this.mode===r.DEFLATERAW?u.deflateEnd(this.strm):c.inflateEnd(this.strm),void(this.mode=r.NONE))},i.prototype.reset=function(){switch(this.mode){case r.DEFLATE:case r.DEFLATERAW:var e=u.deflateReset(this.strm);break;case r.INFLATE:case r.INFLATERAW:var e=c.inflateReset(this.strm)}e!==r.Z_OK&&this._error(e)},i.prototype._error=function(e){this.onerror(o[e]+": "+this.strm.msg,e),this.write_in_progress=!1,this.pending_close&&this.close()},r.Zlib=i}).call(this,e("_process"),e("buffer").Buffer)},{_process:77,buffer:70,"pako/lib/zlib/constants":59,"pako/lib/zlib/deflate.js":61,"pako/lib/zlib/inflate.js":63,"pako/lib/zlib/messages":65,"pako/lib/zlib/zstream":67}],69:[function(e,t,r){(function(t,n){function i(e,t,r){function i(){for(var t;null!==(t=e.read());)s.push(t),u+=t.length;e.once("readable",i)}function a(t){e.removeListener("end",o),e.removeListener("readable",i),r(t)}function o(){var t=n.concat(s,u);s=[],r(null,t),e.close()}var s=[],u=0;e.on("error",a),e.on("end",o),e.end(t),i()}function a(e,t){if("string"==typeof t&&(t=new n(t)),!n.isBuffer(t))throw new TypeError("Not a string or buffer");var r=g.Z_FINISH;return e._processChunk(t,r)}function o(e){return this instanceof o?void p.call(this,e,g.DEFLATE):new o(e)}function s(e){return this instanceof s?void p.call(this,e,g.INFLATE):new s(e)}function u(e){return this instanceof u?void p.call(this,e,g.GZIP):new u(e)}function c(e){return this instanceof c?void p.call(this,e,g.GUNZIP):new c(e)}function l(e){return this instanceof l?void p.call(this,e,g.DEFLATERAW):new l(e)}function f(e){return this instanceof f?void p.call(this,e,g.INFLATERAW):new f(e)}function h(e){return this instanceof h?void p.call(this,e,g.UNZIP):new h(e)}function p(e,t){if(this._opts=e=e||{},this._chunkSize=e.chunkSize||r.Z_DEFAULT_CHUNK,d.call(this,e),e.flush&&e.flush!==g.Z_NO_FLUSH&&e.flush!==g.Z_PARTIAL_FLUSH&&e.flush!==g.Z_SYNC_FLUSH&&e.flush!==g.Z_FULL_FLUSH&&e.flush!==g.Z_FINISH&&e.flush!==g.Z_BLOCK)throw new Error("Invalid flush flag: "+e.flush);if(this._flushFlag=e.flush||g.Z_NO_FLUSH,e.chunkSize&&(e.chunkSize<r.Z_MIN_CHUNK||e.chunkSize>r.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBits<r.Z_MIN_WINDOWBITS||e.windowBits>r.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.level<r.Z_MIN_LEVEL||e.level>r.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevel<r.Z_MIN_MEMLEVEL||e.memLevel>r.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=r.Z_FILTERED&&e.strategy!=r.Z_HUFFMAN_ONLY&&e.strategy!=r.Z_RLE&&e.strategy!=r.Z_FIXED&&e.strategy!=r.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!n.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new g.Zlib(t);var i=this;this._hadError=!1,this._binding.onerror=function(e,t){i._binding=null,i._hadError=!0;var n=new Error(e);n.errno=t,n.code=r.codes[t],i.emit("error",n)};var a=r.Z_DEFAULT_COMPRESSION;"number"==typeof e.level&&(a=e.level);var o=r.Z_DEFAULT_STRATEGY;"number"==typeof e.strategy&&(o=e.strategy),this._binding.init(e.windowBits||r.Z_DEFAULT_WINDOWBITS,a,e.memLevel||r.Z_DEFAULT_MEMLEVEL,o,e.dictionary),this._buffer=new n(this._chunkSize),this._offset=0,this._closed=!1,this._level=a,this._strategy=o,this.once("end",this.close)}var d=e("_stream_transform"),g=e("./binding"),y=e("util"),v=e("assert").ok;g.Z_MIN_WINDOWBITS=8,g.Z_MAX_WINDOWBITS=15,g.Z_DEFAULT_WINDOWBITS=15,g.Z_MIN_CHUNK=64,g.Z_MAX_CHUNK=1/0,g.Z_DEFAULT_CHUNK=16384,g.Z_MIN_MEMLEVEL=1,g.Z_MAX_MEMLEVEL=9,g.Z_DEFAULT_MEMLEVEL=8,g.Z_MIN_LEVEL=-1,g.Z_MAX_LEVEL=9,g.Z_DEFAULT_LEVEL=g.Z_DEFAULT_COMPRESSION,Object.keys(g).forEach(function(e){e.match(/^Z/)&&(r[e]=g[e])}),r.codes={Z_OK:g.Z_OK,Z_STREAM_END:g.Z_STREAM_END,Z_NEED_DICT:g.Z_NEED_DICT,Z_ERRNO:g.Z_ERRNO,Z_STREAM_ERROR:g.Z_STREAM_ERROR,Z_DATA_ERROR:g.Z_DATA_ERROR,Z_MEM_ERROR:g.Z_MEM_ERROR,Z_BUF_ER
6ROR:g.Z_BUF_ERROR,Z_VERSION_ERROR:g.Z_VERSION_ERROR},Object.keys(r.codes).forEach(function(e){r.codes[r.codes[e]]=e}),r.Deflate=o,r.Inflate=s,r.Gzip=u,r.Gunzip=c,r.DeflateRaw=l,r.InflateRaw=f,r.Unzip=h,r.createDeflate=function(e){return new o(e)},r.createInflate=function(e){return new s(e)},r.createDeflateRaw=function(e){return new l(e)},r.createInflateRaw=function(e){return new f(e)},r.createGzip=function(e){return new u(e)},r.createGunzip=function(e){return new c(e)},r.createUnzip=function(e){return new h(e)},r.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),i(new o(t),e,r)},r.deflateSync=function(e,t){return a(new o(t),e)},r.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),i(new u(t),e,r)},r.gzipSync=function(e,t){return a(new u(t),e)},r.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),i(new l(t),e,r)},r.deflateRawSync=function(e,t){return a(new l(t),e)},r.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),i(new h(t),e,r)},r.unzipSync=function(e,t){return a(new h(t),e)},r.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),i(new s(t),e,r)},r.inflateSync=function(e,t){return a(new s(t),e)},r.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),i(new c(t),e,r)},r.gunzipSync=function(e,t){return a(new c(t),e)},r.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),i(new f(t),e,r)},r.inflateRawSync=function(e,t){return a(new f(t),e)},y.inherits(p,d),p.prototype.params=function(e,n,i){if(e<r.Z_MIN_LEVEL||e>r.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(n!=r.Z_FILTERED&&n!=r.Z_HUFFMAN_ONLY&&n!=r.Z_RLE&&n!=r.Z_FIXED&&n!=r.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+n);if(this._level!==e||this._strategy!==n){var a=this;this.flush(g.Z_SYNC_FLUSH,function(){a._binding.params(e,n),a._hadError||(a._level=e,a._strategy=n,i&&i())})}else t.nextTick(i)},p.prototype.reset=function(){return this._binding.reset()},p.prototype._flush=function(e){this._transform(new n(0),"",e)},p.prototype.flush=function(e,r){var i=this._writableState;if(("function"==typeof e||void 0===e&&!r)&&(r=e,e=g.Z_FULL_FLUSH),i.ended)r&&t.nextTick(r);else if(i.ending)r&&this.once("end",r);else if(i.needDrain){var a=this;this.once("drain",function(){a.flush(r)})}else this._flushFlag=e,this.write(new n(0),"",r)},p.prototype.close=function(e){if(e&&t.nextTick(e),!this._closed){this._closed=!0,this._binding.close();var r=this;t.nextTick(function(){r.emit("close")})}},p.prototype._transform=function(e,t,r){var i,a=this._writableState,o=a.ending||a.ended,s=o&&(!e||a.length===e.length);if(null===!e&&!n.isBuffer(e))return r(new Error("invalid input"));s?i=g.Z_FINISH:(i=this._flushFlag,e.length>=a.length&&(this._flushFlag=this._opts.flush||g.Z_NO_FLUSH));this._processChunk(e,i,r)},p.prototype._processChunk=function(e,t,r){function i(l,p){if(!u._hadError){var d=o-p;if(v(d>=0,"have should not go down"),d>0){var g=u._buffer.slice(u._offset,u._offset+d);u._offset+=d,c?u.push(g):(f.push(g),h+=g.length)}if((0===p||u._offset>=u._chunkSize)&&(o=u._chunkSize,u._offset=0,u._buffer=new n(u._chunkSize)),0===p){if(s+=a-l,a=l,!c)return!0;var y=u._binding.write(t,e,s,a,u._buffer,u._offset,u._chunkSize);return y.callback=i,void(y.buffer=e)}return c?void r():!1}}var a=e&&e.length,o=this._chunkSize-this._offset,s=0,u=this,c="function"==typeof r;if(!c){var l,f=[],h=0;this.on("error",function(e){l=e});do var p=this._binding.writeSync(t,e,s,a,this._buffer,this._offset,o);while(!this._hadError&&i(p[0],p[1]));if(this._hadError)throw l;var d=n.concat(f,h);return this.close(),d}var g=this._binding.write(t,e,s,a,this._buffer,this._offset,o);g.buffer=e,g.callback=i},y.inherits(o,p),y.inherits(s,p),y.inherits(u,p),y.inherits(c,p),y.inherits(l,p),y.inherits(f,p),y.inherits(h,p)}).call(this,e("_process"),e("buffer").Buffer)},{"./binding":68,_process:77,_stream_transform:86,assert:55,buffer:70,util:89}],70:[function(e,t,r){(function(t){"use strict";function n(){try{var e=new Uint8Array(1);return e.foo=function(){return 42},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(t){return!1}}function i(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(i()<t)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=o.prototype):(null===e&&(e=new o(t)),e.length=t),e}function o(e,t,r){if(!(o.TYPED_ARRAY_SUPPORT||this instanceof o))return new o(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return l(this,e)}return s(this,e,t,r)}function s(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?p(e,t,r,n):"string"==typeof t?f(e,t,r):d(e,t)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number')}function c(e,t,r,n){return u(t),0>=t?a(e,t):void 0!==r?"string"==typeof n?a(e,t).fill(r,n):a(e,t).fill(r):a(e,t)}function l(e,t){if(u(t),e=a(e,0>t?0:0|g(t)),!o.TYPED_ARRAY_SUPPORT)for(var r=0;t>r;r++)e[r]=0;return e}function f(e,t,r){if("string"==typeof r&&""!==r||(r="utf8"),!o.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');
vendor: 18,046 bytes, line 6
6var n=0|v(t,r);return e=a(e,n),e.write(t,r),e}function h(e,t){var r=0|g(t.length);e=a(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function p(e,t,r,n){if(t.byteLength,0>r||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return t=void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),o.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=o.prototype):e=h(e,t),e}function d(e,t){if(o.isBuffer(t)){var r=0|g(t.length);return e=a(e,r),0===e.length?e:(t.copy(e,0,0,r),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||Q(t.length)?a(e,0):h(e,t);if("Buffer"===t.type&&J(t.data))return h(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function g(e){if(e>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function y(e){return+e!=e&&(e=0),o.alloc(+e)}function v(e,t){if(o.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":case void 0:return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(e).length;default:if(n)return q(e).length;t=(""+t).toLowerCase(),n=!0}}function m(e,t,r){var n=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),0>=r)return"";if(r>>>=0,t>>>=0,t>=r)return"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,r);case"utf8":case"utf-8":return B(this,t,r);case"ascii":return R(this,t,r);case"binary":return F(this,t,r);case"base64":return k(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function b(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function E(e,t,r,n){function i(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,o=e.length,s=t.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,r/=2}for(var u=-1,c=0;o>r+c;c++)if(i(e,r+c)===i(t,-1===u?0:c-u)){if(-1===u&&(u=c),c-u+1===s)return(r+u)*a}else-1!==u&&(c-=c-u),u=-1;return-1}function _(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var a=t.length;if(a%2!==0)throw new Error("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;n>o;o++){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[r+o]=s}return o}function w(e,t,r,n){return Z(q(t,e.length-r),e,r,n)}function C(e,t,r,n){return Z(z(t),e,r,n)}function S(e,t,r,n){return C(e,t,r,n)}function A(e,t,r,n){return Z(W(t),e,r,n)}function T(e,t,r,n){return Z(G(t,e.length-r),e,r,n)}function k(e,t,r){return 0===t&&r===e.length?Y.fromByteArray(e):Y.fromByteArray(e.slice(t,r))}function B(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;r>i;){var a=e[i],o=null,s=a>239?4:a>223?3:a>191?2:1;if(r>=i+s){var u,c,l,f;switch(s){case 1:128>a&&(o=a);break;case 2:u=e[i+1],128===(192&u)&&(f=(31&a)<<6|63&u,f>127&&(o=f));break;case 3:u=e[i+1],c=e[i+2],128===(192&u)&&128===(192&c)&&(f=(15&a)<<12|(63&u)<<6|63&c,f>2047&&(55296>f||f>57343)&&(o=f));break;case 4:u=e[i+1],c=e[i+2],l=e[i+3],128===(192&u)&&128===(192&c)&&128===(192&l)&&(f=(15&a)<<18|(63&u)<<12|(63&c)<<6|63&l,f>65535&&1114112>f&&(o=f))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return I(n)}function I(e){var t=e.length;if($>=t)return String.fromCharCode.apply(String,e);for(var r="",n=0;t>n;)r+=String.fromCharCode.apply(String,e.slice(n,n+=$));return r}function R(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;r>i;i++)n+=String.fromCharCode(127&e[i]);return n}function F(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;r>i;i++)n+=String.fromCharCode(e[i]);return n}function N(e,t,r){var n=e.length;(!t||0>t)&&(t=0),(!r||0>r||r>n)&&(r=n);for(var i="",a=t;r>a;a++)i+=H(e[a]);return i}function j(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function P(e,t,r){if(e%1!==0||0>e)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,r,n,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||a>t)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function O(e,t,r,n){0>t&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);a>i;i++)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function x(e,t,r,n){0>t&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);a>i;i++)e[r+i]=t>>>8*(n?i:3-i)&255}function D(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(0>r)throw new RangeError("Index out of range")}function U(e,t,r,n,i){return i||D(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(e,t,r,n,23,4),r+4}function M(e,t,r,n,i){return i||D(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(e,t,r,n,52,8),r+8}function K(e){if(e=V(e).replace(ee,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function V(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function H(e){return 16>e?"0"+e.toString(16):e.toString(16)}function q(e,t){t=t||1/0;for(var r,n=e.length,i=null,a=[],o=0;n>o;o++){if(r=e.charCodeAt(o),r>55295&&57344>r){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(56320>r){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,128>r){if((t-=1)<0)break;a.push(r)}else if(2048>r){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(65536>r){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function z(e){for(var t=[],r=0;r<e.length;r++)t.push(255&e.charCodeAt(r));return t}function G(e,t){for(var r,n,i,a=[],o=0;o<e.length&&!((t-=2)<0);o++)r=e.charCodeAt(o),n=r>>8,i=r%256,a.push(i),a.push(n);return a}function W(e){return Y.toByteArray(K(e))}function Z(e,t,r,n){for(var i=0;n>i&&!(i+r>=t.length||i>=e.length);i++)t[i+r]=e[i];return i}function Q(e){return e!==e}var Y=e("base64-js"),X=e("ieee754"),J=e("isarray");r.Buffer=o,r.SlowBuffer=y,r.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:n(),r.kMaxLength=i(),o.poolSize=8192,o._augment=function(e){return e.__proto__=o.prototype,e},o.from=function(e,t,r){return s(null,e,t,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(e,t,r){return c(null,e,t,r)},o.allocUnsafe=function(e){return l(null,e)},o.allocUnsafeSlow=function(e){return l(null,e)},o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.compare=function(e,t){if(!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);a>i;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return n>r?-1:r>n?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!J(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;r++)t+=e[r].length;var n=o.allocUnsafe(t),i=0;for(r=0;r<e.length;r++){var a=e[r];if(!o.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},o.byteLength=v,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;e>t;t+=2)b(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;e>t;t+=4)b(this,t,t+3),b(this,t+1,t+2);return this},o.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?B(this,0,e):m.apply(this,arguments)},o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:0===o.compare(this,e)},o.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},o.prototype.compare=function(e,t,r,n,i){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),0>t||r>e.length||0>n||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var a=i-n,s=r-t,u=Math.min(a,s),c=this.slice(n,i),l=e.slice(t,r),f=0;u>f;++f)if(c[f]!==l[f]){a=c[f],s=l[f];break}return s>a?-1:a>s?1:0},o.prototype.indexOf=function(e,t,r){if("string"==typeof t?(r=t,t=0):t>2147483647?t=2147483647:-2147483648>t&&(t=-2147483648),t>>=0,0===this.length)return-1;if(t>=this.length)return-1;if(0>t&&(t=Math.max(this.length+t,0)),"string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:E(this,e,t,r);if("number"==typeof e)return o.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,e,t):E(this,[e],t,r);throw new TypeError("val must be string, number or Buffer")},o.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},o.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t=0|t,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(0>r||0>t)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":return C(this,e,t,r);case"binary":return S(this,e,t,r);case"base64":return A(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;o.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),e>t&&(t=e);var n;if(o.TYPED_ARRAY_SUPPORT)n=this.subarray(e,t),n.__proto__=o.prototype;else{var i=t-e;n=new o(i,void 0);for(var a=0;i>a;a++)n[a]=this[a+e]}return n},o.prototype.readUIntLE=function(e,t,r){e=0|e,t=0|t,r||P(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},o.prototype.readUIntBE=function(e,t,r){e=0|e,t=0|t,r||P(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e=0|e,t=0|t,r||P(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e=0|e,t=0|t,r||P(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*t)),a},o.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),X.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),X.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),X.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),X.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t=0|t,r=0|r,!n){var i=Math.pow(2,8*r)-1;L(this,e,t,r,i,0)}var a=1,o=0;for(this[t]=255&e;++o<r&&(a*=256);)this[t+o]=e/a&255;return t+r},o.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t=0|t,r=0|r,!n){var i=Math.pow(2,8*r)-1;L(this,e,t,r,i,0)}var a=r-1,o=1;for(this[t+a]=255&e;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,1,255,0),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):x(this,e,t,!0),t+4},o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):x(this,e,t,!1),t+4},o.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t=0|t,!n){var i=Math.pow(2,8*r-1);L(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)0>e&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t=0|t,!n){var i=Math.pow(2,8*r-1);L(this,e,t,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)0>e&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,1,127,-128),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):x(this,e,t,!0),t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):x(this,e,t,!1),t+4},o.prototype.writeFloatLE=function(e,t,r){return U(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return U(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return M(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return M(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&r>n&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>n)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,a=n-r;if(this===e&&t>r&&n>t)for(i=a-1;i>=0;i--)e[i+t]=this[i+r];else if(1e3>a||!o.TYPED_ARRAY_SUPPORT)for(i=0;a>i;i++)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+a),t);return a},o.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);256>i&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e=255&e);if(0>t||this.length<t||this.length<r)throw new RangeError("Out of range index");if(t>=r)return this;t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;r>a;a++)this[a]=e;else{var s=o.isBuffer(e)?e:q(new o(e,n).toString()),u=s.length;for(a=0;r-t>a;a++)this[a+t]=s[a%u]}return this};var ee=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":71,ieee754:72,isarray:73}],71:[function(e,t,r){"use strict";function n(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
6+/",t=0,r=e.length;r>t;++t)u[t]=e[t],c[e.charCodeAt(t)]=t;c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63}function i(e){var t,r,n,i,a,o,s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a="="===e[s-2]?2:"="===e[s-1]?1:0,o=new l(3*s/4-a),n=a>0?s-4:s;var u=0;for(t=0,r=0;n>t;t+=4,r+=3)i=c[e.charCodeAt(t)]<<18|c[e.charCodeAt(t+1)]<<12|c[e.charCodeAt(t+2)]<<6|c[e.charCodeAt(t+3)],o[u++]=i>>16&255,o[u++]=i>>8&255,o[u++]=255&i;return 2===a?(i=c[e.charCodeAt(t)]<<2|c[e.charCodeAt(t+1)]>>4,o[u++]=255&i):1===a&&(i=c[e.charCodeAt(t)]<<10|c[e.charCodeAt(t+1)]<<4|c[e.charCodeAt(t+2)]>>2,o[u++]=i>>8&255,o[u++]=255&i),o}function a(e){return u[e>>18&63]+u[e>>12&63]+u[e>>6&63]+u[63&e]}function o(e,t,r){for(var n,i=[],o=t;r>o;o+=3)n=(e[o]<<16)+(e[o+1]<<8)+e[o+2],i.push(a(n));return i.join("")}function s(e){for(var t,r=e.length,n=r%3,i="",a=[],s=16383,c=0,l=r-n;l>c;c+=s)a.push(o(e,c,c+s>l?l:c+s));return 1===n?(t=e[r-1],i+=u[t>>2],i+=u[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=u[t>>10],i+=u[t>>4&63],i+=u[t<<2&63],i+="="),a.push(i),a.join("")}r.toByteArray=i,r.fromByteArray=s;var u=[],c=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array; 7n()},{}],72:[function(e,t,r){r.read=function(e,t,r,n,i){var a,o,s=8*i-n-1,u=(1<<s)-1,c=u>>1,l=-7,f=r?i-1:0,h=r?-1:1,p=e[t+f];for(f+=h,a=p&(1<<-l)-1,p>>=-l,l+=s;l>0;a=256*a+e[t+f],f+=h,l-=8);for(o=a&(1<<-l)-1,a>>=-l,l+=n;l>0;o=256*o+e[t+f],f+=h,l-=8);if(0===a)a=1-c;else{if(a===u)return o?NaN:(p?-1:1)*(1/0);o+=Math.pow(2,n),a-=c}return(p?-1:1)*o*Math.pow(2,a-n)},r.write=function(e,t,r,n,i,a){var o,s,u,c=8*a-i-1,l=(1<<c)-1,f=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,d=n?1:-1,g=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),t+=o+f>=1?h/u:h*Math.pow(2,1-f),t*u>=2&&(o++,u/=2),o+f>=l?(s=0,o=l):o+f>=1?(s=(t*u-1)*Math.pow(2,i),o+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[r+p]=255&s,p+=d,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;e[r+p]=255&o,p+=d,o/=256,c-=8);e[r+p-d]|=128*g}},{}],73:[function(e,t,r){var n={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},{}],74:[function(e,t,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function a(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!a(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,r,n,a,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[e],s(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),r.apply(this,a)}else if(o(r))for(a=Array.prototype.slice.call(arguments,1),c=r.slice(),n=c.length,u=0;n>u;u++)c[u].apply(this,a);return!0},n.prototype.addListener=function(e,t){var r;if(!i(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned&&(r=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var n=!1;return r.listener=t,this.on(e,r),this},n.prototype.removeListener=function(e,t){var r,n,a,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],a=r.length,n=-1,r===t||i(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit
7("removeListener",e,t);else if(o(r)){for(s=a;s-- >0;)if(r[s]===t||r[s].listener&&r[s].listener===t){n=s;break}if(0>n)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],i(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},{}],75:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},{}],76:[function(e,t,r){t.exports=function(e){return!(null==e||!(e._isBuffer||e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)))}},{}],77:[function(e,t,r){function n(){l&&s&&(l=!1,s.length?c=s.concat(c):f=-1,c.length&&i())}function i(){if(!l){var e=setTimeout(n);l=!0;for(var t=c.length;t;){for(s=c,c=[];++f<t;)s&&s[f].run();f=-1,t=c.length}s=null,l=!1,clearTimeout(e)}}function a(e,t){this.fun=e,this.array=t}function o(){}var s,u=t.exports={},c=[],l=!1,f=-1;u.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new a(e,t)),1!==c.length||l||setTimeout(i,0)},a.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=o,u.addListener=o,u.once=o,u.off=o,u.removeListener=o,u.removeAllListeners=o,u.emit=o,u.binding=function(e){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(e){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},{}],78:[function(e,t,r){"use strict";function n(e){return this instanceof n?(c.call(this,e),l.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",i)):new n(e)}function i(){this.allowHalfOpen||this._writableState.ended||s(a,this)}function a(e){e.end()}var o=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=n;var s=e("process-nextick-args"),u=e("core-util-is");u.inherits=e("inherits");var c=e("./_stream_readable"),l=e("./_stream_writable");u.inherits(n,c);for(var f=o(l.prototype),h=0;h<f.length;h++){var p=f[h];n.prototype[p]||(n.prototype[p]=l.prototype[p])}},{"./_stream_readable":79,"./_stream_writable":81,"core-util-is":82,inherits:75,"process-nextick-args":84}],79:[function(e,t,r){(function(r){"use strict";function n(t,r){P=P||e("./_stream_duplex"),t=t||{},this.objectMode=!!t.objectMode,r instanceof P&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(j||(j=e("string_decoder/").StringDecoder),this.decoder=new j(t.encoding),this.encoding=t.encoding)}function i(t){return P=P||e("./_stream_duplex"),this instanceof i?(this._readableState=new n(t,this),this.readable=!0,t&&"function"==typeof t.read&&(this._read=t.read),void B.call(this)):new i(t)}function a(e,t,r,n,i){var a=c(t,r);if(a)e.emit("error",a);else if(null===r)t.reading=!1,l(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||n||(r=t.decoder.write(r),u=!t.objectMode&&0===r.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&f(e))),p(e,t)}else i||(t.reading=!1);return o(t)}function o(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function s(e){return e>=L?e=L:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function u(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:0>=e?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function c(e,t){var r=null;return k.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function l(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,f(e)}}function f(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(N("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?A(h,e):h(e))}function h(e){N("emit readable"),e.emit("readable"),b(e)}function p(e,t){t.readingMore||(t.readingMore=!0,A(d,e,t))}function d(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(N("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function g(e){return function(){var t=e._readableState;N("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&I(e,"data")&&(t.flowing=!0,b(e))}}function y(e){N("readable nexttick read 0"),e.read(0)}function v(e,t){t.resumeScheduled||(t.resumeScheduled=!0,A(m,e,t))}function m(e,t){t.reading||(N("resume read 0"),e.read(0)),t.resumeScheduled=!1,e.emit("resume"),b(e),t.flowing&&!t.reading&&e.read(0)}function b(e){var t=e._readableState;if(N("flow",t.flowing),t.flowing)do var r=e.read();while(null!==r&&t.flowing)}function E(e,t){var r,n=t.buffer,i=t.length,a=!!t.decoder,o=!!t.objectMode;if(0===n.length)return null;if(0===i)r=null;else if(o)r=n.shift();else if(!e||e>=i)r=a?n.join(""):1===n.length?n[0]:k.concat(n,i),n.length=0;else if(e<n[0].length){var s=n[0];r=s.slice(0,e),n[0]=s.slice(e)}else if(e===n[0].length)r=n.shift();else{r=a?"":new k(e);for(var u=0,c=0,l=n.length;l>c&&e>u;c++){var s=n[0],f=Math.min(e-u,s.length);a?r+=s.slice(0,f):s.copy(r,u,0,f),f<s.length?n[0]=s.slice(f):n.shift(),u+=f}}return r}function _(e){var t=e._readableState;if(t.length>
70)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,A(w,t,e))}function w(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function C(e,t){for(var r=0,n=e.length;n>r;r++)t(e[r],r)}function S(e,t){for(var r=0,n=e.length;n>r;r++)if(e[r]===t)return r;return-1}t.exports=i;var A=e("process-nextick-args"),T=e("isarray"),k=e("buffer").Buffer;i.ReadableState=n;var B,I=(e("events"),function(e,t){return e.listeners(t).length});!function(){try{B=e("stream")}catch(t){}finally{B||(B=e("events").EventEmitter)}}();var k=e("buffer").Buffer,R=e("core-util-is");R.inherits=e("inherits");var F=e("util"),N=void 0;N=F&&F.debuglog?F.debuglog("stream"):function(){};var j;R.inherits(i,B);var P,P;i.prototype.push=function(e,t){var r=this._readableState;return r.objectMode||"string"!=typeof e||(t=t||r.defaultEncoding,t!==r.encoding&&(e=new k(e,t),t="")),a(this,r,e,t,!1)},i.prototype.unshift=function(e){var t=this._readableState;return a(this,t,e,"",!0)},i.prototype.isPaused=function(){return this._readableState.flowing===!1},i.prototype.setEncoding=function(t){return j||(j=e("string_decoder/").StringDecoder),this._readableState.decoder=new j(t),this._readableState.encoding=t,this};var L=8388608;i.prototype.read=function(e){N("read",e);var t=this._readableState,r=e;if(("number"!=typeof e||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return N("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?_(this):f(this),null;if(e=u(e,t),0===e&&t.ended)return 0===t.length&&_(this),null;var n=t.needReadable;N("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&(n=!0,N("length less than watermark",n)),(t.ended||t.reading)&&(n=!1,N("reading or ended",n)),n&&(N("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),n&&!t.reading&&(e=u(r,t));var i;return i=e>0?E(e,t):null,null===i&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),r!==e&&t.ended&&0===t.length&&_(this),null!==i&&this.emit("data",i),i},i.prototype._read=function(e){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function n(e){N("onunpipe"),e===f&&a()}function i(){N("onend"),e.end()}function a(){N("cleanup"),e.removeListener("close",u),e.removeListener("finish",c),e.removeListener("drain",y),e.removeListener("error",s),e.removeListener("unpipe",n),f.removeListener("end",i),f.removeListener("end",a),f.removeListener("data",o),v=!0,!h.awaitDrain||e._writableState&&!e._writableState.needDrain||y()}function o(t){N("ondata");var r=e.write(t);!1===r&&(1!==h.pipesCount||h.pipes[0]!==e||1!==f.listenerCount("data")||v||(N("false write response, pause",f._readableState.awaitDrain),f._readableState.awaitDrain++),f.pause())}function s(t){N("onerror",t),l(),e.removeListener("error",s),0===I(e,"error")&&e.emit("error",t)}function u(){e.removeListener("finish",c),l()}function c(){N("onfinish"),e.removeListener("close",u),l()}function l(){N("unpipe"),f.unpipe(e)}var f=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=e;break;case 1:h.pipes=[h.pipes,e];break;default:h.pipes.push(e)}h.pipesCount+=1,N("pipe count=%d opts=%j",h.pipesCount,t);var p=(!t||t.end!==!1)&&e!==r.stdout&&e!==r.stderr,d=p?i:a;h.endEmitted?A(d):f.once("end",d),e.on("unpipe",n);var y=g(f);e.on("drain",y);var v=!1;return f.on("data",o),e._events&&e._events.error?T(e._events.error)?e._events.error.unshift(s):e._events.error=[s,e._events.error]:e.on("error",s),e.once("close",u),e.once("finish",c),e.emit("pipe",f),h.flowing||(N("pipe resume"),f.resume()),e},i.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;n>i;i++)r[i].emit("unpipe",this);return this}var a=S(t.pipes,e);return-1===a?this:(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this),this)},i.prototype.on=function(e,t){var r=B.prototype.on.call(this,e,t);if("data"===e&&!1!==this._readableState.flowing&&this.resume(),"readable"===e&&!this._readableState.endEmitted){var n=this._readableState;n.readableListening||(n.readableListening=!0,n.emittedReadable=!1,n.needReadable=!0,n.reading?n.length&&f(this,n):A(y,this))}return r},i.prototype.addListener=i.prototype.on,i.prototype.resume=function(){var e=this._readableState;return e.flowing||(N("resume"),e.flowing=!0,v(this,e)),this},i.prototype.pause=function(){return N("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(N("pause"),this._readableState.flowing=!1,this.emit
7("pause")),this},i.prototype.wrap=function(e){var t=this._readableState,r=!1,n=this;e.on("end",function(){if(N("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&n.push(e)}n.push(null)}),e.on("data",function(i){if(N("wrapped data"),t.decoder&&(i=t.decoder.write(i)),(!t.objectMode||null!==i&&void 0!==i)&&(t.objectMode||i&&i.length)){var a=n.push(i);a||(r=!0,e.pause())}});for(var i in e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));var a=["error","close","destroy","pause","resume"];return C(a,function(t){e.on(t,n.emit.bind(n,t))}),n._read=function(t){N("wrapped _read",t),r&&(r=!1,e.resume())},n},i._fromList=E}).call(this,e("_process"))},{"./_stream_duplex":78,_process:77,buffer:70,"core-util-is":82,events:74,inherits:75,isarray:83,"process-nextick-args":84,"string_decoder/":87,util:56}],80:[function(e,t,r){"use strict";function n(e){this.afterTransform=function(t,r){return i(e,t,r)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function i(e,t,r){var n=e._transformState;n.transforming=!1;var i=n.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));n.writechunk=null,n.writecb=null,null!==r&&void 0!==r&&e.push(r),i(t);var a=e._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&e._read(a.highWaterMark)}function a(e){if(!(this instanceof a))return new a(e);s.call(this,e),this._transformState=new n(this);var t=this;this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.once("prefinish",function(){"function"==typeof this._flush?this._flush(function(e){o(t,e)}):o(t)})}function o(e,t){if(t)return e.emit("error",t);var r=e._writableState,n=e._transformState;if(r.length)throw new Error("calling transform done when ws.length != 0");if(n.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}t.exports=a;var s=e("./_stream_duplex"),u=e("core-util-is");u.inherits=e("inherits"),u.inherits(a,s),a.prototype.push=function(e,t){return this._transformState.needTransform=!1,s.prototype.push.call(this,e,t)},a.prototype._transform=function(e,t,r){throw new Error("not implemented")},a.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},a.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0}},{"./_stream_duplex":78,"core-util-is":82,inherits:75}],81:[function(e,t,r){(function(r){"use strict";function n(){}function i(e,t,r){this.chunk=e,this.encoding=t,this.callback=r,this.next=null}function a(t,r){I=I||e("./_stream_duplex"),t=t||{},this.objectMode=!!t.objectMode,r instanceof I&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var a=t.decodeStrings===!1;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){d(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new w(this),this.corkedRequestsFree.next=new w(this)}function o(t){return I=I||e("./_stream_duplex"),this instanceof o||this instanceof I?(this._writableState=new a(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev)),void k.call(this)):new o(t)}function s(e,t){var r=new Error("write after end");e.emit("error",r),C(t,r)}function u(e,t,r,n){var i=!0;if(!A.isBuffer(r)&&"string"!=typeof r&&null!==r&&void 0!==r&&!t.objectMode){var a=new TypeError("Invalid non-string/buffer chunk");e.emit("error",a),C(n,a),i=!1}return i}function c(e,t,r){return e.objectMode||e.decodeStrings===!1||"string"!=typeof t||(t=new A(t,r)),t}function l(e,t,r,n,a){r=c(t,r,n),A.isBuffer(r)&&(n="buffer");var o=t.objectMode?1:r.length;t.length+=o;var s=t.length<t.highWaterMark;if(s||(t.needDrain=!0),t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest=new i(r,n,a),u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else f(e,t,!1,o,r,n,a);return s}function f(e,t,r,n,i,a,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function h(e,t,r,n,i){--t.pendingcb,r?C(i,n):i(n),e._writableState.errorEmitted=!0,e.emit("error",n)}function p(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function d(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(p(r),t)h(e,r,n,t,i);else{var a=m(r);a||r.corked||r.bufferProcessing||!r.bufferedRequest||v(e,r),n?S(g,e,r,a,i):g(e,r,a,i)}}function g(e,t,r,n){r||y(e,t),t.pendingcb--,n(),E(e,t)}function y(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function v(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),a=t.corkedRequestsFree;a.entry=r;for(var o=0;r;)i[o]=r,r=r.next,o+=1;f(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,t.corkedRequestsFree=a.next,a.next=null}else{for(;r;){var s=r.chunk,u=r.encoding,c=r.callback,l=t.objectMode?1:s.length;if(f(e,t,!1,l,s,u,c),r=r.next,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=r,t.bufferProcessing=!1}function m(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function b(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function E(e,t){var r=m(t);return r&&(0===t.pendingcb?(b(e,t),t.finished=!0,e.emit("finish")):b(e,t)),r}function _(e,t,r){t.ending=!0,E(e,t),r&&(t.finished?C(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function w(e){var t=this;this.next=null,this.entry=null,this.finish=function(r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}}t.exports=o;var C=e("process-nextick-args"),S=!r.browser&&["v0.10","v0.9."].indexOf(r.ver
vendor: 8,828 bytes, line 7
7sion.slice(0,5))>-1?setImmediate:C,A=e("buffer").Buffer;o.WritableState=a;var T=e("core-util-is");T.inherits=e("inherits");var k,B={deprecate:e("util-deprecate")};!function(){try{k=e("stream")}catch(t){}finally{k||(k=e("events").EventEmitter)}}();var A=e("buffer").Buffer;T.inherits(o,k);var I;a.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(a.prototype,"buffer",{get:B.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var I;o.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},o.prototype.write=function(e,t,r){var i=this._writableState,a=!1;return"function"==typeof t&&(r=t,t=null),A.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=n),i.ended?s(this,r):u(this,i,e,r)&&(i.pendingcb++,a=l(this,i,e,t,r)),a},o.prototype.cork=function(){var e=this._writableState;e.corked++},o.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||v(this,e))},o.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);this._writableState.defaultEncoding=e},o.prototype._write=function(e,t,r){r(new Error("not implemented"))},o.prototype._writev=null,o.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||_(this,n,r)}}).call(this,e("_process"))},{"./_stream_duplex":78,_process:77,buffer:70,"core-util-is":82,events:74,inherits:75,"process-nextick-args":84,"util-deprecate":85}],82:[function(e,t,r){(function(e){function t(e){return Array.isArray?Array.isArray(e):"[object Array]"===y(e)}function n(e){return"boolean"==typeof e}function i(e){return null===e}function a(e){return null==e}function o(e){return"number"==typeof e}function s(e){return"string"==typeof e}function u(e){return"symbol"==typeof e}function c(e){return void 0===e}function l(e){return"[object RegExp]"===y(e)}function f(e){return"object"==typeof e&&null!==e}function h(e){return"[object Date]"===y(e)}function p(e){return"[object Error]"===y(e)||e instanceof Error}function d(e){return"function"==typeof e}function g(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function y(e){return Object.prototype.toString.call(e)}r.isArray=t,r.isBoolean=n,r.isNull=i,r.isNullOrUndefined=a,r.isNumber=o,r.isString=s,r.isSymbol=u,r.isUndefined=c,r.isRegExp=l,r.isObject=f,r.isDate=h,r.isError=p,r.isFunction=d,r.isPrimitive=g,r.isBuffer=e.isBuffer}).call(this,{isBuffer:e("../../../../insert-module-globals/node_modules/is-buffer/index.js")})},{"../../../../insert-module-globals/node_modules/is-buffer/index.js":76}],83:[function(e,t,r){arguments[4][73][0].apply(r,arguments)},{dup:73}],84:[function(e,t,r){(function(e){"use strict";function r(t,r,n,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var a,o,s=arguments.length;switch(s){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,r)});case 3:return e.nextTick(function(){t.call(null,r,n)});case 4:return e.nextTick(function(){t.call(null,r,n,i)});default:for(a=new Array(s-1),o=0;o<a.length;)a[o++]=arguments[o];return e.nextTick(function(){t.apply(null,a)})}}!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports=r:t.exports=e.nextTick}).call(this,e("_process"))},{_process:77}],85:[function(e,t,r){(function(e){function r(e,t){function r(){if(!i){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}if(n("noDeprecation"))return e;var i=!1;return r}function n(t){try{if(!e.localStorage)return!1}catch(r){return!1}var n=e.localStorage[t];return null==n?!1:"true"===String(n).toLowerCase()}t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],86:[function(e,t,r){t.exports=e("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":80}],87:[function(e,t,r){function n(e){if(e&&!u(e))throw new Error("Unknown encoding: "+e)}function i(e){return e.toString(this.encoding)}function a(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function o(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var s=e("buffer").Buffer,u=s.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},c=r.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),n(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=a;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=o;break;default:return void(this.write=i)}this.charBuffer=new s(6),this.charReceived=0,this.charLength=0};c.prototype.write=function(e){for(var t="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived<this.charLength)return"";e=e.slice(r,e.length),t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var n=t.charCodeAt(t.length-1);if(!(n>=55296&&56319>=n)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var i=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),t+=e.toString(this.encoding,0,i);var i=t.length-1,n=t.charCodeAt(i);if(n>=55296&&56319>=n){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),e.copy(this.charBuffer,0,0,a),t.substring(0,i)}return t},c.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(1==t&&r>>5==6){this.charLength=2;break}if(2>=t&&r>>4==14){this.charLength=3;break}if(3>=t&&r>>3==30){this.charLength=4;break}}this.charReceived=t},c.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;t+=n.slice(0,r).toString(i)}return t}},{buffer:70}],88:[function(e,t,r){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],89:[function(e,t,r){(function(t,n){function i(e,t){var n={seen:[],stylize:o};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(t)?n.showHidden=t:t&&r._extend(n,t),_(n.showHidden)&&(n.showHidden=!1),_(n.depth)&&(n.depth=2),_(n.colors)&&(n.colors=!1),_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=a),u(n,e,n.depth)}function a(e,t){var r=i.styles[t];return r?"�["+i.colors[r][0]+"m"+e+"�["+i.colors[r][1]+"m":e}function o(e,t){return e}function s(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}function u(e,t,n){if(e.customInspect&&t&&T(t.inspect)&&t.inspect!==r.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(n,e);return b(i)||(i=u(e,i,n)),i}var a=c(e,t);if(a)return a;var o=Object.keys(t),g=s(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),A(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return l(t);if(0===o.length){if(T(t)){var y=t.name?": "+t.name:"";return e.stylize("[Function"+y+"]","special")}if(w(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(S(t))return e.stylize(Date.prototype.toString.call(t),"date");if(A(t))return l(t)}var v="",m=!1,E=["{","}"];if(d(t)&&(m=!0,E=["[","]"]),T(t)){var _=t.name?": "+t.name:"";v=" [Function"+_+"]"}if(w(t)&&(v=" "+RegExp.prototype.toString.call(t)),S(t)&&(v=" "+Date.prototype.toUTCString.call(t)),A(t)&&(v=" "+l(t)),0===o.length&&(!m||0==t.length))return E[0]+v+E[1];if(0>n)return w(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var C;return C=m?f(e,t,n,g,o):o.map(function(r){return h(e,t,n,g,r,m)}),e.seen.pop(),p(C,v,E)}function c(e,t){if(_(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";
vendor: 4,859 bytes, lines 7-8
7return e.stylize(r,"string")}return m(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,r,n,i){for(var a=[],o=0,s=t.length;s>o;++o)F(t,String(o))?a.push(h(e,t,r,n,String(o),!0)):a.push("");return i.forEach(function(i){i.match(/^\d+$/)||a.push(h(e,t,r,n,i,!0))}),a}function h(e,t,r,n,i,a){var o,s,c;if(c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},c.get?s=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(s=e.stylize("[Setter]","special")),F(n,i)||(o="["+i+"]"),s||(e.seen.indexOf(c.value)<0?(s=y(r)?u(e,c.value,null):u(e,c.value,r-1),s.indexOf("\n")>-1&&(s=a?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),_(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2), 8o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+s}function p(e,t,r){var n=0,i=e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function d(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function y(e){return null===e}function v(e){return null==e}function m(e){return"number"==typeof e}function b(e){return"string"==typeof e}function E(e){return"symbol"==typeof e}function _(e){return void 0===e}function w(e){return C(e)&&"[object RegExp]"===B(e)}function C(e){return"object"==typeof e&&null!==e}function S(e){return C(e)&&"[object Date]"===B(e)}function A(e){return C(e)&&("[object Error]"===B(e)||e instanceof Error)}function T(e){return"function"==typeof e}function k(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function B(e){return Object.prototype.toString.call(e)}function I(e){return 10>e?"0"+e.toString(10):e.toString(10)}function R(){var e=new Date,t=[I(e.getHours()),I(e.getMinutes()),I(e.getSeconds())].join(":");return[e.getDate(),L[e.getMonth()],t].join(" ")}function F(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var N=/%[sdj%]/g;r.format=function(e){if(!b(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(i(arguments[r]));return t.join(" ")}for(var r=1,n=arguments,a=n.length,o=String(e).replace(N,function(e){if("%%"===e)return"%";if(r>=a)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return e}}),s=n[r];a>r;s=n[++r])o+=y(s)||!C(s)?" "+s:" "+i(s);return o},r.deprecate=function(e,i){function a(){if(!o){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),o=!0}return e.apply(this,arguments)}if(_(n.process))return function(){return r.deprecate(e,i).apply(this,arguments)};if(t.noDeprecation===!0)return e;var o=!1;return a};var j,P={};r.debuglog=function(e){if(_(j)&&(j=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!P[e])if(new RegExp("\\b"+e+"\\b","i").test(j)){var n=t.pid;P[e]=function(){var t=r.format.apply(r,arguments);console.error("%s %d: %s",e,n,t)}}else P[e]=function(){};return P[e]},r.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=d,r.isBoolean=g,r.isNull=y,r.isNullOrUndefined=v,r.isNumber=m,r.isString=b,r.isSymbol=E,r.isUndefined=_,r.isRegExp=w,r.isObject=C,r.isDate=S,r.isError=A,r.isFunction=T,r.isPrimitive=k,r.isBuffer=e("./support/isBuffer");var L=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];r.log=function(){console.log("%s - %s",R(),r.format.apply(r,arguments))},r.inherits=e("inherits"),r._extend=function(e,t){if(!t||!C(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":88,_process:77,inherits:75}],90:[function(t,r,n){(function(n,i){(function(){"use strict";function a(e){return"function"==typeof e||"object"==typeof e&&null!==e}function o(e){return"function"==typeof e}function s(e){Q=e}function u(e){$=e}function c(){return function(){n.nextTick(d)}}function l(){return function(){Z(d)}}function f(){var e=0,t=new re(d),r=document.createTextNode("");return t.observe(r,{characterData:!0}
8),function(){r.data=e=++e%2}}function h(){var e=new MessageChannel;return e.port1.onmessage=d,function(){e.port2.postMessage(0)}}function p(){return function(){setTimeout(d,1)}}function d(){for(var e=0;J>e;e+=2){var t=ae[e],r=ae[e+1];t(r),ae[e]=void 0,ae[e+1]=void 0}J=0}function g(){try{var e=t,r=e("vertx");return Z=r.runOnLoop||r.runOnContext,l()}catch(n){return p()}}function y(e,t){var r=this,n=new this.constructor(m);void 0===n[ue]&&x(n);var i=r._state;if(i){var a=arguments[i-1];$(function(){P(i,n,a,r._result)})}else R(r,n,e,t);return n}function v(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var r=new t(m);return T(r,e),r}function m(){}function b(){return new TypeError("You cannot resolve a promise with itself")}function E(){return new TypeError("A promises callback cannot return that same promise.")}function _(e){try{return e.then}catch(t){return he.error=t,he}}function w(e,t,r,n){try{e.call(t,r,n)}catch(i){return i}}function C(e,t,r){$(function(e){var n=!1,i=w(r,t,function(r){n||(n=!0,t!==r?T(e,r):B(e,r))},function(t){n||(n=!0,I(e,t))},"Settle: "+(e._label||" unknown promise"));!n&&i&&(n=!0,I(e,i))},e)}function S(e,t){t._state===le?B(e,t._result):t._state===fe?I(e,t._result):R(t,void 0,function(t){T(e,t)},function(t){I(e,t)})}function A(e,t,r){t.constructor===e.constructor&&r===oe&&constructor.resolve===se?S(e,t):r===he?I(e,he.error):void 0===r?B(e,t):o(r)?C(e,t,r):B(e,t)}function T(e,t){e===t?I(e,b()):a(t)?A(e,t,_(t)):B(e,t)}function k(e){e._onerror&&e._onerror(e._result),F(e)}function B(e,t){e._state===ce&&(e._result=t,e._state=le,0!==e._subscribers.length&&$(F,e))}function I(e,t){e._state===ce&&(e._state=fe,e._result=t,$(k,e))}function R(e,t,r,n){var i=e._subscribers,a=i.length;e._onerror=null,i[a]=t,i[a+le]=r,i[a+fe]=n,0===a&&e._state&&$(F,e)}function F(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n,i,a=e._result,o=0;o<t.length;o+=3)n=t[o],i=t[o+r],n?P(r,n,i,a):i(a);e._subscribers.length=0}}function N(){this.error=null}function j(e,t){try{return e(t)}catch(r){return pe.error=r,pe}}function P(e,t,r,n){var i,a,s,u,c=o(r);if(c){if(i=j(r,n),i===pe?(u=!0,a=i.error,i=null):s=!0,t===i)return void I(t,E())}else i=n,s=!0;t._state!==ce||(c&&s?T(t,i):u?I(t,a):e===le?B(t,i):e===fe&&I(t,i))}function L(e,t){try{t(function(t){T(e,t)},function(t){I(e,t)})}catch(r){I(e,r)}}function O(){return de++}function x(e){e[ue]=de++,e._state=void 0,e._result=void 0,e._subscribers=[]}function D(e){return new be(this,e).promise}function U(e){var t=this;return new t(X(e)?function(r,n){for(var i=e.length,a=0;i>a;a++)t.resolve(e[a]).then(r,n)}:function(e,t){t(new TypeError("You must pass an array to race."))})}function M(e){var t=this,r=new t(m);return I(r,e),r}function K(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function V(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object c
8onstructor cannot be called as a function.")}function H(e){this[ue]=O(),this._result=this._state=void 0,this._subscribers=[],m!==e&&("function"!=typeof e&&K(),this instanceof H?L(this,e):V())}function q(e,t){this._instanceConstructor=e,this.promise=new e(m),this.promise[ue]||x(this.promise),X(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?B(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&B(this.promise,this._result))):I(this.promise,z())}function z(){return new Error("Array Methods must be provided an Array")}function G(){var e;if("undefined"!=typeof i)e=i;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=e.Promise;r&&"[object Promise]"===Object.prototype.toString.call(r.resolve())&&!r.cast||(e.Promise=me)}var W;W=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var Z,Q,Y,X=W,J=0,$=function(e,t){ae[J]=e,ae[J+1]=t,J+=2,2===J&&(Q?Q(d):Y())},ee="undefined"!=typeof window?window:void 0,te=ee||{},re=te.MutationObserver||te.WebKitMutationObserver,ne="undefined"==typeof self&&"undefined"!=typeof n&&"[object process]"==={}.toString.call(n),ie="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,ae=new Array(1e3);Y=ne?c():re?f():ie?h():void 0===ee&&"function"==typeof t?g():p();var oe=y,se=v,ue=Math.random().toString(36).substring(16),ce=void 0,le=1,fe=2,he=new N,pe=new N,de=0,ge=D,ye=U,ve=M,me=H;H.all=ge,H.race=ye,H.resolve=se,H.reject=ve,H._setScheduler=s,H._setAsap=u,H._asap=$,H.prototype={constructor:H,then:oe,"catch":function(e){return this.then(null,e)}};var be=q;q.prototype._enumerate=function(){for(var e=this.length,t=this._input,r=0;this._state===ce&&e>r;r++)this._eachEntry(t[r],r)},q.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===se){var i=_(e);if(i===oe&&e._state!==ce)this._settledAt(e._state,t,e._result);else if("function"!=typeof i)this._remaining--,this._result[t]=e;else if(r===me){var a=new r(m);A(a,e,i),this._willSettleAt(a,t)}else this._willSettleAt(new r(function(t){t(e)}),t)}else this._willSettleAt(n(e),t)},q.prototype._settledAt=function(e,t,r){var n=this.promise;n._state===ce&&(this._remaining--,e===fe?I(n,r):this._result[t]=r),0===this._remaining&&B(n,this._result)},q.prototype._willSettleAt=function(e,t){var r=this;R(e,void 0,function(e){r._settledAt(le,t,e)},function(e){r._settledAt(fe,t,e)})};var Ee=G,_e={Promise:me,polyfill:Ee};"function"==typeof e&&e.amd?e(function(){return _e}):"undefined"!=typeof r&&r.exports?r.exports=_e:"undefined"!=typeof this&&(this.ES6Promise=_e),Ee()}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:77}],91:[function(e,t,r){(function(){function e(e,t,r){null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function n(){return new e(null)}function i(e,t,r,n,i,a){for(;--a>=0;){var o=t*this[e++]+r[n]+i;i=Math.floor(o/67108864),r[n++]=67108863&o}return i}function a(e,t,r,n,i,a){for(var o=32767&t,s=t>>15;--a>=0;){var u=32767&this[e],c=this[e++]>>15,l=s*u+c*o;u=o*u+((32767&l)<<15)+r[n]+(1073741823&i),i=(u>>>30)+(l>>>15)+s*c+(i>>>30),r[n++]=1073741823&u}return i}function o(e,t,r,n,i,a){for(var o=16383&t,s=t>>14;--a>=0;){var u=16383&this[e],c=this[e++]>>14,l=s*u+c*o;u=o*u+((16383&l)<<14)+r[n]+i,i=(u>>28)+(l>>14)+s*c,r[n++]=268435455&u}return i}function s(e){return yt.charAt(e)}function u(e,t){var r=vt[e.charCodeAt(t)];return null==r?-1:r}function c(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=0>e?-1:0,e>0?this[0]=e:-1>e?this[0]=e+this.DV:this.t=0}function f(e){var t=n();return t.fromInt(e),t}function h(t,r){var n;if(16==r)n=4;else if(8==r)n=3;else if(256==r)n=8;else if(2==r)n=1;else if(32==r)n=5;else{if(4!=r)return void this.fromRadix(t,r);n=2}this.t=0,this.s=0;for(var i=t.length,a=!1,o=0;--i>=0;){var s=8==n?255&t[i]:u(t,i);0>s?"-"==t.charAt(i)&&(a=!0):(a=!1,0==o?this[this.t++]=s:o+n>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,o+=n,o>=this.DB&&(o-=this.DB))}8==n&&0!=(128&t[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),a&&e.ZERO.subTo(this,this)}function p(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function d(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,i=!1,a="",o=this.t,u=this.DB-o*this.DB%t;if(o-- >0)for(u<this.DB&&(r=this[o]>>u)>0&&(i=!0,a=s(r));o>=0;)t>u?(r=(this[o]&(1<<u)-1)<<t-u,r|=this[--o]>>(u+=this.DB-t)):(r=this[o]>>(u-=t)&n,0>=u&&(u+=this.DB,--o)),r>0&&(i=!0),i&&(a+=s(r));return i?a:"0"}function g(){var t=n();return e.ZERO.subTo(this,t),t}function y(){return this.s<0?this.negate():this}function v(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(t=r-e.t,0!=t)return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0}function m(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function b(){return this.t<=0?0:this.DB*(this.t-1)+m(this[this.t-1]^this.s&this.DM)}function E(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}function _(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s}function w(e,t){var r,n=e%this.DB,i=this.DB-n,a=(1<<i)-1,o=Math.floor(e/this.DB),s=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t[r+o+1]=this[r]>>i|s,s=(this[r]&a)<<n;for(r=o-1;r>=0;--r)t[r]=0;t[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function C(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,i=this.DB-n,a=(1<<n)-1;t[0]=this[r]>>n;for(var o=r+1;o<this.t;++o)t[o-r-1]|=(this[o]&a)<<i,t[o-r]=this[o]>>n;n>0&&(t[this.t-r-1]|=(this.s&a)<<i),t.t=this.t-r,t.clamp()}function S(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);i>r;)n+=this[r]-e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e[r],t[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=0>n?-1:0,-1>n?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()}function A(t,r){var n=this.abs(),i=t.abs(),a=n.t;for(r.t=a+i.t;--a>=0;)r[a]=0;for(a=0;a<i.t;++a)r[a+n.t]=n.am(0,i[a],r,a,0,n.t);r.s=0,r.clamp(),this.s!=t.s&&e.ZERO.subTo(r,r)}function T(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(t,r,i){var a=t.abs();if(!(a.t<=0)){var o=this.abs();if(o.t<a.t)return null!=r&&r.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=n());var s=n(),u=this.s,c=t.s,l=this.DB-m(a[a.t-1]);l>0?(a.lShiftTo(l,s),o.lShiftTo(l,i)):(a.copyTo(s),o.copyTo(i));var f=s.t,h=s[f-1];if(0!=h){var p=h*(1<<this.F1)+(f>
81?s[f-2]>>this.F2:0),d=this.FV/p,g=(1<<this.F1)/p,y=1<<this.F2,v=i.t,b=v-f,E=null==r?n():r;for(s.dlShiftTo(b,E),i.compareTo(E)>=0&&(i[i.t++]=1,i.subTo(E,i)),e.ONE.dlShiftTo(f,E),E.subTo(s,s);s.t<f;)s[s.t++]=0;for(;--b>=0;){var _=i[--v]==h?this.DM:Math.floor(i[v]*d+(i[v-1]+y)*g);if((i[v]+=s.am(0,_,i,b,0,f))<_)for(s.dlShiftTo(b,E),i.subTo(E,i);i[v]<--_;)i.subTo(E,i)}null!=r&&(i.drShiftTo(f,r),u!=c&&e.ZERO.subTo(r,r)),i.t=f,i.clamp(),l>0&&i.rShiftTo(l,i),0>u&&e.ZERO.subTo(i,i)}}}function B(t){var r=n();return this.abs().divRemTo(t,null,r),this.s<0&&r.compareTo(e.ZERO)>0&&t.subTo(r,r),r}function I(e){this.m=e}function R(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function F(e){return e}function N(e){e.divRemTo(this.m,null,e)}function j(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function P(e,t){e.squareTo(t),this.reduce(t)}function L(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function O(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function x(t){var r=n();return t.abs().dlShiftTo(this.m.t,r),r.divRemTo(this.m,null,r),t.s<0&&r.compareTo(e.ZERO)>0&&this.m.subTo(r,r),r}function D(e){var t=n();return e.copyTo(t),this.reduce(t),t}function U(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e[t],n=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e[r]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function M(e,t){e.squareTo(t),this.reduce(t)}function K(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function V(){return 0==(this.t>0?1&this[0]:this.s)}function H(t,r){if(t>4294967295||1>t)return e.ONE;var i=n(),a=n(),o=r.convert(this),s=m(t)-1;for(o.copyTo(i);--s>=0;)if(r.sqrTo(i,a),(t&1<<s)>0)r.mulTo(a,o,i);else{var u=i;i=a,a=u}return r.revert(i)}function q(e,t){var r;return r=256>e||t.isEven()?new I(t):new O(t),this.exp(e,r)}function z(){var e=n();return this.copyTo(e),e}function G(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function W(){return 0==this.t?this.s:this[0]<<24>>24}function Z(){return 0==this.t?this.s:this[0]<<16>>16}function Q(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function Y(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function X(e){if(null==e&&(e=10),0==this.signum()||2>e||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),i=f(r),a=n(),o=n(),s="";for(this.divRemTo(i,a,o);a.signum()>0;)s=(r+o.intValue()).toString(e).substr(1)+s,a.divRemTo(i,a,o);return o.intValue().toString(e)+s}function J(t,r){this.fromInt(0),null==r&&(r=10);for(var n=this.chunkSize(r),i=Math.pow(r,n),a=!1,o=0,s=0,c=0;c<t.length;++c){var l=u(t,c);0>l?"-"==t.charAt(c)&&0==this.signum()&&(a=!0):(s=r*s+l,++o>=n&&(this.dMultiply(i),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(r,o)),this.dAddOffset(s,0)),a&&e.ZERO.subTo(this,this)}function $(t,r,n){if("number"==typeof r)if(2>t)this.fromInt(1);else for(this.fromNumber(t,n),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),se,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(r);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this);else{var i=new Array,a=7&t;i.length=(t>>3)+1,r.nextBytes(i),a>0?i[0]&=(1<<a)-1:i[0]=0,this.fromString(i,256)}}function ee(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n<this.DB&&(r=this[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)8>n?(r=(this[e]&(1<<n)-1)<<8-n,r|=this[--e]>>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,0>=n&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t}function te(e){return 0==this.compareTo(e)}function re(e){return this.compareTo(e)<0?this:e}function ne(e){return this.compareTo(e)>0?this:e}function ie(e,t,r){var n,i,a=Math.min(e.t,this.t);for(n=0;a>n;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(i=e.s&this.DM,n=a;n<this.t;++n)r[n]=t(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=a;n<e.t;++n)r[n]=t(i,e[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}function ae(e,t){return e&t}function oe(e){var t=n();return this.bitwiseTo(e,ae,t),t}function se(e,t){return e|t}function ue(e){var t=n();return this.bitwiseTo(e,se,t),t}function ce(e,t){return e^t}function le(e){var t=n();return this.bitwiseTo(e,ce,t),t}function fe(e,t){return e&~t}function he(e){var t=n();return this.bitwiseTo(e,fe,t),t}function pe(){for(var e=n(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}function de(e){var t=n();return 0>e?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function ge(e){var t=n();return 0>e?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function ye(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function ve(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+ye(this[e]);return this.s<0?this.t*this.DB:-1}function me(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function be(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=me(this[r]^t);return e}function Ee(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)}function _e(t,r){var n=e.ONE.shiftLeft(t);return this.bitwiseTo(n,r,n),n}function we(e){return this.changeBit(e,se)}function Ce(e){return this.changeBit(e,fe)}function Se(e){return this.changeBit(e,ce)}function Ae(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);i>r;)n+=this[r]+e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e[r],t[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=0>n?-1:0,n>0?t[r++]=n:-1>n&&(t[r++]=this.DV+n),t.t=r,t.clamp()}function Te(e){var t=n();return this.addTo(e,t),t}function ke(e){var t=n();return this.subTo(e,t),t}function Be(e){var t=n();return this.multiplyTo(e,t),t}function Ie(){var e=n();return this.squareTo(e),e}function Re(e){var t=n();return this.divRemTo(e,t,null),t}function Fe(e){var t=n();return this.divRemTo(e,null,t),t}function Ne(e){var t=n(),r=n();return this.divRemTo(e,t,r),new Array(t,r)}function je(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Pe(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function Le(){}function Oe(e){return e}function xe(e,t,r){e.multiplyTo(t,r)}function De(e,t){e.squareTo(t)}function Ue(e){return this.exp(e,new Le)}function Me(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r[--n]=0;var i;for(i=r.t-this.t;i>n;++n)r[n+this.t]=this.am(0,e[n],r,n,0,this.t);for(i=Math.min(e.t,t);i>n;++n)this.am(0,e[n],r,n,0,t-n);r.clamp()}function Ke(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r[this.t+n-t]=this.am(t-n,e[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}function Ve(t){this.r2=n(),this.q3=n(),e.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function He(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);
8if(e.compareTo(this.m)<0)return e;var t=n();return e.copyTo(t),this.reduce(t),t}function qe(e){return e}function ze(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function Ge(e,t){e.squareTo(t),this.reduce(t)}function We(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function Ze(e,t){var r,i,a=e.bitLength(),o=f(1);if(0>=a)return o;r=18>a?1:48>a?3:144>a?4:768>a?5:6,i=8>a?new I(t):t.isEven()?new Ve(t):new O(t);var s=new Array,u=3,c=r-1,l=(1<<r)-1;if(s[1]=i.convert(this),r>1){var h=n();for(i.sqrTo(s[1],h);l>=u;)s[u]=n(),i.mulTo(h,s[u-2],s[u]),u+=2}var p,d,g=e.t-1,y=!0,v=n();for(a=m(e[g])-1;g>=0;){for(a>=c?p=e[g]>>a-c&l:(p=(e[g]&(1<<a+1)-1)<<c-a,g>0&&(p|=e[g-1]>>this.DB+a-c)),u=r;0==(1&p);)p>>=1,--u;if((a-=u)<0&&(a+=this.DB,--g),y)s[p].copyTo(o),y=!1;else{for(;u>1;)i.sqrTo(o,v),i.sqrTo(v,o),u-=2;u>0?i.sqrTo(o,v):(d=o,o=v,v=d),i.mulTo(v,s[p],o)}for(;g>=0&&0==(e[g]&1<<a);)i.sqrTo(o,v),d=o,o=v,v=d,--a<0&&(a=this.DB-1,--g)}return i.revert(o)}function Qe(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),a=r.getLowestSetBit();if(0>a)return t;for(a>i&&(a=i),a>0&&(t.rShiftTo(a,t),r.rShiftTo(a,r));t.signum()>0;)(i=t.getLowestSetBit())>
80&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return a>0&&r.lShiftTo(a,r),r}function Ye(e){if(0>=e)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r}function Xe(t){var r=t.isEven();if(this.isEven()&&r||0==t.signum())return e.ZERO;for(var n=t.clone(),i=this.clone(),a=f(1),o=f(0),s=f(0),u=f(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),r?(a.isEven()&&o.isEven()||(a.addTo(this,a),o.subTo(t,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),r?(s.isEven()&&u.isEven()||(s.addTo(this,s),u.subTo(t,u)),s.rShiftTo(1,s)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);n.compareTo(i)>=0?(n.subTo(i,n),r&&a.subTo(s,a),o.subTo(u,o)):(i.subTo(n,i),r&&s.subTo(a,s),u.subTo(o,u))}return 0!=i.compareTo(e.ONE)?e.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u}function Je(e){var t,r=this.abs();if(1==r.t&&r[0]<=mt[mt.length-1]){for(t=0;t<mt.length;++t)if(r[0]==mt[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<mt.length;){for(var n=mt[t],i=t+1;i<mt.length&&bt>n;)n*=mt[i++];for(n=r.modInt(n);i>t;)if(n%mt[t++]==0)return!1}return r.millerRabin(e)}function $e(t){var r=this.subtract(e.ONE),i=r.getLowestSetBit();if(0>=i)return!1;var a=r.shiftRight(i);t=t+1>>1,t>mt.length&&(t=mt.length);for(var o=n(),s=0;t>s;++s){o.fromInt(mt[Math.floor(Math.random()*mt.length)]);var u=o.modPow(a,this);if(0!=u.compareTo(e.ONE)&&0!=u.compareTo(r)){for(var c=1;c++<i&&0!=u.compareTo(r);)if(u=u.modPowInt(2,this),0==u.compareTo(e.ONE))return!1;if(0!=u.compareTo(r))return!1}}return!0}function et(e){_t[wt++]^=255&e,_t[wt++]^=e>>8&255,_t[wt++]^=e>>16&255,_t[wt++]^=e>>24&255,wt>=Tt&&(wt-=Tt)}function tt(){et((new Date).getTime())}function rt(){if(null==Et){for(tt(),Et=ut(),Et.init(_t),wt=0;wt<_t.length;++wt)_t[wt]=0;wt=0}return Et.next()}function nt(e){var t;for(t=0;t<e.length;++t)e[t]=rt()}function it(){}function at(){this.i=0,this.j=0,this.S=new Array}function ot(e){var t,r,n;for(t=0;256>t;++t)this.S[t]=t;for(r=0,t=0;256>t;++t)r=r+this.S[t]+e[t%e.length]&255,n=this.S[t],this.S[t]=this.S[r],this.S[r]=n;this.i=0,this.j=0}function st(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]}function ut(){return new at}var ct,lt=0xdeadbeefcafe,ft=15715070==(16777215<),ht="undefined"!=typeof navigator;ht&&ft&&"Microsoft Internet Explorer"==navigator.appName?(e.prototype.am=a,ct=30):ht&&ft&&"Netscape"!=navigator.appName?(e.prototype.am=i,ct=26):(e.prototype.am=o,ct=28),e.prototype.DB=ct,e.prototype.DM=(1<<ct)-1,e.prototype.DV=1<<ct;var pt=52;e.prototype.FV=Math.pow(2,pt),e.prototype.F1=pt-ct,e.prototype.F2=2*ct-pt;var dt,gt,yt="0123456789abcdefghijklmnopqrstuvwxyz",vt=new Array;for(dt="0".charCodeAt(0),gt=0;9>=gt;++gt)vt[dt++]=gt;for(dt="a".charCodeAt(0),gt=10;36>gt;++gt)vt[dt++]=gt;for(dt="A".charCodeAt(0),gt=10;36>gt;++gt)vt[dt++]=gt;I.prototype.convert=R,I.prototype.revert=F,I.prototype.reduce=N,I.prototype.mulTo=j,I.prototype.sqrTo=P,O.prototype.convert=x,O.prototype.revert=D,O.prototype.reduce=U,O.prototype.mulTo=K,O.prototype.sqrTo=M,e.prototype.copyTo=c,e.prototype.fromInt=l,e.prototype.fromString=h,e.prototype.clamp=p,e.prototype.dlShiftTo=E,e.prototype.drShiftTo=_,e.prototype.lShiftTo=w,e.prototype.rShiftTo=C,e.prototype.subTo=S,e.prototype.multiplyTo=A,e.prototype.squareTo=T,e.prototype.divRemTo=k,e.prototype.invDigit=L,e.prototype.isEven=V,e.prototype.exp=H,e.prototype.toString=d,e.prototype.negate=g,e.prototype.abs=y,e.prototype.compareTo=v,e.prototype.bitLength=b,e.prototype.mod=B,e.prototype.modPowInt=q,e.ZERO=f(0),e.ONE=f(1),Le.prototype.convert=Oe,Le.prototype.revert=Oe,Le.prototype.mulTo=xe,Le.prototype.sqrTo=De,Ve.prototype.convert=He,Ve.prototype.revert=qe,Ve.prototype.reduce=ze,Ve.prototype.mulTo=We,Ve.prototype.sqrTo=Ge;var mt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],bt=(1<<26)/mt[mt.length-1];e.prototype.chunkSize=Q,e.prototype.toRadix=X,e.prototype.fromRadix=J,e.prototype.fromNumber=$,e.prototype.bitwiseTo=ie,e.prototype.changeBit=_e,e.prototype.addTo=Ae,e.prototype.dMultiply=je,e.prototype.dAddOffset=Pe,e.prototype.multiplyLowerTo=Me,e.prototype.multiplyUpperTo=Ke,e.prototype.modInt=Ye,e.prototype.millerRabin=$e,e.prototype.clone=z,e.prototype.intValue=G,e.prototype.byteValue=W,e.prototype.shortValue=Z,e.prototype.signum=Y,e.prototype.toByteArray=ee,e.prototype.equals=te,e.prototype.min=re,e.prototype.max=ne,e.prototype.and=oe,e.prototype.or=ue,e.prototype.xor=le,e.prototype.andNot=he,e.prototype.not=pe,e.prototype.shiftLeft=de,e.prototype.shiftRight=ge,e.prototype.getLowestSetBit=ve,e.prototype.bitCount=be,e.prototype.testBit=Ee,e.prototype.setBit=we,e.prototype.clearBit=Ce,e.prototype.flip
8Bit=Se,e.prototype.add=Te,e.prototype.subtract=ke,e.prototype.multiply=Be,e.prototype.divide=Re,e.prototype.remainder=Fe,e.prototype.divideAndRemainder=Ne,e.prototype.modPow=Ze,e.prototype.modInverse=Xe,e.prototype.pow=Ue,e.prototype.gcd=Qe,e.prototype.isProbablePrime=Je,e.prototype.square=Ie,e.prototype.Barrett=Ve;var Et,_t,wt;if(null==_t){_t=new Array,wt=0;var Ct;if("undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var St=new Uint8Array(32);for(window.crypto.getRandomValues(St),Ct=0;32>Ct;++Ct)_t[wt++]=St[Ct]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var At=window.crypto.random(32);for(Ct=0;Ct<At.length;++Ct)_t[wt++]=255&At.charCodeAt(Ct)}for(;Tt>wt;)Ct=Math.floor(65536*Math.random()),_t[wt++]=Ct>>>8,_t[wt++]=255&Ct;wt=0,tt()}it.prototype.nextBytes=nt,at.prototype.init=ot,at.prototype.next=st;var Tt=256;"undefined"!=typeof r?r=t.exports={BigInteger:e,SecureRandom:it}:this.jsbn={BigInteger:e,SecureRandom:it}}).call(this)},{}],92:[function(e,t,r){function n(e,t,r){var n=e[t];w.call(e,t)&&l(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function i(e){return function(t){return null==t?void 0:t[e]}}function a(e,t,r,i){r||(r={});for(var a=-1,o=t.length;++a<o;){var s=t[a],u=i?i(r[s],e[s],s,r,e):e[s];n(r,s,u)}return r}function o(e){return y(function(t,r){var n=-1,i=r.length,a=i>1?r[i-1]:void 0,o=i>2?r[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,o&&u(r[0],r[1],o)&&(a=3>i?void 0:a,i=1),t=Object(t);++n<i;){var s=r[n];s&&e(t,s,n,a)}return t})}function s(e,t){return t=null==t?v:t,!!t&&("number"==typeof e||E.test(e))&&e>-1&&e%1==0&&t>e}function u(e,t,r){if(!d(r))return!1;var n=typeof t;return("number"==n?f(r)&&s(t,r.length):"string"==n&&t in r)?l(r[t],e):!1}function c(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||_;return e===r}function l(e,t){return e===t||e!==e&&t!==t}function f(e){return null!=e&&p(T(e))&&!h(e)}function h(e){var t=d(e)?C.call(e):"";return t==m||t==b}function p(e){return"number"==typeof e&&e>-1&&e%1==0&&v>=e}function d(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var g=e("lodash.keys"),y=e("lodash.rest"),v=9007199254740991,m="[object Function]",b="[object GeneratorFunction]",E=/^(?:0|[1-9]\d*)$/,_=Object.prototype,w=_.hasOwnProperty,C=_.toString,S=_.propertyIsEnumerable,A=!S.call({valueOf:1},"valueOf"),T=i("length"),k=o(function(e,t){if(A||c(t)||f(t))return void a(t,g(t),e);for(var r in t)w.call(t,r)&&n(e,r,t[r])});t.exports=k},{"lodash.keys":93,"lodash.rest":94}],93:[function(e,t,r){function n(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function i(e,t){return k.call(e,t)||"object"==typeof e&&t in e&&null===s(e)}function a(e){return F(Object(e))}function o(e){return function(t){return null==t?void 0:t[e]}}function s(e){return R(Object(e))}function u(e){var t=e?e.length:void 0;return g(t)&&(j(e)||m(e)||f(e))?n(t,String):null}function c(e,t){return t=null==t?E:t,!!t&&("number"==typeof e||A.test(e))&&e>-1&&e%1==0&&t>e}function l(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||T;return e===r}function f(e){return p(e)&&k.call(e,"callee")&&(!I.call(e,"callee")||B.call(e)==_)}function h(e){return null!=e&&g(N(e))&&!d(e)}function p(e){return v(e)&&h(e)}function d(e){var t=y(e)?B.call(e):"";return t==w||t==C}function g(e){return"number"==typeof e&&e>-1&&e%1==0&&E>=e}function y(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function v(e){return!!e&&"object"==typeof e}function m(e){return"string"==typeof e||!j(e)&&v(e)&&B.call(e)==S}function b(e){ 9var t=l(e);if(!t&&!h(e))return a(e);var r=u(e),n=!!r,o=r||[],s=o.length;for(var f in e)!i(e,f)||n&&("length"==f||c(f,s))||t&&"constructor"==f||o.push(f);return o}var E=9007199254740991,_="[object Arguments]",w="[object Function]",C="[object GeneratorFunction]",S="[object String]",A=/^(?:0|[1-9]\d*)$/,T=Object.prototype,k=T.hasOwnProperty,B=T.toString,I=T.propertyIsEnumerable,R=Object.getPrototypeOf,F=Object.keys,N=o("length"),j=Array.isArray;t.exports=b},{}],94:[function(e,t,r){function n(e,t,r){var n=r.length;switch(n){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function i(e,t){if("function"!=typeof e)throw new TypeError(h);
9return t=T(void 0===t?e.length-1:l(t),0),function(){for(var r=arguments,i=-1,a=T(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];switch(t){case 0:return e.call(this,o);case 1:return e.call(this,r[0],o);case 2:return e.call(this,r[0],r[1],o)}var s=Array(t+1);for(i=-1;++i<t;)s[i]=r[i];return s[t]=o,n(e,this,s)}}function a(e){var t=o(e)?A.call(e):"";return t==y||t==v}function o(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function s(e){return!!e&&"object"==typeof e}function u(e){return"symbol"==typeof e||s(e)&&A.call(e)==m}function c(e){if(!e)return 0===e?e:0;if(e=f(e),e===p||e===-p){var t=0>e?-1:1;return t*d}return e===e?e:0}function l(e){var t=c(e),r=t%1;return t===t?r?t-r:t:0}function f(e){if("number"==typeof e)return e;if(u(e))return g;if(o(e)){var t=a(e.valueOf)?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(b,"");var r=_.test(e);return r||w.test(e)?C(e.slice(2),r?2:8):E.test(e)?g:+e}var h="Expected a function",p=1/0,d=1.7976931348623157e308,g=NaN,y="[object Function]",v="[object GeneratorFunction]",m="[object Symbol]",b=/^\s+|\s+$/g,E=/^[-+]0x[0-9a-f]+$/i,_=/^0b[01]+$/i,w=/^0o[0-7]+$/i,C=parseInt,S=Object.prototype,A=S.toString,T=Math.max;t.exports=i},{}],95:[function(e,t,r){function n(e){return i(e,!1,!0)}var i=e("lodash._baseclone");t.exports=n},{"lodash._baseclone":96}],96:[function(e,t,r){(function(e){function n(e,t){return e.set(t[0],t[1]),e}function i(e,t){return e.add(t),e}function a(e,t){for(var r=-1,n=e.length;++r<n&&t(e[r],r,e)!==!1;);return e}function o(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function s(e,t,r,n){var i=-1,a=e.length;for(n&&a&&(r=e[++i]);++i<a;)r=t(r,e[i],i,e);return r}function u(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function c(e){return e&&e.Object===Object?e:null}function l(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(r){}return t}function f(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function h(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}function p(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function d(){this.__data__=Ut?Ut(null):{}}function g(e){return this.has(e)&&delete this.__data__[e]}function y(e){var t=this.__data__;if(Ut){var r=t[e];return r===Re?void 0:r}return wt.call(t,e)?t[e]:void 0}function v(e){var t=this.__data__;return Ut?void 0!==t[e]:wt.call(t,e)}function m(e,t){var r=this.__data__;return r[e]=Ut&&void 0===t?Re:t,this}function b(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function E(){this.__data__=[]}function _(e){var t=this.__data__,r=D(t,e);if(0>r)return!1;var n=t.length-1;return r==n?t.pop():Ft.call(t,r,1),!0}function w(e){var t=this.__data__,r=D(t,e);return 0>r?void 0:t[r][1]}function C(e){return D(this.__data__,e)>-1}function S(e,t){var r=this.__data__,n=D(r,e);return 0>n?r.push([e,t]):r[n][1]=t,this}function A(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function T(){this.__data__={hash:new p,map:new(Lt||b),string:new p}}function k(e){return ie(this,e)["delete"](e)}function B(e){return ie(this,e).get(e)}function I(e){return ie(this,e).has(e)}function R(e,t){return ie(this,e).set(e,t),this}function F(e){this.__data__=new b(e)}function N(){this.__data__=new b}function j(e){return this.__data__["delete"](e)}function P(e){return this.__data__.get(e)}function L(e){return this.__data__.has(e)}function O(e,t){var r=this.__data__;return r instanceof b&&r.__data__.length==Ie&&(r=this.__data__=new A(r.__data__)),r.set(e,t),this}function x(e,t,r){var n=e[t];wt.call(e,t)&&ve(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function D(e,t){for(var r=e.length;r--;)if(ve(e[r][0],t))return r;return-1}function U(e,t){return e&&te(t,ke(t),e)}function M(e,t,r,n,i,o,s){var u;if(n&&(u=o?n(e,i,o,s):n(e)),void 0!==u)return u;if(!Ce(e))return e;var c=Zt(e);if(c){if(u=ce(e),!t)return ee(e,u)}else{var f=ue(e),h=f==xe||f==De;if(Qt(e))return G(e,t);if(f==Ke||f==Ne||h&&!o){if(l(e))return o?e:{};if(u=le(h?{}:e),!t)return re(e,U(u,e))}else{if(!ct[f])return o?e:{};u=fe(e,f,M,t)}}s||(s=new F);var p=s.get(e);if(p)return p;if(s.set(e,u),!c)var d=r?ne(e):ke(e);return a(d||e,function(i,a){d&&(a=i,i=e[a]),x(u,a,M(i,t,r,n,a,e,s))}),u}function K(e){return Ce(e)?It(e):{}}function V(e,t,r){var n=t(e);return Zt(e)?n:o(n,r(e))}function H(e,t){return wt.call(e,t)||"object"==typeof e&&t in e&&null===oe(e)}function q(e){return jt(Object(e))}function z(e){return function(t){return null==t?void 0:t[e]}}function G(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}function W(e){var t=new e.constructor(e.byteLength);return new kt(t).set(new kt(e)),t}function Z(e,t){var r=t?W(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Q(e,t,r){var i=t?r(f(e),!0):f(e);return s(i,n,new e.constructor)}function Y(e){var t=new e.constructor(e.source,ot.exec(e));return t.lastIndex=e.lastIndex,t}function X(e,t,r){var n=t?r(h(e),!0):h(e);return s(n,i,new e.constructor)}function J(e){return Gt?Object(Gt.call(e)):{}}function $(e,t){var r=t?W(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function ee(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function te(e,t,r,n){r||(r={});for(var i=-1,a=t.length;++i<a;){var o=t[i],s=n?n(r[o],e[o],o,r,e):e[o];x(r,o,s)}return r}function re(e,t){return te(e,se(e),t)}function ne(e){return V(e,ke,se)}function ie(e,t){var r=e.__data__;return de(t)?r["string"==typeof t?"string":"hash"]:r.map}function ae(e,t){var r=e[t];return Ae(r)?r:void 0}function oe(e){return Nt(Object(e))}function se(e){return Bt(Object(e))}function ue(e){return Ct.call(e)}function ce(e){var t=e.length,r=e.constructor(t);return t&&"string"==typeof e[0]&&wt.call(e,"index")&&(r.index=e.index,r.input
9=e.input),r}function le(e){return"function"!=typeof e.constructor||ge(e)?{}:K(oe(e))}function fe(e,t,r,n){var i=e.constructor;switch(t){case Ze:return W(e);case Pe:case Le:return new i(+e);case Qe:return Z(e,n);case Ye:case Xe:case Je:case $e:case et:case tt:case rt:case nt:case it:return $(e,n);case Ue:return Q(e,n,r);case Me:case ze:return new i(e);case He:return Y(e);case qe:return X(e,n,r);case Ge:return J(e)}}function he(e){var t=e?e.length:void 0;return we(t)&&(Zt(e)||Te(e)||me(e))?u(t,String):null}function pe(e,t){return t=null==t?Fe:t,!!t&&("number"==typeof e||ut.test(e))&&e>-1&&e%1==0&&t>e}function de(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function ge(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||Et;return e===r}function ye(e){if(null!=e){try{return _t.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function ve(e,t){return e===t||e!==e&&t!==t}function me(e){return Ee(e)&&wt.call(e,"callee")&&(!Rt.call(e,"callee")||Ct.call(e)==Ne)}function be(e){return null!=e&&we(Wt(e))&&!_e(e)}function Ee(e){return Se(e)&&be(e)}function _e(e){var t=Ce(e)?Ct.call(e):"";return t==xe||t==De}function we(e){return"number"==typeof e&&e>-1&&e%1==0&&Fe>=e}function Ce(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Se(e){return!!e&&"object"==typeof e}function Ae(e){if(!Ce(e))return!1;var t=_e(e)||l(e)?St:st;return t.test(ye(e))}function Te(e){return"string"==typeof e||!Zt(e)&&Se(e)&&Ct.call(e)==ze}function ke(e){var t=ge(e);if(!t&&!be(e))return q(e);var r=he(e),n=!!r,i=r||[],a=i.length;for(var o in e)!H(e,o)||n&&("length"==o||pe(o,a))||t&&"constructor"==o||i.push(o);return i}function Be(e){return function(){return e}}var Ie=200,Re="__lodash_hash_undefined__",Fe=9007199254740991,Ne="[object Arguments]",je="[object Array]",Pe="[object Boolean]",Le="[object Date]",Oe="[object Error]",xe="[object Function]",De="[object GeneratorFunction]",Ue="[object Map]",Me="[object Number]",Ke="[object Object]",Ve="[object Promise]",He="[object RegExp]",qe="[object Set]",ze="[object String]",Ge="[object Symbol]",We="[object WeakMap]",Ze="[object ArrayBuffer]",Qe="[object DataView]",Ye="[object Float32Array]",Xe="[object Float64Array]",Je="[object Int8Array]",$e="[object Int16Array]",et="[object Int32Array]",tt="[object Uint8Array]",rt="[object Uint8ClampedArray]",nt="[object Uint16Array]",it="[object Uint32Array]",at=/[\\^$.*+?()[\]{}|]/g,ot=/\w*$/,st=/^\[object .+?Constructor\]$/,ut=/^(?:0|[1-9]\d*)$/,ct={};ct[Ne]=ct[je]=ct[Ze]=ct[Qe]=ct[Pe]=ct[Le]=ct[Ye]=ct[Xe]=ct[Je]=ct[$e]=ct[et]=ct[Ue]=ct[Me]=ct[Ke]=ct[He]=ct[qe]=ct[ze]=ct[Ge]=ct[tt]=ct[rt]=ct[nt]=ct[it]=!0,ct[Oe]=ct[xe]=ct[We]=!1;var lt={"function":!0,object:!0},ft=lt[typeof r]&&r&&!r.nodeType?r:void 0,ht=lt[typeof t]&&t&&!t.nodeType?t:void 0,pt=ht&&ht.exports===ft?ft:void 0,dt=c(ft&&ht&&"object"==typeof e&&e),gt=c(lt[typeof self]&&self),yt=c(lt[typeof window]&&window),vt=c(lt[typeof this]&&this),mt=dt||yt!==(vt&&vt.window)&&yt||gt||vt||Function("return this")(),bt=Array.prototype,Et=Object.prototype,_t=Function.prototype.toString,wt=Et.hasOwnProperty,Ct=Et.toString,St=RegExp("^"+_t.call(wt).replace(at,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),At=pt?mt.Buffer:void 0,Tt=mt.Symbol,kt=mt.Uint8Array,Bt=Object.getOwnPropertySymbols,It=Object.create,Rt=Et.propertyIsEnumerable,Ft=bt.splice,Nt=Object.getPrototypeOf,jt=Object.keys,Pt=ae(mt,"DataView"),Lt=ae(mt,"Map"),Ot=ae(mt,"Promise"),xt=ae(mt,"Set"),Dt=ae(mt,"WeakMap"),Ut=ae(Object,"create"),Mt=ye(Pt),Kt=ye(Lt),Vt=ye(Ot),Ht=ye(xt),qt=ye(Dt),zt=Tt?Tt.prototype:void 0,Gt=zt?zt.valueOf:void 0;p.prototype.clear=d,p.prototype["delete"]=g,p.prototype.get=y,p.prototype.has=v,p.prototype.set=m,b.prototype.clear=E,b.prototype["delete"]=_,b.prototype.get=w,b.prototype.has=C,b.prototype.set=S,A.prototype.clear=T,A.prototype["delete"]=k,A.prototype.get=B,A.prototype.has=I,A.prototype.set=R,F.prototype.clear=N,F.prototype["delete"]=j,F.prototype.get=P,F.prototype.has=L,F.prototype.set=O;var Wt=z("length");Bt||(se=function(){return[]}),(Pt&&ue(new Pt(new ArrayBuffer(1)))!=Qe||Lt&&ue(new Lt)!=Ue||Ot&&ue(Ot.resolve())!=Ve||xt&&ue(new xt)!=qe||Dt&&ue(new Dt)!=We)&&(ue=function(e){var t=Ct.call(e),r=t==Ke?e.constructor:void 0,n=r?ye(r):void 0;if(n)switch(n){case Mt:return Qe;case Kt:return Ue;case Vt:return Ve;case Ht:return qe;case qt:return We}return t});var Zt=Array.isArray,Qt=At?function(e){return e instanceof At}:Be(!1);t.exports=M}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],97:[function(e,t,r){function n(e,t,r){return e===e&&(void 0!==r&&(e=r>=e?e:r),void 0!==t&&(e=e>=t?e:t)),e}function i(e,t,r,n){var i=e.length;for(r=v(r),0>r&&(r=-r>i?0:i+r),n=void 0===n||n>i?i:v(n),0>n&&(n+=i),n=r>n?0:m(n);n>r;)e[r++]=t;return e}function a(e){return function(t){return null==t?void 0:t[e]}}function o(e,t){return t=null==t?_:t,!!t&&("number"==typeof e||N.test(e))&&e>-1&&e%1==0&&t>e}function s(e,t,r){if(!p(r))return!1;var n=typeof t;return("number"==n?l(r)&&o(t,r.length):"string"==n&&t in r)?c(r[t],e):!1}function u(e,t,r,n){var a=e?e.length:0;return a?(r&&"number"!=typeof r&&s(e,t,r)&&(r=0,n=a),i(e,t,r,n)):[]}function c(e,t){return e===t||e!==e&&t!==t}function l(e){return null!=e&&h(O(e))&&!f(e)}function f(e){var t=p(e)?L.call(e):"";return t==A||t==T}function h(e){return"number"==typeof e&&e>-1&&e%1==0&&_>=e}function p(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function d(e){return!!e&&"object"==typeof e}function g(e){return"symbol"==typeof e||d(e)&&L.call(e)==k}function y(e){if(!e)return 0===e?e:0;if(e=b(e),e===E||e===-E){var t=0>
9e?-1:1;return t*w}return e===e?e:0}function v(e){var t=y(e),r=t%1;return t===t?r?t-r:t:0}function m(e){return e?n(v(e),0,S):0}function b(e){if("number"==typeof e)return e;if(g(e))return C;if(p(e)){var t=f(e.valueOf)?e.valueOf():e;e=p(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(B,"");var r=R.test(e);return r||F.test(e)?j(e.slice(2),r?2:8):I.test(e)?C:+e}var E=1/0,_=9007199254740991,w=1.7976931348623157e308,C=NaN,S=4294967295,A="[object Function]",T="[object GeneratorFunction]",k="[object Symbol]",B=/^\s+|\s+$/g,I=/^[-+]0x[0-9a-f]+$/i,R=/^0b[01]+$/i,F=/^0o[0-7]+$/i,N=/^(?:0|[1-9]\d*)$/,j=parseInt,P=Object.prototype,L=P.toString,O=a("length");t.exports=u},{}],98:[function(e,t,r){function n(e){var t=e?e.length:0;return t?i(e,1):[]}var i=e("lodash._baseflatten");t.exports=n},{"lodash._baseflatten":99}],99:[function(e,t,r){function n(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function i(e,t,r,a,s){var u=-1,c=e.length;for(r||(r=o),s||(s=[]);++u<c;){var l=e[u];t>0&&r(l)?t>1?i(l,t-1,r,a,s):n(s,l):a||(s[s.length]=l)}return s}function a(e){return function(t){return null==t?void 0:t[e]}}function o(e){return C(e)||s(e)}function s(e){return c(e)&&b.call(e,"callee")&&(!_.call(e,"callee")||E.call(e)==g)}function u(e){return null!=e&&f(w(e))&&!l(e)}function c(e){return p(e)&&u(e)}function l(e){var t=h(e)?E.call(e):"";return t==y||t==v}function f(e){return"number"==typeof e&&e>-1&&e%1==0&&d>=e}function h(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function p(e){return!!e&&"object"==typeof e}var d=9007199254740991,g="[object Arguments]",y="[object Function]",v="[object GeneratorFunction]",m=Object.prototype,b=m.hasOwnProperty,E=m.toString,_=m.propertyIsEnumerable,w=a("length"),C=Array.isArray;t.exports=i},{}],100:[function(e,t,r){function n(e,t){for(var r=-1,n=e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function i(e){return function(t){return null==t?void 0:t[e]}}function a(e){return s(e)?e:[]}function o(e){return null!=e&&c(b(e))&&!u(e)}function s(e){return f(e)&&o(e)}function u(e){var t=l(e)?m.call(e):"";return t==g||t==y}function c(e){return"number"==typeof e&&e>-1&&e%1==0&&d>=e}function l(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function f(e){return!!e&&"object"==typeof e}var h=e("lodash._baseintersection"),p=e("lodash.rest"),d=9007199254740991,g="[object Function]",y="[object GeneratorFunction]",v=Object.prototype,m=v.toString,b=i("length"),E=p(function(e){var t=n(e,a);return t.length&&t[0]===e[0]?h(t):[]});t.exports=E},{"lodash._baseintersection":101,"lodash.rest":103}],101:[function(e,t,r){function n(e,t){return!!e.length&&o(e,t,0)>-1}function i(e,t,r){for(var n=-1,i=e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function a(e,t){for(var r=-1,n=e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function o(e,t,r){if(t!==t)return c(e,r);for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function s(e){return function(t){return e(t)}}function u(e,t){return e.has(t)}function c(e,t,r){for(var n=e.length,i=t+(r?0:-1);r?i--:++i<n;){var a=e[i];if(a!==a)return i}return-1}function l(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(r){}return t}function f(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function h(){this.__data__=ne?ne(null):{}}function p(e){return this.has(e)&&delete this.__data__[e]}function d(e){var t=this.__data__;if(ne){var r=t[e];return r===H?void 0:r}return X.call(t,e)?t[e]:void 0}function g(e){var t=this.__data__;return ne?void 0!==t[e]:X.call(t,e)}function y(e,t){var r=this.__data__;return r[e]=ne&&void 0===t?H:t,this}function v(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function m(){this.__data__=[]}function b(e){var t=this.__data__,r=N(t,e);if(0>r)return!1;var n=t.length-1;return r==n?t.pop():ee.call(t,r,1),!0}function E(e){var t=this.__data__,r=N(t,e);return 0>r?void 0:t[r][1]}function _(e){return N(this.__data__,e)>-1}function w(e,t){var r=this.__data__,n=N(r,e);return 0>n?r.push([e,t]):r[n][1]=t,this}function C(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function S(){this.__data__={hash:new f,map:new(re||v),string:new f}}function A(e){return P(this,e)["delete"](e)}function T(e){return P(this,e).get(e)}function k(e){return P(this,e).has(e)}function B(e,t){return P(this,e).set(e,t),this}function I(e){var t=-1,r=e?e.length:0;for(this.__data__=new C;++t<r;)this.add(e[t])}function R(e){return this.__data__.set(e,H),this}function F(e){return this.__data__.has(e)}function N(e,t){for(var r=e.length;r--;)if(D(e[r][0],t))return r;return-1}function j(e,t,r){for(var o=r?i:n,c=e[0].length,l=e.length,f=l,h=Array(l),p=1/0,d=[];f--;){var g=e[f];f&&t&&(g=a(g,s(t))),p=te(g.length,p),h[f]=!r&&(t||c>=120&&g.length>=120)?new I(f&&g):void 0}g=e[0];var y=-1,v=h[0];e:for(;++y<c&&d.length<p;){var m=g[y],b=t?t(m):m;if(m=r||0!==m?m:0,!(v?u(v,b):o(d,b,r))){for(f=l;--f;){var E=h[f];if(!(E?u(E,b):o(e[f],b,r)))continue e}v&&v.push(b),d.push(m)}}return d}function P(e,t){var r=e.__data__;return O(t)?r["string"==typeof t?"string":"hash"]:r.map}function L(e,t){var r=e[t];return K(r)?r:void 0}function O(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function x(e){if(null!=e){try{return Y.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function D(e,t){return e===t||e!==e&&t!==t}function U(e){var t=M(e)?J.call(e):"";return t==q||t==z}function M(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function K(e){if(!M(e))return!1;var t=U(e)||l(e)?$:W;return t.test(x(e))}var V=e("lodash._root"),H="__lodash_hash_undefined__",q="[object Function]",z="[object GeneratorFunction]",G=/[\\^$.*+?()[\]{}|]/g,W=/^\[object .+?Constructor\]$/,Z=Array.prototype,Q=Object.prototype,Y=Function.prototype.toString,X=Q.hasOwnProperty,J=Q.toString,$=
9RegExp("^"+Y.call(X).replace(G,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ee=Z.splice,te=Math.min,re=L(V,"Map"),ne=L(Object,"create");f.prototype.clear=h,f.prototype["delete"]=p,f.prototype.get=d,f.prototype.has=g,f.prototype.set=y,v.prototype.clear=m,v.prototype["delete"]=b,v.prototype.get=E,v.prototype.has=_,v.prototype.set=w,C.prototype.clear=S,C.prototype["delete"]=A,C.prototype.get=T,C.prototype.has=k,C.prototype.set=B,I.prototype.add=I.prototype.push=R,I.prototype.has=F,t.exports=j},{"lodash._root":102}],102:[function(e,t,r){(function(e){function n(e){return e&&e.Object===Object?e:null}var i={"function":!0,object:!0},a=i[typeof r]&&r&&!r.nodeType?r:void 0,o=i[typeof t]&&t&&!t.nodeType?t:void 0,s=n(a&&o&&"object"==typeof e&&e),u=n(i[typeof self]&&self),c=n(i[typeof window]&&window),l=n(i[typeof this]&&this),f=s||c!==(l&&l.window)&&c||u||l||Function("return this")();t.exports=f}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],103:[function(e,t,r){arguments[4][94][0].apply(r,arguments)},{dup:94}],104:[function(e,t,r){function n(e,t){for(var r=-1,n=e.length;++r<n&&t(e[r],r,e)!==!1;);return e}function i(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(r){}return t}function a(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function o(){this.__data__=We?We(null):{}}function s(e){return this.has(e)&&delete this.__data__[e]}function u(e){var t=this.__data__;if(We){var r=t[e];return r===se?void 0:r}return Ke.call(t,e)?t[e]:void 0}function c(e){var t=this.__data__;return We?void 0!==t[e]:Ke.call(t,e)}function l(e,t){var r=this.__data__;return r[e]=We&&void 0===t?se:t,this}function f(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function h(){this.__data__=[]}function p(e){var t=this.__data__,r=F(t,e);if(0>r)return!1;var n=t.length-1;return r==n?t.pop():ze.call(t,r,1),!0}function d(e){var t=this.__data__,r=F(t,e);return 0>r?void 0:t[r][1]}function g(e){return F(this.__data__,e)>-1}function y(e,t){var r=this.__data__,n=F(r,e);return 0>n?r.push([e,t]):r[n][1]=t,this}function v(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function m(){this.__data__={hash:new a,map:new(Ge||f),string:new a}}function b(e){return D(this,e)["delete"](e)}function E(e){return D(this,e).get(e)}function _(e){return D(this,e).has(e)}function w(e,t){return D(this,e).set(e,t),this}function C(e){this.__data__=new f(e)}function S(){this.__data__=new f}function A(e){return this.__data__["delete"](e)}function T(e){return this.__data__.get(e)}function k(e){return this.__data__.has(e)}function B(e,t){var r=this.__data__;return r instanceof f&&r.__data__.length==oe&&(r=this.__data__=new v(r.__data__)),r.set(e,t),this}function I(e,t,r){(void 0===r||q(e[t],r))&&("number"!=typeof t||void 0!==r||t in e)||(e[t]=r)}function R(e,t,r){var n=e[t];Ke.call(e,t)&&q(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function F(e,t){for(var r=e.length;r--;)if(q(e[r][0],t))return r;return-1}function N(e,t,r,i,a){if(e!==t){if(!Qe(t)&&!$(t))var o=ne(t);n(o||t,function(n,s){if(o&&(s=n,n=t[s]),Y(n))a||(a=new C),j(e,t,s,r,N,i,a);else{var u=i?i(e[s],n,s+"",e,t,a):void 0;void 0===u&&(u=n),I(e,s,u)}})}}function j(e,t,r,n,i,a,o){var s=e[r],u=t[r],c=o.get(u);if(c)return void I(e,r,c);var l=a?a(s,u,r+"",e,t,o):void 0,f=void 0===l;f&&(l=u,Qe(u)||$(u)?Qe(s)?l=s:W(s)?l=L(s):(f=!1,l=te(u,!0)):re(u)||z(u)?z(s)?l=ee(s):!Y(s)||n&&Z(s)?(f=!1,l=te(u,!0)):l=s:f=!1),o.set(u,l),f&&i(l,u,n,a,o),o["delete"](u),I(e,r,l)}function P(e){return function(t){return null==t?void 0:t[e]}}function L(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function O(e,t,r,n){r||(r={});for(var i=-1,a=t.length;++i<a;){var o=t[i],s=n?n(r[o],e[o],o,r,e):e[o];R(r,o,s)}return r}function x(e){return ie(function(t,r){var n=-1,i=r.length,a=i>1?r[i-1]:void 0,o=i>2?r[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,o&&K(r[0],r[1],o)&&(a=3>i?void 0:a,i=1),t=Object(t);++n<i;){var s=r[n];s&&e(t,s,n,a)}return t})}function D(e,t){var r=e.__data__;
9return V(t)?r["string"==typeof t?"string":"hash"]:r.map}function U(e,t){var r=e[t];return J(r)?r:void 0}function M(e,t){return t=null==t?ue:t,!!t&&("number"==typeof e||Oe.test(e))&&e>-1&&e%1==0&&t>e}function K(e,t,r){if(!Y(r))return!1;var n=typeof t;return("number"==n?G(r)&&M(t,r.length):"string"==n&&t in r)?q(r[t],e):!1}function V(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function H(e){if(null!=e){try{return Me.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function q(e,t){return e===t||e!==e&&t!==t}function z(e){return W(e)&&Ke.call(e,"callee")&&(!qe.call(e,"callee")||Ve.call(e)==ce)}function G(e){return null!=e&&Q(Ze(e))&&!Z(e)}function W(e){return X(e)&&G(e)}function Z(e){var t=Y(e)?Ve.call(e):"";return t==de||t==ge}function Q(e){return"number"==typeof e&&e>-1&&e%1==0&&ue>=e}function Y(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function X(e){return!!e&&"object"==typeof e}function J(e){if(!Y(e))return!1;var t=Z(e)||i(e)?He:Le;return t.test(H(e))}function $(e){return X(e)&&Q(e.length)&&!!xe[Ve.call(e)]}function ee(e){return O(e,ne(e))}var te=e("lodash._baseclone"),re=e("lodash.isplainobject"),ne=e("lodash.keysin"),ie=e("lodash.rest"),ae=e("lodash._root"),oe=200,se="__lodash_hash_undefined__",ue=9007199254740991,ce="[object Arguments]",le="[object Array]",fe="[object Boolean]",he="[object Date]",pe="[object Error]",de="[object Function]",ge="[object GeneratorFunction]",ye="[object Map]",ve="[object Number]",me="[object Object]",be="[object RegExp]",Ee="[object Set]",_e="[object String]",we="[object WeakMap]",Ce="[object ArrayBuffer]",Se="[object DataView]",Ae="[object Float32Array]",Te="[object Float64Array]",ke="[object Int8Array]",Be="[object Int16Array]",Ie="[object Int32Array]",Re="[object Uint8Array]",Fe="[object Uint8ClampedArray]",Ne="[object Uint16Array]",je="[object Uint32Array]",Pe=/[\\^$.*+?()[\]{}|]/g,Le=/^\[object .+?Constructor\]$/,Oe=/^(?:0|[1-9]\d*)$/,xe={};xe[Ae]=xe[Te]=xe[ke]=xe[Be]=xe[Ie]=xe[Re]=xe[Fe]=xe[Ne]=xe[je]=!0,xe[ce]=xe[le]=xe[Ce]=xe[fe]=xe[Se]=xe[he]=xe[pe]=xe[de]=xe[ye]=xe[ve]=xe[me]=xe[be]=xe[Ee]=xe[_e]=xe[we]=!1;var De=Array.prototype,Ue=Object.prototype,Me=Function.prototype.toString,Ke=Ue.hasOwnProperty,Ve=Ue.toString,He=RegExp("^"+Me.call(Ke).replace(Pe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qe=Ue.propertyIsEnumerable,ze=De.splice,Ge=U(ae,"Map"),We=U(Object,"create");a.prototype.clear=o,a.prototype["delete"]=s,a.prototype.get=u,a.prototype.has=c,a.prototype.set=l,f.prototype.clear=h,f.prototype["delete"]=p,f.prototype.get=d,f.prototype.has=g,f.prototype.set=y,v.prototype.clear=m,v.prototype["delete"]=b,v.prototype.get=E,v.prototype.has=_,v.prototype.set=w,C.prototype.clear=S,C.prototype["delete"]=A,C.prototype.get=T,C.prototype.has=k,C.prototype.set=B;var Ze=P("length"),Qe=Array.isArray,Ye=x(function(e,t,r){N(e,t,r)});t.exports=Ye},{"lodash._baseclone":105,"lodash._root":106,"lodash.isplainobject":107,"lodash.keysin":108,"lodash.rest":109}],105:[function(e,t,r){arguments[4][96][0].apply(r,arguments)},{dup:96}],106:[function(e,t,r){arguments[4][102][0].apply(r,arguments)},{dup:102}],107:[function(e,t,r){function n(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(r){}return t}function i(e){return p(Object(e))}function a(e){return!!e&&"object"==typeof e}function o(e){if(!a(e)||h.call(e)!=s||n(e))return!1;var t=i(e);if(null===t)return!0;var r=l.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&c.call(r)==f}var s="[object Object]",u=Object.prototype,c=Function.prototype.toString,l=u.hasOwnProperty,f=c.call(Object),h=u.toString,p=Object.getPrototypeOf;t.exports=o},{}],108:[function(e,t,r){(function(e){function n(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function i(e){return e&&e.Object===Object?e:null}function a(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}function o(e){e=null==e?e:Object(e);var t=[];for(var r in e)t.push(r);return t}function s(e){return function(t){return null==t?void 0:t[e]}}function u(e){var t=e?e.length:void 0;return g(t)&&(K(e)||m(e)||f(e))?n(t,String):null}function c(e,t){return t=null==t?E:t,!!t&&("number"==typeof e||A.test(e))&&e>-1&&e%1==0&&t>e}function l(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||P;return e===r}function f(e){return p(e)&&L.call(e,"callee")&&(!U.call(e,"callee")||O.call(e)==_)}function h(e){return null!=e&&g(M(e))&&!d(e)}function p(e){return v(e)&&h(e)}function d(e){var t=y(e)?O.call(e):"";return t==w||t==C}function g(e){return"number"==typeof e&&e>-1&&e%1==0&&E>=e}function y(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function v(e){return!!e&&"object"==typeof e}function m(e){return"string"==typeof e||!K(e)&&v(e)&&O.call(e)==S}function b(e){for(var t=-1,r=l(e),n=o(e),i=n.length,a=u(e),s=!!a,f=a||[],h=f.length;++t<i;){var p=n[t];
9s&&("length"==p||c(p,h))||"constructor"==p&&(r||!L.call(e,p))||f.push(p)}return f}var E=9007199254740991,_="[object Arguments]",w="[object Function]",C="[object GeneratorFunction]",S="[object String]",A=/^(?:0|[1-9]\d*)$/,T={"function":!0,object:!0},k=T[typeof r]&&r&&!r.nodeType?r:void 0,B=T[typeof t]&&t&&!t.nodeType?t:void 0,I=i(k&&B&&"object"==typeof e&&e),R=i(T[typeof self]&&self),F=i(T[typeof window]&&window),N=i(T[typeof this]&&this),j=I||F!==(N&&N.window)&&F||R||N||Function("return this")(),P=Object.prototype,L=P.hasOwnProperty,O=P.toString,x=j.Reflect,D=x?x.enumerate:void 0,U=P.propertyIsEnumerable;D&&!U.call({valueOf:1},"valueOf")&&(o=function(e){return a(D(e))});var M=s("length"),K=Array.isArray;t.exports=b}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],109:[function(e,t,r){arguments[4][94][0].apply(r,arguments)},{dup:94}],110:[function(e,t,r){function n(e,t){for(var r=-1,n=e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function i(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function a(e,t,r,n){var i=-1,a=e.length;for(n&&a&&(r=e[++i]);++i<a;)r=t(r,e[i],i,e);return r}function o(e,t,r){var n=t(e);return A(e)?n:i(n,r(e))}function s(e,t){return e=Object(e),a(t,function(t,r){return r in e&&(t[r]=e[r]),t},{})}function u(e){return o(e,y,S)}function c(e){return C(Object(e))}function l(e){return w(Object(e))}function f(e){if("string"==typeof e||p(e))return e;var t=e+"";return"0"==t&&1/e==-m?"-0":t}function h(e){return!!e&&"object"==typeof e}function p(e){return"symbol"==typeof e||h(e)&&_.call(e)==b}var d=e("lodash._basedifference"),g=e("lodash._baseflatten"),y=e("lodash.keysin"),v=e("lodash.rest"),m=1/0,b="[object Symbol]",E=Object.prototype,_=E.toString,w=Object.getOwnPropertySymbols,C=Object.getPrototypeOf;w||(l=function(){return[]});var S=w?function(e){for(var t=[];e;)i(t,l(e)),e=c(e);return t}:l,A=Array.isArray,T=v(function(e,t){return null==e?{}:(t=n(g(t,1),f),s(e,d(u(e),t)))});t.exports=T},{"lodash._basedifference":111,"lodash._baseflatten":113,"lodash.keysin":114,"lodash.rest":115}],111:[function(e,t,r){function n(e,t){return!!e.length&&o(e,t,0)>-1}function i(e,t,r){for(var n=-1,i=e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function a(e,t){for(var r=-1,n=e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function o(e,t,r){if(t!==t)return c(e,r);for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function s(e){return function(t){return e(t)}}function u(e,t){return e.has(t)}function c(e,t,r){for(var n=e.length,i=t+(r?0:-1);r?i--:++i<n;){var a=e[i];if(a!==a)return i}return-1}function l(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(r){}return t}function f(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function h(){this.__data__=ne?ne(null):{}}function p(e){return this.has(e)&&delete this.__data__[e]}function d(e){var t=this.__data__;if(ne){var r=t[e];return r===q?void 0:r}return J.call(t,e)?t[e]:void 0}function g(e){var t=this.__data__;return ne?void 0!==t[e]:J.call(t,e)}function y(e,t){var r=this.__data__;return r[e]=ne&&void 0===t?q:t,this}function v(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function m(){this.__data__=[]}function b(e){var t=this.__data__,r=N(t,e);if(0>r)return!1;var n=t.length-1;return r==n?t.pop():te.call(t,r,1),!0}function E(e){var t=this.__data__,r=N(t,e);return 0>r?void 0:t[r][1]}function _(e){return N(this.__data__,e)>-1}function w(e,t){var r=this.__data__,n=N(r,e);return 0>n?r.push([e,t]):r[n][1]=t,this}function C(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function S(){this.__data__={hash:new f,map:new(re||v),string:new f}}function A(e){return P(this,e)["delete"](e)}function T(e){return P(this,e).get(e)}function k(e){return P(this,e).has(e)}function B(e,t){return P(this,e).set(e,t),this}function I(e){var t=-1,r=e?e.length:0;for(this.__data__=new C;++t<r;)this.add(e[t])}function R(e){return this.__data__.set(e,q),this}function F(e){return this.__data__.has(e)}function N(e,t){for(var r=e.length;r--;)if(D(e[r][0],t))return r;return-1}function j(e,t,r,o){var c=-1,l=n,f=!0,h=e.length,p=[],d=t.length;
9if(!h)return p;r&&(t=a(t,s(r))),o?(l=i,f=!1):t.length>=H&&(l=u,f=!1,t=new I(t));e:for(;++c<h;){var g=e[c],y=r?r(g):g;if(g=o||0!==g?g:0,f&&y===y){for(var v=d;v--;)if(t[v]===y)continue e;p.push(g)}else l(t,y,o)||p.push(g)}return p}function P(e,t){var r=e.__data__;return O(t)?r["string"==typeof t?"string":"hash"]:r.map}function L(e,t){var r=e[t];return K(r)?r:void 0}function O(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e; 10}function x(e){if(null!=e){try{return X.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function D(e,t){return e===t||e!==e&&t!==t}function U(e){var t=M(e)?$.call(e):"";return t==z||t==G}function M(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function K(e){if(!M(e))return!1;var t=U(e)||l(e)?ee:Z;return t.test(x(e))}var V=e("lodash._root"),H=200,q="__lodash_hash_undefined__",z="[object Function]",G="[object GeneratorFunction]",W=/[\\^$.*+?()[\]{}|]/g,Z=/^\[object .+?Constructor\]$/,Q=Array.prototype,Y=Object.prototype,X=Function.prototype.toString,J=Y.hasOwnProperty,$=Y.toString,ee=RegExp("^"+X.call(J).replace(W,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),te=Q.splice,re=L(V,"Map"),ne=L(Object,"create");f.prototype.clear=h,f.prototype["delete"]=p,f.prototype.get=d,f.prototype.has=g,f.prototype.set=y,v.prototype.clear=m,v.prototype["delete"]=b,v.prototype.get=E,v.prototype.has=_,v.prototype.set=w,C.prototype.clear=S,C.prototype["delete"]=A,C.prototype.get=T,C.prototype.has=k,C.prototype.set=B,I.prototype.add=I.prototype.push=R,I.prototype.has=F,t.exports=j},{"lodash._root":112}],112:[function(e,t,r){arguments[4][102][0].apply(r,arguments)},{dup:102}],113:[function(e,t,r){arguments[4][99][0].apply(r,arguments)},{dup:99}],114:[function(e,t,r){arguments[4][108][0].apply(r,arguments)},{dup:108}],115:[function(e,t,r){arguments[4][94][0].apply(r,arguments)},{dup:94}],116:[function(e,t,r){function n(e,t){for(var r=-1,n=e.length,i=0,a=[];++r<n;){var o=e[r];o!==t&&o!==s||(e[r]=s,a[i++]=r)}return a}function i(e){var t=e;return t.placeholder}var a=e("lodash._createwrapper"),o=e("lodash.rest"),s="__lodash_placeholder__",u=64,c=o(function(e,t){var r=n(t,i(c));return a(e,u,void 0,t,r)});c.placeholder={},t.exports=c},{"lodash._createwrapper":117,"lodash.rest":118}],117:[function(e,t,r){(function(e){function n(e,t,r){var n=r.length;switch(n){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function i(e){return e&&e.Object===Object?e:null}function a(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&n++;return n}function o(e,t){for(var r=-1,n=e.length,i=0,a=[];++r<n;){var o=e[r];o!==t&&o!==I||(e[r]=I,a[i++]=r)}return a}function s(e){return w(e)?ue(e):{}}function u(e,t,r,n){for(var i=-1,a=e.length,o=r.length,s=-1,u=t.length,c=ce(a-o,0),l=Array(u+c),f=!n;++s<u;)l[s]=t[s];for(;++i<o;)(f||a>i)&&(l[r[i]]=e[i]);for(;c--;)l[s++]=e[i++];return l}function c(e,t,r,n){for(var i=-1,a=e.length,o=-1,s=r.length,u=-1,c=t.length,l=ce(a-s,0),f=Array(l+c),h=!n;++i<l;)f[i]=e[i];for(var p=i;++u<c;)f[p+u]=t[u];for(;++o<s;)(h||a>i)&&(f[p+r[o]]=e[i++]);return f}function l(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function f(e,t,r){function n(){var t=this&&this!==ae&&this instanceof n?a:e;return t.apply(i?r:this,arguments)}var i=t&R,a=h(e);return n}function h(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=s(e.prototype),n=e.apply(r,t);return w(n)?n:r}}function p(e,t,r){function i(){for(var s=arguments.length,u=Array(s),c=s,l=m(i);c--;)u[c]=arguments[c];var f=3>s&&u[0]!==l&&u[s-1]!==l?[]:o(u,l);if(s-=f.length,r>s)return y(e,t,d,i.placeholder,void 0,u,f,void 0,void 0,r-s);var h=this&&this!==ae&&this instanceof i?a:e;return n(h,this,u)}var a=h(e);return i}function d(e,t,r,n,i,s,l,f,p,g){function v(){for(var T=arguments.length,k=Array(T),B=T;B--;)k[B]=arguments[B];if(C)var I=m(v),R=a(k,I);if(n&&(k=u(k,n,i,C)),s&&(k=c(k,s,l,C)),T-=R,C&&g>T){var F=o(k,I);return y(e,t,d,v.placeholder,r,k,F,f,p,g-T)}var N=_?r:this,j=w?N[e]:e;return T=k.length,f?k=E(k,f):S&&T>1&&k.reverse(),b&&T>p&&(k.length=p),this&&this!==ae&&this instanceof v&&(j=A||h(j)),j.apply(N,k)}var b=t&x,_=t&R,w=t&F,C=t&(j|P),S=t&D,A=w?void 0:h(e);return v}
10function g(e,t,r,i){function a(){for(var t=-1,u=arguments.length,c=-1,l=i.length,f=Array(l+u),h=this&&this!==ae&&this instanceof a?s:e;++c<l;)f[c]=i[c];for(;u--;)f[c++]=arguments[++t];return n(h,o?r:this,f)}var o=t&R,s=h(e);return a}function y(e,t,r,n,i,a,o,s,u,c){var l=t&j,f=l?o:void 0,h=l?void 0:o,p=l?a:void 0,d=l?void 0:a;t|=l?L:O,t&=~(l?O:L),t&N||(t&=~(R|F));var g=r(e,t,i,p,f,d,h,s,u,c);return g.placeholder=n,g}function v(e,t,r,n,i,a,o,s){var u=t&F;if(!u&&"function"!=typeof e)throw new TypeError(B);var c=n?n.length:0;if(c||(t&=~(L|O),n=i=void 0),o=void 0===o?o:ce(T(o),0),s=void 0===s?s:T(s),c-=i?i.length:0,t&O){var l=n,h=i;n=i=void 0}var y=[e,t,r,n,i,l,h,a,o,s];if(e=y[0],t=y[1],r=y[2],n=y[3],i=y[4],s=y[9]=null==y[9]?u?0:e.length:ce(y[9]-c,0),!s&&t&(j|P)&&(t&=~(j|P)),t&&t!=R)v=t==j||t==P?p(e,t,s):t!=L&&t!=(R|L)||i.length?d.apply(void 0,y):g(e,t,r,n);else var v=f(e,t,r);return v}function m(e){var t=e;return t.placeholder}function b(e,t){return t=null==t?M:t,!!t&&("number"==typeof e||Y.test(e))&&e>-1&&e%1==0&&t>e}function E(e,t){for(var r=e.length,n=le(t.length,r),i=l(e);n--;){var a=t[n];e[n]=b(a,r)?i[a]:void 0}return e}function _(e){var t=w(e)?se.call(e):"";return t==H||t==q}function w(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function C(e){return!!e&&"object"==typeof e}function S(e){return"symbol"==typeof e||C(e)&&se.call(e)==z}function A(e){if(!e)return 0===e?e:0;if(e=k(e),e===U||e===-U){var t=0>e?-1:1;return t*K}return e===e?e:0}function T(e){var t=A(e),r=t%1;return t===t?r?t-r:t:0}function k(e){if("number"==typeof e)return e;if(S(e))return V;if(w(e)){var t=_(e.valueOf)?e.valueOf():e;e=w(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(G,"");var r=Z.test(e);return r||Q.test(e)?J(e.slice(2),r?2:8):W.test(e)?V:+e}var B="Expected a function",I="__lodash_placeholder__",R=1,F=2,N=4,j=8,P=16,L=32,O=64,x=128,D=512,U=1/0,M=9007199254740991,K=1.7976931348623157e308,V=NaN,H="[object Function]",q="[object GeneratorFunction]",z="[object Symbol]",G=/^\s+|\s+$/g,W=/^[-+]0x[0-9a-f]+$/i,Z=/^0b[01]+$/i,Q=/^0o[0-7]+$/i,Y=/^(?:0|[1-9]\d*)$/,X={"function":!0,object:!0},J=parseInt,$=X[typeof r]&&r&&!r.nodeType?r:void 0,ee=X[typeof t]&&t&&!t.nodeType?t:void 0,te=i($&&ee&&"object"==typeof e&&e),re=i(X[typeof self]&&self),ne=i(X[typeof window]&&window),ie=i(X[typeof this]&&this),ae=te||ne!==(ie&&ie.window)&&ne||re||ie||Function("return this")(),oe=Object.prototype,se=oe.toString,ue=Object.create,ce=Math.max,le=Math.min;t.exports=v}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],118:[function(e,t,r){arguments[4][94][0].apply(r,arguments)},{dup:94}],119:[function(e,t,r){function n(e,t){for(var r=-1,n=e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function i(e,t,r,n){var i=-1,a=e.length;for(n&&a&&(r=e[++i]);++i<a;)r=t(r,e[i],i,e);return r}function a(e,t){return e=Object(e),i(t,function(t,r){return r in e&&(t[r]=e[r]),t},{})}function o(e){if("string"==typeof e||u(e))return e;var t=e+"";return"0"==t&&1/e==-f?"-0":t}function s(e){return!!e&&"object"==typeof e}function u(e){return"symbol"==typeof e||s(e)&&d.call(e)==h}var c=e("lodash._baseflatten"),l=e("lodash.rest"),f=1/0,h="[object Symbol]",p=Object.prototype,d=p.toString,g=l(function(e,t){return null==e?{}:a(e,n(c(t,1),o))});t.exports=g},{"lodash._baseflatten":120,"lodash.rest":121}],120:[function(e,t,r){arguments[4][99][0].apply(r,arguments)},{dup:99}],121:[function(e,t,r){arguments[4][94][0].apply(r,arguments)},{dup:94}],122:[function(e,t,r){function n(e){return e&&e.length?i(e):[]}var i=e("lodash._baseuniq");t.exports=n},{"lodash._baseuniq":123}],123:[function(e,t,r){function n(e,t){return!!e.length&&a(e,t,0)>-1}function i(e,t,r){for(var n=-1,i=e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function a(e,t,r){if(t!==t)return s(e,r);for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function o(e,t){return e.has(t)}function s(e,t,r){for(var n=e.length,i=t+(r?0:-1);r?i--:++i<n;){var a=e[i];if(a!==a)return i}return-1}function u(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(r){}return t}function c(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}function l(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function f(){this.__data__=ne?ne(null):{}}function h(e){return this.has(e)&&delete this.__data__[e]}function p(e){var t=this.__data__;if(ne){var r=t[e];return r===q?void 0:r}return J.call(t,e)?t[e]:void 0}function d(e){var t=this.__data__;return ne?void 0!==t[e]:J.call(t,e)}function g(e,t){var r=this.__data__;return r[e]=ne&&void 0===t?q:t,this}function y(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function v(){this.__data__=[]}function m(e){var t=this.__data__,r=F(t,e);if(0>r)return!1;var n=t.length-1;return r==n?t.pop():te.call(t,r,1),!0}function b(e){var t=this.__data__,r=F(t,e);return 0>r?void 0:t[r][1]}function E(e){return F(this.__data__,e)>-1}function _(e,t){var r=this.__data__,n=F(r,e);return 0>n?r.push([e,t]):r[n][1]=t,this}function w(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function C(){this.__data__={hash:new l,map:new(re||y),string:new l}}function S(e){return j(this,e)["delete"](e)}function A(e){return j(this,e).get(e)}function T(e){return j(this,e).has(e)}function k(e,t){return j(this,e).set(e,t),this}function B(e){var t=-1,r=e?e.length:0;for(this.__data__=new w;++t<r;)this.add(e[t])}function I(e){return this.__data__.set(e,q),this}function R(e){return this.__data__.has(e)}function F(e,t){for(var r=e.length;r--;)if(x(e[r][0],t))return r;return-1}function N(e,t,r){var a=-1,s=n,u=e.length,l=!0,f=[],h=f;if(r)l=!1,s=i;else if(u>=H){var p=t?null:K(e);if(p)return c(p);l=!1,s=o,h=new B}else h=t?[]:f;e:for(;++a<u;){var d=e[a],g=t?t(d):d;if(d=r||0!==d?d:0,l&&g===g){for(var y=h.length;y--;)if(h[y]===g)continue e;t&&h.push(g),f.push(d)}else s(h,g,r)||(h!==f&&h.push(g),f.push(d))}return f}function j(e,t){var r=e.__data__;
10return L(t)?r["string"==typeof t?"string":"hash"]:r.map}function P(e,t){var r=e[t];return M(r)?r:void 0}function L(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function O(e){if(null!=e){try{return X.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function x(e,t){return e===t||e!==e&&t!==t}function D(e){var t=U(e)?$.call(e):"";return t==z||t==G}function U(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function M(e){if(!U(e))return!1;var t=D(e)||u(e)?ee:Z;return t.test(O(e))}var K=e("lodash._createset"),V=e("lodash._root"),H=200,q="__lodash_hash_undefined__",z="[object Function]",G="[object GeneratorFunction]",W=/[\\^$.*+?()[\]{}|]/g,Z=/^\[object .+?Constructor\]$/,Q=Array.prototype,Y=Object.prototype,X=Function.prototype.toString,J=Y.hasOwnProperty,$=Y.toString,ee=RegExp("^"+X.call(J).replace(W,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),te=Q.splice,re=P(V,"Map"),ne=P(Object,"create");l.prototype.clear=f,l.prototype["delete"]=h,l.prototype.get=p,l.prototype.has=d,l.prototype.set=g,y.prototype.clear=v,y.prototype["delete"]=m,y.prototype.get=b,y.prototype.has=E,y.prototype.set=_,w.prototype.clear=C,w.prototype["delete"]=S,w.prototype.get=A,w.prototype.has=T,w.prototype.set=k,B.prototype.add=B.prototype.push=I,B.prototype.has=R,t.exports=N},{"lodash._createset":124,"lodash._root":125}],124:[function(e,t,r){(function(e){function n(e){return e&&e.Object===Object?e:null}function i(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(r){}return t}function a(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}function o(e,t){var r=e[t];return l(r)?r:void 0}function s(e){if(null!=e){try{return T.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function u(e){var t=c(e)?B.call(e):"";return t==p||t==d}function c(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function l(e){if(!c(e))return!1;var t=u(e)||i(e)?I:y;return t.test(s(e))}function f(){}var h=1/0,p="[object Function]",d="[object GeneratorFunction]",g=/[\\^$.*+?()[\]{}|]/g,y=/^\[object .+?Constructor\]$/,v={"function":!0,object:!0},m=v[typeof r]&&r&&!r.nodeType?r:void 0,b=v[typeof t]&&t&&!t.nodeType?t:void 0,E=n(m&&b&&"object"==typeof e&&e),_=n(v[typeof self]&&self),w=n(v[typeof window]&&window),C=n(v[typeof this]&&this),S=E||w!==(C&&C.window)&&w||_||C||Function("return this")(),A=Object.prototype,T=Function.prototype.toString,k=A.hasOwnProperty,B=A.toString,I=RegExp("^"+T.call(k).replace(g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),R=o(S,"Set"),F=R&&1/a(new R([,-0]))[1]==h?function(e){return new R(e)}:f;t.exports=F}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],125:[function(e,t,r){arguments[4][102][0].apply(r,arguments)},{dup:102}],126:[function(t,r,n){!function(n,i){"function"==typeof e&&e.amd?e([],i):"function"==typeof t&&"object"==typeof r&&r&&r.exports?r.exports=i():(n.dcodeIO=n.dcodeIO||{}).Long=i()}(this,function(){"use strict";function e(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function t(e){return(e&&e.__isLong__)===!0}function r(e,t){var r,n,a;return t?(e>>>=0,(a=e>=0&&256>e)&&(n=u[e])?n:(r=i(e,0>(0|e)?-1:0,!0),a&&(u[e]=r),r)):(e|=0,(a=e>=-128&&128>e)&&(n=s[e])?n:(r=i(e,0>e?-1:0,!1),a&&(s[e]=r),r))}function n(e,t){if(isNaN(e)||!isFinite(e))return t?y:g;if(t){if(0>e)return y;if(e>=h)return _}else{if(-p>=e)return w;if(e+1>=p)return E}return 0>e?n(-e,t).neg():i(e%f|0,e/f|0,t)}function i(t,r,n){return new e(t,r,n)}function a(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(r=t,t=!1):t=!!t,r=r||10,2>r||r>36)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return a(e.substring(1),t,r).neg();for(var o=n(c(r,8)),s=g,u=0;u<e.length;u+=8){var l=Math.min(8,e.length-u),f=parseInt(e.substring(u,u+l),r);if(8>l){var h=n(c(r,l));s=s.mul(h).add(n(f))}else s=s.mul(o),s=s.add(n(f))}return s.unsigned=t,s}function o(t){return t instanceof e?t:"number"==typeof t?n(t):"string"==typeof t?a(t):i(t.low,t.high,t.unsigned)}e.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,
10configurable:!1}),e.isLong=t;var s={},u={};e.fromInt=r,e.fromNumber=n,e.fromBits=i;var c=Math.pow;e.fromString=a,e.fromValue=o;var l=1<<24,f=4294967296,h=0x10000000000000000,p=h/2,d=r(l),g=r(0);e.ZERO=g;var y=r(0,!0);e.UZERO=y;var v=r(1);e.ONE=v;var m=r(1,!0);e.UONE=m;var b=r(-1);e.NEG_ONE=b;var E=i(-1,2147483647,!1);e.MAX_VALUE=E;var _=i(-1,-1,!0);e.MAX_UNSIGNED_VALUE=_;var w=i(0,-2147483648,!1);e.MIN_VALUE=w;var C=e.prototype;return C.toInt=function(){return this.unsigned?this.low>>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},C.toString=function(e){if(e=e||10,2>e||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(w)){var t=n(e),r=this.div(t),i=r.mul(t).sub(this);return r.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var a=n(c(e,6),this.unsigned),o=this,s="";;){var u=o.div(a),l=o.sub(u.mul(a)).toInt()>>>0,f=l.toString(e);if(o=u,o.isZero())return f+s;for(;f.length<6;)f="0"+f;s=""+f+s}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},C.isZero=function(){return 0===this.high&&0===this.low},C.isNegative=function(){return!this.unsigned&&this.high<0},C.isPositive=function(){return this.unsigned||this.high>=0},C.isOdd=function(){return 1===(1&this.low)},C.isEven=function(){return 0===(1&this.low)},C.equals=function(e){return t(e)||(e=o(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},C.eq=C.equals,C.notEquals=function(e){return!this.eq(e)},C.neq=C.notEquals,C.lessThan=function(e){return this.comp(e)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(e){return this.comp(e)<=0},C.lte=C.lessThanOrEqual,C.greaterThan=function(e){return this.comp(e)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(e){return this.comp(e)>=0},C.gte=C.greaterThanOrEqual,C.compare=function(e){if(t(e)||(e=o(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(v)},C.neg=C.negate,C.add=function(e){t(e)||(e=o(e));var r=this.high>>>16,n=65535&this.high,a=this.low>>>16,s=65535&this.low,u=e.high>>>16,c=65535&e.high,l=e.low>>>16,f=65535&e.low,h=0,p=0,d=0,g=0;return g+=s+f,d+=g>>>16,g&=65535,d+=a+l,p+=d>>>16,d&=65535,p+=n+c,h+=p>>>16,p&=65535,h+=r+u,h&=65535,i(d<<16|g,h<<16|p,this.unsigned)},C.subtract=function(e){return t(e)||(e=o(e)),this.add(e.neg())},C.sub=C.subtract,C.multiply=function(e){if(this.isZero())return g;if(t(e)||(e=o(e)),e.isZero())return g;if(this.eq(w))return e.isOdd()?w:g;if(e.eq(w))return this.isOdd()?w:g;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(d)&&e.lt(d))return n(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,a=65535&this.high,s=this.low>>>16,u=65535&this.low,c=e.high>>>16,l=65535&e.high,f=e.low>>>16,h=65535&e.low,p=0,y=0,v=0,m=0;return m+=u*h,v+=m>>>16,m&=65535,v+=s*h,y+=v>>>16,v&=65535,v+=u*f,y+=v>>>16,v&=65535,y+=a*h,p+=y>>>16,y&=65535,y+=s*f,p+=y>>>16,y&=65535,y+=u*l,p+=y>>>16,y&=65535,p+=r*h+a*f+s*l+u*c,p&=65535,i(v<<16|m,p<<16|y,this.unsigned)},C.mul=C.multiply,C.divide=function(e){if(t(e)||(e=o(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?y:g;var r,i,a;if(this.unsigned)e.unsigned||(e=e.toUnsigned());else{if(this.eq(w)){if(e.eq(v)||e.eq(b))return w;if(e.eq(w))return v;var s=this.shr(1);return r=s.div(e).shl(1),r.eq(g)?e.isNegative()?v:b:(i=this.sub(e.mul(r)),a=r.add(i.div(e)))}if(e.eq(w))return this.unsigned?y:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg()}if(this.unsigned){if(e.gt(this))return y;if(e.gt(this.shru(1)))return m;a=y}else a=g;
10for(i=this;i.gte(e);){r=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var u=Math.ceil(Math.log(r)/Math.LN2),l=48>=u?1:c(2,u-48),f=n(r),h=f.mul(e);h.isNegative()||h.gt(i);)r-=l,f=n(r,this.unsigned),h=f.mul(e);f.isZero()&&(f=v),a=a.add(f),i=i.sub(h)}return a},C.div=C.divide,C.modulo=function(e){return t(e)||(e=o(e)),this.sub(this.div(e).mul(e))},C.mod=C.modulo,C.not=function(){return i(~this.low,~this.high,this.unsigned)},C.and=function(e){return t(e)||(e=o(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},C.or=function(e){return t(e)||(e=o(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},C.xor=function(e){return t(e)||(e=o(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},C.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0===(e&=63)?this:32>e?i(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):i(0,this.low<<e-32,this.unsigned)},C.shl=C.shiftLeft,C.shiftRight=function(e){return t(e)&&(e=e.toInt()),0===(e&=63)?this:32>e?i(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):i(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},C.shr=C.shiftRight,C.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),e&=63,0===e)return this;var r=this.high;if(32>e){var n=this.low;return i(n>>>e|r<<32-e,r>>>e,this.unsigned)}return 32===e?i(r,0,this.unsigned):i(r>>>e-32,0,this.unsigned)},C.shru=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},e})},{}],127:[function(e,t,r){!function(){function r(e,t){var r=function(){return new s.aes.Algorithm(e,t)};s.cipher.registerAlgorithm(e,r)}function n(){p=!0,l=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;128>t;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;u=new Array(256),c=new Array(256),f=new Array(4),h=new Array(4);for(var t=0;4>t;++t)f[t]=new Array(256),h[t]=new Array(256);for(var r,n,i,a,o,s,d,g=0,y=0,t=0;256>t;++t){a=y^y<<1^y<<2^y<<3^y<<4,a=a>>8^255&a^99,u[g]=a,c[a]=g,o=e[a],r=e[g],n=e[r],i=e[n],s=o<<24^a<<16^a<<8^(a^o),d=(r^n^i)<<24^(g^i)<<16^(g^n^i)<<8^(g^r^i);for(var v=0;4>v;++v)f[v][g]=s,h[v][a]=d,s=s<<24|s>>>8,d=d<<24|d>>>8;0===g?g=y=1:(g=r^e[e[e[r^i]]],y^=e[e[y]])}}function i(e,t){for(var r,n=e.slice(0),i=1,a=n.length,o=a+6+1,s=d*o,c=a;s>c;++c)r=n[c-1],c%a===0?(r=u[r>>>16&255]<<24^u[r>>>8&255]<<16^u[255&r]<<8^u[r>>>24]^l[i]<<24,i++):a>6&&c%a===4&&(r=u[r>>>24]<<24^u[r>>>16&255]<<16^u[r>>>8&255]<<8^u[255&r]),n[c]=n[c-a]^r;if(t){var f,p=h[0],g=h[1],y=h[2],v=h[3],m=n.slice(0);s=n.length;for(var c=0,b=s-d;s>c;c+=d,b-=d)if(0===c||c===s-d)m[c]=n[b],m[c+1]=n[b+3],m[c+2]=n[b+2],m[c+3]=n[b+1];else for(var E=0;d>E;++E)f=n[b+E],m[c+(3&-E)]=p[u[f>>>24]]^g[u[f>>>16&255]]^y[u[f>>>8&255]]^v[u[255&f]];n=m}return n}function a(e,t,r,n){var i,a,o,s,l,p=e.length/4-1;n?(i=h[0],a=h[1],o=h[2],s=h[3],l=c):(i=f[0],a=f[1],o=f[2],s=f[3],l=u);var d,g,y,v,m,b,E;d=t[0]^e[0],g=t[n?3:1]^e[1],y=t[2]^e[2],v=t[n?1:3]^e[3];for(var _=3,w=1;p>w;++w)m=i[d>>>24]^a[g>>>16&255]^o[y>>>8&255]^s[255&v]^e[++_],b=i[g>>>24]^a[y>>>16&255]^o[v>>>8&255]^s[255&d]^e[++_],E=i[y>>>24]^a[v>>>16&255]^o[d>>>8&255]^s[255&g]^e[++_],v=i[v>>>24]^a[d>>>16&255]^o[g>>>8&255]^s[255&y]^e[++_],d=m,g=b,y=E;r[0]=l[d>>>24]<<24^l[g>>>16&255]<<16^l[y>>>8&255]<<8^l[255&v]^e[++_],r[n?3:1]=l[g>>>24]<<24^l[y>>>16&255]<<16^l[v>>>8&255]<<8^l[255&d]^e[++_],r[2]=l[y>>>24]<<24^l[v>>>16&255]<<16^l[d>>>8&255]<<8^l[255&g]^e[++_],r[n?1:3]=l[v>>>24]<<24^l[d>>>16&255]<<16^l[g>>>8&255]<<8^l[255&y]^e[++_]}function o(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="AES-"+r;t=e.decrypt?s.cipher.createDecipher(n,e.key):s.cipher.createCipher(n,e.key);var i=t.start;return t.start=function(e,r){var n=null;r instanceof s.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,i.call(t,r)},t}var s={aes:t.exports||{},cipher:e("./cipher"),util:e("./util")};s.aes.startEncrypting=function(e,t,r,n){var i=o({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},s.aes.createEncryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!1,mode:t})},s.aes.startDecrypting=function(e,t,r,n){var i=o({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},s.aes.createDecryptionCipher=function(e,t){return o({key:e,output:null,decrypt:!0,mode:t})},s.aes.Algorithm=function(e,t){p||n();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return a(r._w,e,t,!1)},decrypt:function(e,t){return a(r._w,e,t,!0)}}}),r._init=!1},s.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(s.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=s.util.createBuffer();for(var n=0;n<t.length;++n)r.putByte(t[n])}}else r=s.util.createBuffer(r);if(!s.util.isArray(r)){t=r,r=[];var a=t.length();if(16===a||24===a||32===a){a>>>=2;
10for(var n=0;a>n;++n)r.push(t.getInt32())}}if(!s.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var o=this.mode.name,u=-1!==["CFB","OFB","CTR","GCM"].indexOf(o);this._w=i(r,e.decrypt&&!u),this._init=!0}},s.aes._expandKey=function(e,t){return p||n(),i(e,t)},s.aes._updateBlock=a,e("./cipherModes"),r("AES-CBC",s.cipher.modes.cbc),r("AES-CFB",s.cipher.modes.cfb),r("AES-OFB",s.cipher.modes.ofb),r("AES-CTR",s.cipher.modes.ctr),r("AES-GCM",s.cipher.modes.gcm);var u,c,l,f,h,p=!1,d=4}()},{"./cipher":130,"./cipherModes":131,"./util":156}],128:[function(e,t,r){!function(){function t(e,t,n){var i=t.entity===o.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:o.cipher.createDecipher("AES-CBC",i?n.keys.server_write_key:n.keys.client_write_key),iv:i?n.keys.server_write_IV:n.keys.client_write_IV},e.write.cipherState={init:!1,cipher:o.cipher.createCipher("AES-CBC",i?n.keys.client_write_key:n.keys.server_write_key),iv:i?n.keys.client_write_IV:n.keys.server_write_IV},e.read.cipherFunction=a,e.write.cipherFunction=r,e.read.macLength=e.write.macLength=n.mac_length,e.read.macFunction=e.write.macFunction=s.hmac_sha1}function r(e,t){var r=!1,i=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(i),t.updateSequenceNumber();var a;a=e.version.minor===s.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:o.random.getBytesSync(16),t.cipherState.init=!0;var u=t.cipherState.cipher;return u.start({iv:a}),e.version.minor>=s.Versions.TLS_1_1.minor&&u.output.putBytes(a),u.update(e.fragment),u.finish(n)&&(e.fragment=u.output,e.length=e.fragment.length(),r=!0),r}function n(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function i(e,t,r){var n=!0;if(r){for(var i=t.length(),a=t.last(),o=i-1-a;i-1>o;++o)n=n&&t.at(o)==a;n&&t.truncate(a+1)}return n}function a(e,t){var r=!1;++u;var n;n=e.version.minor===s.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:e.fragment.getBytes(16),t.cipherState.init=!0;var a=t.cipherState.cipher;a.start({iv:n}),a.update(e.fragment),r=a.finish(i);for(var c=t.macLength,l="",f=0;c>f;++f)l+=String.fromCharCode(0);var h=a.output.length();h>=c?(e.fragment=a.output.getBytes(h-c),l=a.output.getBytes(c)):e.fragment=a.output.getBytes(),e.fragment=o.util.createBuffer(e.fragment),e.length=e.fragment.length();var p=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=p===l&&r}var o={tls:e("./tls"),cipher:e("./cipher"),util:e("./util")};e("./aes");var s=o.tls;s.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=s.BulkCipherAlgorithm.aes,e.cipher_type=s.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=s.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:t},s.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=s.BulkCipherAlgorithm.aes,e.cipher_type=s.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=s.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:t};var u=0}()},{"./aes":127,"./cipher":130,"./tls":155,"./util":156}],129:[function(e,t,r){!function(){var r={asn1:t.exports||{},util:e("./util"),pki:{}},n=r.asn1;r.pki=e("./pki"),n.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},n.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},n.create=function(e,t,n,i){if(r.util.isArray(i)){for(var a=[],o=0;o<i.length;++o)void 0!==i[o]&&a.push(i[o]);i=a}return{tagClass:e,type:t,constructed:n,composed:n||r.util.isArray(i),value:i}};var i=function(e){var t=e.getByte();if(128!==t){var r,n=128&t;return r=n?e.getInt((127&t)<<3):t}};n.fromDer=function(e,t){if(void 0===t&&(t=!0),"string"==typeof e&&(e=r.util.createBuffer(e)),e.length()<2){var a=new Error("Too few bytes to parse DER.");throw a.bytes=e.length(),a}var o=e.getByte(),s=192&o,u=31&o,c=i(e);if(e.length()<c){if(t){var a=new Error("Too few bytes to read ASN.1 value.");throw a.detail=e.length()+" < "+c,a}c=e.length()}var l,f=32===(32&o),h=f;if(!h&&s===n.Class.UNIVERSAL&&u===n.Type.BITSTRING&&c>1){var p=e.read,d=e.getByte();if(0===d){o=e.getByte();var g=192&o;if(g===n.Class.UNIVERSAL||g===n.Class.CONTEXT_SPECIFIC)try{var y=i(e);h=y===c-(e.read-p),h&&(++p,--c)}catch(v){}}e.read=p}if(h)if(l=[],void 0===c)for(;;){if(e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2);break}l.push(n.fromDer(e,t))}else for(var m=e.length();c>0;)l.push(n.fromDer(e,t)),c-=m-e.length(),m=e.length();else{if(void 0===c){if(t)throw new Error("Non-constructed ASN.1 object of indefinite length.");c=e.length()}if(u===n.Type.BMPSTRING){l="";for(var b=0;c>b;b+=2)l+=String.fromCharCode(e.getInt16())}else l=e.getBytes(c)}return n.create(s,u,f,l)},n.toDer=function(e){var t=r.util.createBuffer(),i=e.tagClass|e.type,a=r.util.createBuffer();
10if(e.composed){e.constructed?i|=32:a.putByte(0);for(var o=0;o<e.value.length;++o)void 0!==e.value[o]&&a.putBuffer(n.toDer(e.value[o]))}else if(e.type===n.Type.BMPSTRING)for(var o=0;o<e.value.length;++o)a.putInt16(e.value.charCodeAt(o));else a.putBytes(e.value);if(t.putByte(i),a.length()<=127)t.putByte(127&a.length());else{var s=a.length(),u="";do u+=String.fromCharCode(255&s),s>>>=8;while(s>0);t.putByte(128|u.length);for(var o=u.length-1;o>=0;--o)t.putByte(u.charCodeAt(o))}return t.putBuffer(a),t},n.oidToDer=function(e){var t=e.split("."),n=r.util.createBuffer();n.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var i,a,o,s,u=2;u<t.length;++u){i=!0,a=[],o=parseInt(t[u],10);do s=127&o,o>>>=7,i||(s|=128),a.push(s),i=!1;while(o>0);for(var c=a.length-1;c>=0;--c)n.putByte(a[c])}return n},n.derToOid=function(e){var t;"string"==typeof e&&(e=r.util.createBuffer(e));var n=e.getByte();t=Math.floor(n/40)+"."+n%40;for(var i=0;e.length()>0;)n=e.getByte(),i<<=7,128&n?i+=127&n:(t+="."+(i+n),i=0);return t},n.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),a=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),s=0;if(e.length>11){var u=e.charAt(10),c=10;"+"!==u&&"-"!==u&&(s=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,n,i),t.setUTCHours(a,o,s,0),c&&(u=e.charAt(c),"+"===u||"-"===u)){var l=parseInt(e.substr(c+1,2),10),f=parseInt(e.substr(c+4,2),10),h=60*l+f;h*=6e4,"+"===u?t.setTime(+t-h):t.setTime(+t+h)}return t},n.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),a=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),s=parseInt(e.substr(12,2),10),u=0,c=0,l=!1;"Z"===e.charAt(e.length-1)&&(l=!0);var f=e.length-5,h=e.charAt(f);if("+"===h||"-"===h){var p=parseInt(e.substr(f+1,2),10),d=parseInt(e.substr(f+4,2),10);c=60*p+d,c*=6e4,"+"===h&&(c*=-1),l=!0}return"."===e.charAt(14)&&(u=1e3*parseFloat(e.substr(14),10)),l?(t.setUTCFullYear(r,n,i),t.setUTCHours(a,o,s,u),t.setTime(+t+c)):(t.setFullYear(r,n,i),t.setHours(a,o,s,u)),t},n.dateToUtcTime=function(e){var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},n.integerToDer=function(e){var t=r.util.createBuffer();if(e>=-128&&128>e)return t.putSignedInt(e,8);if(e>=-32768&&32768>e)return t.putSignedInt(e,16);if(e>=-8388608&&8388608>e)return t.putSignedInt(e,24);if(e>=-2147483648&&2147483648>e)return t.putSignedInt(e,32);var n=new Error("Integer too large; max is 32-bits.");throw n.integer=e,n},n.derToInteger=function(e){"string"==typeof e&&(e=r.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)}
10,n.validate=function(e,t,i,a){var o=!1;if(e.tagClass!==t.tagClass&&"undefined"!=typeof t.tagClass||e.type!==t.type&&"undefined"!=typeof t.type)a&&(e.tagClass!==t.tagClass&&a.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'), 11e.type!==t.type&&a.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||"undefined"==typeof t.constructed){if(o=!0,t.value&&r.util.isArray(t.value))for(var s=0,u=0;o&&u<t.value.length;++u)o=t.value[u].optional||!1,e.value[s]&&(o=n.validate(e.value[s],t.value[u],i,a),o?++s:t.value[u].optional&&(o=!0)),!o&&a&&a.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');o&&i&&(t.capture&&(i[t.capture]=e.value),t.captureAsn1&&(i[t.captureAsn1]=e))}else a&&a.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');return o};var a=/[^\\u0000-\\u00ff]/;n.prettyPrint=function(e,t,i){var o="";t=t||0,i=i||2,t>0&&(o+="\n");for(var s="",u=0;t*i>u;++u)s+=" ";switch(o+=s+"Tag: ",e.tagClass){case n.Class.UNIVERSAL:o+="Universal:";break;case n.Class.APPLICATION:o+="Application:";break;case n.Class.CONTEXT_SPECIFIC:o+="Context-Specific:";break;case n.Class.PRIVATE:o+="Private:"}if(e.tagClass===n.Class.UNIVERSAL)switch(o+=e.type,e.type){case n.Type.NONE:o+=" (None)";break;case n.Type.BOOLEAN:o+=" (Boolean)";break;case n.Type.BITSTRING:o+=" (Bit string)";break;case n.Type.INTEGER:o+=" (Integer)";break;case n.Type.OCTETSTRING:o+=" (Octet string)";break;case n.Type.NULL:o+=" (Null)";break;case n.Type.OID:o+=" (Object Identifier)";break;case n.Type.ODESC:o+=" (Object Descriptor)";break;case n.Type.EXTERNAL:o+=" (External or Instance of)";break;case n.Type.REAL:o+=" (Real)";break;case n.Type.ENUMERATED:o+=" (Enumerated)";break;case n.Type.EMBEDDED:o+=" (Embedded PDV)";break;case n.Type.UTF8:o+=" (UTF8)";break;case n.Type.ROID:o+=" (Relative Object Identifier)";break;case n.Type.SEQUENCE:o+=" (Sequence)";break;case n.Type.SET:o+=" (Set)";break;case n.Type.PRINTABLESTRING:o+=" (Printable String)";break;case n.Type.IA5String:o+=" (IA5String (ASCII))";break;case n.Type.UTCTIME:o+=" (UTC time)";break;case n.Type.GENERALIZEDTIME:o+=" (Generalized time)";break;case n.Type.BMPSTRING:o+=" (BMP String)"}else o+=e.type;if(o+="\n",o+=s+"Constructed: "+e.constructed+"\n",e.composed){for(var c=0,l="",u=0;u<e.value.length;++u)void 0!==e.value[u]&&(c+=1,l+=n.prettyPrint(e.value[u],t+1,i),u+1<e.value.length&&(l+=","));o+=s+"Sub values: "+c+l}else{if(o+=s+"Value: ",e.type===n.Type.OID){var f=n.derToOid(e.value);o+=f,r.pki&&r.pki.oids&&f in r.pki.oids&&(o+=" ("+r.pki.oids[f]+") ")}if(e.type===n.Type.INTEGER)try{o+=n.derToInteger(e.value)}catch(h){o+="0x"+r.util.bytesToHex(e.value)}else e.type===n.Type.OCTETSTRING?(a.test(e.value)||(o+="("+e.value+") "),o+="0x"+r.util.bytesToHex(e.value)):o+=e.type===n.Type.UTF8?r.util.decodeUtf8(e.value):e.type===n.Type.PRINTABLESTRING||e.type===n.Type.IA5String?e.value:a.test(e.value)?"0x"+r.util.bytesToHex(e.value):0===e.value.length?"[null]":e.value}return o}}()},{"./pki":146,"./util":156}],130:[function(e,t,r){!function(){var r={cipher:t.exports||{},util:e("./util")};r.cipher=r.cipher||{},r.cipher.algorithms=r.cipher.algorithms||{},r.cipher.createCipher=function(e,t){var n=e;if("string"==typeof n&&(n=r.cipher.getAlgorithm(n),n&&(n=n())),!n)throw new Error("Unsupported algorithm: "+e);return new r.cipher.BlockCipher({algorithm:n,key:t,decrypt:!1})},r.cipher.createDecipher=function(e,t){var n=e;if("string"==typeof n&&(n=r.cipher.getAlgorithm(n),n&&(n=n())),!n)throw new Error("Unsupported algorithm: "+e);return new r.cipher.BlockCipher({algorithm:n,key:t,decrypt:!0})},r.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),r.cipher.algorithms[e]=t},r.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in r.cipher.algorithms?r.cipher.algorithms[e]:null};var n=r.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};n.prototype.start=function(e){e=e||{};var t={};for(var n in e)t[n]=e[n];t.decrypt=this._decrypt,this._finish=!1,this._input=r.util.createBuffer(),this.output=e.output||r.util.createBuffer(),this.mode.start(t)},n.prototype.update=function(e){for(this._finish||this._input.putBuffer(e);this._input.length()>=this.blockSize||this._input.length()>0&&this._finish;)this._op.call(this.mode,this._input,this.output);this._input.compact()}
11,n.prototype.finish=function(e){e&&"CBC"===this.mode.name&&(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,this._decrypt||!this.mode.pad||this.mode.pad(this._input,t)?(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t)?!1:!this.mode.afterFinish||this.mode.afterFinish(this.output,t)):!1}}()},{"./util":156}],131:[function(e,t,r){!function(){function r(e){if("string"==typeof e&&(e=a.util.createBuffer(e)),a.util.isArray(e)&&e.length>4){var t=e;e=a.util.createBuffer();for(var r=0;r<e.length;++r)e.putByte(t[r])}return a.util.isArray(e)||(e=[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]),e}function n(e){e[e.length-1]=e[e.length-1]+1&4294967295}function i(e){return[e/4294967296|0,4294967295&e]}var a={cipher:e("./cipher"),util:e("./util")},o=a.cipher.modes=t.exports||{};o.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._blocks=this.blockSize/4,this._inBlock=new Array(this._blocks),this._outBlock=new Array(this._blocks)},o.ecb.prototype.start=function(e){},o.ecb.prototype.encrypt=function(e,t){for(var r=0;r<this._blocks;++r)this._inBlock[r]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var r=0;r<this._blocks;++r)t.putInt32(this._outBlock[r])},o.ecb.prototype.decrypt=function(e,t){for(var r=0;r<this._blocks;++r)this._inBlock[r]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var r=0;r<this._blocks;++r)t.putInt32(this._outBlock[r])},o.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},o.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return n>this.blockSize<<2?!1:(e.truncate(n),!0)},o.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._blocks=this.blockSize/4,this._inBlock=new Array(this._blocks),this._outBlock=new Array(this._blocks)},o.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv),this._prev=this._iv.slice(0)}},o.cbc.prototype.encrypt=function(e,t){for(var r=0;r<this._blocks;++r)this._inBlock[r]=this._prev[r]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var r=0;r<this._blocks;++r)t.putInt32(this._outBlock[r]);this._prev=this._outBlock},o.cbc.prototype.decrypt=function(e,t){for(var r=0;r<this._blocks;++r)this._inBlock[r]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var r=0;r<this._blocks;++r)t.putInt32(this._prev[r]^this._outBlock[r]);this._prev=this._inBlock.slice(0)},o.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},o.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return n>this.blockSize<<2?!1:(e.truncate(n),!0)},o.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._blocks=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._blocks)},o.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv),this._inBlock=this._iv.slice(0)},o.cfb.prototype.encrypt=function(e,t){this.cipher.encrypt(this._inBlock,this._outBlock);for(var r=0;r<this._blocks;++r)this._inBlock[r]=e.getInt32()^this._outBlock[r],t.putInt32(this._inBlock[r])},o.cfb.prototype.decrypt=function(e,t){this.cipher.encrypt(this._inBlock,this._outBlock);for(var r=0;r<this._blocks;++r)this._inBlock[r]=e.getInt32(),t.putInt32(this._inBlock[r]^this._outBlock[r])},o.cfb.prototype.afterFinish=function(e,t){return t.overflow>0&&e.truncate(this.blockSize-t.overflow),!0},o.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._blocks=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._blocks)},o.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv),this._inBlock=this._iv.slice(0)},o.ofb.prototype.encrypt=function(e,t){this.cipher.encrypt(this._inBlock,this._outBlock);for(var r=0;r<this._blocks;++r)t.putInt32(e.getInt32()^this._outBlock[r]),this._inBlock[r]=this._outBlock[r]},o.ofb.prototype.decrypt=o.ofb.prototype.encrypt,o.ofb.prototype.afterFinish=function(e,t){return t.overflow>0&&e.truncate(this.blockSize-t.overflow),!0},o.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._blocks=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._blocks)},o.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv),this._inBlock=this._iv.slice(0)},o.ctr.prototype.encrypt=function(e,t){this.cipher.encrypt(this._inBlock,this._outBlock),n(this._inBlock);for(var r=0;r<this._blocks;++r)t.putInt32(e.getInt32()^this._outBlock[r])},o.ctr.prototype.decrypt=o.ctr.prototype.encrypt,o.ctr.prototype.afterFinish=function(e,t){return t.overflow>0&&e.truncate(this.blockSize-t.overflow),!0},o.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._blocks=this.blockSize/4,this._inBlock=new Array(this._blocks),this._outBlock=new Array(this._blocks),this._R=3774873600},o.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=a.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?a.util.createBuffer(e.additionalData):a.util.createBuffer(),"tagLength"in e?this._tagLength=e.tagLength:this._tagLength=128,this._tag=null,e.decrypt&&(this._tag=a.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._blocks),this.tag=null,this._hashSubkey=new Array(this._blocks),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var o=t.length();if(12===o)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*o)))}this._inBlock=this._j0.slice(0),n(this._inBlock),r=a.util.createBuffer(r),this._aDataLength=i(8*r.length());var s=r.length()%this.blockSize;for(s&&r.fillWithByte(0,this.blockSize-s),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},o.gcm.prototype.encrypt=function(e,t){this.cipher.encrypt(this._inBlock,this._outBlock),n(this._inBlock);for(var r=e.length(),i=0;i<this._blocks;++i)this._outBlock[i]^=e.getInt32();if(r<this.blockSize){var o=r%this.blockSize;this._cipherLength+=o;var s=a.util.createBuffer();s.putInt32(this._outBlock[0]),s.putInt32(this._outBlock[1]),s.putInt32(this._outBlock[2]),s.putInt32(this._outBlock[3]),s.truncate(this.blockSize-o),this._outBlock[0]=s.getInt32(),this._outBlock[1]=s.getInt32(),this._outBlock[2]=s.getInt32(),this._outBlock[3]=s.getInt32()}else this._cipherLength+=this.blockSize;for(var i=0;i<this._blocks;++i)t.putInt32(this._outBlock[i]);this._s=this.ghash(this._hashSubkey,this._s,this._outBlock)},o.gcm.prototype.decrypt=function(e,t){this.cipher.encrypt(this._inBlock,this._outBlock),n(this._inBlock);var r=e.length();this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._blocks;++i)t.putInt32(this._outBlock[i]^this._hashBlock[i]);r<this.blockSize?this._cipherLength+=r%this.blockSize:this._cipherLength+=this.blockSize},o.gcm.prototype.afterFinish=function(e,t){var r=!0;t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=a.util.createBuffer();var n=this._aDataLength.concat(i(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,n);var o=[];this.cipher.encrypt(this._j0,o);for(var s=0;s<this._blocks;++s)this.tag.putInt32(this._s[s]^o[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},o.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),i=0;128>i;++i){var a=e[i/32|0]&1<<31-i%32;a&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r},o.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},o.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;32>r;++r){var n=r/8|0,i=e[n]>>>4*(7-r%8)&15,a=this._m[r][i];
11t[0]^=a[0],t[1]^=a[1],t[2]^=a[2],t[3]^=a[3]}return t},o.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},o.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,a=new Array(i),o=0;i>o;++o){var s=[0,0,0,0],u=o/n|0,c=(n-1-o%n)*t;s[u]=1<<t-1<<c,a[o]=this.generateSubHashTable(this.multiply(s,e),t)}return a},o.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,i=new Array(r);i[n]=e.slice(0);for(var a=n>>>1;a>0;)this.pow(i[2*a],i[a]=[]),a>>=1;for(a=2;n>a;){for(var o=1;a>o;++o){var s=i[a],u=i[o];i[a+o]=[s[0]^u[0],s[1]^u[1],s[2]^u[2],s[3]^u[3]]}a*=2}for(i[0]=[0,0,0,0],a=n+1;r>a;++a){var c=i[a^n];i[a]=[e[0]^c[0],e[1]^c[1],e[2]^c[2],e[3]^c[3]]}return i}}()},{"./cipher":130,"./util":156}],132:[function(e,t,r){!function(){function r(e,t){var r=function(){return new o.des.Algorithm(e,t)};o.cipher.registerAlgorithm(e,r)}function n(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],a=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],u=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],f=[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],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],d=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],g=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=e.length()>8?3:1,v=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,E=0;y>E;E++){var _=e.getInt32(),w=e.getInt32();t=252645135&(_>>>4^w),w^=t,_^=t<<4,t=65535&(w>>>-16^_),_^=t,w^=t<<-16,t=858993459&(_>>>2^w),w^=t,_^=t<<2,t=65535&(w>>>-16^_),_^=t,w^=t<<-16,t=1431655765&(_>>>1^w),w^=t,_^=t<<1,t=16711935&(w>>>8^_),_^=t,w^=t<<8,t=1431655765&(_>>>1^w),w^=t,_^=t<<1,t=_<<8|w>>>20&240,_=w<<24|w<<8&16711680|w>>>8&65280|w>>>24&240,w=t;for(var C=0;C<m.length;++C){m[C]?(_=_<<2|_>>>26,w=w<<2|w>>>26):(_=_<<1|_>>>27,w=w<<1|w>>>27),_&=-15,w&=-15;var S=r[_>>>28]|n[_>>>24&15]|i[_>>>20&15]|a[_>>>16&15]|o[_>>>12&15]|s[_>>>8&15]|u[_>>>4&15],A=c[w>>>28]|l[w>>>24&15]|f[w>>>20&15]|h[w>>>16&15]|p[w>>>12&15]|d[w>>>8&15]|g[w>>>4&15];t=65535&(A>>>16^S),v[b++]=S^t,v[b++]=A^t<<16}}return v}function i(e,t,r,n){var i,a=32===e.length?3:9;i=3===a?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,g=t[0],y=t[1];o=252645135&(g>>>4^y),y^=o,g^=o<<4,o=65535&(g>>>16^y),y^=o,g^=o<<16,o=858993459&(y>>>2^g),g^=o,y^=o<<2,o=16711935&(y>>>8^g),g^=o,y^=o<<8,o=1431655765&(g>>>1^y),y^=o,g^=o<<1,g=g<<1|g>>>31,y=y<<1|y>>>31;for(var v=0;a>v;v+=3){for(var m=i[v+1],b=i[v+2],E=i[v];E!=m;E+=b){var _=y^e[E],w=(y>>>4|y<<28)^e[E+1];o=g,g=y,y=o^(u[_>>>24&63]|l[_>>>16&63]|h[_>>>8&63]|d[63&_]|s[w>>>24&63]|c[w>>>16&63]|f[w>>>8&63]|p[63&w])}o=g,g=y,y=o}g=g>>>1|g<<31,y=y>>>1|y<<31,o=1431655765&(g>>>1^y),y^=o,g^=o<<1,o=16711935&(y>>>8^g),g^=o,y^=o<<8,o=858993459&(y>>>2^g),g^=o,y^=o<<2,o=65535&(g>>>16^y),y^=o,g^=o<<16,o=252645135&(g>>>4^y),y^=o,g^=o<<4,r[0]=g,r[1]=y}function a(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?o.cipher.createDecipher(n,e.key):o.cipher.createCipher(n,e.key);var i=t.start;return t.start=function(e,r){var n=null;r instanceof o.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,i.call(t,r)},t}var o={des:t.exports||{},cipher:e("./cipher"),util:e("./util")};o.des.startEncrypting=function(e,t,r,n){var i=a({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},o.des.createEncryptionCipher=function(e,t){return a({key:e,output:null,decrypt:!1,mode:t})},o.des.startDecrypting=function(e,t,r,n){var i=a({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},o.des.createDecryptionCipher=function(e,t){return a({key:e,output:null,decrypt:!0,mode:t})},o.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},o.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=o.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=n(t),this._init=!0}},e("./cipherModes"),r("DES-ECB",o.cipher.modes.ecb),r("DES-CBC",o.cipher.modes.cbc),r("DES-CFB",o.cipher.modes.cfb),r("DES-OFB",o.cipher.modes.ofb),r("DES-CTR",o.cipher.modes.ctr),r("3DES-ECB",o.cipher.modes.ecb),r("3DES-CBC",o.cipher.modes.cbc),r("3DES-CFB",o.cipher.modes.cfb),r("3DES-OFB",o.cipher.modes.ofb),r("3DES-CTR",o.cipher.modes.ctr);var s=[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],u=[-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],c=[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],l=[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],f=[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],h=[536870928,541065216,16384,541081616,54106
115216,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],p=[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],d=[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]}()},{"./cipher":130,"./cipherModes":131,"./util":156}],133:[function(e,t,r){!function(){var r={hmac:t.exports||{},util:e("./util"),md:e("./md")};e("./md5"),e("./sha1");var n=r.hmac=r.hmac||{};n.create=function(){var e=null,t=null,n=null,i=null,a={};return a.start=function(a,o){if(null!==a)if("string"==typeof a){if(a=a.toLowerCase(),!(a in r.md.algorithms))throw new Error('Unknown hash algorithm "'+a+'"');t=r.md.algorithms[a].create()}else t=a;if(null===o)o=e;else{if("string"==typeof o)o=r.util.createBuffer(o);else if(r.util.isArray(o)){var s=o;o=r.util.createBuffer();for(var u=0;u<s.length;++u)o.putByte(s[u])}var c=o.length();c>t.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),n=r.util.createBuffer(),i=r.util.createBuffer(),c=o.length();for(var u=0;c>u;++u){var s=o.at(u);n.putByte(54^s),i.putByte(92^s)}if(c<t.blockLength)for(var s=t.blockLength-c,u=0;s>u;++u)n.putByte(54),i.putByte(92);e=o,n=n.bytes(),i=i.bytes()}t.start(),t.update(n)},a.update=function(e){t.update(e)},a.getMac=function(){var e=t.digest().bytes();return t.start(),t.update(i),t.update(e),t.digest()},a.digest=a.getMac,a}}()},{"./md":135,"./md5":136,"./sha1":152,"./util":156}],134:[function(e,t,r){!function(){r.BigInteger=e("jsbn").BigInteger}()},{jsbn:158}],135:[function(e,t,r){!function(){var e={md:t.exports||{}};e.md.algorithms={}}()},{}],136:[function(e,t,r){!function(){function r(){o=String.fromCharCode(128),o+=i.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],u=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],c=new Array(64);for(var e=0;64>e;++e)c[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}function n(e,t,r){for(var n,i,a,o,l,f,h,p,d=r.length();d>=64;){for(i=e.h0,a=e.h1,o=e.h2,l=e.h3,p=0;16>p;++p)t[p]=r.getInt32Le(),f=l^a&(o^l),n=i+f+c[p]+t[p],h=u[p],i=l,l=o,o=a,a+=n<<h|n>>>32-h;for(;32>p;++p)f=o^l&(a^o),n=i+f+c[p]+t[s[p]],h=u[p],i=l,l=o,o=a,a+=n<<h|n>>>32-h;for(;48>p;++p)f=a^o^l,n=i+f+c[p]+t[s[p]],h=u[p],i=l,l=o,o=a,a+=n<<h|n>>>32-h;for(;64>p;++p)f=o^(a|~l),n=i+f+c[p]+t[s[p]],h=u[p],i=l,l=o,o=a,a+=n<<h|n>>>32-h;e.h0=e.h0+i|0,e.h1=e.h1+a|0,e.h2=e.h2+o|0,e.h3=e.h3+l|0,d-=64}}var i={md5:t.exports||{},util:e("./util"),md:e("./md")},a=i.md5;i.md.md5=i.md.algorithms.md5=a,a.create=function(){l||r();var e=null,t=i.util.createBuffer(),a=new Array(16),s={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,messageLength64:[0,0]};return s.start=function(){return s.messageLength=0,s.messageLength64=[0,0],t=i.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},s},s.start(),s.update=function(r,o){return"utf8"===o&&(r=i.util.encodeUtf8(r)),s.messageLength+=r.length,s.messageLength64[0]+=r.length/4294967296>>>0,s.messageLength64[1]+=r.length>>>0,t.putBytes(r),n(e,a,t),(t.read>2048||0===t.length())&&t.compact(),s},s.digest=function(){var r=i.util.createBuffer();r.putBytes(t.bytes()),r.putBytes(o.substr(0,64-(s.messageLength64[1]+8&63))),r.putInt32Le(s.messageLength64[1]<<3),r.putInt32Le(s.messageLength64[0]<<3|s.messageLength64[0]>>>28);var u={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};n(u,a,r);var c=i.util.createBuffer();return c.putInt32Le(u.h0),c.putInt32Le(u.h1),c.putInt32Le(u.h2),c.putInt32Le(u.h3),c},s};var o=null,s=null,u=null,c=null,l=!1}()},{"./md":135,"./util":156}],137:[function(e,t,r){!function(){var r={mgf:t.exports||{}};r.mgf.mgf1=e("./mgf1")}()},{"./mgf1":138}],138:[function(e,t,r){!function(){var r={mgf:e("./mgf"),util:e("./util")},n=r.mgf.mgf1=t.exports;n.create=function(e){var t={generate:function(t,n){for(var i=new r.util.ByteBuffer,a=Math.ceil(n/e.digestLength),o=0;a>o;o++){var s=new r.util.ByteBuffer;s.putInt32(o),e.start(),e.update(t+s.getBytes()),i.putBuffer(e.digest())}return i.truncate(i.length()-n),i.getBytes()}};return t}}()},{"./mgf":137,"./util":156}],139:[function(e,t,r){!function(){var r=({pki:e("./pki"),oids:t.exports},t.exports||{});r["1.2.840.113549.1.1.1"]="rsaEncryption",r.rsaEncryption="1.2.840.113549.1.1.1",r["1.2.840.113549.1.1.4"]="md5WithRSAEncryption",r.md5WithRSAEncryption="1.2.840.113549.1.1.4",r["1.2.840.113549.1.1.5"]="sha1WithRSAEncryption",r.sha1WithRSAEncryption="1.2.840.113549.1.1.5",r["1.2.840.113549.1.1.7"]="RSAES-OAEP",r["RSAES-OAEP"]="1.2.840.113549.1.1.7",r["1.2.840.113549.1.1.8"]="mgf1",r.mgf1="1.2.840.113549.1.1.8",r["1.2.840.113549.1.1.9"]="pSpecified",r.pSpecified="1.2.840.113549.1.1.9",r["1.2.840.113549.1.1.10"]="RSASSA-PSS",r["RSASSA-PSS"]="1.2.840.113549.1.1.10",r["1.2.840.113549.1.1.11"]="sha256WithRSAEncryption",r.sha256WithRSAEncryption="1.2.840.113549.1.1.11",r["1.2.840.113549.1.1.12"]="sha384WithRSAEncryption",r.sha384WithRSAEncryption="1.2.840.113549.1.1.12",r["1.2.840.113549.1.1.13"]="sha512WithRSAEncryption",r.sha512WithRSAEncryption="1.2.840.113549.1.1.13",r["1.3.14.3.2.7"]="desCBC",r.desCBC="1.3.14.3.2.7",r["1.3.14.3.2.26"]="sha1",r.sha1="1.3.14.3.2.26",r["2.16.840.1.101.3.4.2.1"]="sha256",r.sha256="2.16.840.1.101.3.4.2.1",r["2.16.840.1.101.3.4.2.2"]="sha384",r.sha384="2.16.840.1.101.3.4.2.2",r["2.16.840.1.101.3.4.2.3"]="sha512",r.sha512="2.16.840.1.101.3.4.2.3",r["1.2.840.113549.2.5"]="md5",r.md5="1.2.840.113549.2.5",r["1.2.840.113549.1.7.1"]="data",r.data="1.2.840.113549.1.7.1",r["1.2.840.113549.1.7.2"]="signedData",r.signedData="1.2.840.113549.1.7.2",r["1.2.840.113549.1.7.3"]="envelopedData",r.envelopedData="1.2.840.113549.1.7.3",r["1.2.840.113549.1.7.4"]="signedAndEnvelopedData",r.signedAndEnvelopedData="1.2.840.113549.1.7.4",r["1.2.840.113549.1.7.5"]="digestedData",r.digestedData="1.2.840.113549.1.7.5",r["1.2.840.113549.1.7.6"]="encryptedData",r.encryptedData="1.2.840.113549.1.7.6",r["1.2.840.113549.1.9.1"]="emailAddress",r.emailAddress="1.2.840.113549.1.9.1",r["1.2.840.113549.1.9.2"]="unstructuredName",r.unstructuredName="1.2.840.113549.1.9.2",r["1.2.840.113549.1.9.3"]="contentType",r.contentType="1.2.840.113549.1.9.3",r["1.2.840.113549.1.9.4"]="messageDigest",r.messageDigest="1.2.840.113549.1.9.4",r["1.2.840.113549.1.9.5"]="signingTime",r.signingTime="1.2.840.113549.1.9.5",r["1.2.840.113549.1.9.6"]="counterSignature",r.counterSignature="
111.2.840.113549.1.9.6",r["1.2.840.113549.1.9.7"]="challengePassword",r.challengePassword="1.2.840.113549.1.9.7",r["1.2.840.113549.1.9.8"]="unstructuredAddress",r.unstructuredAddress="1.2.840.113549.1.9.8",r["1.2.840.113549.1.9.14"]="extensionRequest",r.extensionRequest="1.2.840.113549.1.9.14",r["1.2.840.113549.1.9.20"]="friendlyName",r.friendlyName="1.2.840.113549.1.9.20",r["1.2.840.113549.1.9.21"]="localKeyId",r.localKeyId="1.2.840.113549.1.9.21",r["1.2.840.113549.1.9.22.1"]="x509Certificate",r.x509Certificate="1.2.840.113549.1.9.22.1",r["1.2.840.113549.1.12.10.1.1"]="keyBag",r.keyBag="1.2.840.113549.1.12.10.1.1",r["1.2.840.113549.1.12.10.1.2"]="pkcs8ShroudedKeyBag",r.pkcs8ShroudedKeyBag="1.2.840.113549.1.12.10.1.2",r["1.2.840.113549.1.12.10.1.3"]="certBag",r.certBag="1.2.840.113549.1.12.10.1.3",r["1.2.840.113549.1.12.10.1.4"]="crlBag",r.crlBag="1.2.840.113549.1.12.10.1.4",r["1.2.840.113549.1.12.10.1.5"]="secretBag",r.secretBag="1.2.840.113549.1.12.10.1.5",r["1.2.840.113549.1.12.10.1.6"]="safeContentsBag",r.safeContentsBag="1.2.840.113549.1.12.10.1.6",r["1.2.840.113549.1.5.13"]="pkcs5PBES2",r.pkcs5PBES2="1.2.840.113549.1.5.13",r["1.2.840.113549.1.5.12"]="pkcs5PBKDF2",r.pkcs5PBKDF2="1.2.840.113549.1.5.12",r["1.2.840.113549.1.12.1.1"]="pbeWithSHAAnd128BitRC4",r.pbeWithSHAAnd128BitRC4="1.2.840.113549.1.12.1.1",r["1.2.840.113549.1.12.1.2"]="pbeWithSHAAnd40BitRC4",r.pbeWithSHAAnd40BitRC4="1.2.840.113549.1.12.1.2",r["1.2.840.113549.1.12.1.3"]="pbeWithSHAAnd3-KeyTripleDES-CBC",r["pbeWithSHAAnd3-KeyTripleDES-CBC"]="1.2.840.113549.1.12.1.3",r["1.2.840.113549.1.12.1.4"]="pbeWithSHAAnd2-KeyTripleDES-CBC",r["pbeWithSHAAnd2-KeyTripleDES-CBC"]="1.2.840.113549.1.12.1.4",r["1.2.840.113549.1.12.1.5"]="pbeWithSHAAnd128BitRC2-CBC",r["pbeWithSHAAnd128BitRC2-CBC"]="1.2.840.113549.1.12.1.5",r["1.2.840.113549.1.12.1.6"]="pbewithSHAAnd40BitRC2-CBC",r["pbewithSHAAnd40BitRC2-CBC"]="1.2.840.113549.1.12.1.6",r["1.2.840.113549.3.7"]="des-EDE3-CBC",r["des-EDE3-CBC"]="1.2.840.113549.3.7",r["2.16.840.1.101.3.4.1.2"]="aes128-CBC",r["aes128-CBC"]="2.16.840.1.101.3.4.1.2",r["2.16.840.1.101.3.4.1.22"]="aes192-CBC",r["aes192-CBC"]="2.16.840.1.101.3.4.1.22",r["2.16.840.1.101.3.4.1.42"]="aes256-CBC",r["aes256-CBC"]="2.16.840.1.101.3.4.1.42",r["2.5.4.3"]="commonName",r.commonName="2.5.4.3",r["2.5.4.5"]="serialName",r.serialName="2.5.4.5",r["2.5.4.6"]="countryName",r.countryName="2.5.4.6",r["2.5.4.7"]="localityName",r.localityName="2.5.4.7",r["2.5.4.8"]="stateOrProvinceName",r.stateOrProvinceName="2.5.4.8",r["2.5.4.10"]="organizationName",r.organizationName="2.5.4.10",r["2.5.4.11"]="organizationalUnitName",r.organizationalUnitName="2.5.4.11",r["2.16.840.1.113730.1.1"]="nsCertType",r.nsCertType="2.16.840.1.113730.1.1",r["2.5.29.1"]="authorityKeyIdentifier", 12r["2.5.29.2"]="keyAttributes",r["2.5.29.3"]="certificatePolicies",r["2.5.29.4"]="keyUsageRestriction",r["2.5.29.5"]="policyMapping",r["2.5.29.6"]="subtreesConstraint",r["2.5.29.7"]="subjectAltName",r["2.5.29.8"]="issuerAltName",r["2.5.29.9"]="subjectDirectoryAttributes",r["2.5.29.10"]="basicConstraints",r["2.5.29.11"]="nameConstraints",r["2.5.29.12"]="policyConstraints",r["2.5.29.13"]="basicConstraints",r["2.5.29.14"]="subjectKeyIdentifier",r.subjectKeyIdentifier="2.5.29.14",r["2.5.29.15"]="keyUsage",r.keyUsage="2.5.29.15",r["2.5.29.16"]="privateKeyUsagePeriod",r["2.5.29.17"]="subjectAltName",r.subjectAltName="2.5.29.17",r["2.5.29.18"]="issuerAltName",r.issuerAltName="2.5.29.18",r["2.5.29.19"]="basicConstraints",r.basicConstraints="2.5.29.19",r["2.5.29.20"]="cRLNumber",r["2.5.29.21"]="cRLReason",r["2.5.29.22"]="expirationDate",r["2.5.29.23"]="instructionCode",r["2.5.29.24"]="invalidityDate",r["2.5.29.25"]="cRLDistributionPoints",r["2.5.29.26"]="issuingDistributionPoint",r["2.5.29.27"]="deltaCRLIndicator",r["2.5.29.28"]="issuingDistributionPoint",r["2.5.29.29"]="certificateIssuer",r["2.5.29.30"]="nameConstraints",r["2.5.29.31"]="cRLDistributionPoints",r["2.5.29.32"]="certificatePolicies",r["2.5.29.33"]="policyMappings",r["2.5.29.34"]="policyConstraints",r["2.5.29.35"]="authorityKeyIdentifier",r["2.5.29.36"]="policyConstraints",r["2.5.29.37"]="extKeyUsage",r.extKeyUsage="2.5.29.37",r["2.5.29.46"]="freshestCRL",r["2.5.29.54"]="inhibitAnyPol
12icy",r["1.3.6.1.5.5.7.3.1"]="serverAuth",r.serverAuth="1.3.6.1.5.5.7.3.1",r["1.3.6.1.5.5.7.3.2"]="clientAuth",r.clientAuth="1.3.6.1.5.5.7.3.2",r["1.3.6.1.5.5.7.3.3"]="codeSigning",r.codeSigning="1.3.6.1.5.5.7.3.3",r["1.3.6.1.5.5.7.3.4"]="emailProtection",r.emailProtection="1.3.6.1.5.5.7.3.4",r["1.3.6.1.5.5.7.3.8"]="timeStamping",r.timeStamping="1.3.6.1.5.5.7.3.8"}()},{"./pki":146}],140:[function(e,t,r){!function(){var r={util:e("./util"),pkcs5:e("./pkcs5"),md:e("./md"),hmac:e("./hmac")};e("./sha1");var n=r.pkcs5;t.exports=r.pbkdf2=n.pbkdf2=function(e,t,n,i,a,o){function s(){return m>f?o(null,v):(p.start(null,null),p.update(t),p.update(r.util.int32ToBytes(m)),d=y=p.digest().getBytes(),b=2,void u())}function u(){return n>=b?(p.start(null,null),p.update(y),g=p.digest().getBytes(),d=r.util.xorBytes(d,g,c),y=g,++b,r.util.setImmediate(u)):(v+=f>m?d:d.substr(0,h),++m,void s())}"function"==typeof a&&(o=a,a=null),"undefined"!=typeof a&&null!==a||(a=r.md.sha1.create());var c=a.digestLength;if(i>4294967295*c){var l=new Error("Derived key is too long.");if(o)return o(l);throw l}var f=Math.ceil(i/c),h=i-(f-1)*c,p=r.hmac.create();p.start(a,e);var d,g,y,v="";if(!o){for(var m=1;f>=m;++m){p.start(null,null),p.update(t),p.update(r.util.int32ToBytes(m)),d=y=p.digest().getBytes();for(var b=2;n>=b;++b)p.start(null,null),p.update(y),g=p.digest().getBytes(),d=r.util.xorBytes(d,g,c),y=g;v+=f>m?d:d.substr(0,h)}return v}var b,m=1;s()}}()},{"./hmac":133,"./md":135,"./pkcs5":143,"./sha1":152,"./util":156}],141:[function(e,t,r){!function(){function r(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i<e.values.length;++i)r.push(e.values[i].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";for(var a=0,o=-1,i=0;i<t.length;++i,++a)if(a>65&&-1!==o){var s=t[o];","===s?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+s+t.substr(o+1),a=i-o-1,o=-1,++i}else" "!==t[i]&&" "!==t[i]&&","!==t[i]||(o=i);return t}function n(e){return e.replace(/^\s+/,"")}var i={pem:t.exports||{},util:e("./util")},a=i.pem;a.encode=function(e,t){t=t||{};var n,a="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(n={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},a+=r(n)),e.contentDomain&&(n={name:"Content-Domain",values:[e.contentDomain]},a+=r(n)),e.dekInfo&&(n={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&n.values.push(e.dekInfo.parameters),a+=r(n)),e.headers)for(var o=0;o<e.headers.length;++o)a+=r(e.headers[o]);return e.procType&&(a+="\r\n"),a+=i.util.encode64(e.body,t.maxline||64)+"\r\n",a+="-----END "+e.type+"-----\r\n"},a.decode=function(e){for(var t,r=[],a=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,o=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,s=/\r?\n/;;){if(t=a.exec(e),!t)break;var u={type:t[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:i.util.decode64(t[3])};if(r.push(u),t[2]){for(var c=t[2].split(s),l=0;t&&l<c.length;){for(var f=c[l].replace(/\s+$/,""),h=l+1;h<c.length;++h){var p=c[h];if(!/\s/.test(p[0]))break;f+=p,l=h}if(t=f.match(o)){for(var d={name:t[1],values:[]},g=t[2].split(","),y=0;y<g.length;++y)d.values.push(n(g[y]));if(u.procType)if(u.contentDomain||"Content-Domain"!==d.name)if(u.dekInfo||"DEK-Info"!==d.name)u.headers.push(d);else{if(0===d.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');u.dekInfo={algorithm:g[0],parameters:g[1]||null}}else u.contentDomain=g[0]||"";else{if("Proc-Type"!==d.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==d.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');u.procType={version:g[0],type:g[1]}}}++l}if("ENCRYPTED"===u.procType&&!u.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r}}()},{"./util":156}],142:[function(e,t,r){!function(){function r(e,t,r){r||(r=n.md.sha1.create());for(var i="",a=Math.ceil(t/r.digestLength),o=0;a>o;++o){var s=String.fromCharCode(o>>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+s),i+=r.digest().getBytes()}return i.substring(0,t)}var n={pkcs1:t.exports||{},util:e("./util"),random:e("./random"),md:e("./md")};e("./sha1");var i=n.pkcs1;i.encode_rsa_oaep=function(e,t,i){var a,o,s,u;"string"==typeof i?(a=i,o=arguments[3]||void 0,s=arguments[4]||void 0):i&&(a=i.label||void 0,o=i.seed||void 0,s=i.md||void 0,i.mgf1&&i.mgf1.md&&(u=i.mgf1.md)),s?s.start():s=n.md.sha1.create(),u||(u=s);var c=Math.ceil(e.n.bitLength()/8),l=c-2*s.digestLength-2;if(t.length>l){var f=new Error("RSAES-OAEP input message length is too long.");throw f.length=t.length,f.maxLength=l,f}a||(a=""),s.update(a,"raw");for(var h=s.digest(),p="",d=l-t.length,g=0;d>
12g;g++)p+="\x00";var y=h.getBytes()+p+"�"+t;if(o){if(o.length!==s.digestLength){var f=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw f.seedLength=o.length,f.digestLength=s.digestLength,f}}else o=n.random.getBytes(s.digestLength);var v=r(o,c-s.digestLength-1,u),m=n.util.xorBytes(y,v,y.length),b=r(m,s.digestLength,u),E=n.util.xorBytes(o,b,o.length);return"\x00"+E+m},i.decode_rsa_oaep=function(e,t,i){var a,o,s;"string"==typeof i?(a=i,o=arguments[3]||void 0):i&&(a=i.label||void 0,o=i.md||void 0,i.mgf1&&i.mgf1.md&&(s=i.mgf1.md));var u=Math.ceil(e.n.bitLength()/8);if(t.length!==u){var c=new Error("RSAES-OAEP encoded message length is invalid.");throw c.length=t.length,c.expectedLength=u,c}if(void 0===o?o=n.md.sha1.create():o.start(),s||(s=o),u<2*o.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");a||(a=""),o.update(a,"raw");for(var l=o.digest().getBytes(),f=t.charAt(0),h=t.substring(1,o.digestLength+1),p=t.substring(1+o.digestLength),d=r(p,o.digestLength,s),g=n.util.xorBytes(h,d,h.length),y=r(g,u-o.digestLength-1,s),v=n.util.xorBytes(p,y,p.length),m=v.substring(0,o.digestLength),c="\x00"!==f,b=0;b<o.digestLength;++b)c|=l.charAt(b)!==m.charAt(b);for(var E=1,_=o.digestLength,w=o.digestLength;w<v.length;w++){var C=v.charCodeAt(w),S=1&C^1,A=E?65534:0;c|=C&A,E&=S,_+=E}if(c||1!==v.charCodeAt(_))throw new Error("Invalid RSAES-OAEP padding.");return v.substring(_+1)}}()},{"./md":135,"./random":150,"./sha1":152,"./util":156}],143:[function(e,t,r){!function(){var r={pkcs5:t.exports||{}};r.pkcs5=e("./pbkdf2")}()},{"./pbkdf2":140}],144:[function(e,t,r){!function(){var r={pkcs7:t.exports,asn1:e("./asn1"),aes:e("./aes"),des:e("./des"),pki:e("./x509"),pem:e("./pem"),random:e("./random"),util:e("./util")};e("./pkcs7asn1");var n=r.asn1,i=r.pkcs7;r.pkcs7.asn1=e("./pkcs7asn1"),i.messageFromPem=function(e){var t=r.pem.decode(e)[0];if("PKCS7"!==t.type){var a=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw a.headerType=t.type,a}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var o=n.fromDer(t.body);return i.messageFromAsn1(o)},i.messageToPem=function(e,t){var i={type:"PKCS7",body:n.toDer(e.toAsn1()).getBytes()};return r.pem.encode(i,{maxline:t})},i.messageFromAsn1=function(e){var t={},a=[];if(!n.validate(e,i.asn1.contentInfoValidator,t,a)){var o=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw o.errors=a,o}var s,u=n.derToOid(t.contentType);switch(u){case r.pki.oids.envelopedData:s=i.createEnvelopedData();break;case r.pki.oids.encryptedData:s=i.createEncryptedData();break;case r.pki.oids.signedData:s=i.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+u+" is not (yet) supported.")}return s.fromAsn1(t.content.value[0]),s};var a=function(e){var t={},a=[];if(!n.validate(e,i.asn1.recipientInfoValidator,t,a)){var o=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 EnvelopedData.");throw o.errors=a,o}return{version:t.version.charCodeAt(0),issuer:r.pki.RDNAttributesAsArray(t.issuer),serialNumber:r.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:n.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}},o=function(e){return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(e.version).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[r.pki.distinguishedNameToAsn1({attributes:e.issuer}),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,r.util.hexToBytes(e.serialNumber))]),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.encryptedContent.algorithm).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,e.encryptedContent.content)])},s=function(e){for(var t=[],r=0;r<e.length;r++)t.push(a(e[r]));return t},u=function(e){for(var t=[],r=0;r<e.length;r++)t.push(o(e[r]));return t},c=function(e){return[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(r.pki.oids.data).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.algorithm).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,e.parameter.getBytes())]),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,e.content.getBytes())])]},l=function(e,t,i){var a={},o=[];if(!n.validate(t,i,a,o)){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw s.errors=s,s}var u=n.derToOid(a.contentType);if(u!==r.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");
12if(a.encryptedContent){var c="";if(r.util.isArray(a.encryptedContent))for(var l=0;l<a.encryptedContent.length;++l){if(a.encryptedContent[l].type!==n.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");c+=a.encryptedContent[l].value}else c=a.encryptedContent;e.encryptedContent={algorithm:n.derToOid(a.encAlgorithm),parameter:r.util.createBuffer(a.encParameter.value),content:r.util.createBuffer(c)}}if(a.content){var c="";if(r.util.isArray(a.content))for(var l=0;l<a.content.length;++l){if(a.content[l].type!==n.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");c+=a.content[l].value}else c=a.content;e.content=r.util.createBuffer(c)}return e.version=a.version.charCodeAt(0),e.rawCapture=a,a},f=function(e){if(void 0===e.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===e.content){var t;switch(e.encryptedContent.algorithm){case r.pki.oids["aes128-CBC"]:case r.pki.oids["aes192-CBC"]:case r.pki.oids["aes256-CBC"]:t=r.aes.createDecryptionCipher(e.encryptedContent.key);break;case r.pki.oids.desCBC:case r.pki.oids["des-EDE3-CBC"]:t=r.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}};i.createSignedData=function(){var e=null;return e={type:r.pki.oids.signedData,version:1,certificates:[],crls:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(t){l(e,t,i.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[];for(var n=e.rawCapture.certificates.value,a=0;a<n.length;++a)e.certificates.push(r.pki.certificateFromAsn1(n[a]))},toAsn1:function(){if("content"in e)throw new Error("Signing PKCS#7 content not yet implemented.");e.contentInfo||e.sign();for(var t=[],i=0;i<e.certificates.length;++i)t.push(r.pki.certificateToAsn1(e.certificates[0]));var a=[];return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.type).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(e.version).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo,n.create(n.Class.CONTEXT_SPECIFIC,0,!0,t),n.create(n.Class.CONTEXT_SPECIFIC,1,!0,a),n.create(n.Class.UNIVERSAL,n.Type.SET,!0,e.signerInfos)])])])},sign:function(t){if("content"in e)throw new Error("PKCS#7 signing not yet implemented.");"object"!=typeof e.content&&(e.contentInfo=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(r.pki.oids.data).getBytes())]),"content"in e&&e.contentInfo.value.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,e.content)])))},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(t){"string"==typeof t&&(t=r.pki.certificateFromPem(t)),e.certificates.push(t)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},i.createEncryptedData=function(){var e=null;return e={type:r.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:r.pki.oids["aes256-CBC"]},fromAsn1:function(t){l(e,t,i.asn1.encryptedDataValidator)},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),f(e)}}},i.createEnvelopedData=function(){var e=null;return e={type:r.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:r.pki.oids["aes256-CBC"]},fromAsn1:function(t){var r=l(e,t,i.asn1.envelopedDataValidator);e.recipients=s(r.recipientInfos.value)},toAsn1:function(){return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.type).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(e.version).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SET,!0,u(e.recipients)),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,c(e.encryptedContent))])])])},findRecipient:function(t){for(var r=t.issuer.attributes,n=0;n<e.recipients.length;++n){var i=e.recipients[n],a=i.issuer;
12if(i.serialNumber===t.serialNumber&&a.length===r.length){for(var o=!0,s=0;s<r.length;++s)if(a[s].type!==r[s].type||a[s].value!==r[s].value){o=!1;break}if(o)return i}}return null},decrypt:function(t,n){if(void 0===e.encryptedContent.key&&void 0!==t&&void 0!==n)switch(t.encryptedContent.algorithm){case r.pki.oids.rsaEncryption:case r.pki.oids.desCBC:var i=n.decrypt(t.encryptedContent.content);e.encryptedContent.key=r.util.createBuffer(i);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}f(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:r.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,n){if(void 0===e.encryptedContent.content){n=n||e.encryptedContent.algorithm,t=t||e.encryptedContent.key;var i,a,o;switch(n){case r.pki.oids["aes128-CBC"]:i=16,a=16,o=r.aes.createEncryptionCipher;break;case r.pki.oids["aes192-CBC"]:i=24,a=16,o=r.aes.createEncryptionCipher;break;case r.pki.oids["aes256-CBC"]:i=32,a=16,o=r.aes.createEncryptionCipher;break;case r.pki.oids["des-EDE3-CBC"]:i=24,a=8,o=r.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+n)}if(void 0===t)t=r.util.createBuffer(r.random.getBytes(i));else if(t.length()!=i)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+i+".");e.encryptedContent.algorithm=n,e.encryptedContent.key=t,e.encryptedContent.parameter=r.util.createBuffer(r.random.getBytes(a));var s=o(t);if(s.start(e.encryptedContent.parameter.copy()),s.update(e.content),!s.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=s.output}for(var u=0;u<e.recipients.length;u++){var c=e.recipients[u];if(void 0===c.encryptedContent.content)switch(c.encryptedContent.algorithm){case r.pki.oids.rsaEncryption:c.encryptedContent.content=c.encryptedContent.key.encrypt(e.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm)}}}}}}()},{"./aes":127,"./asn1":129,"./des":132,"./pem":141,"./pkcs7asn1":145,"./random":150,"./util":156,"./x509":157}],145:[function(e,t,r){!function(){var r={pkcs7asn1:t.exports||{},asn1:e("./asn1"),pkcs7:e("./pkcs7"),util:e("./util")},n=r.asn1,i=r.pkcs7asn1,a={name:"ContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};i.contentInfoValidator=a;var o={name:"EncryptedContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};i.envelopedDataValidator={name:"EnvelopedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(o)},i.encryptedDataValidator={name:"EncryptedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"}].concat(o)};var s={name:"SignerInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,c
12onstructed:!1},{name:"SignerInfo.IssuerAndSerialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0},{name:"SignerInfo.DigestAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0},{name:"SignerInfo.AuthenticatedAttributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.DigestEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0},{name:"SignerInfo.EncryptedDigest",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.UnauthenticatedAttributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0}]};i.signedDataValidator={name:"SignedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},a,{name:"SignedData.Certificates",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,capture:"signerInfos",optional:!0,value:[s]}]},i.recipientInfoValidator={name:"RecipientInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}}()},{"./asn1":129,"./pkcs7":144,"./util":156}],146:[function(e,t,r){!function(){var r={asn1:e("./asn1"),pem:e("./pem"),util:e("./util"),pki:t.exports||{}};r.pki.oids=e("./oids");var n=r.asn1,i=r.pki;i.pemToDer=function(e){var t=r.pem.decode(e)[0];if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return r.util.createBuffer(t.body)},i.privateKeyFromPem=function(e){var t=r.pem.decode(e)[0];if("PRIVATE KEY"!==t.type&&"RSA PRIVATE KEY"!==t.type){var a=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw a.headerType=t.type,a}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var o=n.fromDer(t.body);return i.privateKeyFromAsn1(o)},i.privateKeyToPem=function(e,t){var a={type:"RSA PRIVATE KEY",body:n.toDer(i.privateKeyToAsn1(e)).getBytes()};return r.pem.encode(a,{maxline:t})},i.privateKeyInfoToPem=function(e,t){var i={type:"PRIVATE KEY",body:n.toDer(e).getBytes()};return r.pem.encode(i,{maxline:t})}}()},{"./asn1":129,"./oids":139,"./pem":141,"./util":156}],147:[function(e,t,r){!function(){function r(e,t,r,a){return"workers"in r?i(e,t,r,a):n(e,t,r,a)}function n(e,t,r,i){var u=a(e,t),c=0,f=o(u.bitLength());"millerRabinTests"in r&&(f=r.millerRabinTests);var h=10;"maxBlockTime"in r&&(h=r.maxBlockTime);var p=+new Date;do{if(u.bitLength()>e&&(u=a(e,t)),u.isProbablePrime(f))return i(null,u);u.dAddOffset(l[c++%8],0)}while(0>h||+new Date-p<h);s.util.setImmediate(function(){n(e,t,r,i)})}function i(e,t,r,i){function o(){function r(r){if(!d){--s;var o=r.data;if(o.found){for(var l=0;l<n.length;++l)n[l].terminate();return d=!0,i(null,new c(o.prime,16))}u.bitLength()>e&&(u=a(e,t));var p=u.toString(16);r.target.postMessage({hex:p,workLoad:f}),u.dAddOffset(h,0)}}l=Math.max(1,l);for(var n=[],o=0;l>o;++o)n[o]=new Worker(p);for(var s=l,o=0;l>o;++o)n[o].addEventListener("message",r);var d=!1}if("undefined"==typeof Worker)return n(e,t,r,i);var u=a(e,t),l=r.workers,f=r.workLoad||100,h=30*f/8,p=r.workerScript||"forge/prime.worker.js";return-1===l?s.util.estimateCores(function(e,t){e&&(t=2),l=t-1,o()}):void o()}function a(e,t){var r=new c(e,t),n=e-1;
12return r.testBit(n)||r.bitwiseTo(c.ONE.shiftLeft(n),h,r),r.dAddOffset(31-r.mod(f).byteValue(),0),r}function o(e){return 100>=e?27:150>=e?18:200>=e?15:250>=e?12:300>=e?9:350>=e?8:400>=e?7:500>=e?6:600>=e?5:800>=e?4:1250>=e?3:2}var s={prime:t.exports||{},util:e("./util"),jsbn:e("./jsbn"),random:e("./random")},u=s.prime,c=s.jsbn.BigInteger,l=[6,4,2,4,2,4,6,2],f=new c(null);f.fromInt(30);var h=function(e,t){return e|t};u.generateProbablePrime=function(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};var i=t.algorithm||"PRIMEINC";"string"==typeof i&&(i={name:i}),i.options=i.options||{};var a=t.prng||s.random,o={nextBytes:function(e){for(var t=a.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===i.name)return r(e,o,i.options,n);throw new Error("Invalid prime generation algorithm: "+i.name)}}()},{"./jsbn":134,"./random":150,"./util":156}],148:[function(e,t,r){(function(r){!function(){var n={prng:t.exports||{},util:e("./util")},i="undefined"!=typeof r&&r.versions&&r.versions.node,a=null;n.disableNativeCode||!i||r.versions["node-webkit"]||(a=e("crypto"));var o=n.prng;o.create=function(e){function t(e){if(s.pools[0].messageLength>=32)return i(),e();var t=32-s.pools[0].messageLength<<5;s.seedFile(t,function(t,r){return t?e(t):(s.collect(r),i(),void e())})}function r(){if(s.pools[0].messageLength>=32)return i();var e=32-s.pools[0].messageLength<<5;s.collect(s.seedFileSync(e)),i()}function i(){var e=s.plugin.md.create();e.update(s.pools[0].digest().getBytes()),s.pools[0].start();for(var t=1,r=1;32>r;++r)t=31===t?2147483648:t<<2,t%s.reseeds===0&&(e.update(s.pools[r].digest().getBytes()),s.pools[r].start());var n=e.digest().getBytes();e.start(),e.update(n);var i=e.digest().getBytes();s.key=s.plugin.formatKey(n),s.seed=s.plugin.formatSeed(i),s.reseeds=4294967295===s.reseeds?0:s.reseeds+1,s.generated=0}function o(e){var t=null;if("undefined"!=typeof window){var r=window.crypto||window.msCrypto;r&&r.getRandomValues&&(t=function(e){return r.getRandomValues(e)})}var i=n.util.createBuffer();if(t)for(;i.length()<e;){var a=Math.max(1,Math.min(e-i.length(),65536)/4),o=new Uint32Array(Math.floor(a));try{t(o);for(var s=0;s<o.length;++s)i.putInt32(o[s])}catch(u){if(!("undefined"!=typeof QuotaExceededError&&u instanceof QuotaExceededError))throw u}}if(i.length()<e)for(var c,l,f,h=Math.floor(65536*Math.random());i.length()<e;){l=16807*(65535&h),c=16807*(h>>16),l+=(32767&c)<<16,l+=c>>15,l=(2147483647&l)+(l>>31),h=4294967295&l;for(var s=0;3>s;++s)f=h>>>(s<<3),f^=Math.floor(256*Math.random()),i.putByte(String.fromCharCode(255&f))}return i.getBytes(e)}for(var s={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0},u=e.md,c=new Array(32),l=0;32>l;++l)c[l]=u.create();return s.pools=c,s.pool=0,s.generate=function(e,r){function i(f){if(f)return r(f);if(l.length()>=e)return r(null,l.getBytes(e));if(s.generated>1048575&&(s.key=null),null===s.key)return n.util.nextTick(function(){t(i)});var h=a(s.key,s.seed);s.generated+=h.length,l.putBytes(h),s.key=u(a(s.key,o(s.seed))),s.seed=c(a(s.key,s.seed)),n.util.setImmediate(i)}if(!r)return s.generateSync(e);var a=s.plugin.cipher,o=s.plugin.increment,u=s.plugin.formatKey,c=s.plugin.formatSeed,l=n.util.createBuffer();s.key=null,i()},s.generateSync=function(e){var t=s.plugin.cipher,i=s.plugin.increment,a=s.plugin.formatKey,o=s.plugin.formatSeed;s.key=null;for(var u=n.util.createBuffer();u.length()<e;){s.generated>1048575&&(s.key=null),null===s.key&&r();var c=t(s.key,s.seed);s.generated+=c.length,u.putBytes(c),s.key=a(t(s.key,i(s.seed))),s.seed=o(t(s.key,s.seed))}return u.getBytes(e)},a?(s.seedFile=function(e,t){a.randomBytes(e,function(e,r){return e?t(e):void t(null,r.toString())})},s.seedFileSync=function(e){return a.randomBytes(e).toString()}):(s.seedFile=function(e,t){try{t(null,o(e))}catch(r){t(r)}},s.seedFileSync=o),s.collect=function(e){for(var t=e.length,r=0;t>r;++r)s.pools[s.pool].update(e.substr(r,1)),s.pool=31===s.pool?0:s.pool+1},s.collectInt=function(e,t){for(var r="",n=0;t>n;n+=8)r+=String.fromCharCode(e>>n&255);s.collect(r)},s.registerWorker=function(e){if(e===self)s.seedFile=function(e,t){function r(e){var n=e.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",r),t(n.forge.prng.err,n.forge.prng.bytes))}self.addEventListener("message",r),self.postMessage({forge:{prng:{needed:e}}})};else{var t=function(t){var r=t.data;r.forge&&r.forge.prng&&s.seedFile(r.forge.prng.needed,function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})})};e.addEventListener("message",t)}},s}}()}).call(this,e("_process"))},{"./util":156,_process:77,crypto:56}],149:[function(e,t,r){!function(){var r={pss:t.exports||{},random:e("./random"),util:e("./util")},n=r.pss;n.create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t=e.md,n=e.mgf,i=t.digestLength,a=e.salt||null;"string"==typeof a&&(a=r.util.createBuffer(a));var o;if("saltLength"in e)o=e.saltLength;else{if(null===a)throw new Error("Salt length not specified or specific salt not given.");o=a.length()}if(null!==a&&a.length()!==o)throw new Error("Given salt length does not match length of given salt.");var s=e.prng||r.random,u={};return u.encode=function(e,u){var c,l=u-1,f=Math.ceil(l/8),h=e.digest().getBytes();if(i+o+2>f)throw new Error("Message is too long to encrypt.");var p;p=null===a?s.getBytesSync(o):a.bytes();var d=new r.util.ByteBuffer;d.fillWithByte(0,8),d.putBytes(h),d.putBytes(p),t.start(),t.update(d.getBytes());var g=t.digest().getBytes(),y=new r.util.ByteBuffer;y.fillWithByte(0,f-o-i-2),y.putByte(1),y.putBytes(p);var v=y.getBytes(),m=f-i-1,b=n.generate(g,m),E="";for(c=0;m>c;c++)E+=String.fromCharCode(v.charCodeAt(c)^b.charCodeAt(c));var _=65280>>8*f-l&255;return E=String.fromCharCode(E.charCodeAt(0)&~_)+E.substr(1),E+g+String.fromCharCode(188)},u.verify=function(e,a,s){var u,c=s-1,l=Math.ceil(c/8);if(a=a.substr(-l),i+o+2>l)throw new Error("Inconsistent parameters to PSS signature verification.");
12if(188!==a.charCodeAt(l-1))throw new Error("Encoded message does not end in 0xBC.");var f=l-i-1,h=a.substr(0,f),p=a.substr(f,i),d=65280>>8*l-c&255;if(0!==(h.charCodeAt(0)&d))throw new Error("Bits beyond keysize not zero as expected.");var g=n.generate(p,f),y="";for(u=0;f>u;u++)y+=String.fromCharCode(h.charCodeAt(u)^g.charCodeAt(u));y=String.fromCharCode(y.charCodeAt(0)&~d)+y.substr(1);var v=l-i-o-2;for(u=0;v>u;u++)if(0!==y.charCodeAt(u))throw new Error("Leftmost octets not zero as expected");if(1!==y.charCodeAt(v))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var m=y.substr(-o),b=new r.util.ByteBuffer;b.fillWithByte(0,8),b.putBytes(e),b.putBytes(m),t.start(),t.update(b.getBytes());var E=t.digest().getBytes();return p===E},u}}()},{"./random":150,"./util":156}],150:[function(e,t,r){(function(r){!function(){var n={aes:e("./aes"),md:e("./md"),prng:e("./prng"),util:e("./util")};e("./sha256"),function(e){function i(){var e=n.prng.create(a);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}var a={},o=new Array(4),s=n.util.createBuffer();a.formatKey=function(e){var t=n.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1); 13},a.formatSeed=function(e){var t=n.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},a.cipher=function(e,t){return n.aes._updateBlock(e,t,o,!1),s.putInt32(o[0]),s.putInt32(o[1]),s.putInt32(o[2]),s.putInt32(o[3]),s.getBytes()},a.increment=function(e){return++e[3],e},a.md=n.md.sha256;var u=i(),c="undefined"!=typeof r&&r.versions&&r.versions.node,l=null;if("undefined"!=typeof window){var f=window.crypto||window.msCrypto;f&&f.getRandomValues&&(l=function(e){return f.getRandomValues(e)})}if(n.disableNativeCode||!c&&!l){if("undefined"==typeof window||void 0===window.document,u.collectInt(+new Date,32),"undefined"!=typeof navigator){var h="";for(var p in navigator)try{"string"==typeof navigator[p]&&(h+=navigator[p])}catch(d){}u.collect(h),h=null}e&&(e().mousemove(function(e){u.collectInt(e.clientX,16),u.collectInt(e.clientY,16)}),e().keypress(function(e){u.collectInt(e.charCode,8)}))}n.random=t.exports=u,n.random.createInstance=i}("undefined"!=typeof jQuery?jQuery:null)}()}).call(this,e("_process"))},{"./aes":127,"./md":135,"./prng":148,"./sha256":153,"./util":156,_process:77}],151:[function(e,t,r){!function(){function r(e,t,r){var n=s.util.createBuffer(),i=Math.ceil(t.n.bitLength()/8);if(e.length>i-11){var a=new Error("Message is too long for PKCS#1 v1.5 padding.");throw a.length=e.length,a.max=i-11,a}n.putByte(0),n.putByte(r);var o,u=i-3-e.length;if(0===r||1===r){o=0===r?0:255;for(var c=0;u>c;++c)n.putByte(o)}else for(;u>0;){for(var l=0,f=s.random.getBytes(u),c=0;u>c;++c)o=f.charCodeAt(c),0===o?++l:n.putByte(o);u=l}return n.putByte(0),n.putBytes(e),n}function n(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8),a=s.util.createBuffer(e),o=a.getByte(),u=a.getByte();if(0!==o||r&&0!==u&&1!==u||!r&&2!=u||r&&0===u&&"undefined"==typeof n)throw new Error("Encryption block is invalid.");var c=0;if(0===u){c=i-3-n;for(var l=0;c>l;++l)if(0!==a.getByte())throw new Error("Encryption block is invalid.")}else if(1===u)for(c=0;a.length()>1;){if(255!==a.getByte()){--a.read;break}++c}else if(2===u)for(c=0;a.length()>1;){if(0===a.getByte()){--a.read;break}++c}var f=a.getByte();if(0!==f||c!==i-3-a.length())throw new Error("Encryption block is invalid.");return a.getBytes()}function i(e,t,r){function n(){i(e.pBits,function(t,n){return t?r(t):(e.p=n,null!==e.q?a(t,e.q):void i(e.qBits,a))})}function i(e,t){s.prime.generateProbablePrime(e,o,t)}function a(t,o){if(t)return r(t);if(e.q=o,e.p.compareTo(e.q)<0){var s=e.p;e.p=e.q,e.q=s}if(0!==e.p.subtract(u.ONE).gcd(e.e).compareTo(u.ONE))return e.p=null,void n();if(0!==e.q.subtract(u.ONE).gcd(e.e).compareTo(u.ONE))return e.q=null,void i(e.qBits,a);if(e.p1=e.p.subtract(u.ONE),e.q1=e.q.subtract(u.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(u.ONE))return e.p=e.q=null,void n();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void i(e.qBits,a);var c=e.e.modInverse(e.phi);e.keys={privateKey:l.rsa.setPrivateKey(e.n,e.e,c,e.p,e.q,c.mod(e.p1),c.mod(e.q1),e.q.modInverse(e.p)),publicKey:l.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"function"==typeof t&&(r=t,t={}),t=t||{};var o={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};
13"prng"in t&&(o.prng=t.prng),n()}function a(e){var t=e.toString(16);return t[0]>="8"&&(t="00"+t),s.util.hexToBytes(t)}function o(e){return 100>=e?27:150>=e?18:200>=e?15:250>=e?12:300>=e?9:350>=e?8:400>=e?7:500>=e?6:600>=e?5:800>=e?4:1250>=e?3:2}var s={rsa:t.exports,pki:e("./pki"),asn1:e("./asn1"),jsbn:e("./jsbn"),pkcs1:e("./pkcs1"),prime:e("./prime"),random:e("./random"),util:e("./util")};if("undefined"==typeof u)var u=s.jsbn.BigInteger;var c=s.asn1;s.pki.rsa=s.rsa;var l=s.pki,f=[6,4,2,4,2,4,6,2],h={name:"PrivateKeyInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},p={name:"RSAPrivateKey",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},d={name:"RSAPublicKey",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},g=s.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:c.Class.UNIVERSAL,type:c.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},y=function(e){var t;if(!(e.algorithm in l.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=l.oids[e.algorithm];var n=c.oidToDer(t).getBytes(),i=c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[]),a=c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[]);a.value.push(c.create(c.Class.UNIVERSAL,c.Type.OID,!1,n)),a.value.push(c.create(c.Class.UNIVERSAL,c.Type.NULL,!1,""));var o=c.create(c.Class.UNIVERSAL,c.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(a),i.value.push(o),c.toDer(i).getBytes()},v=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);t.dP||(t.dP=t.d.mod(t.p.subtract(u.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(u.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));var n;do n=new u(s.util.bytesToHex(s.random.getBytes(t.n.bitLength()/8)),16).mod(t.n);while(n.equals(u.ZERO));e=e.multiply(n.modPow(t.e,t.n)).mod(t.n);for(var i=e.mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);i.compareTo(a)<0;)i=i.add(t.p);var o=i.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return o=o.multiply(n.modInverse(t.n)).mod(t.n)};l.rsa.encrypt=function(e,t,n){var i,a=n,o=Math.ceil(t.n.bitLength()/8);n!==!1&&n!==!0?(a=2===n,i=r(e,t,n)):(i=s.util.createBuffer(),i.putBytes(e));for(var c=new u(i.toHex(),16),l=v(c,t,a),f=l.toString(16),h=s.util.createBuffer(),p=o-Math.ceil(f.length/2);p>0;)h.putByte(0),--p;return h.putBytes(s.util.hexToBytes(f)),h.getBytes()},l.rsa.decrypt=function(e,t,r,i){var a=Math.ceil(t.n.bitLength()/8);if(e.length!==a){var o=new Error("Encrypted message length is invali
13d.");throw o.length=e.length,o.expected=a,o}var c=new u(s.util.createBuffer(e).toHex(),16);if(c.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var l=v(c,t,r),f=l.toString(16),h=s.util.createBuffer(),p=a-Math.ceil(f.length/2);p>0;)h.putByte(0),--p;return h.putBytes(s.util.hexToBytes(f)),i!==!1?n(h.getBytes(),t,r):h.getBytes()},l.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048,r=r||{};var n,i=r.prng||s.random,a={nextBytes:function(e){for(var t=i.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},o=r.algorithm||"PRIMEINC";if("PRIMEINC"!==o)throw new Error("Invalid key generation algorithm: "+o);return n={algorithm:o,state:0,bits:e,rng:a,eInt:t||65537,e:new u(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},n.e.fromInt(n.eInt),n},l.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new u(null);r.fromInt(30);for(var n,i=0,a=function(e,t){return e|t},s=+new Date,c=0;null===e.keys&&(0>=t||t>c);){if(0===e.state){var h=null===e.p?e.pBits:e.qBits,p=h-1;0===e.pqState?(e.num=new u(h,e.rng),e.num.testBit(p)||e.num.bitwiseTo(u.ONE.shiftLeft(p),a,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),i=0,++e.pqState):1===e.pqState?e.num.bitLength()>h?e.pqState=0:e.num.isProbablePrime(o(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(f[i++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(u.ONE).gcd(e.e).compareTo(u.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(u.ONE),e.q1=e.q.subtract(u.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(u.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var d=e.e.modInverse(e.phi);e.keys={privateKey:l.rsa.setPrivateKey(e.n,e.e,d,e.p,e.q,d.mod(e.p1),d.mod(e.q1),e.q.modInverse(e.p)),publicKey:l.rsa.setPublicKey(e.n,e.e)}}n=+new Date,c+=n-s,s=n}return null!==e.keys},l.rsa.generateKeyPair=function(e,t,r,n){1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(n=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(n=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537);var a=l.rsa.createKeyPairGenerationState(e,t,r);return n?void i(a,r,n):(l.rsa.stepKeyPairGenerationState(a,0),a.keys)},l.setRsaPublicKey=l.rsa.setPublicKey=function(e,t){var i={n:e,e:t};return i.encrypt=function(e,t,n){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,n){return r(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return s.pkcs1.encode_rsa_oaep(t,e,n)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var a=t.encode(e,i,!0);return l.rsa.encrypt(a,i,!0)},i.verify=function(e,t,r){"string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===r?r={verify:function(e,t){t=n(t,i,!0);var r=c.fromDer(t);return e===r.value[1].value}}:"NONE"!==r&&"NULL"!==r&&null!==r||(r={verify:function(e,t){return t=n(t,i,!0),e===t}});var a=l.rsa.decrypt(t,i,!0,!1);return r.verify(e,a,i.n.bitLength())},i},l.setRsaPrivateKey=l.rsa.setPrivateKey=function(e,t,r,i,a,o,u,c){var f={n:e,e:t,d:r,p:i,q:a,dP:o,dQ:u,qInv:c};return f.decrypt=function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=l.rsa.decrypt(e,f,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:n};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return s.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,f,!1)},f.sign=function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:y},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}}
13,r=1);var n=t.encode(e,f.n.bitLength());return l.rsa.encrypt(n,f,r)},f},l.wrapRsaPrivateKey=function(e){return c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,c.integerToDer(0).getBytes()),c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(l.oids.rsaEncryption).getBytes()),c.create(c.Class.UNIVERSAL,c.Type.NULL,!1,"")]),c.create(c.Class.UNIVERSAL,c.Type.OCTETSTRING,!1,c.toDer(e).getBytes())])},l.privateKeyFromAsn1=function(e){var t={},r=[];if(c.validate(e,h,t,r)&&(e=c.fromDer(s.util.createBuffer(t.privateKey))),t={},r=[],!c.validate(e,p,t,r)){var n=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw n.errors=r,n}var i,a,o,f,d,g,y,v;return i=s.util.createBuffer(t.privateKeyModulus).toHex(),a=s.util.createBuffer(t.privateKeyPublicExponent).toHex(),o=s.util.createBuffer(t.privateKeyPrivateExponent).toHex(),f=s.util.createBuffer(t.privateKeyPrime1).toHex(),d=s.util.createBuffer(t.privateKeyPrime2).toHex(),g=s.util.createBuffer(t.privateKeyExponent1).toHex(),y=s.util.createBuffer(t.privateKeyExponent2).toHex(),v=s.util.createBuffer(t.privateKeyCoefficient).toHex(),l.setRsaPrivateKey(new u(i,16),new u(a,16),new u(o,16),new u(f,16),new u(d,16),new u(g,16),new u(y,16),new u(v,16))},l.privateKeyToAsn1=l.privateKeyToRSAPrivateKey=function(e){return c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,c.integerToDer(0).getBytes()),c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,a(e.n)),c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,a(e.e)),c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,a(e.d)),c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,a(e.p)),c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,a(e.q)),c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,a(e.dP)),c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,a(e.dQ)),c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,a(e.qInv))])},l.publicKeyFromAsn1=function(e){var t={},r=[];if(c.validate(e,g,t,r)){var n=c.derToOid(t.publicKeyOid);if(n!==l.oids.rsaEncryption){var i=new Error("Cannot read public key. Unknown OID.");throw i.oid=n,i}e=t.rsaPublicKey}if(r=[],!c.validate(e,d,t,r)){var i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw i.errors=r,i}var a=s.util.createBuffer(t.publicKeyModulus).toHex(),o=s.util.createBuffer(t.publicKeyExponent).toHex();return l.setRsaPublicKey(new u(a,16),new u(o,16))},l.publicKeyToAsn1=l.publicKeyToSubjectPublicKeyInfo=function(e){return c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(l.oids.rsaEncryption).getBytes()),c.create(c.Class.UNIVERSAL,c.Type.NULL,!1,"")]),c.create(c.Class.UNIVERSAL,c.Type.BITSTRING,!1,[l.publicKeyToRSAPublicKey(e)])])},l.publicKeyToRSAPublicKey=function(e){return c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,a(e.n)),c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,a(e.e))])}}()},{"./asn1":129,"./jsbn":134,"./pkcs1":142,"./pki":146,"./prime":147,"./random":150,"./util":156}],152:[function(e,t,r){!function(){function r(){o=String.fromCharCode(128),o+=i.util.fillString(String.fromCharCode(0),64),s=!0}function n(e,t,r){for(var n,i,a,o,s,u,c,l,f=r.length();f>=64;){for(i=e.h0,a=e.h1,o=e.h2,s=e.h3,u=e.h4,l=0;16>l;++l)n=r.getInt32(),t[l]=n,c=s^a&(o^s),n=(i<<5|i>>>27)+c+u+1518500249+n,u=s,s=o,o=a<<30|a>>>2,a=i,i=n;for(;20>l;++l)n=t[l-3]^t[l-8]^t[l-14]^t[l-16],n=n<<1|n>>>31,t[l]=n,c=s^a&(o^s),n=(i<<5|i>>>27)+c+u+1518500249+n,u=s,s=o,o=a<<30|a>>>2,a=i,i=n;for(;32>l;++l)n=t[l-3]^t[l-8]^t[l-14]^t[l-16],n=n<<1|n>>>31,t[l]=n,c=a^o^s,n=(i<<5|i>>>27)+c+u+1859775393+n,u=s,s=o,o=a<<30|a>>>2,a=i,i=n;for(;40>l;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,c=a^o^s,n=(i<<5|i>>>27)+c+u+1859775393+n,u=s,s=o,o=a<<30|a>>>2,a=i,i=n;for(;60>l;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,c=a&o|s&(a^o),n=(i<<5|i>>>27)+c+u+2400959708+n,u=s,s=o,o=a<<30|a>>>2,a=i,i=n;for(;80>l;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,c=a^o^s,n=(i<<5|i>>>27)+c+u+3395469782+n,u=s,s=o,o=a<<30|a>>>2,a=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+a|0,e.h2=e.h2+o|0,e.h3=e.h3+s|0,e.h4=e.h4+u|0,f-=64}}var i={sha1:t.exports||{},util:e("./util"),md:e("./md")},a=i.sha1;i.md.sha1=i.md.algorithms.sha1=a,a.create=function(){s||r();var e=null,t=i.util.createBuffer(),a=new Array(80),u={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,messageLength64:[0,0]};return u.start=function(){return u.messageLength=0,u.messageLength64=[0,0],t=i.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},u},u.start(),u.update=function(r,o){return"utf8"===o&&(r=i.util.encodeUtf8(r)),u.messageLength+=r.length,u.messageLength64[0]+=r.length/4294967296>>>0,u.messageLength64[1]+=r.length>>>0,t.putBytes(r),n(e,a,t),(t.read>2048||0===t.length())&&t.compact(),u},u.digest=function(){var r=i.util.createBuffer();r.putBytes(t.bytes()),r.putBytes(o.substr(0,64-(u.messageLength64[1]+8&63))),r.putInt32(u.messageLength64[0]<<3|u.messageLength64[0]>>>28),r.putInt32(u.messageLength64[1]<<3);var s={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};n(s,a,r);var c=i.util.createBuffer();return c.putInt32(s.h0),c.putInt32(s.h1),c.putInt32(s.h2),c.putInt32(s.h3),c.putInt32(s.h4),c},u};var o=null,s=!1}()},{"./md":135,"./util":156}],153:[function(e,t,r){!function(){function r(){o=String.fromCharCode(128),o+=i.util.fillString(String.fromCharCode(0),64),u=[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,2756
13734187,3204031479,3329325298],s=!0}function n(e,t,r){for(var n,i,a,o,s,c,l,f,h,p,d,g,y,v,m,b=r.length();b>=64;){for(l=0;16>l;++l)t[l]=r.getInt32();for(;64>l;++l)n=t[l-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=t[l-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[l]=n+t[l-7]+i+t[l-16]|0;for(f=e.h0,h=e.h1,p=e.h2,d=e.h3,g=e.h4,y=e.h5,v=e.h6,m=e.h7,l=0;64>l;++l)o=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),s=v^g&(y^v),a=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),c=f&h|p&(f^h),n=m+o+s+u[l]+t[l],i=a+c,m=v,v=y,y=g,g=d+n|0,d=p,p=h,h=f,f=n+i|0;e.h0=e.h0+f|0,e.h1=e.h1+h|0,e.h2=e.h2+p|0,e.h3=e.h3+d|0,e.h4=e.h4+g|0,e.h5=e.h5+y|0,e.h6=e.h6+v|0,e.h7=e.h7+m|0,b-=64}}var i={sha256:t.exports||{},util:e("./util"),md:e("./md")},a=i.sha256;i.md.sha256=i.md.algorithms.sha256=a,a.create=function(){s||r();var e=null,t=i.util.createBuffer(),a=new Array(64),u={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,messageLength64:[0,0]};return u.start=function(){return u.messageLength=0,u.messageLength64=[0,0],t=i.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},u},u.start(),u.update=function(r,o){return"utf8"===o&&(r=i.util.encodeUtf8(r)),u.messageLength+=r.length,u.messageLength64[0]+=r.length/4294967296>>>0,u.messageLength64[1]+=r.length>>>0,t.putBytes(r),n(e,a,t),(t.read>2048||0===t.length())&&t.compact(),u},u.digest=function(){var r=i.util.createBuffer();r.putBytes(t.bytes()),r.putBytes(o.substr(0,64-(u.messageLength64[1]+8&63))),r.putInt32(u.messageLength64[0]<<3|u.messageLength64[0]>>>28),r.putInt32(u.messageLength64[1]<<3);var s={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};n(s,a,r);var c=i.util.createBuffer();return c.putInt32(s.h0),c.putInt32(s.h1),c.putInt32(s.h2),c.putInt32(s.h3),c.putInt32(s.h4),c.putInt32(s.h5),c.putInt32(s.h6),c.putInt32(s.h7),c},u};var o=null,s=!1,u=null}()},{"./md":135,"./util":156}],154:[function(e,t,r){!function(){function r(){s=String.fromCharCode(128),s+=i.util.fillString(String.fromCharCode(0),128),c=[[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]],f={"SHA-512":64,"SHA-384":48,"SHA-512/256":32,"SHA-512-224":28},l={},l["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],l["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],l["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,28279439
1307],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],l["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],u=!0}function n(e,t,r){for(var n,i,a,o,s,u,l,f,h,p,d,g,y,v,m,b,E,_,w,C,S,A,T,k,B,I,R,F,N,j,P,L,O,x,D,U=r.length();U>=128;){for(N=0;16>N;++N)t[N][0]=r.getInt32()>>>0,t[N][1]=r.getInt32()>>>0;for(;80>N;++N)L=t[N-2],j=L[0],P=L[1],n=((j>>>19|P<<13)^(P>>>29|j<<3)^j>>>6)>>>0,i=((j<<13|P>>>19)^(P<<3|j>>>29)^(j<<26|P>>>6))>>>0,x=t[N-15],j=x[0],P=x[1],a=((j>>>1|P<<31)^(j>>>8|P<<24)^j>>>7)>>>0,o=((j<<31|P>>>1)^(j<<24|P>>>8)^(j<<25|P>>>7))>>>0,O=t[N-7],D=t[N-16],P=i+O[1]+o+D[1],t[N][0]=n+O[0]+a+D[0]+(P/4294967296>>>0)>>>0,t[N][1]=P>>>0;for(y=e[0][0],v=e[0][1],m=e[1][0],b=e[1][1],E=e[2][0],_=e[2][1],w=e[3][0],C=e[3][1],S=e[4][0],A=e[4][1],T=e[5][0],k=e[5][1],B=e[6][0],I=e[6][1],R=e[7][0],F=e[7][1],N=0;80>N;++N)l=((S>>>14|A<<18)^(S>>>18|A<<14)^(A>>>9|S<<23))>>>0,f=((S<<18|A>>>14)^(S<<14|A>>>18)^(A<<23|S>>>9))>>>0,h=(B^S&(T^B))>>>0,p=(I^A&(k^I))>>>0,s=((y>>>28|v<<4)^(v>>>2|y<<30)^(v>>>7|y<<25))>>>0,u=((y<<4|v>>>28)^(v<<30|y>>>2)^(v<<25|y>>>7))>>>0,d=(y&m|E&(y^m))>>>0,g=(v&b|_&(v^b))>>>0,P=F+f+p+c[N][1]+t[N][1],n=R+l+h+c[N][0]+t[N][0]+(P/4294967296>>>0)>>>0,i=P>>>0,P=u+g,a=s+d+(P/4294967296>>>0)>>>0,o=P>>>0,R=B,F=I,B=T,I=k,T=S,k=A,P=C+i,S=w+n+(P/4294967296>>>0)>>>0,A=P>>>0,w=E,C=_,E=m,_=b,m=y,b=v,P=i+o,y=n+a+(P/4294967296>>>0)>>>0,v=P>>>0;P=e[0][1]+v,e[0][0]=e[0][0]+y+(P/4294967296>>>0)>>>0,e[0][1]=P>>>0,P=e[1][1]+b,e[1][0]=e[1][0]+m+(P/4294967296>>>0)>>>0,e[1][1]=P>>>0,P=e[2][1]+_,e[2][0]=e[2][0]+E+(P/4294967296>>>0)>>>0,e[2][1]=P>>>0,P=e[3][1]+C,e[3][0]=e[3][0]+w+(P/4294967296>>>0)>>>0,e[3][1]=P>>>0,P=e[4][1]+A,e[4][0]=e[4][0]+S+(P/4294967296>>>0)>>>0,e[4][1]=P>>>0,P=e[5][1]+k,e[5][0]=e[5][0]+T+(P/4294967296>>>0)>>>0,e[5][1]=P>>>0,P=e[6][1]+I,e[6][0]=e[6][0]+B+(P/4294967296>>>0)>>>0,e[6][1]=P>>>0,P=e[7][1]+F,e[7][0]=e[7][0]+R+(P/4294967296>>>0)>>>0,e[7][1]=P>>>0,U-=128}}var i={sha512:t.exports||{},util:e("./util"),md:e("./md")},a=i.sha512;i.md.sha512=i.md.algorithms.sha512=a;var o=i.sha384=i.sha512.sha384=i.sha512.sha384||{};o.create=function(){return a.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=o,i.sha512.sha256=i.sha512.sha256||{create:function(){return a.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return a.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,a.create=function(e){if(u||r(),"undefined"==typeof e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],a=null,o=i.util.createBuffer(),c=new Array(80),h=0;80>h;++h)c[h]=new Array(2);var p={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:f[e],messageLength:0,messageLength128:[0,0,0,0]};return p.start=function(){p.messageLength=0,p.messageLength128=[0,0,0,0],o=i.util.createBuffer(),a=new Array(t.length);for(var e=0;e<t.length;++e)a[e]=t[e].slice(0);return p},p.start(),p.update=function(e,t){"utf8"===t&&(e=i.util.encodeUtf8(e)),p.messageLength+=e.length;var r=e.length;r=[r/4294967296>>>0,r>>>0];for(var s=3;s>=0;--s)p.messageLength128[s]+=r[1],r[1]=r[0]+(p.messageLength128[s]/4294967296>>>0),p.messageLength128[s]=p.messageLength128[s]>>>0,r[0]=r[1]/4294967296>>>0;return o.putBytes(e),n(a,c,o),(o.read>2048||0===o.length())&&o.compact(),p},p.digest=function(){var t=i.util.createBuffer();t.putBytes(o.bytes()),t.putBytes(s.substr(0,128-(p.messageLength128[3]+16&127)));for(var r=[],u=0;3>u;++u)r[u]=p.messageLength128[u]<<3|p.messageLength128[u-1]>>>28;r[3]=p.messageLength128[3]<<3,t.putInt32(r[0]),t.putInt32(r[1]),t.putInt32(r[2]),t.putInt32(r[3]);for(var l=new Array(a.length),u=0;u<a.length;++u)l[u]=a[u].slice(0);n(l,c,t);var f,h=i.util.createBuffer();f="SHA-512"===e?l.length:"SHA-384"===e?l.length-2:l.length-4;for(var u=0;f>u;++u)h.putInt32(l[u][0]),u===f-1&&"SHA-512/224"===e||h.putInt32(l[u][1]);return h},p};var s=null,u=!1,c=null,l=null,f=null}()},{"./md":135,"./util":156}],155:[function(e,t,r){!function(){var r=function(e,t,r,n){var i=z.util.createBuffer(),a=e.length>>1,o=a+(1&e.length),s=e.substr(0,o),u=e.substr(a,o),c=z.util.createBuffer(),l=z.hmac.create();r=t+r;var f=Math.ceil(n/16),h=Math.ceil(n/20);l.start("MD5",s);var p=z.util.createBuffer();c.putBytes(r);for(var d=0;f>d;++d)l.start(null,null),l.update(c.getBytes()),c.putBuffer(l.digest()),l.start(null,null),l.update(c.bytes()+r),p.putBuffer(l.digest());l.start("SHA1",u);var g=z.util.createBuffer();c.clear(),c.putBytes(r);for(var d=0;h>d;++d)l.start(null,null),l.update(c.getBytes()),c.putBuffer(l.digest()),l.start(null,null),l.update(c.bytes()+r),g.putBuffer(l.digest());return i.putBytes(z.util.xorBytes(p.getBytes(),g.getBytes(),n)),i},n=function(e,t,r){var n=z.hmac.create();n.start("SHA1",e);var i=z.util.createBuffer();return i.putInt32(t[0]),i.putInt32(t[1]),i.putByte(r.type),i.putByte(r.version.major),i.putByte(r.version.minor),i.putInt16(r.length),i.putBytes(r.fragment.bytes()),n.update(i.getBytes()),n.digest().getBytes()},i=function(e,t,r){var n=!1;try{var i=e.deflate(t.fragment.getBytes());t.fragment=z.util.createBuffer(i),t.length=i.length,n=!0}catch(a){}return n},a=function(e,t,r){var n=!1;try{var i=e.inflate(t.fragment.getBytes());t.fragment=z.util.createBuffer(i),t.length=i.length,n=!0}catch(a){}return n},o=function(e,t){var r=0;switch(t){case 1:r=e.getByte();break;case 2:r=e.getInt16();break;case 3:r=e.getInt24();break;case 4:r=e.getInt32()}return z.util.createBuffer(e.getBytes(r))},s=function(e,t,r){e.putInt(r.length(),t<<3),e.putBuffer(r)},u={};u.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}},u.SupportedVersions=[u.Versions.TLS_1_1,u.Versions.TLS_1_0],u.Version=u.Supp
13ortedVersions[0],u.MaxFragment=15360,u.ConnectionEnd={server:0,client:1},u.PRFAlgorithm={tls_prf_sha256:0},u.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},u.CipherType={stream:0,block:1,aead:2},u.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},u.CompressionMethod={none:0,deflate:1},u.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},u.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20},u.Alert={},u.Alert.Level={warning:1,fatal:2},u.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100},u.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},u.CipherSuites={},u.getCipherSuite=function(e){var t=null;for(var r in u.CipherSuites){var n=u.CipherSuites[r];if(n.id[0]===e.charCodeAt(0)&&n.id[1]===e.charCodeAt(1)){t=n;break}}return t},u.handleUnexpected=function(e,t){var r=!e.open&&e.entity===u.ConnectionEnd.client;r||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.unexpected_message}})},u.handleHelloRequest=function(e,t,r){!e.handshaking&&e.handshakes>0&&(u.queue(e,u.createAlert(e,{level:u.Alert.Level.warning,description:u.Alert.Description.no_renegotiation})),u.flush(e)),e.process()},u.parseHelloMessage=function(e,t,r){var n=null,i=e.entity===u.ConnectionEnd.client;if(38>r)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});else{var a=t.fragment,s=a.length();if(n={version:{major:a.getByte(),minor:a.getByte()},random:z.util.createBuffer(a.getBytes(32)),session_id:o(a,1),extensions:[]},i?(n.cipher_suite=a.getBytes(2),n.compression_method=a.getByte()):(n.cipher_suites=o(a,2),n.compression_methods=o(a,1)),s=r-(s-a.length()),s>0){for(var c=o(a,2);c.length()>0;)n.extensions.push({type:[c.getByte(),c.getByte()],data:o(c,2)});if(!i)for(var l=0;l<n.extensions.length;++l){var f=n.extensions[l];if(0===f.type[0]&&0===f.type[1])for(var h=o(f.data,2);h.length()>0;){var p=h.getByte(); 14if(0!==p)break;e.session.extensions.server_name.serverNameList.push(o(h,2).getBytes())}}}if(e.session.version&&(n.version.major!==e.session.version.major||n.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=u.getCipherSuite(n.cipher_suite);else for(var d=z.util.createBuffer(n.cipher_suites.bytes());d.length()>0&&(e.session.cipherSuite=u.getCipherSuite(d.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.handshake_failure},cipherSuite:z.util.bytesToHex(n.cipher_suite)});i?e.session.compressionMethod=n.compression_method:e.session.compressionMethod=u.CompressionMethod.none}return n},u.createSecurityParameters=function(e,t){var r=e.entity===u.ConnectionEnd.client,n=t.random.bytes(),i=r?e.session.sp.client_random:n,a=r?n:u.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:u.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:i,server_random:a}},u.handleServerHello=function(e,t,r){var n=u.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var i=n.session_id.bytes();i.length>0&&i===e.session.id?(e.expect=d,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,u.createSecurityParameters(e,n)),e.session.id=i,e.process()}},u.handleClientHello=function(e,t,r){var n=u.parseHelloMessage(e,t,r);if(!e.fail){var i=n.session_id.bytes(),a=null;if(e.sessionCache&&(a=e.sessionCache.getSession(i),null===a?i="":(a.version.major!==n.version.major||a.version.minor>n.version.minor)&&(a=null,i="")),0===i.length&&(i=z.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=n.version,e.session.sp={},a)e.version=e.session.version=a.version,e.session.sp=a.sp;else{for(var o,s=1;
14s<u.SupportedVersions.length&&(o=u.SupportedVersions[s],!(o.minor<=n.version.minor));++s);e.version={major:o.major,minor:o.minor},e.session.version=e.version}null!==a?(e.expect=w,e.session.resuming=!0,e.session.sp.client_random=n.random.bytes()):(e.expect=e.verifyClient!==!1?b:E,e.session.resuming=!1,u.createSecurityParameters(e,n)),e.open=!0,u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createServerHello(e)})),e.session.resuming?(u.queue(e,u.createRecord(e,{type:u.ContentType.change_cipher_spec,data:u.createChangeCipherSpec()})),e.state.pending=u.createConnectionState(e),e.state.current.write=e.state.pending.write,u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createFinished(e)}))):(u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createCertificate(e)})),e.fail||(u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createServerKeyExchange(e)})),e.verifyClient!==!1&&u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createCertificateRequest(e)})),u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createServerHelloDone(e)})))),u.flush(e),e.process()}},u.handleCertificate=function(e,t,r){if(3>r)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var n,i,a=t.fragment,s={certificate_list:o(a,3)},c=[];try{for(;s.certificate_list.length()>0;)n=o(s.certificate_list,3),i=z.asn1.fromDer(n),n=z.pki.certificateFromAsn1(i,!0),c.push(n)}catch(l){return e.error(e,{message:"Could not parse certificate list.",cause:l,send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.bad_certificate}})}var h=e.entity===u.ConnectionEnd.client;!h&&e.verifyClient!==!0||0!==c.length?0===c.length?e.expect=h?f:E:(h?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],u.verifyCertificateChain(e,c)&&(e.expect=h?f:E)):e.error(e,{message:h?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}}),e.process()},u.handleServerKeyExchange=function(e,t,r){return r>0?e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.unsupported_certificate}}):(e.expect=h,void e.process())},u.handleClientKeyExchange=function(e,t,r){if(48>r)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.unsupported_certificate}});var n=t.fragment,i={enc_pre_master_secret:o(n,2).getBytes()},a=null;if(e.getPrivateKey)try{a=e.getPrivateKey(e,e.session.serverCertificate),a=z.pki.privateKeyFromPem(a)}catch(s){e.error(e,{message:"Could not get private key.",cause:s,send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}})}if(null===a)return e.error(e,{message:"No private key set.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}});try{var c=e.session.sp;c.pre_master_secret=a.decrypt(i.enc_pre_master_secret);var l=e.session.clientHelloVersion;if(l.major!==c.pre_master_secret.charCodeAt(0)||l.minor!==c.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(s){c.pre_master_secret=z.random.getBytes(48)}e.expect=w,null!==e.session.clientCertificate&&(e.expect=_),e.process()},u.handleCertificateRequest=function(e,t,r){if(3>r)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var n=t.fragment,i={certificate_types:o(n,1),certificate_authorities:o(n,2)};e.session.certificateRequest=i,e.expect=p,e.process()},u.handleCertificateVerify=function(e,t,r){if(2>r)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var n=t.fragment;n.read-=4;var i=n.bytes();n.read+=4;var a={signature:o(n,2).getBytes()},s=z.util.createBuffer();s.putBuffer(e.session.md5.digest()),s.putBuffer(e.session.sha1.digest()),s=s.getBytes();try{var c=e.session.clientCertificate;if(!c.publicKey.verify(s,a.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(l){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.handshake_failure}})}e.expect=w,e.process()},u.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.record_overflow}});if(null===e.serverCertificate){var n={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.insufficient_security}},i=0,a=e.verify(e,n.alert.description,i,[]);if(a!==!0)return(a||0===a)&&("object"!=typeof a||z.util.isArray(a)?"number"==typeof a&&(n.alert.description=a):(a.message&&(n.message=a.message),a.alert&&(n.alert.description=a.alert))),e.error(e,n)}null!==e.session.certificateRequest&&(t=u.createRecord(e,{type:u.ContentType.handshake,data:u.createCertificate(e)}),u.queue(e,t)),t=u.createRecord(e,{type:u.ContentType.handshake,data:u.createClientKeyExchange(e)}
14),u.queue(e,t),e.expect=v;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createCertificateVerify(e,t)})),u.queue(e,u.createRecord(e,{type:u.ContentType.change_cipher_spec,data:u.createChangeCipherSpec()})),e.state.pending=u.createConnectionState(e),e.state.current.write=e.state.pending.write,u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createFinished(e)})),e.expect=d,u.flush(e),e.process()};return null===e.session.certificateRequest||null===e.session.clientCertificate?o(e,null):void u.getClientSignature(e,o)},u.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var r=e.entity===u.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=u.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?g:C,e.process()},u.handleFinished=function(e,t,n){var i=t.fragment;i.read-=4;var a=i.bytes();i.read+=4;var o=t.fragment.getBytes();i=z.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var s=e.entity===u.ConnectionEnd.client,c=s?"server finished":"client finished",l=e.session.sp,f=12,h=r;return i=h(l.master_secret,c,i.getBytes(),f),i.getBytes()!==o?e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.decrypt_error}}):(e.session.md5.update(a),e.session.sha1.update(a),(e.session.resuming&&s||!e.session.resuming&&!s)&&(u.queue(e,u.createRecord(e,{type:u.ContentType.change_cipher_spec,data:u.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createFinished(e)}))),e.expect=s?y:S,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,u.flush(e),e.isConnected=!0,e.connected(e),void e.process())},u.handleAlert=function(e,t){var r,n=t.fragment,i={level:n.getByte(),description:n.getByte()};switch(i.description){case u.Alert.Description.close_notify:r="Connection closed.";break;case u.Alert.Description.unexpected_message:r="Unexpected message.";break;case u.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case u.Alert.Description.decryption_failed:r="Decryption failed.";break;case u.Alert.Description.record_overflow:r="Record overflow.";break;case u.Alert.Description.decompression_failure:r="Decompression failed.";break;case u.Alert.Description.handshake_failure:r="Handshake failure.";break;case u.Alert.Description.bad_certificate:r="Bad certificate.";break;case u.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case u.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case u.Alert.Description.certificate_expired:r="Certificate expired.";break;case u.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case u.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case u.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case u.Alert.Description.access_denied:r="Access denied.";break;case u.Alert.Description.decode_error:r="Decode error.";break;case u.Alert.Description.decrypt_error:r="Decrypt error.";break;case u.Alert.Description.export_restriction:r="Export restriction.";break;case u.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case u.Alert.Description.insufficient_security:r="Insufficient security.";break;case u.Alert.Description.internal_error:r="Internal error.";break;case u.Alert.Description.user_canceled:r="User canceled.";break;case u.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}return i.description===u.Alert.Description.close_notify?e.close():(e.error(e,{message:r,send:!1,origin:e.entity===u.ConnectionEnd.client?"server"
vendor: 8,443 bytes, line 14
14:"client",alert:i}),void e.process())},u.handleHandshake=function(e,t){var r=t.fragment,n=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=z.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var a=r.bytes(i+4);r.read+=4,n in U[e.entity][e.expect]?(e.entity!==u.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:z.md.md5.create(),sha1:z.md.sha1.create()}),n!==u.HandshakeType.hello_request&&n!==u.HandshakeType.certificate_verify&&n!==u.HandshakeType.finished&&(e.session.md5.update(a),e.session.sha1.update(a)),U[e.entity][e.expect][n](e,t,i)):u.handleUnexpected(e,t)},u.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},u.handleHeartbeat=function(e,t){var r=t.fragment,n=r.getByte(),i=r.getInt16(),a=r.getBytes(i);if(n===u.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>a.length)return e.process();u.queue(e,u.createRecord(e,{type:u.ContentType.heartbeat,data:u.createHeartbeat(u.HeartbeatMessageType.heartbeat_response,a)})),u.flush(e)}else if(n===u.HeartbeatMessageType.heartbeat_response){if(a!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,z.util.createBuffer(a))}e.process()};var c=0,l=1,f=2,h=3,p=4,d=5,g=6,y=7,v=8,m=0,b=1,E=2,_=3,w=4,C=5,S=6,A=u.handleUnexpected,T=u.handleChangeCipherSpec,k=u.handleAlert,B=u.handleHandshake,I=u.handleApplicationData,R=u.handleHeartbeat,F=[];F[u.ConnectionEnd.client]=[[A,k,B,A,R],[A,k,B,A,R],[A,k,B,A,R],[A,k,B,A,R],[A,k,B,A,R],[T,k,A,A,R],[A,k,B,A,R],[A,k,B,I,R],[A,k,B,A,R]],F[u.ConnectionEnd.server]=[[A,k,B,A,R],[A,k,B,A,R],[A,k,B,A,R],[A,k,B,A,R],[T,k,A,A,R],[A,k,B,A,R],[A,k,B,I,R],[A,k,B,A,R]];var N=u.handleHelloRequest,j=u.handleServerHello,P=u.handleCertificate,L=u.handleServerKeyExchange,O=u.handleCertificateRequest,x=u.handleServerHelloDone,D=u.handleFinished,U=[];U[u.ConnectionEnd.client]=[[A,A,j,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A],[N,A,A,A,A,A,A,A,A,A,A,P,L,O,x,A,A,A,A,A,A],[N,A,A,A,A,A,A,A,A,A,A,A,L,O,x,A,A,A,A,A,A],[N,A,A,A,A,A,A,A,A,A,A,A,A,O,x,A,A,A,A,A,A],[N,A,A,A,A,A,A,A,A,A,A,A,A,A,x,A,A,A,A,A,A],[N,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A],[N,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,D],[N,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A],[N,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A]];var M=u.handleClientHello,K=u.handleClientKeyExchange,V=u.handleCertificateVerify;U[u.ConnectionEnd.server]=[[A,M,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A],[A,A,A,A,A,A,A,A,A,A,A,P,A,A,A,A,A,A,A,A,A],[A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,K,A,A,A,A],[A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,V,A,A,A,A,A],[A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A],[A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,D],[A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A],[A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A]],u.generateKeys=function(e,t){var n=r,i=t.client_random+t.server_random;e.session.resuming||(t.master_secret=n(t.pre_master_secret,"master secret",i,48).bytes(),t.pre_master_secret=null),i=t.server_random+t.client_random;var a=2*t.mac_key_length+2*t.enc_key_length,o=e.version.major===u.Versions.TLS_1_0.major&&e.version.minor===u.Versions.TLS_1_0.minor;o&&(a+=2*t.fixed_iv_length);var s=n(t.master_secret,"key expansion",i,a),c={client_write_MAC_key:s.getBytes(t.mac_key_length),server_write_MAC_key:s.getBytes(t.mac_key_length),client_write_key:s.getBytes(t.enc_key_length),server_write_key:s.getBytes(t.enc_key_length)};return o&&(c.client_write_IV=s.getBytes(t.fixed_iv_length),c.server_write_IV=s.getBytes(t.fixed_iv_length)),c},u.createConnectionState=function(e){var t=e.entity===u.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}}),!e.fail},e.session){var o=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(o),o.keys=u.generateKeys(e,o),n.read.macKey=t?o.keys.server_write_MAC_key:o.keys.client_write_MAC_key,n.write.macKey=t?o.keys.client_write_MAC_key:o.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,o),o.compression_algorithm){case u.CompressionMethod.none:break;case u.CompressionMethod.deflate:n.read.compressFunction=a,n.write.compressFunction=i;break;default:throw new Error("Unsupported compression algorithm.")}}return n},u.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=z.util.createBuffer();return r.putInt32(t),r.putBytes(z.random.getBytes(28)),r},u.createRecord=function(e,t){if(!t.data)return null;var r={type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data};return r},u.createAlert=function(e,t){var r=z.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),u.createRecord(e,{type:u.ContentType.alert,data:r})},u.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=z.util.createBuffer(),r=0;r<e.cipherSuites.length;++r){var n=e.cipherSuites[r];t.putByte(n.id[0]),t.putByte(n.id[1])}var i=t.length(),a=z.util.createBuffer();a.putByte(u.CompressionMethod.none);var o=a.length(),c=z.util.createBuffer();if(e.virtualHost){var l=z.util.createBuffer();l.putByte(0),l.putByte(0);var f=z.util.createBuffer();f.putByte(0),s(f,2,z.util.createBuffer(e.virtualHost));var h=z.util.createBuffer();s(h,2,f),s(l,2,h),c.putBuffer(l)}var p=c.length();p>0&&(p+=2);var d=e.session.id,g=d.length+1+2+4+28+2+i+1+o+p,y=z.util.createBuffer();return y.putByte(u.HandshakeType.client_hello),y.putInt24(g),y.putByte(e.version.major),y.putByte(e.version.minor),y.putBytes(e.session.sp.client_random),s(y,1,z.util.createBuffer(d)),s(y,2,t),s(y,1,a),p>0&&s(y,2,c),y},u.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,n=z.util.createBuffer();return n.putByte(u.HandshakeType.server_hello),n.putInt24(r),n.putByte(e.version.major),n.putByte(e.version.minor),n.putBytes(e.session.sp.server_random),s(n,1,z.util.createBuffer(t)),n.putByte(e.session.cipherSuite.id[0]),n.putByte(e.session.cipherSuite.id[1]),n.putByte(e.session.compressionMethod),n},u.createCertificate=function(e){var t=e.entity===u.ConnectionEnd.client,r=null;if(e.getCertificate){var n;n=t?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,r=e.getCertificate(e,n)}var i=z.util.createBuffer();if(null!==r)try{z.util.isArray(r)||(r=[r]);for(var a=null,o=0;o<r.length;++o){var c=z.pem.decode(r[o])[0];if("CERTIFICATE"!==c.type&&"X509 CERTIFICATE"!==c.type&&"TRUSTED CERTIFICATE"!==c.type){var l=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw l.headerType=c.type,l}if(c.procType&&"ENCRYPTED"===c.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var f=z.util.createBuffer(c.body);null===a&&(a=z.asn1.fromDer(f.bytes(),!1));var h=z.util.createBuffer();s(h,3,f),i.putBuffer(h)}r=z.pki.certificateFromAsn1(a),t?e.session.clientCertificate=r:e.session.serverCertificate=r}catch(p){return e.error(e,{message:"Could not send certificate list.",cause:p,send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.bad_certificate}})}var d=3+i.length(),g=z.util.createBuffer();return g.putByte(u.HandshakeType.certificate),g.putInt24(d),s(g,3,
14i),g},u.createClientKeyExchange=function(e){var t=z.util.createBuffer();t.putByte(e.session.clientHelloVersion.major),t.putByte(e.session.clientHelloVersion.minor),t.putBytes(z.random.getBytes(46));var r=e.session.sp;r.pre_master_secret=t.getBytes();var n=e.session.serverCertificate.publicKey;t=n.encrypt(r.pre_master_secret);var i=t.length+2,a=z.util.createBuffer();return a.putByte(u.HandshakeType.client_key_exchange),a.putInt24(i),a.putInt16(t.length),a.putBytes(t),a},u.createServerKeyExchange=function(e){var t=0,r=z.util.createBuffer();return t>0&&(r.putByte(u.HandshakeType.server_key_exchange),r.putInt24(t)),r},u.getClientSignature=function(e,t){var r=z.util.createBuffer();r.putBuffer(e.session.md5.digest()),r.putBuffer(e.session.sha1.digest()),r=r.getBytes(),e.getSignature=e.getSignature||function(e,t,r){var n=null;if(e.getPrivateKey)try{n=e.getPrivateKey(e,e.session.clientCertificate),n=z.pki.privateKeyFromPem(n)}catch(i){e.error(e,{message:"Could not get private key.",cause:i,send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}})}null===n?e.error(e,{message:"No private key set.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}}):t=n.sign(t,null),r(e,t)},e.getSignature(e,r,t)},u.createCertificateVerify=function(e,t){var r=t.length+2,n=z.util.createBuffer();return n.putByte(u.HandshakeType.certificate_verify),n.putInt24(r),n.putInt16(t.length),n.putBytes(t),n},u.createCertificateRequest=function(e){var t=z.util.createBuffer();t.putByte(1);var r=z.util.createBuffer();for(var n in e.caStore.certs){var i=e.caStore.certs[n],a=z.pki.distinguishedNameToAsn1(i.subject);r.putBuffer(z.asn1.toDer(a))}var o=1+t.length()+2+r.length(),c=z.util.createBuffer();return c.putByte(u.HandshakeType.certificate_request),c.putInt24(o),s(c,1,t),s(c,2,r),c},u.createServerHelloDone=function(e){var t=z.util.createBuffer();return t.putByte(u.HandshakeType.server_hello_done),t.putInt24(0),t},u.createChangeCipherSpec=function(){var e=z.util.createBuffer();return e.putByte(1),e},u.createFinished=function(e){var t=z.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var n=e.entity===u.ConnectionEnd.client,i=e.session.sp,a=12,o=r,s=n?"client finished":"server finished";t=o(i.master_secret,s,t.getBytes(),a);var c=z.util.createBuffer();return c.putByte(u.HandshakeType.finished),c.putInt24(t.length()),c.putBuffer(t),c},u.createHeartbeat=function(e,t,r){"undefined"==typeof r&&(r=t.length);var n=z.util.createBuffer();n.putByte(e),n.putInt16(r),n.putBytes(t);var i=n.length(),a=Math.max(16,i-r-3);return n.putBytes(z.random.getBytes(a)),n},u.queue=function(e,t){if(t){if(t.type===u.ContentType.handshake){var r=t.fragment.bytes();e.session.md5.update(r),e.session.sha1.update(r),r=null}var n;if(t.fragment.length()<=u.MaxFragment)n=[t];else{n=[];for(var i=t.fragment.bytes();i.length>u.MaxFragment;)n.push(u.createRecord(e,{type:t.type,data:z.util.createBuffer(i.slice(0,u.MaxFragment))})),i=i.slice(u.MaxFragment);i.length>0&&n.push(u.createRecord(e,{type:t.type,data:z.util.createBuffer(i)}))}for(var a=0;a<n.length&&!e.fail;++a){var o=n[a],s=e.state.current.write;s.update(e,o)&&e.records.push(o)}}},u.flush=function(e){for(var t=0;t<e.records.length;++t){var r=e.records[t];e.tlsData.putByte(r.type),e.tlsData.putByte(r.version.major),e.tlsData.putByte(r.version.minor),e.tlsData.putInt16(r.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var H=function(e){switch(e){case!0:return!0;case z.pki.certificateError.bad_certificate:return u.Alert.Description.bad_certificate;case z.pki.certificateError.unsupported_certificate:return u.Alert.Description.unsupported_certificate;case z.pki.certificateError.certificate_revoked:return u.Alert.Description.certificate_revoked;case z.pki.certificateError.certificate_expired:return u.Alert.Description.certificate_expired;case z.pki.certificateError.certificate_unknown:return u.Alert.Description.certificate_unknown;case z.pki.certificateError.unknown_ca:return u.Alert.Description.unknown_ca;default:return u.Alert.Description.bad_certificate}},q=function(e){switch(e){case!0:return!0;case u.Alert.Description.bad_certificate:return z.pki.certificateError.bad_certificate;case u.Alert.Description.unsupported_certificate:return z.pki.certificateError.unsupported_certificate;case u.Alert.Description.certificate_revoked:return z.pki.certificateError.certificate_revoked;case u.Alert.Description.certificate_expired:return z.pki.certificateError.certificate_expired;case u.Alert.Description.certificate_unknown:return z.pki.certificateError.certificate_unknown;case u.Alert.Description.unknown_ca:return z.pki.certificateError.unknown_ca;default:return z.pki.certificateError.bad_certificate}};u.verifyCertificateChain=function(e,t){try{z.pki.verifyCertificateChain(e.caStore,t,function(t,r,n){var i=(H(t),e.verify(e,t,r,n));if(i!==!0){if("object"==typeof i&&!z.util.isArray(i)){var a=new Error("The application rejected the certificate.");throw a.send=!0,a.alert={level:u.Alert.Level.fatal,description:u.Alert.Description.bad_certificate},i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert),a}i!==t&&(i=q(i))}return i})}catch(r){var n=r;("object"!=typeof n||z.util.isArray(n))&&(n={send:!0,alert:{level:u.Alert.Level.fatal,description:H(r)}}),"send"in n||(n.send=!0),"alert"in n||(n.alert={level:u.Alert.Level.fatal,description:H(n.error)}),e.error(e,n)}return!e.fail},u.createSessionCache=function(e,t){var r=null;if(e&&e.getSession&&e.setSession&&e.order)r=e;else{r={},r.cache=e||{},r.capacity=Math.max(t||100,1),r.order=[];for(var n in e)r.order.length<=t?r.order.push(n):delete e[n];r.getSession=function(e){var t=null,n=null;if(e?n=z.util.bytesToHex(e):r.order.length>
140&&(n=r.order[0]),null!==n&&n in r.cache){t=r.cache[n],delete r.cache[n];for(var i in r.order)if(r.order[i]===n){r.order.splice(i,1);break}}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var n=r.order.shift();delete r.cache[n]}var n=z.util.bytesToHex(e);r.order.push(n),r.cache[n]=t}}return r},u.createConnection=function(e){var t=null;t=e.caStore?z.util.isArray(e.caStore)?z.pki.createCaStore(e.caStore):e.caStore:z.pki.createCaStore();var r=e.cipherSuites||null;if(null===r){r=[];for(var n in u.CipherSuites)r.push(u.CipherSuites[n])}var i=e.server?u.ConnectionEnd.server:u.ConnectionEnd.client,a=e.sessionCache?u.createSessionCache(e.sessionCache):null,o={version:{major:u.Version.major,minor:u.Version.minor},entity:i,sessionId:e.sessionId,caStore:t,sessionCache:a,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,n){return t},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:z.util.createBuffer(),tlsData:z.util.createBuffer(),data:z.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===u.ConnectionEnd.client?"client":"server"),r.send&&(u.queue(t,u.createAlert(t,r.alert)),u.flush(t));var n=r.fatal!==!1;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null};o.reset=function(e){o.version={major:u.Version.major,minor:u.Version.minor},o.record=null,o.session=null,o.peerCertificate=null,o.state={pending:null,current:null},o.expect=o.entity===u.ConnectionEnd.client?c:m,o.fragmented=null,o.records=[],o.open=!1,o.handshakes=0,o.handshaking=!1,o.isConnected=!1,o.fail=!(e||"undefined"==typeof e),o.input.clear(),o.tlsData.clear(),o.data.clear(),o.state.current=u.createConnectionState(o)},o.reset();var s=function(e,t){var r=t.type-u.ContentType.change_cipher_spec,n=F[e.entity][e.expect];r in n?n[r](e,t):u.handleUnexpected(e,t)},l=function(e){var t=0,r=e.input,n=r.length();if(5>n)t=5-n;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:z.util.createBuffer(),ready:!1};var i=e.record.version.major===e.version.major;i&&e.session&&e.session.version&&(i=e.record.version.minor===e.version.minor),i||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}})}return t},f=function(e){var t=0,r=e.input,n=r.length();if(n<e.record.length)t=e.record.length-n;else{e.record.fragment.putBytes(r.getBytes(e.record.length)),r.compact();var i=e.state.current.read;i.update(e,e.record)&&(null!==e.fragmented&&(e.fragmented.type===e.record.type?(e.fragmented.fragment.putBuffer(e.record.fragment),e.record=e.fragmented):e.error(e,{message:"Invalid fragmented record.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.unexpected_message}})),e.record.ready=!0)}return t};return o.handshake=function(e){if(o.entity!==u.ConnectionEnd.client)o.error(o,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(o.handshaking)o.error(o,{message:"Handshake already in progress.",fatal:!1});else{o.fail&&!o.open&&0===o.handshakes&&(o.fail=!1),o.handshaking=!0,e=e||"";var t=null;e.length>0&&(o.sessionCache&&(t=o.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&o.sessionCache&&(t=o.sessionCache.getSession(),null!==t&&(e=t.id)),o.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:z.md.md5.create(),sha1:z.md.sha1.create()},t&&(o.version=t.version,o.session.sp=t.sp),o.session.sp.client_random=u.createRandom().getBytes(),o.open=!0,u.queue(o,u.createRecord(o,{type:u.ContentType.handshake,data:u.createClientHello(o)})),u.flush(o)}},o.process=function(e){var t=0;return e&&o.input.putBytes(e),o.fail||(null!==o.record&&o.record.ready&&o.record.fragment.isEmpty()&&(o.record=null),null===o.record&&(t=l(o)),o.fail||null===o.record||o.record.ready||(t=f(o)),!o.fail&&null!==o.record&&o.record.ready&&s(o,o.record)),t},o.prepare=function(e){return u.queue(o,u.createRecord(o,{type:u.ContentType.application_data,data:z.util.createBuffer(e)})),u.flush(o)},o.prepareHeartbeatRequest=function(e,t){return e instanceof z.util.ByteBuffer&&(e=e.bytes()),"undefined"==typeof t&&(t=e.length),o.expectedHeartbeatPayload=e,u.queue(o,u.createRecord(o,{type:u.ContentType.heartbeat,data:u.createHeartbeat(u.HeartbeatMessageType.heartbeat_request,e,t)})),u.flush(o)},o.close=function(e){if(!o.fail&&o.sessionCache&&o.session){var t={id:o.session.id,version:o.session.version,sp:o.session.sp};t.sp.keys=null,o.sessionCache.setSession(t.id,t)}o.open&&(o.open=!1,o.input.clear(),(o.isConnected||o.handshaking)&&(o.isConnected=o.handshaking=!1,u.queue(o,u.createAlert(o,{level:u.Alert.Level.warning,de
14scription:u.Alert.Description.close_notify})),u.flush(o)),o.closed(o)),o.reset(e)},o};var z={tls:t.exports||{},asn1:e("./asn1"),hmac:e("./hmac"),md:e("./md"),pem:e("./pem"),pki:e("./x509"),random:e("./random"),util:e("./util")};e("./sha1"),e("./md5");for(var G in u)"function"!=typeof u[G]&&(z.tls[G]=u[G]);z.tls.prf_tls1=r,z.tls.hmac_sha1=n,z.tls.createSessionCache=u.createSessionCache,z.tls.createConnection=u.createConnection}()},{"./asn1":129,"./hmac":133,"./md":135,"./md5":136,"./pem":141,"./random":150,"./sha1":152,"./util":156,"./x509":157}],156:[function(e,t,r){(function(e){!function(){ 15function r(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(i.isArrayBuffer(e)||i.isArrayBufferView(e)){var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(n){for(var a=0;a<t.length;++a)this.putByte(t[a])}}else(e instanceof r||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}function n(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=i.isArrayBuffer(e),n=i.isArrayBufferView(e);return r||n?(r?this.data=new DataView(e):this.data=new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength)):(this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),void("writeOffset"in t&&(this.write=t.writeOffset)))}var i=t.exports||{};"undefined"!=typeof e&&e.nextTick?(i.nextTick=e.nextTick,"function"==typeof setImmediate?i.setImmediate=setImmediate:i.setImmediate=i.nextTick):"function"==typeof setImmediate?(i.setImmediate=setImmediate,i.nextTick=function(e){return setImmediate(e)}):(i.setImmediate=function(e){setTimeout(e,0)},i.nextTick=i.setImmediate),i.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},i.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer};var a=[];"undefined"!=typeof DataView&&a.push(DataView),"undefined"!=typeof Int8Array&&a.push(Int8Array),"undefined"!=typeof Uint8Array&&a.push(Uint8Array),"undefined"!=typeof Uint8ClampedArray&&a.push(Uint8ClampedArray),"undefined"!=typeof Int16Array&&a.push(Int16Array),"undefined"!=typeof Uint16Array&&a.push(Uint16Array),"undefined"!=typeof Int32Array&&a.push(Int32Array),"undefined"!=typeof Uint32Array&&a.push(Uint32Array),"undefined"!=typeof Float32Array&&a.push(Float32Array),"undefined"!=typeof Float64Array&&a.push(Float64Array),i.isArrayBufferView=function(e){for(var t=0;t<a.length;++t)if(e instanceof a[t])return!0;return!1},i.ByteBuffer=r,i.ByteStringBuffer=r;var o=4096;i.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>o&&(this.data.substr(0,1),this._constructedStringLength=0)},i.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},i.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},i.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},i.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),t>>>=1,t>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},i.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},i.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(i.encodeUtf8(e))},i.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},i.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},i.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},i.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},i.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},i.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},i.ByteStringBuffer.prototype.putInt=function(e,t){var r="";do t-=8,r+=String.fromCharCode(e>>t&255);while(t>0);return this.putBytes(r)},i.ByteStringBuffer.prototype.putSignedInt=function(e,t){return 0>e&&(e+=2<<t-1),this.putInt(e,t)},i.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},i.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},i.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},i.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},i.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},i.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},i.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},i.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},i.ByteStringBuffer.prototype.getInt=function(e){var t=0;do t=(t<<8)+this.data.charCodeAt(this.read++),e-=8;while(e>0);return t},i.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},i.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},i.ByteStringBuffer.prototype.bytes=function(e){return"undefined"==typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},i.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},i.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},i.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},i.ByteStringBuffer.prototype.copy=function(){var e=i.createBuffer(this.data);return e.read=this.read,e},i.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},i.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},i.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},i.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);16>r&&(e+="0"),e+=r.toString(16)}return e},i.ByteStringBuffer.prototype.toString=function(){return i.decodeUtf8(this.bytes())},i.DataBuffer=n,i.DataBuffer.prototype.length=function(){return this.write-this.read},i.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},i.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);
15var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},i.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},i.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;t>r;++r)this.data.setUint8(e);return this},i.DataBuffer.prototype.putBytes=function(e,t){if(i.isArrayBufferView(e)){var r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=r.byteLength-r.byteOffset;this.accommodate(n);var a=new Uint8Array(this.data.buffer,this.write);return a.set(r),this.write+=n,this}if(i.isArrayBuffer(e)){var r=new Uint8Array(e);this.accommodate(r.byteLength);var a=new Uint8Array(this.data.buffer);return a.set(r,this.write),this.write+=r.byteLength,this}if(e instanceof i.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&i.isArrayBufferView(e.data)){var r=new Uint8Array(e.data.byteLength,e.read,e.length());this.accommodate(r.byteLength);var a=new Uint8Array(e.data.byteLength,this.write);return a.set(r),this.write+=r.byteLength,this}if(e instanceof i.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"==typeof e){var o;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),o=new Uint8Array(this.data.buffer,this.write),this.write+=i.binary.hex.decode(e,o,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),o=new Uint8Array(this.data.buffer,this.write),this.write+=i.binary.base64.decode(e,o,this.write),this;if("utf8"===t&&(e=i.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),o=new Uint8Array(this.data.buffer,this.write),this.write+=i.binary.raw.decode(o),this;if("utf16"===t)return this.accommodate(2*e.length),o=new Uint16Array(this.data.buffer,this.write),this.write+=i.text.utf16.encode(o),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},i.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},i.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},i.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},i.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},i.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},i.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},i.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},i.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},i.DataBuffer.prototype.putInt=function(e,t){this.accommodate(t/8);do t-=8,this.data.setInt8(this.write++,e>>t&255);while(t>0);return this},i.DataBuffer.prototype.putSignedInt=function(e,t){return this.accommodate(t/8),0>e&&(e+=2<<t-1),this.putInt(e,t)},i.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},i.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},i.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},i.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},i.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},i.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},i.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},i.DataBuffer.prototype.getInt=function(e){var t=0;do t=(t<<8)+this.data.getInt8(this.read++),e-=8;while(e>0);return t},i.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},i.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},i.DataBuffer.prototype.bytes=function(e){return"undefined"==typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},i.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},i.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},i.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},i.DataBuffer.prototype.copy=function(){return new i.DataBuffer(this)},i.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},i.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},i.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},i.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);16>r&&(e+="0"),e+=r.toString(16)}return e},i.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if(e=e||"utf8","binary"===e||"raw"===e)return i.binary.raw.encode(t);if("hex"===e)return i.binary.hex.encode(t);if("base64"===e)return i.binary.base64.encode(t);if("utf8"===e)return i.text.utf8.decode(t);if("utf16"===e)return i.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},i.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=i.encodeUtf8(e)),new i.ByteBuffer(e)},i.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),t>>>=1,t>0&&(e+=e);return r},i.xorBytes=function(e,t,r){for(var n="",i="",a="",o=0,s=0;r>0;--r,++o)i=e.charCodeAt(o)^t.charCodeAt(o),s>=10&&(n+=a,a="",s=0),a+=String.fromCharCode(i),++s;return n+=a},i.hexToBytes=function(e){var t="",r=0;for(e.length&!0&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},i.bytesToHex=function(e){return i.createBuffer(e).toHex()},i.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
15+/=",u=[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];i.encode64=function(e,t){for(var r,n,i,a="",o="",u=0;u<e.length;)r=e.charCodeAt(u++),n=e.charCodeAt(u++),i=e.charCodeAt(u++),a+=s.charAt(r>>2),a+=s.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=s.charAt((15&n)<<2|i>>6),a+=isNaN(i)?"=":s.charAt(63&i)),t&&a.length>t&&(o+=a.substr(0,t)+"\r\n",a=a.substr(t));return o+=a},i.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,a="",o=0;o<e.length;)t=u[e.charCodeAt(o++)-43],r=u[e.charCodeAt(o++)-43],n=u[e.charCodeAt(o++)-43],i=u[e.charCodeAt(o++)-43],a+=String.fromCharCode(t<<2|r>>4),64!==n&&(a+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(a+=String.fromCharCode((3&n)<<6|i)));return a},i.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},i.decodeUtf8=function(e){return decodeURIComponent(escape(e))},i.binary={raw:{},hex:{},base64:{}},i.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},i.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var i=r,a=0;a<e.length;++a)n[i++]=e.charCodeAt(a);return t?i-r:n},i.binary.hex.encode=i.bytesToHex,i.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2))),r=r||0;var i=0,a=r;for(1&e.length&&(i=1,n[a++]=parseInt(e[0],16));i<e.length;i+=2)n[a++]=parseInt(e.substr(i,2),16);return t?a-r:n},i.binary.base64.encode=function(e,t){for(var r,n,i,a="",o="",u=0;u<e.byteLength;)r=e[u++],n=e[u++],i=e[u++],a+=s.charAt(r>>2),a+=s.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=s.charAt((15&n)<<2|i>>6),a+=isNaN(i)?"=":s.charAt(63&i)),t&&a.length>t&&(o+=a.substr(0,t)+"\r\n",a=a.substr(t));return o+=a},i.binary.base64.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var i,a,o,s,c=0,l=r;c<e.length;)i=u[e.charCodeAt(c++)-43],a=u[e.charCodeAt(c++)-43],o=u[e.charCodeAt(c++)-43],s=u[e.charCodeAt(c++)-43],n[l++]=i<<2|a>>4,64!==o&&(n[l++]=(15&a)<<4|o>>2,64!==s&&(n[l++]=(3&o)<<6|s));return t?l-r:n.subarray(0,l)},i.text={utf8:{},utf16:{}},i.text.utf8.encode=function(e,t,r){e=i.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var a=r,o=0;o<e.length;++o)n[a++]=e.charCodeAt(o);return t?a-r:n},i.text.utf8.decode=function(e){return i.decodeUtf8(String.fromCharCode.apply(null,e))},i.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));var i=new Uint16Array(n);r=r||0;for(var a=r,o=r,s=0;s<e.length;++s)i[o++]=e.charCodeAt(s),a+=2;return t?a-r:n},i.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e))},i.deflate=function(e,t,r){if(t=i.decode64(e.deflate(i.encode64(t)).rval),r){var n=2,a=t.charCodeAt(1);32&a&&(n=6),t=t.substring(n,t.length-4)}return t},i.inflate=function(e,t,r){var n=e.inflate(i.encode64(t)).rval;return null===n?null:i.decode64(n)};var c=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var n;if(null===r?n=e.removeItem(t):(r=i.encode64(JSON.stringify(r)),n=e.setItem(t,r)),"undefined"!=typeof n&&n.rval!==!0){var a=new Error(n.error.message);throw a.id=n.error.id,a.name=n.error.name,a}},l=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(null===r.rval){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(i.decode64(r))),r},f=function(e,t,r,n){var i=l(e,t);null===i&&(i={}),i[r]=n,c(e,t,i)},h=function(e,t,r){var n=l(e,t);return null!==n&&(n=r in n?n[r]:null),n},p=function(e,t,r){var n=l(e,t);if(null!==n&&r in n){delete n[r];var i=!0;for(var a in n){i=!1;break}i&&(n=null),c(e,t,n)}},d=function(e,t){c(e,t,null)},g=function(e,t,r){var n=null;"undefined"==typeof r&&(r=["web","flash"]);var i,a=!1,o=null;for(var s in r){i=r[s];try{if("flash"===i||"both"===i){if(null===t[0])throw new Error("Flash local storage not available.");n=e.apply(this,t),a="flash"===i}"web"!==i&&"both"!==i||(t[0]=localStorage,n=e.apply(this,t),a=!0)}catch(u){o=u}if(a)break}if(!a)throw o;return n};i.setItem=function(e,t,r,n,i){g(f,arguments,i)},i.getItem=function(e,t,r,n){return g(h,arguments,n)},i.removeItem=function(e,t,r,n){g(p,arguments,n)},i.clearItems=function(e,t,r){g(d,arguments,r)},i.parseUrl=function(e){var t=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;t.lastIndex=0;var r=t.exec(e),n=null===r?null:{full:e,scheme:r[1],host:r[2],port:r[3],path:r[4]};return n&&(n.fullHost=n.host,n.port?80!==n.port&&"http"===n.scheme?n.fullHost+=":"+n.port:443!==n.port&&"https"===n.scheme&&(n.fullHost+=":"+n.port):"http"===n.scheme?n.port=80:"https"===n.scheme&&(n.port=443),n.full=n.scheme+"://"+n.fullHost),n};var y=null;i.getQueryVariables=function(e){var t,r=function(e){for(var t={},r=e.split("&"),n=0;n<r.length;n++){var i,a,o=r[n].indexOf("=");o>0?(i=r[n].substring(0,o),a=r[n].substring(o+1)):(i=r[n],a=null),i in t||(t[i]=[]),i in Object.prototype||null===a||t[i].push(unescape(a))}return t};return"undefined"==typeof e?(null===y&&(y="undefined"==typeof window?{}:r(window.location.search.substring(1))),t=y):t=r(e),t},i.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var a=t.split("/");a.length>0&&""===a[0]&&a.shift();var o=""===r?{}:i.getQueryVariables(r);return{pathString:t,queryString:r,path:a,query:o}},i.makeRequest=function(e){var t=i.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return"undefined"==typeof e?t.path:t.path[e]},getQuery:function(e,r){var n;return"undefined"==typeof e?n=t.query:(n=t.query[e],n&&"undefined"!=typeof r&&(n=n[r])),n},getQueryLast:function(e,t){var n,i=r.getQuery(e);return n=i?i[i.length-1]:t}};return r},i.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},i.setPath=function(e,t,r){if("object"==typeof e&&null!==e)for(var n=0,i=t.length;i>n;){var a=t[n++];if(n==i)e[a]=r;else{var o=a in e;(!o||o&&"object"!=typeof e[a]||o&&null===e[a])&&(e[a]={}),e=e[a]}}},i.getPath=function(e,t,r){for(var n=0,i=t.length,a=!0;a&&i>n&&"object"==typeof e&&null!==e;){var o=t[n++];a=o in e,a&&(e=e[o])}return a?e:r},i.deletePath=function(e,t){if("object"==typeof e&&null!==e)for(var r=0,n=t.length;n>r;){var i=t[r++];if(r==n)delete e[i];else{if(!(i in e)||"object"!=typeof e[i]||null===e[i])break;e=e[i]}}},i.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},i.format=function(e){for(var t,r,n=/%./g,i=0,a=[],o=0;t=n.exec(e);){r=e.substring(o,n.lastIndex-2),r.length>0&&a.push(r),o=n.lastIndex;var s=t[0][1];switch(s){case"s":case"o":i<arguments.length?a.push(arguments[i++ +1]):a.push("<?>");break;case"%":a.push("%");break;default:a.push("<%"+s+"?>")}}return a.push(e.substring(o)),a.join("")},i.formatNumber=function(e,t,r,n){var i=e,a=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,s=void 0===n?".":n,u=0>i?"-":"",c=parseInt(i=Math.abs(+i||0).toFixed(a),10)+"",l=c.length>3?c.length%3:0;return u+(l?c.substr(0,l)+s:"")+c.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+s)+(a?o+Math.abs(i-c).toFixed(a).slice(2):"")},i.formatSize=function(e){return e=e>=1073741824?i.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?i.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?i.formatNumber(e/1024,0)+" KiB":i.formatNumber(e,0)+" bytes"},i.bytesFromIP=function(e){return-1!==e.indexOf(".")?i.bytesFromIPv4(e):-1!==e.indexOf(":")?i.bytesFromIPv6(e):null},i.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=i.createBuffer(),r=0;r<e.length;++r){var n=parseInt(e[r],10);if(isNaN(n))return null;t.putByte(n)}return t.getBytes()},i.bytesFromIPv6=function(e){var t=0;e=e.split(":").filter(function(e){return 0===e.length&&++t,!0});for(var r=2*(8-e.length+t),n=i.createBuffer(),a=0;8>a;++a)if(e[a]&&0!==e[a].length){var o=i.hexToBytes(e[a]);o.length<2&&n.putByte(0),n.putBytes(o)}else n.fillWithByte(0,r),r=0;return n.getBytes()}
15,i.bytesToIP=function(e){return 4===e.length?i.bytesToIPv4(e):16===e.length?i.bytesToIPv6(e):null},i.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},i.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],n=0,a=0;a<e.length;a+=2){for(var o=i.bytesToHex(e[a]+e[a+1]);"0"===o[0]&&"0"!==o;)o=o.substr(1);if("0"===o){var s=r[r.length-1],u=t.length;s&&u===s.end+1?(s.end=u,s.end-s.start>r[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}t.push(o)}if(r.length>0){var c=r[n];c.end-c.start>0&&(t.splice(c.start,c.end-c.start+1,""),0===c.start&&t.unshift(""),7===c.end&&t.push(""))}return t.join(":")},i.estimateCores=function(e,t){function r(e,s,u){if(0===s){var c=Math.floor(e.reduce(function(e,t){return e+t},0)/e.length);return i.cores=Math.max(1,c),URL.revokeObjectURL(o),t(null,i.cores)}n(u,function(t,n){e.push(a(u,n)),r(e,s-1,u)})}function n(e,t){for(var r=[],n=[],i=0;e>i;++i){var a=new Worker(o);a.addEventListener("message",function(i){if(n.push(i.data),n.length===e){for(var a=0;e>a;++a)r[a].terminate();t(null,n)}}),r.push(a)}for(var i=0;e>i;++i)r[i].postMessage(i)}function a(e,t){for(var r=[],n=0;e>n;++n)for(var i=t[n],a=r[n]=[],o=0;e>o;++o)if(n!==o){var s=t[o];(i.st>s.st&&i.st<s.et||s.st>i.st&&s.st<i.et)&&a.push(o)}return r.reduce(function(e,t){return Math.max(e,t.length)},0)}if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in i&&!e.update)return t(null,i.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return i.cores=navigator.hardwareConcurrency,t(null,i.cores);if("undefined"==typeof Worker)return i.cores=1,t(null,i.cores);if("undefined"==typeof Blob)return i.cores=2,t(null,i.cores);var o=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),r=t+4;Date.now()<r;);self.postMessage({st:t,et:r})})}.toString(),")()"],{type:"application/javascript"}));r([],5,16)}}()}).call(this,e("_process"))},{_process:77}],157:[function(e,t,r){!function(){function r(e,t){"string"==typeof t&&(t={shortName:t});for(var r,n=null,i=0;null===n&&i<e.attributes.length;++i)r=e.attributes[i],t.type&&t.type===r.type?n=r:t.name&&t.name===r.name?n=r:t.shortName&&t.shortName===r.shortName&&(n=r);return n}function n(e){for(var t,r,n=c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[]),i=e.attributes,a=0;a<i.length;++a){t=i[a];var o=t.value,s=c.Type.PRINTABLESTRING;"valueTagClass"in t&&(s=t.valueTagClass,s===c.Type.UTF8&&(o=u.util.encodeUtf8(o))),r=c.create(c.Class.UNIVERSAL,c.Type.SET,!0,[c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(t.type).getBytes()),c.create(c.Class.UNIVERSAL,s,!1,o)])]),n.value.push(r)}return n}function i(e){for(var t,r=0;r<e.length;++r){if(t=e[r],"undefined"==typeof t.name&&(t.type&&t.type in l.oids?t.name=l.oids[t.type]:t.shortName&&t.shortName in h&&(t.name=l.oids[h[t.shortName]])),"undefined"==typeof t.type){if(!(t.name&&t.name in l.oids)){var n=new Error("Attribute type not specified.");throw n.attribute=t,n}t.type=l.oids[t.name]}if("undefined"==typeof t.shortName&&t.name&&t.name in h&&(t.shortName=h[t.name]),t.type===f.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=c.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var i=0;i<t.extensions.length;++i)t.value.push(l.certificateExtensionToAsn1(a(t.extensions[i])))}if("undefined"==typeof t.value){var n=new Error("Attribute value not specified.");throw n.attribute=t,n}}}function a(e,t){if(t=t||{},"undefined"==typeof e.name&&e.id&&e.id in l.oids&&(e.name=l.oids[e.id]),"undefined"==typeof e.id){if(!(e.name&&e.name in l.oids)){var r=new Error("Extension ID not specified.");throw r.extension=e,r}e.id=l.oids[e.name]}if("undefined"==typeof e.value){if("keyUsage"===e.name){var n=0,i=0,a=0;e.digitalSignature&&(i|=128,n=7),e.nonRepudiation&&(i|=64,n=6),e.keyEncipherment&&(i|=32,n=5),e.dataEncipherment&&(i|=16,n=4),e.keyAgreement&&(i|=8,n=3),e.keyCertSign&&(i|=4,n=2),e.cRLSign&&(i|=2,n=1),e.encipherOnly&&(i|=1,n=0),e.decipherOnly&&
15(a|=128,n=7);var o=String.fromCharCode(n);0!==a?o+=String.fromCharCode(i)+String.fromCharCode(a):0!==i&&(o+=String.fromCharCode(i)),e.value=c.create(c.Class.UNIVERSAL,c.Type.BITSTRING,!1,o)}else if("basicConstraints"===e.name)e.value=c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(c.create(c.Class.UNIVERSAL,c.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,c.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[]);var s=e.value.value;for(var h in e)e[h]===!0&&(h in f?s.push(c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(f[h]).getBytes())):-1!==h.indexOf(".")&&s.push(c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(h).getBytes())))}else if("nsCertType"===e.name){var n=0,i=0;e.client&&(i|=128,n=7),e.server&&(i|=64,n=6),e.email&&(i|=32,n=5),e.objsign&&(i|=16,n=4),e.reserved&&(i|=8,n=3),e.sslCA&&(i|=4,n=2),e.emailCA&&(i|=2,n=1),e.objCA&&(i|=1,n=0);var o=String.fromCharCode(n);0!==i&&(o+=String.fromCharCode(i)),e.value=c.create(c.Class.UNIVERSAL,c.Type.BITSTRING,!1,o)}else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[]);for(var p,d=0;d<e.altNames.length;++d){p=e.altNames[d];var o=p.value;if(7===p.type&&p.ip){if(o=u.util.bytesFromIP(p.ip),null===o){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=e,r}}else 8===p.type&&(o=p.oid?c.oidToDer(c.oidToDer(p.oid)):c.oidToDer(o));e.value.value.push(c.create(c.Class.CONTEXT_SPECIFIC,p.type,!1,o))}}else if("subjectKeyIdentifier"===e.name&&t.cert){var g=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=g.toHex(),e.value=c.create(c.Class.UNIVERSAL,c.Type.OCTETSTRING,!1,g.getBytes())}if("undefined"==typeof e.value){var r=new Error("Extension value not specified.");throw r.extension=e,r}return e}}function o(e,t){switch(e){case f["RSASSA-PSS"]:var r=[];return void 0!==t.hash.algorithmOid&&r.push(c.create(c.Class.CONTEXT_SPECIFIC,0,!0,[c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(t.hash.algorithmOid).getBytes()),c.create(c.Class.UNIVERSAL,c.Type.NULL,!1,"")])])),void 0!==t.mgf.algorithmOid&&r.push(c.create(c.Class.CONTEXT_SPECIFIC,1,!0,[c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(t.mgf.algorithmOid).getBytes()),c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(t.mgf.hash.algorithmOid).getBytes()),c.create(c.Class.UNIVERSAL,c.Type.NULL,!1,"")])])])),void 0!==t.saltLength&&r.push(c.create(c.Class.CONTEXT_SPECIFIC,2,!0,[c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,c.integerToDer(t.saltLength).getBytes())])),c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,r);default:return c.create(c.Class.UNIVERSAL,c.Type.NULL,!1,"")}}function s(e){var t=c.create(c.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===e.attributes.length)return t;for(var r=e.attributes,n=0;n<r.length;++n){var i=r[n],a=i.value,o=c.Type.UTF8;"valueTagClass"in i&&(o=i.valueTagClass),o===c.Type.UTF8&&(a=u.util.encodeUtf8(a));var s=!1;"valueConstructed"in i&&(s=i.valueConstructed);var l=c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(i.type).getBytes()),c.create(c.Class.UNIVERSAL,c.Type.SET,!0,[c.create(c.Class.UNIVERSAL,o,s,a)])]);t.value.push(l)}return t}var u={pki:e("./pki"),asn1:e("./asn1"),md:e("./md"),mgf:e("./mgf"),pem:e("./pem"),pss:e("./pss"),rsa:e("./rsa"),util:e("./util")};e("./md5"),e("./sha1"),e("./sha256");var c=u.asn1,l=t.exports=u.pki,f=l.oids,h={};h.CN=f.commonName,h.commonName="CN",h.C=f.countryName,h.countryName="C",h.L=f.localityName,h.localityName="L",h.ST=f.stateOrProvinceName,h.stateOrProvinceName="ST",h.O=f.organizationName,h.organizationName="O",h.OU=f.organizationalUnitName,h.organizationalUnitName="OU",h.E=f.emailAddress,h.emailAddress="E";var p=u.pki.rsa.publicKeyValidator,d={name:"Certificate",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:c.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,c
vendor: 4,148 bytes, lines 15-16
15onstructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:c.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:c.Class.UNIVERSAL,type:c.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:c.Class.UNIVERSAL,type:c.Type.GENERALIZEDTIME,constructed:!1, 16optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:c.Class.UNIVERSAL,type:c.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:c.Class.UNIVERSAL,type:c.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},p,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:c.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:c.Class.UNIVERSAL,type:c.Type.BITSTRING,constructed:!1,capture:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:c.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:c.Class.UNIVERSAL,type:c.Type.BITSTRING,constructed:!1,capture:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:c.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:c.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:c.Class.UNIVERSAL,type:c.Type.BITSTRING,constructed:!1,capture:"certSignature"}]},g={name:"rsapss",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:c.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:c.Class.UNIVERSAL,type:c.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:c.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:c.Class.UNIVERSAL,type:c.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:c.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:c.Class.UNIVERSAL,type:c.Class.INTEGER,c
vendor: 7,311 bytes, line 16
16onstructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:c.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:c.Class.UNIVERSAL,type:c.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},y={name:"CertificationRequestInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},p,{name:"CertificationRequestInfo.attributes",tagClass:c.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:c.Class.UNIVERSAL,type:c.Type.SET,constructed:!0}]}]}]},v={name:"CertificationRequest",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[y,{name:"CertificationRequest.signatureAlgorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:c.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:c.Class.UNIVERSAL,type:c.Type.BITSTRING,constructed:!1,capture:"csrSignature"}]};l.RDNAttributesAsArray=function(e,t){for(var r,n,i,a=[],o=0;o<e.value.length;++o){r=e.value[o];for(var s=0;s<r.value.length;++s)i={},n=r.value[s],i.type=c.derToOid(n.value[0].value),i.value=n.value[1].value,i.valueTagClass=n.value[1].type,i.type in f&&(i.name=f[i.type],i.name in h&&(i.shortName=h[i.name])),t&&(t.update(i.type),t.update(i.value)),a.push(i)}return a},l.CRIAttributesAsArray=function(e){for(var t=[],r=0;r<e.length;++r)for(var n=e[r],i=c.derToOid(n.value[0].value),a=n.value[1].value,o=0;o<a.length;++o){var s={};if(s.type=i,s.value=a[o].value,s.valueTagClass=a[o].type,s.type in f&&(s.name=f[s.type],s.name in h&&(s.shortName=h[s.name])),s.type===f.extensionRequest){s.extensions=[];for(var u=0;u<s.value.length;++u)s.extensions.push(l.certificateExtensionFromAsn1(s.value[u]))}t.push(s)}return t};var m=function(e,t,r){var n={};if(e!==f["RSASSA-PSS"])return n;r&&(n={hash:{algorithmOid:f.sha1},mgf:{algorithmOid:f.mgf1,hash:{algorithmOid:f.sha1}},saltLength:20});var i={},a=[];if(!c.validate(t,g,i,a)){var o=new Error("Cannot read RSASSA-PSS parameter block.");throw o.errors=a,o}return void 0!==i.hashOid&&(n.hash=n.hash||{},n.hash.algorithmOid=c.derToOid(i.hashOid)),void 0!==i.maskGenOid&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=c.derToOid(i.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=c.derToOid(i.maskGenHashOid)),void 0!==i.saltLength&&(n.saltLength=i.saltLength.charCodeAt(0)),n};l.certificateFromPem=function(e,t,r){var n=u.pem.decode(e)[0];if("CERTIFICATE"!==n.type&&"X509 CERTIFICATE"!==n.type&&"TRUSTED CERTIFICATE"!==n.type){var i=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw i.headerType=n.type,i}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var a=c.fromDer(n.body,r);return l.certificateFromAsn1(a,t)},l.certificateToPem=function(e,t){var r={type:"CERTIFICATE",body:c.toDer(l.certificateToAsn1(e)).getBytes()};return u.pem.encode(r,{maxline:t})},l.publicKeyFromPem=function(e){var t=u.pem.decode(e)[0];if("PUBLIC KEY"!==t.type&&"RSA PUBLIC KEY"!==t.type){var r=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var n=c.fromDer(t.body);return l.publicKeyFromAsn1(n)},l.publicKeyToPem=function(e,t){var r={type:"PUBLIC KEY",body:c.toDer(l.publicKeyToAsn1(e)).getBytes()};return u.pem.encode(r,{maxline:t})},l.publicKeyToRSAPublicKeyPem=function(e,t){var r={type:"RSA PUBLIC KEY",body:c.toDer(l.publicKeyToRSAPublicKey(e)).getBytes()};return u.pem.encode(r,{maxline:t})},l.getPublicKeyFingerprint=function(e,t){t=t||{};var r,n=t.md||u.md.sha1.create(),i=t.type||"RSAPublicKey";switch(i){case"RSAPublicKey":r=c.toDer(l.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":r=c.toDer(l.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}n.start(),n.update(r);var a=n.digest();if("hex"===t.encoding){var o=a.toHex();return t.delimiter?o.match(/.{2}/g).join(t.delimiter):o}if("binary"===t.encoding)return a.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return a},l.certificationRequestFromPem=function(e,t,r){var n=u.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==n.type){var i=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw i.headerType=n.type,i}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var a=c.fromDer(n.body,r);return l.certificationRequestFromAsn1(a,t)},l.certificationRequestToPem=function(e,t){var r={type:"CERTIFICATE REQUEST",body:c.toDer(l.certificationRequestToAsn1(e)).getBytes()};return u.pem.encode(r,{maxline:t})},l.createCertificate=function(){var e={};return e.version=2,e.serialNumber="00",e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return r(e.issuer,t)},e.issuer.addField=function(t){i([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return r(e.subject,t)},e.subject.addField=function(t){i([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){i(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){i(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)a(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){"string"==typeof t&&(t={name:t});for(var r,n=null,i=0;null===n&&i<e.extensions.length;++i)r=e.extensions[i],t.id&&r.id===t.id?n=r:t.name&&r.name===t.name&&(n=r);return n},e.sign=function(t,r){e.md=r||u.md.sha1.create();var n=f[e.md.algorithm+"WithRSAEncryption"];if(!n){var i=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw i.algorithm=e.md.algorithm,i}e.signatureOid=e.siginfo.algorithmOid=n,e.tbsCertificate=l.getTBSCertificate(e);
16var a=c.toDer(e.tbsCertificate);e.md.update(a.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var r=!1;if(!e.issued(t)){var n=t.issuer,i=e.subject,a=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw a.expectedIssuer=n.attributes,a.actualIssuer=i.attributes,a}var o=t.md;if(null===o){if(t.signatureOid in f){var s=f[t.signatureOid];switch(s){case"sha1WithRSAEncryption":o=u.md.sha1.create();break;case"md5WithRSAEncryption":o=u.md.md5.create();break;case"sha256WithRSAEncryption":o=u.md.sha256.create();break;case"RSASSA-PSS":o=u.md.sha256.create()}}if(null===o){var a=new Error("Could not compute certificate digest. Unknown signature OID.");throw a.signatureOid=t.signatureOid,a}var h=t.tbsCertificate||l.getTBSCertificate(t),p=c.toDer(h);o.update(p.getBytes())}if(null!==o){var d;switch(t.signatureOid){case f.sha1WithRSAEncryption:d=void 0;break;case f["RSASSA-PSS"]:var g,y;if(g=f[t.signatureParameters.mgf.hash.algorithmOid],void 0===g||void 0===u.md[g]){var a=new Error("Unsupported MGF hash function.");throw a.oid=t.signatureParameters.mgf.hash.algorithmOid,a.name=g,a}if(y=f[t.signatureParameters.mgf.algorithmOid],void 0===y||void 0===u.mgf[y]){var a=new Error("Unsupported MGF function.");throw a.oid=t.signatureParameters.mgf.algorithmOid,a.name=y,a}if(y=u.mgf[y].create(u.md[g].create()),g=f[t.signatureParameters.hash.algorithmOid],void 0===g||void 0===u.md[g])throw{message:"Unsupported RSASSA-PSS hash function.",oid:t.signatureParameters.hash.algorithmOid,name:g};d=u.pss.create(u.md[g].create(),y,t.signatureParameters.saltLength)}r=e.publicKey.verify(o.digest().getBytes(),t.signature,d)}return r},e.isIssuer=function(t){var r=!1,n=e.issuer,i=t.subject;if(n.hash&&i.hash)r=n.hash===i.hash;else if(n.attributes.length===i.attributes.length){r=!0;for(var a,o,s=0;r&&s<n.attributes.length;++s)a=n.attributes[s],o=i.attributes[s],a.type===o.type&&a.value===o.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return l.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=f.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var n=e.extensions[r];if(n.id===t){var i=e.generateSubjectKeyIdentifier().getBytes();return u.util.hexToBytes(n.subjectKeyIdentifier)===i}}return!1},e},l.certificateFromAsn1=function(e,t){var n={},a=[];if(!c.validate(e,d,n,a)){var o=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw o.errors=a,o}if("string"!=typeof n.certSignature){for(var s="\x00",h=0;h<n.certSignature.length;++h)s+=c.toDer(n.certSignature[h]).getBytes();n.certSignature=s}var p=c.derToOid(n.publicKeyOid);if(p!==l.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var g=l.createCertificate();g.version=n.certVersion?n.certVersion.charCodeAt(0):0;var y=u.util.createBuffer(n.certSerialNumber);
16g.serialNumber=y.toHex(),g.signatureOid=u.asn1.derToOid(n.certSignatureOid),g.signatureParameters=m(g.signatureOid,n.certSignatureParams,!0),g.siginfo.algorithmOid=u.asn1.derToOid(n.certinfoSignatureOid),g.siginfo.parameters=m(g.siginfo.algorithmOid,n.certinfoSignatureParams,!1);var v=u.util.createBuffer(n.certSignature);++v.read,g.signature=v.getBytes();var b=[];if(void 0!==n.certValidity1UTCTime&&b.push(c.utcTimeToDate(n.certValidity1UTCTime)),void 0!==n.certValidity2GeneralizedTime&&b.push(c.generalizedTimeToDate(n.certValidity2GeneralizedTime)),void 0!==n.certValidity3UTCTime&&b.push(c.utcTimeToDate(n.certValidity3UTCTime)),void 0!==n.certValidity4GeneralizedTime&&b.push(c.generalizedTimeToDate(n.certValidity4GeneralizedTime)),b.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(b.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(g.validity.notBefore=b[0],g.validity.notAfter=b[1],g.tbsCertificate=n.tbsCertificate,t){if(g.md=null,g.signatureOid in f){var p=f[g.signatureOid];switch(p){case"sha1WithRSAEncryption":g.md=u.md.sha1.create();break;case"md5WithRSAEncryption":g.md=u.md.md5.create();break;case"sha256WithRSAEncryption":g.md=u.md.sha256.create();break;case"RSASSA-PSS":g.md=u.md.sha256.create()}}if(null===g.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=g.signatureOid,o}var E=c.toDer(g.tbsCertificate);g.md.update(E.getBytes())}var _=u.md.sha1.create();g.issuer.getField=function(e){return r(g.issuer,e)},g.issuer.addField=function(e){i([e]),g.issuer.attributes.push(e)},g.issuer.attributes=l.RDNAttributesAsArray(n.certIssuer,_),n.certIssuerUniqueId&&(g.issuer.uniqueId=n.certIssuerUniqueId),g.issuer.hash=_.digest().toHex();var w=u.md.sha1.create();return g.subject.getField=function(e){return r(g.subject,e)},g.subject.addField=function(e){i([e]),g.subject.attributes.push(e)},g.subject.attributes=l.RDNAttributesAsArray(n.certSubject,w),n.certSubjectUniqueId&&(g.subject.uniqueId=n.certSubjectUniqueId),g.subject.hash=w.digest().toHex(),n.certExtensions?g.extensions=l.certificateExtensionsFromAsn1(n.certExtensions):g.extensions=[],g.publicKey=l.publicKeyFromAsn1(n.subjectPublicKeyInfo),g},l.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r<e.value.length;++r)for(var n=e.value[r],i=0;i<n.value.length;++i)t.push(l.certificateExtensionFromAsn1(n.value[i]));return t},l.certificateExtensionFromAsn1=function(e){var t={};if(t.id=c.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===c.Type.BOOLEAN?(t.critical=0!==e.value[1].value.charCodeAt(0),t.value=e.value[2].value):t.value=e.value[1].value,t.id in f)if(t.name=f[t.id],"keyUsage"===t.name){var r=c.fromDer(t.value),n=0,i=0;r.value.length>1&&(n=r.value.charCodeAt(1),i=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128===(128&n),t.nonRepudiation=64===(64&n),t.keyEncipherment=32===(32&n),t.dataEncipherment=16===(16&n),t.keyAgreement=8===(8&n),t.keyCertSign=4===(4&n),t.cRLSign=2===(2&n),t.encipherOnly=1===(1&n),t.decipherOnly=128===(128&i)}else if("basicConstraints"===t.name){var r=c.fromDer(t.value);r.value.length>0&&r.value[0].type===c.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var a=null;r.value.length>0&&r.value[0].type===c.Type.INTEGER?a=r.value[0].value:r.value.length>1&&(a=r.value[1].value),null!==a&&(t.pathLenConstraint=c.derToInteger(a))}else if("extKeyUsage"===t.name)for(var r=c.fromDer(t.value),o=0;o<r.value.length;++o){var s=c.derToOid(r.value[o].value);s in f?t[f[s]]=!0:t[s]=!0}else if("nsCertType"===t.name){var r=c.fromDer(t.value),n=0;r.value.length>1&&(n=r.value.charCodeAt(1)),t.client=128===(128&n),t.server=64===(64&n),t.email=32===(32&n),t.objsign=16===(16&n),t.reserved=8===(8&n),t.sslCA=4===(4&n),t.emailCA=2===(2&n),t.objCA=1===(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var l,r=c.fromDer(t.value),h=0;h<r.value.length;++h){l=r.value[h];var p={type:l.type,value:l.value};switch(t.altNames.push(p),l.type){case 1:case 2:case 6:break;case 7:p.ip=u.util.bytesToIP(l.value);break;case 8:p.oid=c.derToOid(l.value)}}}else if("subjectKeyIdentifier"===t.name){var r=c.fromDer(t.value);t.subjectKeyIdentifier=u.util.bytesToHex(r.value)}return t},l.certificationRequestFromAsn1=function(e,t){var n={},a=[];if(!c.validate(e,v,n,a)){var o=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw o.errors=a,o}if("string"!=typeof n.csrSignature){for(var s="\x00",h=0;h<n.csrSignature.length;++h)s+=c.toDer(n.csrSignature[h]).getBytes();n.csrSignature=s}var p=c.derToOid(n.publicKeyOid);if(p!==l.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var d=l.createCertificationRequest();d.version=n.csrVersion?n.csrVersion.charCodeAt(0):0,d.signatureOid=u.asn1.derToOid(n.csrSignatureOid),d.signatureParameters=m(d.signatureOid,n.csrSignatureParam
16s,!0),d.siginfo.algorithmOid=u.asn1.derToOid(n.csrSignatureOid),d.siginfo.parameters=m(d.siginfo.algorithmOid,n.csrSignatureParams,!1);var g=u.util.createBuffer(n.csrSignature);if(++g.read,d.signature=g.getBytes(),d.certificationRequestInfo=n.certificationRequestInfo,t){if(d.md=null,d.signatureOid in f){var p=f[d.signatureOid];switch(p){case"sha1WithRSAEncryption":d.md=u.md.sha1.create();break;case"md5WithRSAEncryption":d.md=u.md.md5.create();break;case"sha256WithRSAEncryption":d.md=u.md.sha256.create();break;case"RSASSA-PSS":d.md=u.md.sha256.create()}}if(null===d.md){var o=new Error("Could not compute certification request digest. Unknown signature OID.");throw o.signatureOid=d.signatureOid,o}var y=c.toDer(d.certificationRequestInfo);d.md.update(y.getBytes())}var b=u.md.sha1.create();return d.subject.getField=function(e){return r(d.subject,e)},d.subject.addField=function(e){i([e]),d.subject.attributes.push(e)},d.subject.attributes=l.RDNAttributesAsArray(n.certificationRequestInfoSubject,b),d.subject.hash=b.digest().toHex(),d.publicKey=l.publicKeyFromAsn1(n.subjectPublicKeyInfo),d.getAttribute=function(e){return r(d,e)},d.addAttribute=function(e){i([e]),d.attributes.push(e)},d.attributes=l.CRIAttributesAsArray(n.certificationRequestInfoAttributes||[]),d},l.createCertificationRequest=function(){var e={};return e.version=0,e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return r(e.subject,t)},e.subject.addField=function(t){i([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return r(e,t)},e.addAttribute=function(t){i([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){i(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){i(t),e.attributes=t},e.sign=function(t,r){e.md=r||u.md.sha1.create();var n=f[e.md.algorithm+"WithRSAEncryption"];if(!n){var i=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw i.algorithm=e.md.algorithm,i}e.signatureOid=e.siginfo.algorithmOid=n,e.certificationRequestInfo=l.getCertificationRequestInfo(e);var a=c.toDer(e.certificationRequestInfo);e.md.update(a.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,r=e.md;if(null===r){if(e.signatureOid in f){var n=f[e.signatureOid];switch(n){case"sha1WithRSAEncryption":r=u.md.sha1.create();break;case"md5WithRSAEncryption":r=u.md.md5.create();break;case"sha256WithRSAEncryption":r=u.md.sha256.create();break;case"RSASSA-PSS":r=u.md.sha256.create()}}if(null===r){var i=new Error("Could not compute certification request digest. Unknown signature OID.");throw i.signatureOid=e.signatureOid,i}var a=e.certificationRequestInfo||l.getCertificationRequestInfo(e),o=c.toDer(a);r.update(o.getBytes())}if(null!==r){var s;switch(e.signatureOid){case f.sha1WithRSAEncryption:break;case f["RSASSA-PSS"]:var h,p;if(h=f[e.signatureParameters.mgf.hash.algorithmOid],void 0===h||void 0===u.md[h]){var i=new Error("Unsupported MGF hash function.");throw i.oid=e.signatureParameters.mgf.hash.algorithmOid,i.name=h,i}if(p=f[e.signatureParameters.mgf.algorithmOid],void 0===p||void 0===u.mgf[p]){var i=new Error("Unsupported MGF function.");throw i.oid=e.signatureParameters.mgf.algorithmOid,i.name=p,i}if(p=u.mgf[p].create(u.md[h].create()),h=f[e.signatureParameters.hash.algorithmOid],void 0===h||void 0===u.md[h]){var i=new Error("Unsupported RSASSA-PSS hash function.");throw i.oid=e.signatureParameters.hash.algorithmOid,i.name=h,i}s=u.pss.create(u.md[h].create(),p,e.signatureParameters.saltLength)}t=e.publicKey.verify(r.digest().getBytes(),e.signature,s)}return t},e},l.getTBSCertificate=function(e){var t=c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.CONTEXT_SPECIFIC,0,!0,[c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,c.integerToDer(e.version).getBytes())]),c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,u.util.hexToBytes(e.serialNumber)),c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(e.siginfo.algorithmOid).getBytes()),o(e.siginfo.algorithmOid,e.siginfo.parameters)]),n(e.issuer),c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.UTCTIME,!1,c.dateToUtcTime(e.validity.notBefore)),c.create(c.Class.UNIVERSAL,c.Type.UTCTIME,!1,c.dateToUtcTime(e.validity.notAfter))]),n(e.subject),l.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&t.value.push(c.create(c.Class.CONTEXT_SPECIFIC,1,!0,[c.create(c.Class.UNIVERSAL,c.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&t.value.push(c.create(c.Class.CONTEXT_SPECIFIC,2,!0,[c.create(c.Class.UNIVERSAL,c.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&t.value.push(l.certificateExtensionsToAsn1(e.extensions)),t},l.getCertificationRequestInfo=function(e){var t=c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,c.integerToDer(e.version).getBytes()),n(e.subject),l.publicKeyToAsn1(e.publicKey),s(e)]);return t},l.distinguishedNameToAsn1=function(e){return n(e)},l.certificateToAsn1=function(e){var t=e.tbsCertificate||l.getTBSCertificate(e);return c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[t,c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(e.signatureOid).getBytes()),o(e.signatureOid,e.signatureParameters)]),c.create(c.Class.UNIVERSAL,c.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},l.certificateExtensionsToAsn1=function(e){var t=c.create(c.Class.CONTEXT_SPECIFIC,3,!0,[]),r=c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;n<e.length;++n)r.value.push(l.certificateExtensionToAsn1(e[n]));return t},l.certificateExtensionToAsn1=function(e){var t=c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[]);t.value.push(c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(e.id).getBytes())),e.critical&&t.value.push(c.create(c.Class.UNIVERSAL,c.Type.BOOLEAN,!1,String.fromCharCode(255)));var r=e.value;return"string"!=typeof e.value&&(r=c.toDer(r).getBytes()),t.value.push(c.create(c.Class.UNIVERSAL,c.Type.OCTETSTRING,!1,r)),t},l.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||l.getCertificationRequestInfo(e);return c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[t,c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(e.signatureOid).getBytes()),o(e.signatureOid,e.signatureParameters)]),c.create(c.Class.UNIVERSAL,c.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},l.createCaStore=function(e){function t(e){if(!e.hash){var t=u.md.sha1.create();e.attributes=l.RDNAttributesAsArray(n(e),t),e.hash=t.digest().toHex()}return r.certs[e.hash]||null}var r={certs:{}};if(r.getIssuer=function(e){var r=t(e.issuer);return r}
16,r.addCertificate=function(e){if("string"==typeof e&&(e=u.pki.certificateFromPem(e)),!e.subject.hash){var t=u.md.sha1.create();e.subject.attributes=l.RDNAttributesAsArray(n(e.subject),t),e.subject.hash=t.digest().toHex()}if(e.subject.hash in r.certs){var i=r.certs[e.subject.hash];u.util.isArray(i)||(i=[i]),i.push(e)}else r.certs[e.subject.hash]=e},r.hasCertificate=function(e){var r=t(e.subject);if(!r)return!1;u.util.isArray(r)||(r=[r]);for(var n=c.toDer(l.certificateToAsn1(e)).getBytes(),i=0;i<r.length;++i){var a=c.toDer(l.certificateToAsn1(r[i])).getBytes();if(n===a)return!0}return!1},e)for(var i=0;i<e.length;++i){var a=e[i];r.addCertificate(a)}return r},l.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},l.verifyCertificateChain=function(e,t,r){t=t.slice(0);var n=t.slice(0),i=new Date,a=!0,o=null,s=0;do{var c=t.shift(),f=null,h=!1;if((i<c.validity.notBefore||i>c.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:l.certificateError.certificate_expired,notBefore:c.validity.notBefore,notAfter:c.validity.notAfter,now:i}),null===o){if(f=t[0]||e.getIssuer(c),null===f&&c.isIssuer(c)&&(h=!0,f=c),f){var p=f;u.util.isArray(p)||(p=[p]);for(var d=!1;!d&&p.length>0;){f=p.shift();try{d=f.verify(c)}catch(g){}}d||(o={message:"Certificate signature is invalid.",error:l.certificateError.bad_certificate})}null!==o||f&&!h||e.hasCertificate(c)||(o={message:"Certificate is not trusted.",error:l.certificateError.unknown_ca})}if(null===o&&f&&!c.isIssuer(f)&&(o={message:"Certificate issuer is invalid.",error:l.certificateError.bad_certificate}),null===o)for(var y={keyUsage:!0,basicConstraints:!0},v=0;null===o&&v<c.extensions.length;++v){var m=c.extensions[v];!m.critical||m.name in y||(o={message:"Certificate has an unsupported critical extension.",error:l.certificateError.unsupported_certificate})}if(null===o&&(!a||0===t.length&&(!f||h))){var b=c.getExtension("basicConstraints"),E=c.getExtension("keyUsage");if(null!==E&&(E.keyCertSign&&null!==b||(o={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:l.certificateError.bad_certificate})),null!==o||null===b||b.cA||(o={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:l.certificateError.bad_certificate}),null===o&&null!==E&&"pathLenConstraint"in b){var _=s-1;_>b.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:l.certificateError.bad_certificate})}}var w=null===o?!0:o.error,C=r?r(w,s,n):w;if(C!==!0)throw w===!0&&(o={message:"The application rejected the certificate.",error:l.certificateError.bad_certificate}),(C||0===C)&&("object"!=typeof C||u.util.isArray(C)?"string"==typeof C&&(o.error=C):(C.message&&(o.message=C.message),C.error&&(o.error=C.error))),o;o=null,a=!1,++s}while(t.length>0);return!0}}()},{"./asn1":129,"./md":135,"./md5":136,"./mgf":137,"./pem":141,"./pki":146,"./pss":149,"./rsa":151,"./sha1":152,"./sha256":153,"./util":156}],158:[function(e,t,r){arguments[4][91][0].apply(r,arguments)},{dup:91}],159:[function(e,t,r){t.exports=e("./lib/urlsafe-base64")},{"./lib/urlsafe-base64":160}],160:[function(e,t,r){(function(e){r.version="1.0.0",r.encode=function(t,r){return t instanceof ArrayBuffer&&(t=new Uint8Array(t)),e.isBuffer(t)||(t=new e(t,r)),t.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},r.decode=function(t){return t+=Array(5-t.length%4).join("="),t=t.replace(/\-/g,"+").replace(/\_/g,"/"),new e(t,"base64")},r.validate=function(e){return/^[A-Za-z0-9\-_]+$/.test(e)}}).call(this,e("buffer").Buffer)},{buffer:70}],161:[function(e,t,r){(function(e){var r;if(e.crypto&&crypto.getRandomValues){var n=new Uint8Array(16);r=function(){return crypto.getRandomValues(n),n}}if(!r){var i=new Array(16);r=function(){for(var e,t=0;16>t;t++)0===(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],162:[function(e,t,r){function n(e,t,r){var n=t&&r||0,i=0;for(t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,function(e){16>i&&(t[n+i++]=c[e])});16>i;)t[n+i++]=0;return t}function i(e,t){var r=t||0,n=u;return n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]}function a(e,t,r){var n=t&&r||0,a=t||[];e=e||{};var o=void 0!==e.clockseq?e.clockseq:p,s=void 0!==e.msecs?e.msecs:(new Date).getTime(),u=void 0!==e.nsecs?e.nsecs:g+1,c=s-d+(u-g)/1e4;if(0>c&&void 0===e.clockseq&&(o=o+1&16383),(0>c||s>d)&&void 0===e.nsecs&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");d=s,g=u,p=o,s+=122192928e5;var l=(1e4*(268435455&s)+u)%4294967296;a[n++]=l>>>24&255,a[n++]=l>>>16&255,a[n++]=l>>>8&255,a[n++]=255&l;var f=s/4294967296*1e4&268435455;a[n++]=f>>>8&255,a[n++]=255&f,a[n++]=f>>>24&15|16,a[n++]=f>>>16&255,a[n++]=o>>>8|128,a[n++]=255&o;for(var y=e.node||h,v=0;6>v;v++)a[n+v]=y[v];return t?t:i(a)}function o(e,t,r){var n=t&&r||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null),e=e||{};var a=e.random||(e.rng||s)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var o=0;16>o;o++)t[n+o]=a[o];return t||i(a)}for(var s=e("./rng"),u=[],c={},l=0;256>l;l++)u[l]=(l+256).toString(16).substr(1),c[u[l]]=l;var f=s(),h=[1|f[0],f[1],f[2],f[3],f[4],f[5]],p=16383&(f[6]<<8|f[7]),d=0,g=0,y=o;
16y.v1=a,y.v4=o,y.parse=n,y.unparse=i,t.exports=y},{"./rng":161}]},{},[28])(28)});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.