252 lines
497 KiB
JavaScript
Executable File
252 lines
497 KiB
JavaScript
Executable File
/**
|
||
* CyberChef - The Cyber Swiss Army Knife
|
||
*
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*
|
||
* Copyright 2016 Crown Copyright
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1500)}({0:function(e,t,r){"use strict";var n=r(15),i=r.n(n),a=r(10),o=r(7),s=r(19),u=r(18);function c(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function l(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function o(e){c(a,n,i,o,s,"next",e)}function s(e){c(a,n,i,o,s,"throw",e)}o(void 0)})}}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/
|
||
var p=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,n;return t=e,r=null,n=[{key:"chr",value:function(e){if(e>65535){e-=65536;var t=String.fromCharCode(e>>>10&1023|55296);return e=56320|1023&e,t+String.fromCharCode(e)}return String.fromCharCode(e)}},{key:"ord",value:function(e){if(2===e.length){var t=e.charCodeAt(0),r=e.charCodeAt(1);if(t>=55296&&t<56320&&r>=56320&&r<57344)return 1024*(t-55296)+r-56320+65536}return e.charCodeAt(0)}},{key:"padBytesRight",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=new Array(t);return n.fill(r),Array.prototype.map.call(e,function(e,t){n[t]=e}),n}},{key:"truncate",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...";return e.length>t&&(e=e.slice(0,t-r.length)+r),e}},{key:"hex",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return(t="string"==typeof t?e.ord(t):t).toString(16).padStart(r,"0")}},{key:"bin",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return(t="string"==typeof t?e.ord(t):t).toString(2).padStart(r,"0")}},{key:"printable",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof window&&window.app&&!window.app.options.treatAsUtf8&&(t=e.byteArrayToChars(e.strToByteArray(t)));return t=t.replace(/[\0-\x08\x0B-\x0C\x0E-\x1F\x7F-\x9F\xAD\u0378\u0379\u037F-\u0383\u038B\u038D\u03A2\u0528-\u0530\u0557\u0558\u0560\u0588\u058B-\u058E\u0590\u05C8-\u05CF\u05EB-\u05EF\u05F5-\u0605\u061C\u061D\u06DD\u070E\u070F\u074B\u074C\u07B2-\u07BF\u07FB-\u07FF\u082E\u082F\u083F\u085C\u085D\u085F-\u089F\u08A1\u08AD-\u08E3\u08FF\u0978\u0980\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09FC-\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF2-\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B55\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0C00\u0C04\u0C0D\u0C11\u0C29\u0C34\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5A-\u0C5F\u0C64\u0C65\u0C70-\u0C77\u0C80\u0C81\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0D01\u0D04\u0D0D\u0D11\u0D3B\u0D3C\u0D45\u0D49\u0D4F-\u0D56\u0D58-\u0D5F\u0D64\u0D65\u0D76-\u0D78\u0D80\u0D81\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DF1\u0DF5-\u0E00\u0E3B-\u0E3E\u0E5C-\u0E80\u0E83\u0E85\u0E86\u0E89\u0E8B\u0E8C\u0E8E-\u0E93\u0E98\u0EA0\u0EA4\u0EA6\u0EA8\u0EA9\u0EAC\u0EBA\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F48\u0F6D-\u0F70\u0F98\u0FBD\u0FCD\u0FDB-\u0FFF\u10C6\u10C8-\u10CC\u10CE\u10CF\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u137D-\u137F\u139A-\u139F\u13F5-\u13FF\u169D-\u169F\u16F1-\u16FF\u170D\u1715-\u171F\u1737-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17DE\u17DF\u17EA-\u17EF\u17FA-\u17FF\u180F\u181A-\u181F\u1878-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191D-\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1943\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19DD\u1A1C\u1A1D\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1A9F\u1AAE-\u1AFF\u1B4C-\u1B4F\u1B7D-\u1B7F\u1BF4-\u1BFB\u1C38-\u1C3A\u1C4A-\u1C4C\u1C80-\u1CBF\u1CC8-\u1CCF\u1CF7-\u1CFF\u1DE7-\u1DFB\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FC5\u1FD4\u1FD5\u1FDC\u1FF0\u1FF1\u1FF5\u1FFF\u200B-\u200F\u202A-\u202E\u2060-\u206F\u2072\u2073\u208F\u209D-\u209F\u20BB-\u20CF\u20F1-\u20FF\u218A-\u218F\u23F4-\u23FF\u2427-\u243F\u244B-\u245F\u2700\u2B4D-\u2B4F\u2B5A-\u2BFF\u2C2F\u2C5F\u2CF4-\u2CF8\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D71-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E3C-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3040\u3097\u3098\u3100-\u3104\u312E-\u3130\u318F\u31BB-\u31BF\u31E4-\u31EF\u321F\u32FF\u4DB6-\u4DBF\u9FCD-\u9FFF\uA48D-\uA48F\uA4C7-\uA4CF\uA62C-\uA63F\uA698-\uA69E\uA6F8-\uA6FF\uA78F\uA794-\uA79F\uA7AB-\uA7F7\uA82C-\uA82F\uA83A-\uA83F\uA878-\uA87F\uA8C5-\uA8CD\uA8DA-\uA8DF\uA8FC-\uA8FF\uA954-\uA95E\uA97D-\uA97F\uA9CE\uA9DA-\uA9DD\uA9E0-\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A\uAA5B\uAA7C-\uAA7F\uAAC3-\uAADA\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F-\uABBF\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBC2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFE\uFDFF\uFE1A-\uFE1F\uFE27-\uFE2F\uFE53\uFE67\uFE6C-\uFE6F\uFE75\uFEFD-\uFF00\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFDF\uFFE7\uFFEF-\uFFFB\uFFFE\uFFFF]/g,"."),r||(t=t.replace(/[\x09-\x10\x0D\u2028\u2029]/g,".")),t}},{key:"parseEscapedChars",value:function(e){return e.replace(/(\\)?\\([bfnrtv0'"]|x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]{1,6}\})/g,function(e,t,r){if("\\"===t)return"\\"+r;switch(r[0]){case"0":return"\0";case"b":return"\b";case"t":return"\t";case"n":return"\n";case"v":return"\v";case"f":return"\f";case"r":return"\r";case'"':return'"';case"'":return"'";case"x":return String.fromCharCode(parseInt(r.substr(1),16));case"u":return"{"===r[1]?String.fromCodePoint(parseInt(r.slice(2,-1),16)):String.fromCharCode(parseInt(r.substr(1),16))}})}},{key:"escapeRegex",value:function(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}},{key:"expandAlphRange",value:function(t){for(var r=[],n=0;n<t.length;n++)if(n<t.length-2&&"-"===t[n+1]&&"\\"!==t[n]){for(var i=e.ord(t[n]),a=e.ord(t[n+2]),o=i;o<=a;o++)r.push(e.chr(o));n+=2}else n<t.length-2&&"\\"===t[n]&&"-"===t[n+1]?(r.push("-"),n++):r.push(t[n]);return r}},{key:"convertToByteArray",value:function(t,r){switch(r.toLowerCase()){case"binary":return Object(u.a)(t);case"hex":return Object(o.c)(t);case"decimal":return Object(s.a)(t);case"base64":return Object(a.b)(t,null,"byteArray");case"utf8":return e.strToUtf8ByteArray(t);case"latin1":default:return e.strToByteArray(t)}}},{key:"convertToByteString",value:function(t,r){switch(r.toLowerCase()){case"binary":return e.byteArrayToChars(Object(u.a)(t));case"hex":return e.byteArrayToChars(Object(o.c)(t));case"decimal":return e.byteArrayToChars(Object(s.a)(t));case"base64":return e.byteArrayToChars(Object(a.b)(t,null,"byteArray"));case"utf8":return i.a.encode(t);case"latin1":default:return t}}},{key:"strToByteArray",value:function(t){for(var r,n=new Array(t.length),i=t.length;i--;)if(r=t.charCodeAt(i),n[i]=r,r>255)return e.strToUtf8ByteArray(t);return n}},{key:"strToUtf8ByteArray",value:function(t){var r=i.a.encode(t);return t.length!==r.length&&("function"==typeof importScripts?self.setOption("attemptHighlight",!1):"object"==typeof window&&(window.app.options.attemptHighlight=!1)),e.strToByteArray(r)}},{key:"strToCharcode",value:function(t){for(var r=[],n=0;n<t.length;n++){var i=t.charCodeAt(n);if(n<t.length-1&&i>=55296&&i<56320){var a=t[n+1].charCodeAt(0);a>=56320&&a<57344&&(i=e.ord(t[n]+t[++n]))}r.push(i)}return r}},{key:"byteArrayToUtf8",value:function(t){var r=e.byteArrayToChars(t);try{var n=i.a.decode(r);return r.length!==n.length&&("function"==typeof importScripts?self.setOption("attemptHighlight",!1):"object"==typeof window&&(window.app.options.attemptHighlight=!1)),n}catch(e){return r}}},{key:"byteArrayToChars",value:function(e){if(!e)return"";for(var t="",r=0;r<e.length;)t+=String.fromCharCode(e[r++]);return t}},{key:"arrayBufferToStr",value:function(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=Array.prototype.slice.call(new Uint8Array(t));return r?e.byteArrayToUtf8(n):e.byteArrayToChars(n)}},{key:"parseCSV",value:function(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[","],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["\n","\r"],a=!1,o=!1,s="",u=[],c=[];e.length&&"\ufeff"===e[0]&&(e=e.substr(1));for(var l=0;l<e.length;l++)t=e[l],r=e[l+1]||"",a?(s+=t,a=!1):'"'!==t||o?'"'===t&&o?'"'===r?a=!0:o=!1:!o&&n.indexOf(t)>=0?(u.push(s),s=""):!o&&i.indexOf(t)>=0?(u.push(s),s="",c.push(u),u=[],i.indexOf(r)>=0&&r!==t&&l++):s+=t:o=!0;return u.length&&(u.push(s),c.push(u)),c}},{key:"stripHtmlTags",value:function(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(e=e.replace(/<(script|style)[^>]*>.*<\/(script|style)>/gim,"")),e.replace(/<[^>]+>/g,"")}},{key:"escapeHtml",value:function(e){var t={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`"};return e.replace(/[&<>"'\/`]/g,function(e){return t[e]})}},{key:"unescapeHtml",value:function(e){var t={"&":"&","<":"<",">":">",""":'"',"'":"'","/":"/","`":"`"};return e.replace(/&#?x?[a-z0-9]{2,4};/gi,function(e){return t[e]||e})}},{key:"encodeURIFragment",value:function(e){var t={"%2D":"-","%2E":".","%5F":"_","%7E":"~","%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2C":",","%3B":";","%3A":":","%40":"@","%2F":"/","%3F":"?"};return(e=encodeURIComponent(e)).replace(/%[0-9A-F]{2}/g,function(e){return t[e]||e})}},{key:"generatePrettyRecipe",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="",n="",i="",a="",o="";return e.forEach(function(e){n=e.op.replace(/ /g,"_"),i=JSON.stringify(e.args).slice(1,-1).replace(/'/g,"\\'").replace(/"((?:[^"\\]|\\.)*)"/g,"'$1'").replace(/\\"/g,'"'),a=e.disabled?"/disabled":"",o=e.breakpoint?"/breakpoint":"",r+="".concat(n,"(").concat(i).concat(a).concat(o,")"),t&&(r+="\n")}),r}},{key:"parseRecipeConfig",value:function(e){if(0===(e=e.trim()).length)return[];if("["===e[0])return JSON.parse(e);var t,r;e=e.replace(/\n/g,"");for(var n=/([^(]+)\(((?:'[^'\\]*(?:\\.[^'\\]*)*'|[^)\/'])*)(\/[^)]+)?\)/g,i=[];t=n.exec(e);){r="["+(r=t[2].replace(/"/g,'\\"').replace(/(^|,|{|:)'/g,'$1"').replace(/([^\\]|[^\\]\\\\)'(,|:|}|$)/g,'$1"$2').replace(/\\'/g,"'"))+"]";var a={op:t[1].replace(/_/g," "),args:JSON.parse(r)};t[3]&&t[3].indexOf("disabled")>0&&(a.disabled=!0),t[3]&&t[3].indexOf("breakpoint")>0&&(a.breakpoint=!0),i.push(a)}return i}},{key:"displayFilesAsHTML",value:function(){var t=l(regeneratorRuntime.mark(function t(r){var n,i,o,s,u;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:n=function(t){return"<div class='card' style='white-space: normal;'>\n <div class='card-header'>\n <h6 class=\"mb-0\">\n ".concat(e.escapeHtml(t.name),"\n </h6>\n </div>\n </div>")},i=function(t,r){if(r.startsWith("image")){var n="data:";return n+=r+";","<img style='max-width: 100%;' src='"+(n+="base64,"+Object(a.c)(t))+"'>"}return"<pre>".concat(e.escapeHtml(e.arrayBufferToStr(t.buffer)),"</pre>")},o=function(){var t=l(regeneratorRuntime.mark(function t(r,n){var a,o,s;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.readFile(r);case 2:return a=t.sent,o=new Blob([a],{type:"octet/stream"}),s="<div class='card' style='white-space: normal;'>\n <div class='card-header' id='heading".concat(n,"'>\n <h6 class='mb-0'>\n <a class='collapsed'\n data-toggle='collapse'\n href='#collapse").concat(n,"'\n aria-expanded='false'\n aria-controls='collapse").concat(n,"'\n title=\"Show/hide contents of '").concat(e.escapeHtml(r.name),"'\">\n ").concat(e.escapeHtml(r.name),"</a>\n <span class='float-right' style=\"margin-top: -3px\">\n ").concat(r.size.toLocaleString(),' bytes\n <a title="Download ').concat(e.escapeHtml(r.name),"\"\n href='").concat(URL.createObjectURL(o),"'\n download='").concat(e.escapeHtml(r.name),'\'>\n <i class="material-icons" style="vertical-align: bottom">save</i>\n </a>\n </span>\n </h6>\n </div>\n <div id=\'collapse').concat(n,"' class='collapse' aria-labelledby='heading").concat(n,"' data-parent=\"#files\">\n <div class='card-body'>\n ").concat(i(a,r.type),"\n </div>\n </div>\n </div>"),t.abrupt("return",s);case 6:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}(),s="<div style='padding: 5px; white-space: normal;'>\n ".concat(r.length,' file(s) found\n </div><div id="files" style="padding: 20px">'),u=0;case 5:if(!(u<r.length)){t.next=17;break}if(!r[u].name.endsWith("/")){t.next=10;break}s+=n(r[u]),t.next=14;break;case 10:return t.t0=s,t.next=13,o(r[u],u);case 13:s=t.t0+=t.sent;case 14:u++,t.next=5;break;case 17:return t.abrupt("return",s+="</div>");case 18:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"parseURIParams",value:function(e){if(""===e)return{};"?"!==e[0]&&"#"!==e[0]||(e=e.substr(1));for(var t=e.split("&"),r={},n=0;n<t.length;n++){var i=t[n].split("=");2!==i.length?r[t[n]]=!0:r[i[0]]=decodeURIComponent(i[1].replace(/\+/g," "))}return r}},{key:"readFile",value:function(e){return new Promise(function(t,r){var n=new FileReader,i=new Uint8Array(e.size),a=0,o=function(){if(a>=e.size)t(i);else{var r=e.slice(a,a+10485760);n.readAsArrayBuffer(r)}};n.onload=function(e){i.set(new Uint8Array(n.result),a),a+=10485760,o()},n.onerror=function(e){r(n.error.message)},o()})}},{key:"mod",value:function(e,t){return(e%t+t)%t}},{key:"gcd",value:function(t,r){return r?e.gcd(r,t%r):t}},{key:"modInv",value:function(e,t){e%=t;for(var r=1;r<t;r++)if(e*r%26==1)return r}},{key:"charRep",value:function(e){return{Space:" ",Comma:",","Semi-colon":";",Colon:":","Line feed":"\n",CRLF:"\r\n","Forward slash":"/",Backslash:"\\","0x":"0x","\\x":"\\x","Nothing (separate chars)":"",None:""}[e]}},{key:"regexRep",value:function(e){return{Space:/\s+/g,Comma:/,/g,"Semi-colon":/;/g,Colon:/:/g,"Line feed":/\n/g,CRLF:/\r\n/g,"Forward slash":/\//g,Backslash:/\\/g,"0x":/0x/g,"\\x":/\\x/g,None:/\s+/g}[e]}}],r&&f(t.prototype,r),n&&f(t,n),e}();t.a=p,Array.prototype.unique=function(){for(var e={},t=[],r=0,n=this.length;r<n;r++)e.hasOwnProperty(this[r])||(t.push(this[r]),e[this[r]]=1);return t},Array.prototype.max=function(){return Math.max.apply(null,this)},Array.prototype.min=function(){return Math.min.apply(null,this)},Array.prototype.sum=function(){return this.reduce(function(e,t){return e+t},0)},Array.prototype.equals=function(e){if(!e)return!1;var t=this.length;if(t!==e.length)return!1;for(;t--;)if(this[t]!==e[t])return!1;return!0},String.prototype.count=function(e){return this.split(e).length-1},String.prototype.padStart||(String.prototype.padStart=function(e,t){return e>>=0,t=String(void 0!==t?t:" "),this.length>e?String(this):((e-=this.length)>t.length&&(t+=t.repeat(e/t.length)),t.slice(0,e)+String(this))}),String.prototype.padEnd||(String.prototype.padEnd=function(e,t){return e>>=0,t=String(void 0!==t?t:" "),this.length>e?String(this):((e-=this.length)>t.length&&(t+=t.repeat(e/t.length)),String(this)+t.slice(0,e))})},1:function(e,t,r){"use strict";var n=r(9),i=r(0),a=r(7);function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/
|
||
var s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name="",this.type="",this._value=null,this.disabled=!1,this.hint="",this.rows=0,this.toggleValues=[],this.target=null,this.defaultIndex=0,t&&this._parseConfig(t)}var t,r,n;return t=e,n=[{key:"prepare",value:function(e,t){var r;switch(t){case"binaryString":case"binaryShortString":case"editableOption":case"editableOptionShort":return i.a.parseEscapedChars(e);case"byteArray":return"string"==typeof e?(e=e.replace(/\s+/g,""),Object(a.c)(e)):e;case"number":if(r=parseFloat(e),isNaN(r))throw"Invalid ingredient value. Not a number: "+i.a.truncate(e.toString(),10);return r;default:return e}}}],(r=[{key:"_parseConfig",value:function(e){this.name=e.name,this.type=e.type,this.defaultValue=e.value,this.disabled=!!e.disabled,this.hint=e.hint||!1,this.rows=e.rows||!1,this.toggleValues=e.toggleValues,this.target=void 0!==e.target?e.target:null,this.defaultIndex=void 0!==e.defaultIndex?e.defaultIndex:0}},{key:"config",get:function(){return this._value}},{key:"value",set:function(t){this._value=e.prepare(t,this.type)},get:function(){return this._value}}])&&o(t.prototype,r),n&&o(t,n),e}();function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/
|
||
var c=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._inputType=-1,this._outputType=-1,this._presentType=-1,this._breakpoint=!1,this._disabled=!1,this._flowControl=!1,this._manualBake=!1,this._ingList=[],this.name="",this.module="",this.description="",this.infoURL=null}var t,r,i;return t=e,(r=[{key:"run",value:function(e,t){return e}},{key:"highlight",value:function(e,t){return!1}},{key:"highlightReverse",value:function(e,t){return!1}},{key:"present",value:function(e,t){return e}},{key:"addIngredient",value:function(e){this._ingList.push(e)}},{key:"inputType",set:function(e){this._inputType=n.a.typeEnum(e)},get:function(){return n.a.enumLookup(this._inputType)}},{key:"outputType",set:function(e){this._outputType=n.a.typeEnum(e),this._presentType<0&&(this._presentType=this._outputType)},get:function(){return n.a.enumLookup(this._outputType)}},{key:"presentType",set:function(e){this._presentType=n.a.typeEnum(e)},get:function(){return n.a.enumLookup(this._presentType)}},{key:"args",set:function(e){var t=this;e.forEach(function(e){var r=new s(e);t.addIngredient(r)})},get:function(){return this._ingList.map(function(e){var t={name:e.name,type:e.type,value:e.defaultValue};return e.toggleValues&&(t.toggleValues=e.toggleValues),e.hint&&(t.hint=e.hint),e.rows&&(t.rows=e.rows),e.disabled&&(t.disabled=e.disabled),e.target&&(t.target=e.target),e.defaultIndex&&(t.defaultIndex=e.defaultIndex),t})}},{key:"config",get:function(){return{op:this.name,args:this._ingList.map(function(e){return e.config})}}},{key:"ingValues",set:function(e){var t=this;e.forEach(function(e,r){t._ingList[r].value=e})},get:function(){return this._ingList.map(function(e){return e.value})}},{key:"breakpoint",set:function(e){this._breakpoint=!!e},get:function(){return this._breakpoint}},{key:"disabled",set:function(e){this._disabled=!!e},get:function(){return this._disabled}},{key:"flowControl",get:function(){return this._flowControl},set:function(e){this._flowControl=!!e}},{key:"manualBake",get:function(){return this._manualBake},set:function(e){this._manualBake=!!e}}])&&u(t.prototype,r),i&&u(t,i),e}();t.a=c},10:function(e,t,r){"use strict";r.d(t,"c",function(){return i}),r.d(t,"b",function(){return a}),r.d(t,"a",function(){return o});var n=r(0);
|
||
/**
|
||
* Base64 functions.
|
||
*
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=";if(!e)return"";"string"==typeof e&&(e=n.a.strToByteArray(e)),t=n.a.expandAlphRange(t).join("");for(var r,i,a,o,s,u,c,l="",f=0;f<e.length;)o=(r=e[f++])>>2,s=(3&r)<<4|(i=e[f++])>>4,u=(15&i)<<2|(a=e[f++])>>6,c=63&a,isNaN(i)?u=c=64:isNaN(a)&&(c=64),l+=t.charAt(o)+t.charAt(s)+t.charAt(u)+t.charAt(c);return l}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"string",i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(!e)return"string"===r?"":[];t=t||"A-Za-z0-9+/=",t=n.a.expandAlphRange(t).join("");var a,o,s,u,c,l,f=[],p=0;if(i){var h=new RegExp("[^"+t.replace(/[[\]\\\-^$]/g,"\\$&")+"]","g");e=e.replace(h,"")}for(;p<e.length;)a=t.indexOf(e.charAt(p++))<<2|(u=-1===(u=t.indexOf(e.charAt(p++)||"="))?64:u)>>4,o=(15&u)<<4|(c=-1===(c=t.indexOf(e.charAt(p++)||"="))?64:c)>>2,s=(3&c)<<6|(l=-1===(l=t.indexOf(e.charAt(p++)||"="))?64:l),f.push(a),64!==c&&f.push(o),64!==l&&f.push(s);return"string"===r?n.a.byteArrayToUtf8(f):f}var o=[{name:"Standard (RFC 4648): A-Za-z0-9+/=",value:"A-Za-z0-9+/="},{name:"URL safe (RFC 4648 §5): A-Za-z0-9-_",value:"A-Za-z0-9-_"},{name:"Filename safe: A-Za-z0-9+-=",value:"A-Za-z0-9+\\-="},{name:"itoa64: ./0-9A-Za-z=",value:"./0-9A-Za-z="},{name:"XML: A-Za-z0-9_.",value:"A-Za-z0-9_."},{name:"y64: A-Za-z0-9._-",value:"A-Za-z0-9._-"},{name:"z64: 0-9a-zA-Z+/=",value:"0-9a-zA-Z+/="},{name:"Radix-64 (RFC 4880): 0-9A-Za-z+/=",value:"0-9A-Za-z+/="},{name:"Uuencoding: [space]-_",value:" -_"},{name:"Xxencoding: +-0-9A-Za-z",value:"+\\-0-9A-Za-z"},{name:"BinHex: !-,-0-689@A-NP-VX-Z[`a-fh-mp-r",value:"!-,-0-689@A-NP-VX-Z[`a-fh-mp-r"},{name:"ROT13: N-ZA-Mn-za-m0-9+/=",value:"N-ZA-Mn-za-m0-9+/="},{name:"UNIX crypt: ./0-9A-Za-z",value:"./0-9A-Za-z"}]},1071:function(e,t,r){var n;e.exports=(n=r(34),function(){if("function"==typeof ArrayBuffer){var e=n.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var r=e.byteLength,n=[],i=0;i<r;i++)n[i>>>2]|=e[i]<<24-i%4*8;t.call(this,n,r)}else t.apply(this,arguments)}).prototype=e}}(),n.lib.WordArray)},1072:function(e,t,r){var n;e.exports=(n=r(34),function(){var e=n,t=e.lib.WordArray,r=e.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}r.Utf16=r.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i+=2){var a=t[i>>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var r=e.length,n=[],i=0;i<r;i++)n[i>>>1]|=e.charCodeAt(i)<<16-i%2*16;return t.create(n,2*r)}},r.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],a=0;a<r;a+=2){var o=i(t[a>>>2]>>>16-a%4*8&65535);n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var r=e.length,n=[],a=0;a<r;a++)n[a>>>1]|=i(e.charCodeAt(a)<<16-a%2*16);return t.create(n,2*r)}}}(),n.enc.Utf16)},1073:function(e,t,r){var n,i,a,o,s,u;e.exports=(n=r(34),r(700),a=(i=n).lib.WordArray,o=i.algo,s=o.SHA256,u=o.SHA224=s.extend({_doReset:function(){this._hash=new a.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=4,e}}),i.SHA224=s._createHelper(u),i.HmacSHA224=s._createHmacHelper(u),n.SHA224)},1074:function(e,t,r){var n,i,a,o,s,u,c,l;e.exports=(n=r(34),r(498),r(701),a=(i=n).x64,o=a.Word,s=a.WordArray,u=i.algo,c=u.SHA512,l=u.SHA384=c.extend({_doReset:function(){this._hash=new s.init([new o.init(3418070365,3238371032),new o.init(1654270250,914150663),new o.init(2438529370,812702999),new o.init(355462360,4144912697),new o.init(1731405415,4290775857),new o.init(2394180231,1750603025),new o.init(3675008525,1694076839),new o.init(1203062813,3204075428)])},_doFinalize:function(){var e=c._doFinalize.call(this);return e.sigBytes-=16,e}}),i.SHA384=c._createHelper(l),i.HmacSHA384=c._createHmacHelper(l),n.SHA384)},1075:function(e,t,r){var n;e.exports=(n=r(34),r(498),function(e){var t=n,r=t.lib,i=r.WordArray,a=r.Hasher,o=t.x64.Word,s=t.algo,u=[],c=[],l=[];!function(){for(var e=1,t=0,r=0;r<24;r++){u[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)c[e+5*t]=t+(2*e+3*t)%5*5;for(var i=1,a=0;a<24;a++){for(var s=0,f=0,p=0;p<7;p++){if(1&i){var h=(1<<p)-1;h<32?f^=1<<h:s^=1<<h-32}128&i?i=i<<1^113:i<<=1}l[a]=o.create(s,f)}}();var f=[];!function(){for(var e=0;e<25;e++)f[e]=o.create()}();var p=s.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new o.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,n=this.blockSize/2,i=0;i<n;i++){var a=e[t+2*i],o=e[t+2*i+1];a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(_=r[i]).high^=o,_.low^=a}for(var s=0;s<24;s++){for(var p=0;p<5;p++){for(var h=0,d=0,y=0;y<5;y++)h^=(_=r[p+5*y]).high,d^=_.low;var g=f[p];g.high=h,g.low=d}for(p=0;p<5;p++){var v=f[(p+4)%5],m=f[(p+1)%5],b=m.high,C=m.low;for(h=v.high^(b<<1|C>>>31),d=v.low^(C<<1|b>>>31),y=0;y<5;y++)(_=r[p+5*y]).high^=h,_.low^=d}for(var E=1;E<25;E++){var S=(_=r[E]).high,T=_.low,A=u[E];A<32?(h=S<<A|T>>>32-A,d=T<<A|S>>>32-A):(h=T<<A-32|S>>>64-A,d=S<<A-32|T>>>64-A);var B=f[c[E]];B.high=h,B.low=d}var w=f[0],I=r[0];for(w.high=I.high,w.low=I.low,p=0;p<5;p++)for(y=0;y<5;y++){var _=r[E=p+5*y],k=f[E],R=f[(p+1)%5+5*y],N=f[(p+2)%5+5*y];_.high=k.high^~R.high&N.high,_.low=k.low^~R.low&N.low}_=r[0];var L=l[s];_.high^=L.high,_.low^=L.low}},_doFinalize:function(){var t=this._data,r=t.words,n=(this._nDataBytes,8*t.sigBytes),a=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(e.ceil((n+1)/a)*a>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var o=this._state,s=this.cfg.outputLength/8,u=s/8,c=[],l=0;l<u;l++){var f=o[l],p=f.high,h=f.low;p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),c.push(h),c.push(p)}return new i.init(c,s)},clone:function(){for(var e=a.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=a._createHelper(p),t.HmacSHA3=a._createHmacHelper(p)}(Math),n.SHA3)},1076:function(e,t,r){var n;e.exports=(n=r(34),
|
||
/** @preserve
|
||
(c) 2012 by Cédric Mesnil. All rights reserved.
|
||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||
|
||
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
*/
|
||
function(e){var t=n,r=t.lib,i=r.WordArray,a=r.Hasher,o=t.algo,s=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),f=i.create([0,1518500249,1859775393,2400959708,2840853838]),p=i.create([1352829926,1548603684,1836072691,2053994217,0]),h=o.RIPEMD160=a.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var a,o,h,C,E,S,T,A,B,w,I,_=this._hash.words,k=f.words,R=p.words,N=s.words,L=u.words,D=c.words,O=l.words;for(S=a=_[0],T=o=_[1],A=h=_[2],B=C=_[3],w=E=_[4],r=0;r<80;r+=1)I=a+e[t+N[r]]|0,I+=r<16?d(o,h,C)+k[0]:r<32?y(o,h,C)+k[1]:r<48?g(o,h,C)+k[2]:r<64?v(o,h,C)+k[3]:m(o,h,C)+k[4],I=(I=b(I|=0,D[r]))+E|0,a=E,E=C,C=b(h,10),h=o,o=I,I=S+e[t+L[r]]|0,I+=r<16?m(T,A,B)+R[0]:r<32?v(T,A,B)+R[1]:r<48?g(T,A,B)+R[2]:r<64?y(T,A,B)+R[3]:d(T,A,B)+R[4],I=(I=b(I|=0,O[r]))+w|0,S=w,w=B,B=b(A,10),A=T,T=I;I=_[1]+h+B|0,_[1]=_[2]+C+w|0,_[2]=_[3]+E+S|0,_[3]=_[4]+a+T|0,_[4]=_[0]+o+A|0,_[0]=I},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var i=this._hash,a=i.words,o=0;o<5;o++){var s=a[o];a[o]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return i},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function d(e,t,r){return e^t^r}function y(e,t,r){return e&t|~e&r}function g(e,t,r){return(e|~t)^r}function v(e,t,r){return e&r|t&~r}function m(e,t,r){return e^(t|~r)}function b(e,t){return e<<t|e>>>32-t}t.RIPEMD160=a._createHelper(h),t.HmacRIPEMD160=a._createHmacHelper(h)}(Math),n.RIPEMD160)},1077:function(e,t,r){var n,i,a,o,s,u,c,l,f;e.exports=(n=r(34),r(581),r(582),a=(i=n).lib,o=a.Base,s=a.WordArray,u=i.algo,c=u.SHA1,l=u.HMAC,f=u.PBKDF2=o.extend({cfg:o.extend({keySize:4,hasher:c,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=l.create(r.hasher,e),i=s.create(),a=s.create([1]),o=i.words,u=a.words,c=r.keySize,f=r.iterations;o.length<c;){var p=n.update(t).finalize(a);n.reset();for(var h=p.words,d=h.length,y=p,g=1;g<f;g++){y=n.finalize(y),n.reset();for(var v=y.words,m=0;m<d;m++)h[m]^=v[m]}i.concat(p),u[0]++}return i.sigBytes=4*c,i}}),i.PBKDF2=function(e,t,r){return f.create(r).compute(e,t)},n.PBKDF2)},1078:function(e,t,r){var n;e.exports=(n=r(34),r(77),n.mode.CFB=function(){var e=n.lib.BlockCipherMode.extend();function t(e,t,r,n){var i=this._iv;if(i){var a=i.slice(0);this._iv=void 0}else a=this._prevBlock;n.encryptBlock(a,0);for(var o=0;o<r;o++)e[t+o]^=a[o]}return e.Encryptor=e.extend({processBlock:function(e,r){var n=this._cipher,i=n.blockSize;t.call(this,e,r,i,n),this._prevBlock=e.slice(r,r+i)}}),e.Decryptor=e.extend({processBlock:function(e,r){var n=this._cipher,i=n.blockSize,a=e.slice(r,r+i);t.call(this,e,r,i,n),this._prevBlock=a}}),e}(),n.mode.CFB)},1079:function(e,t,r){var n,i,a;e.exports=(n=r(34),r(77),n.mode.CTR=(i=n.lib.BlockCipherMode.extend(),a=i.Encryptor=i.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0);var o=a.slice(0);r.encryptBlock(o,0),a[n-1]=a[n-1]+1|0;for(var s=0;s<n;s++)e[t+s]^=o[s]}}),i.Decryptor=a,i),n.mode.CTR)},1080:function(e,t,r){var n;e.exports=(n=r(34),r(77),
|
||
/** @preserve
|
||
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
||
* derived from CryptoJS.mode.CTR
|
||
* Jan Hruby jhruby.web@gmail.com
|
||
*/
|
||
n.mode.CTRGladman=function(){var e=n.lib.BlockCipherMode.extend();function t(e){if(255==(e>>24&255)){var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}else e+=1<<24;return e}var r=e.Encryptor=e.extend({processBlock:function(e,r){var n=this._cipher,i=n.blockSize,a=this._iv,o=this._counter;a&&(o=this._counter=a.slice(0),this._iv=void 0),function(e){0===(e[0]=t(e[0]))&&(e[1]=t(e[1]))}(o);var s=o.slice(0);n.encryptBlock(s,0);for(var u=0;u<i;u++)e[r+u]^=s[u]}});return e.Decryptor=r,e}(),n.mode.CTRGladman)},1081:function(e,t,r){var n,i,a;e.exports=(n=r(34),r(77),n.mode.OFB=(i=n.lib.BlockCipherMode.extend(),a=i.Encryptor=i.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,i=this._iv,a=this._keystream;i&&(a=this._keystream=i.slice(0),this._iv=void 0),r.encryptBlock(a,0);for(var o=0;o<n;o++)e[t+o]^=a[o]}}),i.Decryptor=a,i),n.mode.OFB)},1082:function(e,t,r){var n,i;e.exports=(n=r(34),r(77),n.mode.ECB=((i=n.lib.BlockCipherMode.extend()).Encryptor=i.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),i.Decryptor=i.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),i),n.mode.ECB)},1083:function(e,t,r){var n;e.exports=(n=r(34),r(77),n.pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,n=4*t,i=n-r%n,a=r+i-1;e.clamp(),e.words[a>>>2]|=i<<24-a%4*8,e.sigBytes+=i},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},n.pad.Ansix923)},1084:function(e,t,r){var n;e.exports=(n=r(34),r(77),n.pad.Iso10126={pad:function(e,t){var r=4*t,i=r-e.sigBytes%r;e.concat(n.lib.WordArray.random(i-1)).concat(n.lib.WordArray.create([i<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},n.pad.Iso10126)},1085:function(e,t,r){var n;e.exports=(n=r(34),r(77),n.pad.Iso97971={pad:function(e,t){e.concat(n.lib.WordArray.create([2147483648],1)),n.pad.ZeroPadding.pad(e,t)},unpad:function(e){n.pad.ZeroPadding.unpad(e),e.sigBytes--}},n.pad.Iso97971)},1086:function(e,t,r){var n;e.exports=(n=r(34),r(77),n.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){for(var t=e.words,r=e.sigBytes-1;!(t[r>>>2]>>>24-r%4*8&255);)r--;e.sigBytes=r+1}},n.pad.ZeroPadding)},1087:function(e,t,r){var n;e.exports=(n=r(34),r(77),n.pad.NoPadding={pad:function(){},unpad:function(){}},n.pad.NoPadding)},1088:function(e,t,r){var n,i,a,o;e.exports=(n=r(34),r(77),a=(i=n).lib.CipherParams,o=i.enc.Hex,i.format.Hex={stringify:function(e){return e.ciphertext.toString(o)},parse:function(e){var t=o.parse(e);return a.create({ciphertext:t})}},n.format.Hex)},1089:function(e,t,r){var n;e.exports=(n=r(34),r(419),r(420),r(329),r(77),function(){var e=n,t=e.lib.BlockCipher,r=e.algo,i=[],a=[],o=[],s=[],u=[],c=[],l=[],f=[],p=[],h=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var d=n^n<<1^n<<2^n<<3^n<<4;d=d>>>8^255&d^99,i[r]=d,a[d]=r;var y=e[r],g=e[y],v=e[g],m=257*e[d]^16843008*d;o[r]=m<<24|m>>>8,s[r]=m<<16|m>>>16,u[r]=m<<8|m>>>24,c[r]=m,m=16843009*v^65537*g^257*y^16843008*r,l[d]=m<<24|m>>>8,f[d]=m<<16|m>>>16,p[d]=m<<8|m>>>24,h[d]=m,r?(r=y^e[e[e[v^y]]],n^=e[e[n]]):r=n=1}}();var d=[0,1,2,4,8,16,32,64,128,27,54],y=r.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),a=this._keySchedule=[],o=0;o<n;o++)if(o<r)a[o]=t[o];else{var s=a[o-1];o%r?r>6&&o%r==4&&(s=i[s>>>24]<<24|i[s>>>16&255]<<16|i[s>>>8&255]<<8|i[255&s]):(s=i[(s=s<<8|s>>>24)>>>24]<<24|i[s>>>16&255]<<16|i[s>>>8&255]<<8|i[255&s],s^=d[o/r|0]<<24),a[o]=a[o-r]^s}for(var u=this._invKeySchedule=[],c=0;c<n;c++)o=n-c,s=c%4?a[o]:a[o-4],u[c]=c<4||o<=4?s:l[i[s>>>24]]^f[i[s>>>16&255]]^p[i[s>>>8&255]]^h[i[255&s]]}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,s,u,c,i)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,l,f,p,h,a),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,i,a,o,s){for(var u=this._nRounds,c=e[t]^r[0],l=e[t+1]^r[1],f=e[t+2]^r[2],p=e[t+3]^r[3],h=4,d=1;d<u;d++){var y=n[c>>>24]^i[l>>>16&255]^a[f>>>8&255]^o[255&p]^r[h++],g=n[l>>>24]^i[f>>>16&255]^a[p>>>8&255]^o[255&c]^r[h++],v=n[f>>>24]^i[p>>>16&255]^a[c>>>8&255]^o[255&l]^r[h++],m=n[p>>>24]^i[c>>>16&255]^a[l>>>8&255]^o[255&f]^r[h++];c=y,l=g,f=v,p=m}y=(s[c>>>24]<<24|s[l>>>16&255]<<16|s[f>>>8&255]<<8|s[255&p])^r[h++],g=(s[l>>>24]<<24|s[f>>>16&255]<<16|s[p>>>8&255]<<8|s[255&c])^r[h++],v=(s[f>>>24]<<24|s[p>>>16&255]<<16|s[c>>>8&255]<<8|s[255&l])^r[h++],m=(s[p>>>24]<<24|s[c>>>16&255]<<16|s[l>>>8&255]<<8|s[255&f])^r[h++],e[t]=y,e[t+1]=g,e[t+2]=v,e[t+3]=m},keySize:8});e.AES=t._createHelper(y)}(),n.AES)},1090:function(e,t,r){var n;e.exports=(n=r(34),r(419),r(420),r(329),r(77),function(){var e=n,t=e.lib,r=t.WordArray,i=t.BlockCipher,a=e.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],f=a.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=o[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var i=this._subKeys=[],a=0;a<16;a++){var c=i[a]=[],l=u[a];for(r=0;r<24;r++)c[r/6|0]|=t[(s[r]-1+l)%28]<<31-r%6,c[4+(r/6|0)]|=t[28+(s[r+24]-1+l)%28]<<31-r%6;for(c[0]=c[0]<<1|c[0]>>>31,r=1;r<7;r++)c[r]=c[r]>>>4*(r-1)+3;c[7]=c[7]<<5|c[7]>>>27}var f=this._invSubKeys=[];for(r=0;r<16;r++)f[r]=i[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],p.call(this,4,252645135),p.call(this,16,65535),h.call(this,2,858993459),h.call(this,8,16711935),p.call(this,1,1431655765);for(var n=0;n<16;n++){for(var i=r[n],a=this._lBlock,o=this._rBlock,s=0,u=0;u<8;u++)s|=c[u][((o^i[u])&l[u])>>>0];this._lBlock=o,this._rBlock=a^s}var f=this._lBlock;this._lBlock=this._rBlock,this._rBlock=f,p.call(this,1,1431655765),h.call(this,8,16711935),h.call(this,2,858993459),p.call(this,16,65535),p.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function p(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function h(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}e.DES=i._createHelper(f);var d=a.TripleDES=i.extend({_doReset:function(){var e=this._key.words;this._des1=f.createEncryptor(r.create(e.slice(0,2))),this._des2=f.createEncryptor(r.create(e.slice(2,4))),this._des3=f.createEncryptor(r.create(e.slice(4,6)))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=i._createHelper(d)}(),n.TripleDES)},1091:function(e,t,r){var n;e.exports=(n=r(34),r(419),r(420),r(329),r(77),function(){var e=n,t=e.lib.StreamCipher,r=e.algo,i=r.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],i=0;i<256;i++)n[i]=i;i=0;for(var a=0;i<256;i++){var o=i%r,s=t[o>>>2]>>>24-o%4*8&255;a=(a+n[i]+s)%256;var u=n[i];n[i]=n[a],n[a]=u}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=a.call(this)},keySize:8,ivSize:0});function a(){for(var e=this._S,t=this._i,r=this._j,n=0,i=0;i<4;i++){r=(r+e[t=(t+1)%256])%256;var a=e[t];e[t]=e[r],e[r]=a,n|=e[(e[t]+e[r])%256]<<24-8*i}return this._i=t,this._j=r,n}e.RC4=t._createHelper(i);var o=r.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)a.call(this)}});e.RC4Drop=t._createHelper(o)}(),n.RC4)},1092:function(e,t,r){var n;e.exports=(n=r(34),r(419),r(420),r(329),r(77),function(){var e=n,t=e.lib.StreamCipher,r=e.algo,i=[],a=[],o=[],s=r.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)u.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(t){var a=t.words,o=a[0],s=a[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),f=c>>>16|4294901760&l,p=l<<16|65535&c;for(i[0]^=c,i[1]^=f,i[2]^=l,i[3]^=p,i[4]^=c,i[5]^=f,i[6]^=l,i[7]^=p,r=0;r<4;r++)u.call(this)}},_doProcessBlock:function(e,t){var r=this._X;u.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),e[t+n]^=i[n]},blockSize:4,ivSize:2});function u(){for(var e=this._X,t=this._C,r=0;r<8;r++)a[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<a[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<a[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<a[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<a[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<a[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<a[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<a[6]>>>0?1:0)|0,this._b=t[7]>>>0<a[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,s=n>>>16,u=((i*i>>>17)+i*s>>>15)+s*s,c=((4294901760&n)*n|0)+((65535&n)*n|0);o[r]=u^c}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=t._createHelper(s)}(),n.Rabbit)},1093:function(e,t,r){var n;e.exports=(n=r(34),r(419),r(420),r(329),r(77),function(){var e=n,t=e.lib.StreamCipher,r=e.algo,i=[],a=[],o=[],s=r.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var i=0;i<4;i++)u.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(t){var a=t.words,o=a[0],s=a[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),f=c>>>16|4294901760&l,p=l<<16|65535&c;for(n[0]^=c,n[1]^=f,n[2]^=l,n[3]^=p,n[4]^=c,n[5]^=f,n[6]^=l,n[7]^=p,i=0;i<4;i++)u.call(this)}},_doProcessBlock:function(e,t){var r=this._X;u.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),e[t+n]^=i[n]},blockSize:4,ivSize:2});function u(){for(var e=this._X,t=this._C,r=0;r<8;r++)a[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<a[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<a[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<a[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<a[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<a[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<a[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<a[6]>>>0?1:0)|0,this._b=t[7]>>>0<a[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,s=n>>>16,u=((i*i>>>17)+i*s>>>15)+s*s,c=((4294901760&n)*n|0)+((65535&n)*n|0);o[r]=u^c}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=t._createHelper(s)}(),n.RabbitLegacy)},12:function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}
|
||
/**
|
||
* Custom error type for handling Dish type errors.
|
||
* i.e. where the Dish cannot be successfully translated between types
|
||
*
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2018
|
||
* @license Apache-2.0
|
||
*/var u=function(e){function t(){var e,r,a,s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var u=arguments.length,c=new Array(u),l=0;l<u;l++)c[l]=arguments[l];return a=this,(r=!(s=(e=i(t)).call.apply(e,[this].concat(c)))||"object"!==n(s)&&"function"!=typeof s?o(a):s).type="DishError",Error.captureStackTrace&&Error.captureStackTrace(o(o(r)),t),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(t,s(Error)),t}();t.a=u},13:function(e,t,r){"use strict";r.d(t,"c",function(){return n}),r.d(t,"b",function(){return i}),r.d(t,"h",function(){return a}),r.d(t,"j",function(){return o}),r.d(t,"e",function(){return s}),r.d(t,"a",function(){return u}),r.d(t,"d",function(){return c}),r.d(t,"f",function(){return l}),r.d(t,"i",function(){return f}),r.d(t,"g",function(){return p});
|
||
/**
|
||
* Various delimiters
|
||
*
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2018
|
||
* @license Apache-2.0
|
||
*/
|
||
var n=["Space","Comma","Semi-colon","Colon","Line feed","CRLF"],i=["Space","Comma","Semi-colon","Colon","Line feed","CRLF","None"],a=["Space","Line feed","CRLF","Forward slash","Backslash","Comma","Semi-colon","Colon"],o=["Line feed","CRLF","Forward slash","Backslash","Comma","Semi-colon","Colon"],s=["Line feed","CRLF","Space","Comma","Semi-colon","Colon","Nothing (separate chars)"],u=["Line feed","Space","Comma","Semi-colon","Colon","CRLF"],c=["Line feed","CRLF","Space","Comma"],l=["Line feed","CRLF","Space","Comma","Semi-colon"],f=[{name:"Comma",value:","},{name:"Space",value:" "},{name:"Line feed",value:"\\n"},{name:"CRLF",value:"\\r\\n"},{name:"Semi-colon",value:";"},{name:"Colon",value:":"},{name:"Nothing (separate chars)",value:""}],p=[{name:"Line feed",value:"\\n"},{name:"CRLF",value:"\\r\\n"},{name:"Space",value:" "},{name:"Comma",value:","},{name:"Semi-colon",value:";"},{name:"Colon",value:":"},{name:"Nothing (join chars)",value:""}]},14:function(e,t,r){var n,i;!function(a,o){"use strict";void 0===(i="function"==typeof(n=function(){var e=function(){},t="undefined",r=["trace","debug","info","warn","error"];function n(e,t){var r=e[t];if("function"==typeof r.bind)return r.bind(e);try{return Function.prototype.bind.call(r,e)}catch(t){return function(){return Function.prototype.apply.apply(r,[e,arguments])}}}function i(t,n){for(var i=0;i<r.length;i++){var a=r[i];this[a]=i<t?e:this.methodFactory(a,t,n)}this.log=this.debug}function a(r,a,o){return function(r){"debug"===r&&(r="log");return typeof console!==t&&(void 0!==console[r]?n(console,r):void 0!==console.log?n(console,"log"):e)}(r)||function(e,r,n){return function(){typeof console!==t&&(i.call(this,r,n),this[e].apply(this,arguments))}}.apply(this,arguments)}function o(e,n,o){var s,u=this,c="loglevel";function l(){var e;if(typeof window!==t){try{e=window.localStorage[c]}catch(e){}if(typeof e===t)try{var r=window.document.cookie,n=r.indexOf(encodeURIComponent(c)+"=");-1!==n&&(e=/^([^;]+)/.exec(r.slice(n))[1])}catch(e){}return void 0===u.levels[e]&&(e=void 0),e}}e&&(c+=":"+e),u.name=e,u.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},u.methodFactory=o||a,u.getLevel=function(){return s},u.setLevel=function(n,a){if("string"==typeof n&&void 0!==u.levels[n.toUpperCase()]&&(n=u.levels[n.toUpperCase()]),!("number"==typeof n&&n>=0&&n<=u.levels.SILENT))throw"log.setLevel() called with invalid level: "+n;if(s=n,!1!==a&&function(e){var n=(r[e]||"silent").toUpperCase();if(typeof window===t)return;try{return void(window.localStorage[c]=n)}catch(e){}try{window.document.cookie=encodeURIComponent(c)+"="+n+";"}catch(e){}}(n),i.call(u,n,e),typeof console===t&&n<u.levels.SILENT)return"No console available for logging"},u.setDefaultLevel=function(e){l()||u.setLevel(e,!1)},u.enableAll=function(e){u.setLevel(u.levels.TRACE,e)},u.disableAll=function(e){u.setLevel(u.levels.SILENT,e)};var f=l();null==f&&(f=null==n?"WARN":n),u.setLevel(f,!1)}var s=new o,u={};s.getLogger=function(e){if("string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=u[e];return t||(t=u[e]=new o(e,s.getLevel(),s.methodFactory)),t};var c=typeof window!==t?window.log:void 0;return s.noConflict=function(){return typeof window!==t&&window.log===s&&(window.log=c),s},s.getLoggers=function(){return u},s})?n.call(t,r,t,e):n)||(e.exports=i)}()},15:function(e,t,r){!function(e){var t,r,n,i=String.fromCharCode;function a(e){for(var t,r,n=[],i=0,a=e.length;i<a;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<a?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function o(e){if(e>=55296&&e<=57343)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value")}function s(e,t){return i(e>>t&63|128)}function u(e){if(0==(4294967168&e))return i(e);var t="";return 0==(4294965248&e)?t=i(e>>6&31|192):0==(4294901760&e)?(o(e),t=i(e>>12&15|224),t+=s(e,6)):0==(4292870144&e)&&(t=i(e>>18&7|240),t+=s(e,12),t+=s(e,6)),t+=i(63&e|128)}function c(){if(n>=r)throw Error("Invalid byte index");var e=255&t[n];if(n++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function l(){var e,i;if(n>r)throw Error("Invalid byte index");if(n==r)return!1;if(e=255&t[n],n++,0==(128&e))return e;if(192==(224&e)){if((i=(31&e)<<6|c())>=128)return i;throw Error("Invalid continuation byte")}if(224==(240&e)){if((i=(15&e)<<12|c()<<6|c())>=2048)return o(i),i;throw Error("Invalid continuation byte")}if(240==(248&e)&&(i=(7&e)<<18|c()<<12|c()<<6|c())>=65536&&i<=1114111)return i;throw Error("Invalid UTF-8 detected")}e.version="3.0.0",e.encode=function(e){for(var t=a(e),r=t.length,n=-1,i="";++n<r;)i+=u(t[n]);return i},e.decode=function(e){t=a(e),r=t.length,n=0;for(var o,s=[];!1!==(o=l());)s.push(o);return function(e){for(var t,r=e.length,n=-1,a="";++n<r;)(t=e[n])>65535&&(a+=i((t-=65536)>>>10&1023|55296),t=56320|1023&t),a+=i(t);return a}(s)}}(t)},1500:function(e,t,r){"use strict";r.r(t);var n=r(1),i=r(0),a=r(13),o=r(3);function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t){return!t||"object"!==s(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author Jarmo van Lenthe [github.com/jarmovanlenthe]
|
||
* @copyright Crown Copyright 2018
|
||
* @license Apache-2.0
|
||
*/var p=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=c(this,l(t).call(this))).name="A1Z26 Cipher Decode",e.module="Ciphers",e.description="Converts alphabet order numbers into their corresponding alphabet character.<br><br>e.g. <code>1</code> becomes <code>a</code> and <code>2</code> becomes <code>b</code>.",e.infoURL="",e.inputType="string",e.outputType="string",e.args=[{name:"Delimiter",type:"option",value:a.c}],e}var r,s,p;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(t,n["a"]),r=t,(s=[{key:"run",value:function(e,t){var r=i.a.charRep(t[0]||"Space");if(0===e.length)return[];for(var n=e.split(r),a="",s=0;s<n.length;s++){if(n[s]<1||n[s]>26)throw new o.a("Error: all numbers must be between 1 and 26.");a+=i.a.chr(parseInt(n[s],10)+96)}return a}}])&&u(r.prototype,s),p&&u(r,p),t}();function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function y(e,t){return!t||"object"!==h(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author Jarmo van Lenthe [github.com/jarmovanlenthe]
|
||
* @copyright Crown Copyright 2018
|
||
* @license Apache-2.0
|
||
*/var m=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=y(this,g(t).call(this))).name="A1Z26 Cipher Encode",e.module="Ciphers",e.description="Converts alphabet characters into their corresponding alphabet order number.<br><br>e.g. <code>a</code> becomes <code>1</code> and <code>b</code> becomes <code>2</code>.<br><br>Non-alphabet characters are dropped.",e.infoURL="",e.inputType="string",e.outputType="string",e.args=[{name:"Delimiter",type:"option",value:a.c}],e}var r,o,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}(t,n["a"]),r=t,(o=[{key:"run",value:function(e,t){for(var r=i.a.charRep(t[0]||"Space"),n="",a=e.toLowerCase(),o=i.a.strToCharcode(a),s=0;s<o.length;s++){var u=o[s]-96;u>0&&u<=26&&(n+=u.toString(10)+r)}return n.slice(0,-r.length)}}])&&d(r.prototype,o),s&&d(r,s),t}(),b=r(36),C=r.n(b);function E(e){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function T(e,t){return!t||"object"!==E(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function A(e){return(A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/var w=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=T(this,A(t).call(this))).name="AES Decrypt",e.module="Ciphers",e.description="Advanced Encryption Standard (AES) is a U.S. Federal Information Processing Standard (FIPS). It was selected after a 5-year process where 15 competing designs were evaluated.<br><br><b>Key:</b> The following algorithms will be used based on the size of the key:<ul><li>16 bytes = AES-128</li><li>24 bytes = AES-192</li><li>32 bytes = AES-256</li></ul><br><br><b>IV:</b> The Initialization Vector should be 16 bytes long. If not entered, it will default to 16 null bytes.<br><br><b>Padding:</b> In CBC and ECB mode, PKCS#7 padding will be used.<br><br><b>GCM Tag:</b> This field is ignored unless 'GCM' mode is used.",e.infoURL="https://wikipedia.org/wiki/Advanced_Encryption_Standard",e.inputType="string",e.outputType="string",e.args=[{name:"Key",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"IV",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"Mode",type:"option",value:["CBC","CFB","OFB","CTR","GCM","ECB"]},{name:"Input",type:"option",value:["Hex","Raw"]},{name:"Output",type:"option",value:["Raw","Hex"]},{name:"GCM Tag",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]}],e}var r,a,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}(t,n["a"]),r=t,(a=[{key:"run",value:function(e,t){var r=i.a.convertToByteArray(t[0].string,t[0].option),n=i.a.convertToByteArray(t[1].string,t[1].option),a=t[2],s=t[3],u=t[4],c=i.a.convertToByteString(t[5].string,t[5].option);if([16,24,32].indexOf(r.length)<0)throw new o.a("Invalid key length: ".concat(r.length," bytes\n\nThe following algorithms will be used based on the size of the key:\n 16 bytes = AES-128\n 24 bytes = AES-192\n 32 bytes = AES-256"));e=i.a.convertToByteString(e,s);var l=C.a.cipher.createDecipher("AES-"+a,r);if(l.start({iv:n,tag:c}),l.update(C.a.util.createBuffer(e)),l.finish())return"Hex"===u?l.output.toHex():l.output.getBytes();throw new o.a("Unable to decrypt input with these parameters.")}}])&&S(r.prototype,a),s&&S(r,s),t}();function I(e){return(I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function k(e,t){return!t||"object"!==I(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function R(e){return(R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function N(e,t){return(N=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/var L=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=k(this,R(t).call(this))).name="AES Encrypt",e.module="Ciphers",e.description="Advanced Encryption Standard (AES) is a U.S. Federal Information Processing Standard (FIPS). It was selected after a 5-year process where 15 competing designs were evaluated.<br><br><b>Key:</b> The following algorithms will be used based on the size of the key:<ul><li>16 bytes = AES-128</li><li>24 bytes = AES-192</li><li>32 bytes = AES-256</li></ul>You can generate a password-based key using one of the KDF operations.<br><br><b>IV:</b> The Initialization Vector should be 16 bytes long. If not entered, it will default to 16 null bytes.<br><br><b>Padding:</b> In CBC and ECB mode, PKCS#7 padding will be used.",e.infoURL="https://wikipedia.org/wiki/Advanced_Encryption_Standard",e.inputType="string",e.outputType="string",e.args=[{name:"Key",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"IV",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"Mode",type:"option",value:["CBC","CFB","OFB","CTR","GCM","ECB"]},{name:"Input",type:"option",value:["Raw","Hex"]},{name:"Output",type:"option",value:["Hex","Raw"]}],e}var r,a,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&N(e,t)}(t,n["a"]),r=t,(a=[{key:"run",value:function(e,t){var r=i.a.convertToByteArray(t[0].string,t[0].option),n=i.a.convertToByteArray(t[1].string,t[1].option),a=t[2],s=t[3],u=t[4];if([16,24,32].indexOf(r.length)<0)throw new o.a("Invalid key length: ".concat(r.length," bytes\n\nThe following algorithms will be used based on the size of the key:\n 16 bytes = AES-128\n 24 bytes = AES-192\n 32 bytes = AES-256"));e=i.a.convertToByteString(e,s);var c=C.a.cipher.createCipher("AES-"+a,r);return c.start({iv:n}),c.update(C.a.util.createBuffer(e)),c.finish(),"Hex"===u?"GCM"===a?c.output.toHex()+"\n\nTag: "+c.mode.tag.toHex():c.output.toHex():"GCM"===a?c.output.getBytes()+"\n\nTag: "+c.mode.tag.getBytes():c.output.getBytes()}}])&&_(r.prototype,a),s&&_(r,s),t}();function D(e){return(D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function O(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw a}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function U(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function P(e,t){return!t||"object"!==D(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function x(e){return(x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(e,t){return(F=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author Matt C [matt@artemisbot.uk]
|
||
* @copyright Crown Copyright 2018
|
||
* @license Apache-2.0
|
||
*/var V=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=P(this,x(t).call(this))).name="Affine Cipher Decode",e.module="Ciphers",e.description="The Affine cipher is a type of monoalphabetic substitution cipher. To decrypt, each letter in an alphabet is mapped to its numeric equivalent, decrypted by a mathematical function, and converted back to a letter.",e.infoURL="https://wikipedia.org/wiki/Affine_cipher",e.inputType="string",e.outputType="string",e.args=[{name:"a",type:"number",value:1},{name:"b",type:"number",value:0}],e}var r,a,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&F(e,t)}(t,n["a"]),r=t,(a=[{key:"run",value:function(e,t){var r="abcdefghijklmnopqrstuvwxyz",n=O(t,2),a=n[0],s=n[1],u=i.a.modInv(a,26),c="";if(!/^\+?(0|[1-9]\d*)$/.test(a)||!/^\+?(0|[1-9]\d*)$/.test(s))throw new o.a("The values of a and b can only be integers.");if(1!==i.a.gcd(a,26))throw new o.a("The value of `a` must be coprime to 26.");for(var l=0;l<e.length;l++)r.indexOf(e[l])>=0?c+=r[i.a.mod((r.indexOf(e[l])-s)*u,26)]:r.indexOf(e[l].toLowerCase())>=0?c+=r[i.a.mod((r.indexOf(e[l].toLowerCase())-s)*u,26)].toUpperCase():c+=e[l];return c}},{key:"highlight",value:function(e,t){return e}},{key:"highlightReverse",value:function(e,t){return e}}])&&U(r.prototype,a),s&&U(r,s),t}(),M=r(54),j=r.n(M);
|
||
/**
|
||
* Cipher functions.
|
||
*
|
||
* @author Matt C [matt@artemisbot.uk]
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
*
|
||
* @copyright Crown Copyright 2018
|
||
* @license Apache-2.0
|
||
*
|
||
*/
|
||
function K(e,t){var r="abcdefghijklmnopqrstuvwxyz",n=t[0],i=t[1],a="";if(!/^\+?(0|[1-9]\d*)$/.test(n)||!/^\+?(0|[1-9]\d*)$/.test(i))throw new o.a("The values of a and b can only be integers.");for(var s=0;s<e.length;s++)r.indexOf(e[s])>=0?a+=r[(n*r.indexOf(e[s])+i)%26]:r.indexOf(e[s].toLowerCase())>=0?a+=r[(n*r.indexOf(e[s].toLowerCase())+i)%26].toUpperCase():a+=e[s];return a}function H(e){for(var t="".concat(e).concat("ABCDEFGHIKLMNOPQRSTUVWXYZ").split("").unique(),r=[],n=0;n<5;n++)r[n]=t.slice(5*n,5*n+5);return r}var z={Hex:j.a.enc.Hex,Base64:j.a.enc.Base64,UTF8:j.a.enc.Utf8,UTF16:j.a.enc.Utf16,UTF16LE:j.a.enc.Utf16LE,UTF16BE:j.a.enc.Utf16BE,Latin1:j.a.enc.Latin1};function G(e){return(G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function q(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Y(e,t){return!t||"object"!==G(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Q(e){return(Q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function W(e,t){return(W=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author Matt C [matt@artemisbot.uk]
|
||
* @copyright Crown Copyright 2018
|
||
* @license Apache-2.0
|
||
*/var X=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Y(this,Q(t).call(this))).name="Affine Cipher Encode",e.module="Ciphers",e.description="The Affine cipher is a type of monoalphabetic substitution cipher, wherein each letter in an alphabet is mapped to its numeric equivalent, encrypted using simple mathematical function, <code>(ax + b) % 26</code>, and converted back to a letter.",e.infoURL="https://wikipedia.org/wiki/Affine_cipher",e.inputType="string",e.outputType="string",e.args=[{name:"a",type:"number",value:1},{name:"b",type:"number",value:0}],e}var r,i,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&W(e,t)}(t,n["a"]),r=t,(i=[{key:"run",value:function(e,t){return K(e,t)}},{key:"highlight",value:function(e,t){return e}},{key:"highlightReverse",value:function(e,t){return e}}])&&q(r.prototype,i),a&&q(r,a),t}();function Z(e){return(Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function J(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function $(e,t){return!t||"object"!==Z(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ee(e){return(ee=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function te(e,t){return(te=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author Matt C [matt@artemisbot.uk]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/var re=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=$(this,ee(t).call(this))).name="Atbash Cipher",e.module="Ciphers",e.description="Atbash is a mono-alphabetic substitution cipher originally used to encode the Hebrew alphabet. It has been modified here for use with the Latin alphabet.",e.infoURL="https://wikipedia.org/wiki/Atbash",e.inputType="string",e.outputType="string",e.args=[],e}var r,i,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&te(e,t)}(t,n["a"]),r=t,(i=[{key:"run",value:function(e,t){return K(e,[25,25])}},{key:"highlight",value:function(e,t){return e}},{key:"highlightReverse",value:function(e,t){return e}}])&&J(r.prototype,i),a&&J(r,a),t}();function ne(e){return(ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ie(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ae(e,t){return!t||"object"!==ne(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function oe(e){return(oe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function se(e,t){return(se=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author Matt C [matt@artemisbot.uk]
|
||
* @copyright Crown Copyright 2018
|
||
* @license Apache-2.0
|
||
*/var ue=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=ae(this,oe(t).call(this))).name="Bifid Cipher Decode",e.module="Ciphers",e.description="The Bifid cipher is a cipher which uses a Polybius square in conjunction with transposition, which can be fairly difficult to decipher without knowing the alphabet keyword.",e.infoURL="https://wikipedia.org/wiki/Bifid_cipher",e.inputType="string",e.outputType="string",e.args=[{name:"Keyword",type:"string",value:""}],e}var r,i,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&se(e,t)}(t,n["a"]),r=t,(i=[{key:"run",value:function(e,t){var r=t[0].toUpperCase().replace("J","I"),n=r.split("").unique(),i="ABCDEFGHIKLMNOPQRSTUVWXYZ",a=[],s="",u=0,c="";if(!/^[A-Z]+$/.test(r)&&n.length>0)throw new o.a("The key must consist only of letters in the English alphabet");var l=H(r);return e.replace("J","I").split("").forEach(function(e){var t,r=i.split("").indexOf(e.toLocaleUpperCase())>=0;if(r){for(var n=0;n<5;n++)(t=l[n].indexOf(e.toLocaleUpperCase()))>=0&&(c+="".concat(n).concat(t));i.split("").indexOf(e)>=0?a.push(!0):r&&a.push(!1)}else a.push(e)}),a.forEach(function(e){if("boolean"==typeof e){var t=[c[u],c[u+c.length/2]];s+=e?l[t[0]][t[1]]:l[t[0]][t[1]].toLocaleLowerCase(),u++}else s+=e}),s}},{key:"highlight",value:function(e,t){return e}},{key:"highlightReverse",value:function(e,t){return e}}])&&ie(r.prototype,i),a&&ie(r,a),t}();function ce(e){return(ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function le(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function fe(e,t){return!t||"object"!==ce(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function pe(e){return(pe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function he(e,t){return(he=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author Matt C [matt@artemisbot.uk]
|
||
* @copyright Crown Copyright 2018
|
||
* @license Apache-2.0
|
||
*/var de=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=fe(this,pe(t).call(this))).name="Bifid Cipher Encode",e.module="Ciphers",e.description="The Bifid cipher is a cipher which uses a Polybius square in conjunction with transposition, which can be fairly difficult to decipher without knowing the alphabet keyword.",e.infoURL="https://wikipedia.org/wiki/Bifid_cipher",e.inputType="string",e.outputType="string",e.args=[{name:"Keyword",type:"string",value:""}],e}var r,i,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&he(e,t)}(t,n["a"]),r=t,(i=[{key:"run",value:function(e,t){var r=t[0].toUpperCase().replace("J","I"),n=r.split("").unique(),i="ABCDEFGHIKLMNOPQRSTUVWXYZ",a=[],s=[],u=[],c="",l=0;if(!/^[A-Z]+$/.test(r)&&n.length>0)throw new o.a("The key must consist only of letters in the English alphabet");var f=H(r);e.replace("J","I").split("").forEach(function(e){var t,r=i.split("").indexOf(e.toLocaleUpperCase())>=0;if(r){for(var n=0;n<5;n++)(t=f[n].indexOf(e.toLocaleUpperCase()))>=0&&(a.push(t),s.push(n));i.split("").indexOf(e)>=0?u.push(!0):r&&u.push(!1)}else u.push(e)});var p="".concat(s.join("")).concat(a.join(""));return u.forEach(function(e){if("boolean"==typeof e){var t=p.substr(2*l,2).split("");c+=e?f[t[0]][t[1]]:f[t[0]][t[1]].toLocaleLowerCase(),l++}else c+=e}),c}},{key:"highlight",value:function(e,t){return e}},{key:"highlightReverse",value:function(e,t){return e}}])&&le(r.prototype,i),a&&le(r,a),t}(),ye={cipherModes:{ECB:0,CBC:1,PCBC:2,CFB:3,OFB:4,CTR:5},outputTypes:{Base64:0,Hex:1,String:2,Raw:3}},ge={},ve="=",me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";ge.encode=function(e){for(var t=[],r=e.length,n=r%3,i=r-n,a=0;a<i;){var o=e[a++]<<16|e[a++]<<8|e[a++];t.push(me.charAt(o>>>18&63)),t.push(me.charAt(o>>>12&63)),t.push(me.charAt(o>>>6&63)),t.push(me.charAt(63&o))}switch(n){case 2:o=e[a++]<<16|e[a++]<<8;t.push(me.charAt(o>>>18&63)),t.push(me.charAt(o>>>12&63)),t.push(me.charAt(o>>>6&63)),t.push(ve);break;case 1:o=e[a++]<<16;t.push(me.charAt(o>>>18&63)),t.push(me.charAt(o>>>12&63)),t.push(ve),t.push(ve)}return t.join("")},ge.decode=function(e){for(var t=e.split(""),r=[],n=t.length;t[--n]==ve;);for(var i=0;i<n;){var a=me.indexOf(t[i++])<<18;i<=n&&(a|=me.indexOf(t[i++])<<12),i<=n&&(a|=me.indexOf(t[i++])<<6),i<=n&&(a|=me.indexOf(t[i++])),r.push(a>>>16&255),r.push(a>>>8&255),r.push(255&a)}for(;0==r[r.length-1];)r.pop();return r};var be={isString:function(e){return"string"==typeof e||e instanceof String}},Ce={map:function(e,t,r,n){var i=0,a=e&&e.length||0,o=new(n||Array)(a);if(a&&"string"==typeof e&&(e=e.split("")),"string"==typeof t&&(t=cache[t]||buildFn(t)),r)for(;i<a;++i)o[i]=t.call(r,e[i],i,e);else for(;i<a;++i)o[i]=t(e[i],i,e);return o}};ye.Blowfish=new function(){Math.pow(2,2),Math.pow(2,3),Math.pow(2,4);var e=Math.pow(2,8),t=Math.pow(2,16),r=Math.pow(2,24),n=null,i={p:[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],s0:[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],s1:[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],s2:[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],s3:[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]};function a(e,t){return(e>>16^t>>16)<<16|65535&(65535&e^65535&t)}function o(e,t){var r=t.s3[255&e];e>>=8;var n=t.s2[255&e];e>>=8;var i=t.s1[255&e];e>>=8;var a=t.s0[255&e],o=(a>>16)+(i>>16)+((65535&a)+(65535&i)>>16)<<16|(65535&a)+(65535&i)&65535;return((o=(o>>16^n>>16)<<16|65535&(65535&o^65535&n))>>16)+(r>>16)+((65535&o)+(65535&r)>>16)<<16|(65535&o)+(65535&r)&65535}function s(e,t){var r=e.left,n=e.right;r=a(r,t.p[0]),n=a(n,a(o(r,t),t.p[1])),r=a(r,a(o(n,t),t.p[2])),n=a(n,a(o(r,t),t.p[3])),r=a(r,a(o(n,t),t.p[4])),n=a(n,a(o(r,t),t.p[5])),r=a(r,a(o(n,t),t.p[6])),n=a(n,a(o(r,t),t.p[7])),r=a(r,a(o(n,t),t.p[8])),n=a(n,a(o(r,t),t.p[9])),r=a(r,a(o(n,t),t.p[10])),n=a(n,a(o(r,t),t.p[11])),r=a(r,a(o(n,t),t.p[12])),n=a(n,a(o(r,t),t.p[13])),r=a(r,a(o(n,t),t.p[14])),n=a(n,a(o(r,t),t.p[15])),r=a(r,a(o(n,t),t.p[16])),e.right=r,e.left=a(n,t.p[17])}function u(e,t){var r=e.left,n=e.right;r=a(r,t.p[17]),n=a(n,a(o(r,t),t.p[16])),r=a(r,a(o(n,t),t.p[15])),n=a(n,a(o(r,t),t.p[14])),r=a(r,a(o(n,t),t.p[13])),n=a(n,a(o(r,t),t.p[12])),r=a(r,a(o(n,t),t.p[11])),n=a(n,a(o(r,t),t.p[10])),r=a(r,a(o(n,t),t.p[9])),n=a(n,a(o(r,t),t.p[8])),r=a(r,a(o(n,t),t.p[7])),n=a(n,a(o(r,t),t.p[6])),r=a(r,a(o(n,t),t.p[5])),n=a(n,a(o(r,t),t.p[4])),r=a(r,a(o(n,t),t.p[3])),n=a(n,a(o(r,t),t.p[2])),r=a(r,a(o(n,t),t.p[1])),e.right=r,e.left=a(n,t.p[0])}function c(t){var r=t;be.isString(r)&&(r=Ce.map(r.split(""),function(e){return 255&e.charCodeAt(0)}));var n,a,o,u=0,c=0,l={left:0,right:0},f={p:Ce.map(i.p.slice(0),function(t){var n,i=r.length;for(n=0;n<4;n++)c=c*e|r[u++%i];return(t>>16^c>>16)<<16|65535&(65535&t^65535&c)}),s0:i.s0.slice(0),s1:i.s1.slice(0),s2:i.s2.slice(0),s3:i.s3.slice(0)};for(n=0,o=f.p.length;n<o;)s(l,f),f.p[n++]=l.left,f.p[n++]=l.right;for(n=0;n<4;n++)for(a=0,o=f["s"+n].length;a<o;)s(l,f),f["s"+n][a++]=l.left,f["s"+n][a++]=l.right;return f}this.getIV=function(e){switch(e||ye.outputTypes.Base64){case ye.outputTypes.Hex:return Ce.map(n,function(e){return(e<=15?"0":"")+e.toString(16)}).join("");case ye.outputTypes.String:return n.join("");case ye.outputTypes.Raw:return n;default:return ge.encode(n)}},this.setIV=function(i,a){var o=null;switch(a||ye.outputTypes.Base64){case ye.outputTypes.String:o=Ce.map(i.split(""),function(e){return e.charCodeAt(0)});break;case ye.outputTypes.Hex:o=[];for(var s=0,u=i.length-1;s<u;s+=2)o.push(parseInt(i.substr(s,2),16));break;case ye.outputTypes.Raw:o=i;break;default:o=ge.decode(i)}(n={}).left=o[0]*r|o[1]*t|o[2]*e|o[3],n.right=o[4]*r|o[5]*t|o[6]*e|o[7]},this.encrypt=function(i,a,o){var u=ye.outputTypes.Base64,l=ye.cipherModes.ECB;o&&(o.outputType&&(u=o.outputType),o.cipherMode&&(l=o.cipherMode));for(var f=c(a),p=8-(7&i.length),h=0;h<p;h++)i+=String.fromCharCode(p);var d=[],y=i.length>>3,g=0,v={},m=l==ye.cipherModes.CBC,b={left:n.left||null,right:n.right||null};for(h=0;h<y;h++)v.left=i.charCodeAt(g)*r|i.charCodeAt(g+1)*t|i.charCodeAt(g+2)*e|i.charCodeAt(g+3),v.right=i.charCodeAt(g+4)*r|i.charCodeAt(g+5)*t|i.charCodeAt(g+6)*e|i.charCodeAt(g+7),m&&(v.left=(v.left>>16^b.left>>16)<<16|65535&(65535&v.left^65535&b.left),v.right=(v.right>>16^b.right>>16)<<16|65535&(65535&v.right^65535&b.right)),s(v,f),m&&(b.left=v.left,b.right=v.right),d.push(v.left>>24&255),d.push(v.left>>16&255),d.push(v.left>>8&255),d.push(255&v.left),d.push(v.right>>24&255),d.push(v.right>>16&255),d.push(v.right>>8&255),d.push(255&v.right),g+=8;switch(u){case ye.outputTypes.Hex:return Ce.map(d,function(e){return(e<=15?"0":"")+e.toString(16)}).join("");case ye.outputTypes.String:return d.join("");case ye.outputTypes.Raw:return d;default:return ge.encode(d)}},this.decrypt=function(i,a,o){var s=ye.outputTypes.Base64,l=ye.cipherModes.ECB;o&&(o.outputType&&(s=o.outputType),o.cipherMode&&(l=o.cipherMode));var f=c(a),p=[],h=null;switch(s){case ye.outputTypes.Hex:h=[];for(var d=0,y=i.length-1;d<y;d+=2)h.push(parseInt(i.substr(d,2),16));break;case ye.outputTypes.String:h=Ce.map(i.split(""),function(e){return e.charCodeAt(0)});break;case ye.outputTypes.Raw:h=i;break;default:h=ge.decode(i)}var g=h.length>>3,v=0,m={},b=l==ye.cipherModes.CBC,C={left:n.left||null,right:n.right||null};for(d=0;d<g;d++){if(m.left=h[v]*r|h[v+1]*t|h[v+2]*e|h[v+3],m.right=h[v+4]*r|h[v+5]*t|h[v+6]*e|h[v+7],b)var E=m.left,S=m.right;u(m,f),b&&(m.left=(m.left>>16^C.left>>16)<<16|65535&(65535&m.left^65535&C.left),m.right=(m.right>>16^C.right>>16)<<16|65535&(65535&m.right^65535&C.right),C.left=E,C.right=S),p.push(m.left>>24&255),p.push(m.left>>16&255),p.push(m.left>>8&255),p.push(255&m.left),p.push(m.right>>24&255),p.push(m.right>>16&255),p.push(m.right>>8&255),p.push(255&m.right),v+=8}if(p[p.length-1]==p[p.length-2]||1==p[p.length-1]){var T=p[p.length-1];p.splice(p.length-T,T)}return Ce.map(p,function(e){return String.fromCharCode(e)}).join("")},this.setIV("0000000000000000",ye.outputTypes.Hex)};var Ee=ye.Blowfish,Se=r(10),Te=r(7);function Ae(e){return(Ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Be(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw a}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function we(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ie(e,t){return!t||"object"!==Ae(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function _e(e){return(_e=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ke(e,t){return(ke=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/var Re={Base64:0,Hex:1,String:2,Raw:3},Ne={ECB:0,CBC:1,PCBC:2,CFB:3,OFB:4,CTR:5},Le=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Ie(this,_e(t).call(this))).name="Blowfish Decrypt",e.module="Ciphers",e.description="Blowfish is a symmetric-key block cipher designed in 1993 by Bruce Schneier and included in a large number of cipher suites and encryption products. AES now receives more attention.<br><br><b>IV:</b> The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.",e.infoURL="https://wikipedia.org/wiki/Blowfish_(cipher)",e.inputType="string",e.outputType="string",e.args=[{name:"Key",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"IV",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"Mode",type:"option",value:["CBC","PCBC","CFB","OFB","CTR","ECB"]},{name:"Input",type:"option",value:["Hex","Base64","Raw"]},{name:"Output",type:"option",value:["Raw","Hex"]}],e}var r,a,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ke(e,t)}(t,n["a"]),r=t,(a=[{key:"run",value:function(e,t){var r=i.a.convertToByteString(t[0].string,t[0].option),n=i.a.convertToByteArray(t[1].string,t[1].option),a=Be(t,5),s=a[2],u=a[3],c=a[4];if(0===r.length)throw new o.a("Enter a key");e="Raw"===u?i.a.strToByteArray(e):e,Ee.setIV(Object(Se.c)(n),0);var l=Ee.decrypt(e,r,{outputType:Re[u],cipherMode:Ne[s]});return"Hex"===c?Object(Te.e)(i.a.strToByteArray(l)):l}}])&&we(r.prototype,a),s&&we(r,s),t}();function De(e){return(De="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Oe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw a}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ue(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Pe(e,t){return!t||"object"!==De(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function xe(e){return(xe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Fe(e,t){return(Fe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/var Ve={Base64:0,Hex:1,String:2,Raw:3},Me={ECB:0,CBC:1,PCBC:2,CFB:3,OFB:4,CTR:5},je=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Pe(this,xe(t).call(this))).name="Blowfish Encrypt",e.module="Ciphers",e.description="Blowfish is a symmetric-key block cipher designed in 1993 by Bruce Schneier and included in a large number of cipher suites and encryption products. AES now receives more attention.<br><br><b>IV:</b> The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.",e.infoURL="https://wikipedia.org/wiki/Blowfish_(cipher)",e.inputType="string",e.outputType="string",e.args=[{name:"Key",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"IV",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"Mode",type:"option",value:["CBC","PCBC","CFB","OFB","CTR","ECB"]},{name:"Input",type:"option",value:["Raw","Hex"]},{name:"Output",type:"option",value:["Hex","Base64","Raw"]}],e}var r,a,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Fe(e,t)}(t,n["a"]),r=t,(a=[{key:"run",value:function(e,t){var r=i.a.convertToByteString(t[0].string,t[0].option),n=i.a.convertToByteArray(t[1].string,t[1].option),a=Oe(t,5),s=a[2],u=a[3],c=a[4];if(0===r.length)throw new o.a("Enter a key");e=i.a.convertToByteString(e,u),Ee.setIV(Object(Se.c)(n),0);var l=Ee.encrypt(e,r,{outputType:Ve[c],cipherMode:Me[s]});return"Raw"===c?i.a.byteArrayToChars(l):l}}])&&Ue(r.prototype,a),s&&Ue(r,s),t}();function Ke(e){return(Ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function He(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw a}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ze(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ge(e,t){return!t||"object"!==Ke(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function qe(e){return(qe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ye(e,t){return(Ye=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/var Qe=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Ge(this,qe(t).call(this))).name="DES Decrypt",e.module="Ciphers",e.description="DES is a previously dominant algorithm for encryption, and was published as an official U.S. Federal Information Processing Standard (FIPS). It is now considered to be insecure due to its small key size.<br><br><b>Key:</b> DES uses a key length of 8 bytes (64 bits).<br>Triple DES uses a key length of 24 bytes (192 bits).<br><br><b>IV:</b> The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.<br><br><b>Padding:</b> In CBC and ECB mode, PKCS#7 padding will be used.",e.infoURL="https://wikipedia.org/wiki/Data_Encryption_Standard",e.inputType="string",e.outputType="string",e.args=[{name:"Key",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"IV",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"Mode",type:"option",value:["CBC","CFB","OFB","CTR","ECB"]},{name:"Input",type:"option",value:["Hex","Raw"]},{name:"Output",type:"option",value:["Raw","Hex"]}],e}var r,a,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ye(e,t)}(t,n["a"]),r=t,(a=[{key:"run",value:function(e,t){var r=i.a.convertToByteString(t[0].string,t[0].option),n=i.a.convertToByteArray(t[1].string,t[1].option),a=He(t,5),s=a[2],u=a[3],c=a[4];if(8!==r.length)throw new o.a("Invalid key length: ".concat(r.length," bytes\n\nDES uses a key length of 8 bytes (64 bits).\nTriple DES uses a key length of 24 bytes (192 bits)."));e=i.a.convertToByteString(e,u);var l=C.a.cipher.createDecipher("DES-"+s,r);if(l.start({iv:n}),l.update(C.a.util.createBuffer(e)),l.finish())return"Hex"===c?l.output.toHex():l.output.getBytes();throw new o.a("Unable to decrypt input with these parameters.")}}])&&ze(r.prototype,a),s&&ze(r,s),t}();function We(e){return(We="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Xe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw a}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ze(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Je(e,t){return!t||"object"!==We(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function $e(e){return($e=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function et(e,t){return(et=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/var tt=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Je(this,$e(t).call(this))).name="DES Encrypt",e.module="Ciphers",e.description="DES is a previously dominant algorithm for encryption, and was published as an official U.S. Federal Information Processing Standard (FIPS). It is now considered to be insecure due to its small key size.<br><br><b>Key:</b> DES uses a key length of 8 bytes (64 bits).<br>Triple DES uses a key length of 24 bytes (192 bits).<br><br>You can generate a password-based key using one of the KDF operations.<br><br><b>IV:</b> The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.<br><br><b>Padding:</b> In CBC and ECB mode, PKCS#7 padding will be used.",e.infoURL="https://wikipedia.org/wiki/Data_Encryption_Standard",e.inputType="string",e.outputType="string",e.args=[{name:"Key",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"IV",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"Mode",type:"option",value:["CBC","CFB","OFB","CTR","ECB"]},{name:"Input",type:"option",value:["Raw","Hex"]},{name:"Output",type:"option",value:["Hex","Raw"]}],e}var r,a,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&et(e,t)}(t,n["a"]),r=t,(a=[{key:"run",value:function(e,t){var r=i.a.convertToByteString(t[0].string,t[0].option),n=i.a.convertToByteArray(t[1].string,t[1].option),a=Xe(t,5),s=a[2],u=a[3],c=a[4];if(8!==r.length)throw new o.a("Invalid key length: ".concat(r.length," bytes\n\nDES uses a key length of 8 bytes (64 bits).\nTriple DES uses a key length of 24 bytes (192 bits)."));e=i.a.convertToByteString(e,u);var l=C.a.cipher.createCipher("DES-"+s,r);return l.start({iv:n}),l.update(C.a.util.createBuffer(e)),l.finish(),"Hex"===c?l.output.toHex():l.output.getBytes()}}])&&Ze(r.prototype,a),s&&Ze(r,s),t}();function rt(e){return(rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function nt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function it(e,t){return!t||"object"!==rt(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function at(e){return(at=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ot(e,t){return(ot=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/var st=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=it(this,at(t).call(this))).name="Derive EVP key",e.module="Ciphers",e.description="This operation performs a password-based key derivation function (PBKDF) used extensively in OpenSSL. In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually can't be used directly as a cryptographic key, some processing is required.<br><br>A salt provides a large set of keys for any given password, and an iteration count increases the cost of producing keys from a password, thereby also increasing the difficulty of attack.<br><br>If you leave the salt argument empty, a random salt will be generated.",e.infoURL="https://wikipedia.org/wiki/Key_derivation_function",e.inputType="string",e.outputType="string",e.args=[{name:"Passphrase",type:"toggleString",value:"",toggleValues:["UTF8","Latin1","Hex","Base64"]},{name:"Key size",type:"number",value:128},{name:"Iterations",type:"number",value:1},{name:"Hashing function",type:"option",value:["SHA1","SHA256","SHA384","SHA512","MD5"]},{name:"Salt",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]}],e}var r,a,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ot(e,t)}(t,n["a"]),r=t,(a=[{key:"run",value:function(e,t){var r=i.a.convertToByteString(t[0].string,t[0].option),n=t[1]/32,a=t[2],o=t[3],s=i.a.convertToByteString(t[4].string,t[4].option);return j.a.EvpKDF(r,s,{keySize:n,hasher:j.a.algo[o],iterations:a}).toString(j.a.enc.Hex)}}])&&nt(r.prototype,a),o&&nt(r,o),t}();function ut(e){return(ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ct(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function lt(e,t){return!t||"object"!==ut(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ft(e){return(ft=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function pt(e,t){return(pt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/j.a.kdf.OpenSSL.execute=function(e,t,r,n){null==n&&(n=j.a.lib.WordArray.random(8));var i=j.a.algo.EvpKDF.create({keySize:t+r}).compute(e,n),a=j.a.lib.WordArray.create(i.words.slice(t),4*r);return i.sigBytes=4*t,j.a.lib.CipherParams.create({key:i,iv:a,salt:n})},j.a.enc.Hex.parse=function(e){for(var t=(e=e.replace(/\s/g,"")).length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new j.a.lib.WordArray.init(r,t/2)};var ht=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=lt(this,ft(t).call(this))).name="Derive PBKDF2 key",e.module="Ciphers",e.description="PBKDF2 is a password-based key derivation function. It is part of RSA Laboratories' Public-Key Cryptography Standards (PKCS) series, specifically PKCS #5 v2.0, also published as Internet Engineering Task Force's RFC 2898.<br><br>In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually can't be used directly as a cryptographic key, some processing is required.<br><br>A salt provides a large set of keys for any given password, and an iteration count increases the cost of producing keys from a password, thereby also increasing the difficulty of attack.<br><br>If you leave the salt argument empty, a random salt will be generated.",e.infoURL="https://wikipedia.org/wiki/PBKDF2",e.inputType="string",e.outputType="string",e.args=[{name:"Passphrase",type:"toggleString",value:"",toggleValues:["UTF8","Latin1","Hex","Base64"]},{name:"Key size",type:"number",value:128},{name:"Iterations",type:"number",value:1},{name:"Hashing function",type:"option",value:["SHA1","SHA256","SHA384","SHA512","MD5"]},{name:"Salt",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]}],e}var r,a,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&pt(e,t)}(t,n["a"]),r=t,(a=[{key:"run",value:function(e,t){var r=i.a.convertToByteString(t[0].string,t[0].option),n=t[1],a=t[2],o=t[3],s=i.a.convertToByteString(t[4].string,t[4].option)||C.a.random.getBytesSync(n),u=C.a.pkcs5.pbkdf2(r,s,a,n/8,o.toLowerCase());return C.a.util.bytesToHex(u)}}])&&ct(r.prototype,a),o&&ct(r,o),t}(),dt=r(4),yt=r.n(dt);function gt(e){return(gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function vt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw a}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function mt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function bt(e,t){return!t||"object"!==gt(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Ct(e){return(Ct=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Et(e,t){return(Et=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/var St=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=bt(this,Ct(t).call(this))).name="Pseudo-Random Number Generator",e.module="Ciphers",e.description="A cryptographically-secure pseudo-random number generator (PRNG).<br><br>This operation uses the browser's built-in <code>crypto.getRandomValues()</code> method if available. If this cannot be found, it falls back to a Fortuna-based PRNG algorithm.",e.infoURL="https://wikipedia.org/wiki/Pseudorandom_number_generator",e.inputType="string",e.outputType="string",e.args=[{name:"Number of bytes",type:"number",value:32},{name:"Output as",type:"option",value:["Hex","Integer","Byte array","Raw"]}],e}var r,a,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Et(e,t)}(t,n["a"]),r=t,(a=[{key:"run",value:function(e,t){var r,n=vt(t,2),a=n[0],o=n[1];"function"==typeof importScripts&&self.crypto?(r=self.crypto.getRandomValues(new Uint8Array(a)),r=i.a.arrayBufferToStr(r.buffer)):r=C.a.random.getBytesSync(a);var s,u=new yt.a(0);switch(o){case"Hex":return C.a.util.bytesToHex(r);case"Integer":for(s=r.length-1;s>=0;s--)u=u.times(256).plus(r.charCodeAt(s));return u.toFixed();case"Byte array":return JSON.stringify(i.a.strToCharcode(r));case"Raw":default:return r}}}])&&mt(r.prototype,a),o&&mt(r,o),t}();function Tt(e){return(Tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function At(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw a}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Bt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function wt(e,t){return!t||"object"!==Tt(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function It(e){return(It=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _t(e,t){return(_t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/var kt=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=wt(this,It(t).call(this))).name="RC2 Decrypt",e.module="Ciphers",e.description="RC2 (also known as ARC2) is a symmetric-key block cipher designed by Ron Rivest in 1987. 'RC' stands for 'Rivest Cipher'.<br><br><b>Key:</b> RC2 uses a variable size key.<br><br><b>IV:</b> To run the cipher in CBC mode, the Initialization Vector should be 8 bytes long. If the IV is left blank, the cipher will run in ECB mode.<br><br><b>Padding:</b> In both CBC and ECB mode, PKCS#7 padding will be used.",e.infoURL="https://wikipedia.org/wiki/RC2",e.inputType="string",e.outputType="string",e.args=[{name:"Key",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"IV",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"Input",type:"option",value:["Hex","Raw"]},{name:"Output",type:"option",value:["Raw","Hex"]}],e}var r,a,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_t(e,t)}(t,n["a"]),r=t,(a=[{key:"run",value:function(e,t){var r=i.a.convertToByteString(t[0].string,t[0].option),n=i.a.convertToByteString(t[1].string,t[1].option),a=At(t,4),o=a[2],s=a[3],u=C.a.rc2.createDecryptionCipher(r);return e=i.a.convertToByteString(e,o),u.start(n||null),u.update(C.a.util.createBuffer(e)),u.finish(),"Hex"===s?u.output.toHex():u.output.getBytes()}}])&&Bt(r.prototype,a),o&&Bt(r,o),t}();function Rt(e){return(Rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Nt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw a}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Lt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Dt(e,t){return!t||"object"!==Rt(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Ot(e){return(Ot=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ut(e,t){return(Ut=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/var Pt=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Dt(this,Ot(t).call(this))).name="RC2 Encrypt",e.module="Ciphers",e.description="RC2 (also known as ARC2) is a symmetric-key block cipher designed by Ron Rivest in 1987. 'RC' stands for 'Rivest Cipher'.<br><br><b>Key:</b> RC2 uses a variable size key.<br><br>You can generate a password-based key using one of the KDF operations.<br><br><b>IV:</b> To run the cipher in CBC mode, the Initialization Vector should be 8 bytes long. If the IV is left blank, the cipher will run in ECB mode.<br><br><b>Padding:</b> In both CBC and ECB mode, PKCS#7 padding will be used.",e.infoURL="https://wikipedia.org/wiki/RC2",e.inputType="string",e.outputType="string",e.args=[{name:"Key",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"IV",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"Input",type:"option",value:["Raw","Hex"]},{name:"Output",type:"option",value:["Hex","Raw"]}],e}var r,a,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ut(e,t)}(t,n["a"]),r=t,(a=[{key:"run",value:function(e,t){var r=i.a.convertToByteString(t[0].string,t[0].option),n=i.a.convertToByteString(t[1].string,t[1].option),a=Nt(t,4),o=a[2],s=a[3],u=C.a.rc2.createEncryptionCipher(r);return e=i.a.convertToByteString(e,o),u.start(n||null),u.update(C.a.util.createBuffer(e)),u.finish(),"Hex"===s?u.output.toHex():u.output.getBytes()}}])&&Lt(r.prototype,a),o&&Lt(r,o),t}();function xt(e){return(xt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ft(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Vt(e,t){return!t||"object"!==xt(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Mt(e){return(Mt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function jt(e,t){return(jt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/var Kt=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Vt(this,Mt(t).call(this))).name="RC4",e.module="Ciphers",e.description="RC4 (also known as ARC4) is a widely-used stream cipher designed by Ron Rivest. It is used in popular protocols such as SSL and WEP. Although remarkable for its simplicity and speed, the algorithm's history doesn't inspire confidence in its security.",e.infoURL="https://wikipedia.org/wiki/RC4",e.inputType="string",e.outputType="string",e.args=[{name:"Passphrase",type:"toggleString",value:"",toggleValues:["UTF8","UTF16","UTF16LE","UTF16BE","Latin1","Hex","Base64"]},{name:"Input format",type:"option",value:["Latin1","UTF8","UTF16","UTF16LE","UTF16BE","Hex","Base64"]},{name:"Output format",type:"option",value:["Latin1","UTF8","UTF16","UTF16LE","UTF16BE","Hex","Base64"]}],e}var r,i,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&jt(e,t)}(t,n["a"]),r=t,(i=[{key:"run",value:function(e,t){var r=z[t[1]].parse(e),n=z[t[0].option].parse(t[0].string);return j.a.RC4.encrypt(r,n).ciphertext.toString(z[t[2]])}},{key:"highlight",value:function(e,t){return e}},{key:"highlightReverse",value:function(e,t){return e}}])&&Ft(r.prototype,i),a&&Ft(r,a),t}();function Ht(e){return(Ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function zt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Gt(e,t){return!t||"object"!==Ht(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function qt(e){return(qt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Yt(e,t){return(Yt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/var Qt=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Gt(this,qt(t).call(this))).name="RC4 Drop",e.module="Ciphers",e.description="It was discovered that the first few bytes of the RC4 keystream are strongly non-random and leak information about the key. We can defend against this attack by discarding the initial portion of the keystream. This modified algorithm is traditionally called RC4-drop.",e.infoURL="https://wikipedia.org/wiki/RC4#Fluhrer,_Mantin_and_Shamir_attack",e.inputType="string",e.outputType="string",e.args=[{name:"Passphrase",type:"toggleString",value:"",toggleValues:["UTF8","UTF16","UTF16LE","UTF16BE","Latin1","Hex","Base64"]},{name:"Input format",type:"option",value:["Latin1","UTF8","UTF16","UTF16LE","UTF16BE","Hex","Base64"]},{name:"Output format",type:"option",value:["Latin1","UTF8","UTF16","UTF16LE","UTF16BE","Hex","Base64"]},{name:"Number of bytes to drop",type:"number",value:768}],e}var r,i,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Yt(e,t)}(t,n["a"]),r=t,(i=[{key:"run",value:function(e,t){var r=z[t[1]].parse(e),n=z[t[0].option].parse(t[0].string),i=t[3];return j.a.RC4Drop.encrypt(r,n,{drop:i}).ciphertext.toString(z[t[2]])}},{key:"highlight",value:function(e,t){return e}},{key:"highlightReverse",value:function(e,t){return e}}])&&zt(r.prototype,i),a&&zt(r,a),t}();function Wt(e){return(Wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Xt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Zt(e,t){return!t||"object"!==Wt(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Jt(e){return(Jt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $t(e,t){return($t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/var er=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Zt(this,Jt(t).call(this))).name="Triple DES Decrypt",e.module="Ciphers",e.description="Triple DES applies DES three times to each block to increase key size.<br><br><b>Key:</b> Triple DES uses a key length of 24 bytes (192 bits).<br>DES uses a key length of 8 bytes (64 bits).<br><br><b>IV:</b> The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.<br><br><b>Padding:</b> In CBC and ECB mode, PKCS#7 padding will be used.",e.infoURL="https://wikipedia.org/wiki/Triple_DES",e.inputType="string",e.outputType="string",e.args=[{name:"Key",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"IV",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"Mode",type:"option",value:["CBC","CFB","OFB","CTR","ECB"]},{name:"Input",type:"option",value:["Hex","Raw"]},{name:"Output",type:"option",value:["Raw","Hex"]}],e}var r,a,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$t(e,t)}(t,n["a"]),r=t,(a=[{key:"run",value:function(e,t){var r=i.a.convertToByteString(t[0].string,t[0].option),n=i.a.convertToByteArray(t[1].string,t[1].option),a=t[2],s=t[3],u=t[4];if(24!==r.length)throw new o.a("Invalid key length: ".concat(r.length," bytes\n\nTriple DES uses a key length of 24 bytes (192 bits).\nDES uses a key length of 8 bytes (64 bits)."));e=i.a.convertToByteString(e,s);var c=C.a.cipher.createDecipher("3DES-"+a,r);if(c.start({iv:n}),c.update(C.a.util.createBuffer(e)),c.finish())return"Hex"===u?c.output.toHex():c.output.getBytes();throw new o.a("Unable to decrypt input with these parameters.")}}])&&Xt(r.prototype,a),s&&Xt(r,s),t}();function tr(e){return(tr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function rr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function nr(e,t){return!t||"object"!==tr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ir(e){return(ir=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ar(e,t){return(ar=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/var or=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=nr(this,ir(t).call(this))).name="Triple DES Encrypt",e.module="Ciphers",e.description="Triple DES applies DES three times to each block to increase key size.<br><br><b>Key:</b> Triple DES uses a key length of 24 bytes (192 bits).<br>DES uses a key length of 8 bytes (64 bits).<br><br>You can generate a password-based key using one of the KDF operations.<br><br><b>IV:</b> The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.<br><br><b>Padding:</b> In CBC and ECB mode, PKCS#7 padding will be used.",e.infoURL="https://wikipedia.org/wiki/Triple_DES",e.inputType="string",e.outputType="string",e.args=[{name:"Key",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"IV",type:"toggleString",value:"",toggleValues:["Hex","UTF8","Latin1","Base64"]},{name:"Mode",type:"option",value:["CBC","CFB","OFB","CTR","ECB"]},{name:"Input",type:"option",value:["Raw","Hex"]},{name:"Output",type:"option",value:["Hex","Raw"]}],e}var r,a,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ar(e,t)}(t,n["a"]),r=t,(a=[{key:"run",value:function(e,t){var r=i.a.convertToByteString(t[0].string,t[0].option),n=i.a.convertToByteArray(t[1].string,t[1].option),a=t[2],s=t[3],u=t[4];if(24!==r.length)throw new o.a("Invalid key length: ".concat(r.length," bytes\n\nTriple DES uses a key length of 24 bytes (192 bits).\nDES uses a key length of 8 bytes (64 bits)."));e=i.a.convertToByteString(e,s);var c=C.a.cipher.createCipher("3DES-"+a,r);return c.start({iv:n}),c.update(C.a.util.createBuffer(e)),c.finish(),"Hex"===u?c.output.toHex():c.output.getBytes()}}])&&rr(r.prototype,a),s&&rr(r,s),t}();function sr(e){return(sr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ur(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function cr(e,t){return!t||"object"!==sr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function lr(e){return(lr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function fr(e,t){return(fr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author Matt C [matt@artemisbot.uk]
|
||
* @copyright Crown Copyright 2018
|
||
* @license Apache-2.0
|
||
*/var pr=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=cr(this,lr(t).call(this))).name="Vigenère Decode",e.module="Ciphers",e.description="The Vigenere cipher is a method of encrypting alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of polyalphabetic substitution.",e.infoURL="https://wikipedia.org/wiki/Vigenère_cipher",e.inputType="string",e.outputType="string",e.args=[{name:"Key",type:"string",value:""}],e}var r,i,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&fr(e,t)}(t,n["a"]),r=t,(i=[{key:"run",value:function(e,t){var r,n,i,a="abcdefghijklmnopqrstuvwxyz",s=t[0].toLowerCase(),u="",c=0;if(!s)throw new o.a("No key entered");if(!/^[a-zA-Z]+$/.test(s))throw new o.a("The key must consist only of letters");for(var l=0;l<e.length;l++)a.indexOf(e[l])>=0?(i=s[(l-c)%s.length],r=a.indexOf(i),n=a.indexOf(e[l]),u+=a[(n-r+a.length)%26]):a.indexOf(e[l].toLowerCase())>=0?(i=s[(l-c)%s.length].toLowerCase(),r=a.indexOf(i),n=a.indexOf(e[l].toLowerCase()),u+=a[(n+a.length-r)%26].toUpperCase()):(u+=e[l],c++);return u}},{key:"highlight",value:function(e,t){return e}},{key:"highlightReverse",value:function(e,t){return e}}])&&ur(r.prototype,i),a&&ur(r,a),t}();function hr(e){return(hr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function dr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function yr(e,t){return!t||"object"!==hr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function gr(e){return(gr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function vr(e,t){return(vr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
||
/**
|
||
* @author Matt C [matt@artemisbot.uk]
|
||
* @copyright Crown Copyright 2018
|
||
* @license Apache-2.0
|
||
*/var mr=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=yr(this,gr(t).call(this))).name="Vigenère Encode",e.module="Ciphers",e.description="The Vigenere cipher is a method of encrypting alphabetic text by using a series of different Caesar ciphers based on the letters of a keyword. It is a simple form of polyalphabetic substitution.",e.infoURL="https://wikipedia.org/wiki/Vigenère_cipher",e.inputType="string",e.outputType="string",e.args=[{name:"Key",type:"string",value:""}],e}var r,i,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&vr(e,t)}(t,n["a"]),r=t,(i=[{key:"run",value:function(e,t){var r,n,i,a="abcdefghijklmnopqrstuvwxyz",s=t[0].toLowerCase(),u="",c=0;if(!s)throw new o.a("No key entered");if(!/^[a-zA-Z]+$/.test(s))throw new o.a("The key must consist only of letters");for(var l=0;l<e.length;l++)a.indexOf(e[l])>=0?(i=s[(l-c)%s.length],r=a.indexOf(i),n=a.indexOf(e[l]),u+=a[(r+n)%26]):a.indexOf(e[l].toLowerCase())>=0?(i=s[(l-c)%s.length].toLowerCase(),r=a.indexOf(i),n=a.indexOf(e[l].toLowerCase()),u+=a[(r+n)%26].toUpperCase()):(u+=e[l],c++);return u}},{key:"highlight",value:function(e,t){return e}},{key:"highlightReverse",value:function(e,t){return e}}])&&dr(r.prototype,i),a&&dr(r,a),t}(),br="undefined"==typeof self?{}:self.OpModules||{};br.Ciphers={"A1Z26 Cipher Decode":p,"A1Z26 Cipher Encode":m,"AES Decrypt":w,"AES Encrypt":L,"Affine Cipher Decode":V,"Affine Cipher Encode":X,"Atbash Cipher":re,"Bifid Cipher Decode":ue,"Bifid Cipher Encode":de,"Blowfish Decrypt":Le,"Blowfish Encrypt":je,"DES Decrypt":Qe,"DES Encrypt":tt,"Derive EVP key":st,"Derive PBKDF2 key":ht,"Pseudo-Random Number Generator":St,"RC2 Decrypt":kt,"RC2 Encrypt":Pt,RC4:Kt,"RC4 Drop":Qt,"Triple DES Decrypt":er,"Triple DES Encrypt":or,"Vigenère Decode":pr,"Vigenère Encode":mr};t.default=br},17:function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},18:function(e,t,r){"use strict";r.d(t,"b",function(){return i}),r.d(t,"a",function(){return a});var n=r(0);
|
||
/**
|
||
* Binary functions.
|
||
*
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2018
|
||
* @license Apache-2.0
|
||
*/function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Space",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8;if(!e)return"";t=n.a.charRep(t);for(var i="",a=0;a<e.length;a++)i+=e[a].toString(2).padStart(r,"0")+t;return t.length?i.slice(0,-t.length):i}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Space",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,i=n.a.regexRep(t);e=e.replace(i,"");for(var a=[],o=0;o<e.length;o+=r)a.push(parseInt(e.substr(o,r),2));return a}},19:function(e,t,r){"use strict";r.d(t,"a",function(){return i});var n=r(0);
|
||
/**
|
||
* Decimal functions.
|
||
*
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2018
|
||
* @license Apache-2.0
|
||
*/function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto";t=n.a.charRep(t);var r=[],i=e.split(t);""===i[i.length-1]&&(i=i.slice(0,i.length-1));for(var a=0;a<i.length;a++)r[a]=parseInt(i[a],10);return r}},21:function(e,t){var r,n,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(e){r=a}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var u,c=[],l=!1,f=-1;function p(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&h())}function h(){if(!l){var e=s(p);l=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function y(){}i.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 d(e,t)),1!==c.length||l||s(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=y,i.addListener=y,i.once=y,i.off=y,i.removeListener=y,i.removeAllListeners=y,i.emit=y,i.prependListener=y,i.prependOnceListener=y,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},3:function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}
|
||
/**
|
||
* Custom error type for handling operation input errors.
|
||
* i.e. where the operation can handle the error and print a message to the screen.
|
||
*
|
||
* @author d98762625 [d98762625@gmail.com]
|
||
* @copyright Crown Copyright 2018
|
||
* @license Apache-2.0
|
||
*/var u=function(e){function t(){var e,r,a,s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var u=arguments.length,c=new Array(u),l=0;l<u;l++)c[l]=arguments[l];return a=this,(r=!(s=(e=i(t)).call.apply(e,[this].concat(c)))||"object"!==n(s)&&"function"!=typeof s?o(a):s).type="OperationError",Error.captureStackTrace&&Error.captureStackTrace(o(o(r)),t),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(t,s(Error)),t}();t.a=u},329:function(e,t,r){var n,i,a,o,s,u,c,l;e.exports=(n=r(34),r(581),r(582),a=(i=n).lib,o=a.Base,s=a.WordArray,u=i.algo,c=u.MD5,l=u.EvpKDF=o.extend({cfg:o.extend({keySize:4,hasher:c,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=r.hasher.create(),i=s.create(),a=i.words,o=r.keySize,u=r.iterations;a.length<o;){c&&n.update(c);var c=n.update(e).finalize(t);n.reset();for(var l=1;l<u;l++)c=n.finalize(c),n.reset();i.concat(c)}return i.sigBytes=4*o,i}}),i.EvpKDF=function(e,t,r){return l.create(r).compute(e,t)},n.EvpKDF)},34:function(e,t,r){var n;e.exports=(n=n||function(e,t){var r=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),n={},i=n.lib={},a=i.Base={extend:function(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},o=i.WordArray=a.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var a=0;a<i;a++){var o=r[a>>>2]>>>24-a%4*8&255;t[n+a>>>2]|=o<<24-(n+a)%4*8}else for(var a=0;a<i;a+=4)t[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r,n=[],i=function(t){var t=t,r=987654321,n=4294967295;return function(){var i=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},a=0;a<t;a+=4){var s=i(4294967296*(r||e.random()));r=987654071*s(),n.push(4294967296*s()|0)}return new o.init(n,t)}}),s=n.enc={},u=s.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(r,t/2)}},c=s.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(r,t)}},l=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},f=i.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,i=r.sigBytes,a=this.blockSize,s=4*a,u=i/s,c=(u=t?e.ceil(u):e.max((0|u)-this._minBufferSize,0))*a,l=e.min(4*c,i);if(c){for(var f=0;f<c;f+=a)this._doProcessBlock(n,f);var p=n.splice(0,c);r.sigBytes-=l}return new o.init(p,l)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),p=(i.Hasher=f.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){e&&this._append(e);var t=this._doFinalize();return t},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new p.HMAC.init(e,r).finalize(t)}}}),n.algo={});return n}(Math),n)},36:function(e,t,r){(function(t,r,n){"undefined"!=typeof self&&self,e.exports=function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=34)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,i,a){function o(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function s(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(l.isArrayBuffer(e)||l.isArrayBufferView(e))if(void 0!==t&&e instanceof t)this.data=e.toString("binary");else{var r=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,r)}catch(e){for(var n=0;n<r.length;++n)this.putByte(r[n])}}else(e instanceof s||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}var u=a(0),c=a(36),l=e.exports=u.util=u.util||{};!function(){if(void 0!==r&&r.nextTick,"function"==typeof n)return l.setImmediate=function(){return n.apply(void 0,arguments)},void(l.nextTick=function(e){return n(e)});if(l.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",t=[];l.setImmediate=function(r){t.push(r),1===t.length&&window.postMessage(e,"*")},window.addEventListener("message",function(r){if(r.source===window&&r.data===e){r.stopPropagation();var n=t.slice();t.length=0,n.forEach(function(e){e()})}},!0)}if("undefined"!=typeof MutationObserver){var i=Date.now(),a=!0,o=document.createElement("div"),t=[];new MutationObserver(function(){var e=t.slice();t.length=0,e.forEach(function(e){e()})}).observe(o,{attributes:!0});var s=l.setImmediate;l.setImmediate=function(e){Date.now()-i>15?(i=Date.now(),s(e)):(t.push(e),1===t.length&&o.setAttribute("a",a=!a))}}l.nextTick=l.setImmediate}(),l.isNodejs=void 0!==r&&r.versions&&r.versions.node,l.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},l.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},l.isArrayBufferView=function(e){return e&&l.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},l.ByteBuffer=s,l.ByteStringBuffer=s,l.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},l.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},l.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},l.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},l.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},l.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},l.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(l.encodeUtf8(e))},l.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.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))},l.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},l.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},l.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))},l.ByteStringBuffer.prototype.putInt=function(e,t){o(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},l.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},l.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},l.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},l.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},l.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},l.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},l.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},l.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},l.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},l.ByteStringBuffer.prototype.getInt=function(e){o(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},l.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},l.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},l.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},l.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},l.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},l.ByteStringBuffer.prototype.copy=function(){var e=l.createBuffer(this.data);return e.read=this.read,e},l.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},l.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},l.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},l.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},l.ByteStringBuffer.prototype.toString=function(){return l.decodeUtf8(this.bytes())},l.DataBuffer=function(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=l.isArrayBuffer(e),n=l.isArrayBufferView(e);if(r||n)return this.data=r?new DataView(e):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&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)},l.DataBuffer.prototype.length=function(){return this.write-this.read},l.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},l.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var 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},l.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},l.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},l.DataBuffer.prototype.putBytes=function(e,t){if(l.isArrayBufferView(e)){var r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=r.byteLength-r.byteOffset;this.accommodate(n);var i=new Uint8Array(this.data.buffer,this.write);return i.set(r),this.write+=n,this}if(l.isArrayBuffer(e)){var r=new Uint8Array(e);this.accommodate(r.byteLength);var i=new Uint8Array(this.data.buffer);return i.set(r,this.write),this.write+=r.byteLength,this}if(e instanceof l.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&l.isArrayBufferView(e.data)){var r=new Uint8Array(e.data.byteLength,e.read,e.length());this.accommodate(r.byteLength);var i=new Uint8Array(e.data.byteLength,this.write);return i.set(r),this.write+=r.byteLength,this}if(e instanceof l.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"==typeof e){var a;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),a=new Uint8Array(this.data.buffer,this.write),this.write+=l.binary.hex.decode(e,a,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),a=new Uint8Array(this.data.buffer,this.write),this.write+=l.binary.base64.decode(e,a,this.write),this;if("utf8"===t&&(e=l.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),a=new Uint8Array(this.data.buffer,this.write),this.write+=l.binary.raw.decode(a),this;if("utf16"===t)return this.accommodate(2*e.length),a=new Uint16Array(this.data.buffer,this.write),this.write+=l.text.utf16.encode(a),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},l.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},l.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},l.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},l.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},l.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},l.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},l.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},l.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},l.DataBuffer.prototype.putInt=function(e,t){o(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},l.DataBuffer.prototype.putSignedInt=function(e,t){return o(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},l.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},l.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},l.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},l.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},l.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},l.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},l.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},l.DataBuffer.prototype.getInt=function(e){o(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},l.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},l.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},l.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},l.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},l.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},l.DataBuffer.prototype.copy=function(){return new l.DataBuffer(this)},l.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},l.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},l.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},l.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},l.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return l.binary.raw.encode(t);if("hex"===e)return l.binary.hex.encode(t);if("base64"===e)return l.binary.base64.encode(t);if("utf8"===e)return l.text.utf8.decode(t);if("utf16"===e)return l.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},l.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=l.encodeUtf8(e)),new l.ByteBuffer(e)},l.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},l.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},l.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(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},l.bytesToHex=function(e){return l.createBuffer(e).toHex()},l.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",p=[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],h="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";l.encode64=function(e,t){for(var r,n,i,a="",o="",s=0;s<e.length;)r=e.charCodeAt(s++),n=e.charCodeAt(s++),i=e.charCodeAt(s++),a+=f.charAt(r>>2),a+=f.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=f.charAt((15&n)<<2|i>>6),a+=isNaN(i)?"=":f.charAt(63&i)),t&&a.length>t&&(o+=a.substr(0,t)+"\r\n",a=a.substr(t));return o+=a},l.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,a="",o=0;o<e.length;)t=p[e.charCodeAt(o++)-43],r=p[e.charCodeAt(o++)-43],n=p[e.charCodeAt(o++)-43],i=p[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},l.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},l.decodeUtf8=function(e){return decodeURIComponent(escape(e))},l.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:c.encode,decode:c.decode}},l.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},l.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,a=0;a<e.length;++a)n[i++]=e.charCodeAt(a);return t?i-r:n},l.binary.hex.encode=l.bytesToHex,l.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2)));var i=0,a=r=r||0;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},l.binary.base64.encode=function(e,t){for(var r,n,i,a="",o="",s=0;s<e.byteLength;)r=e[s++],n=e[s++],i=e[s++],a+=f.charAt(r>>2),a+=f.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=f.charAt((15&n)<<2|i>>6),a+=isNaN(i)?"=":f.charAt(63&i)),t&&a.length>t&&(o+=a.substr(0,t)+"\r\n",a=a.substr(t));return o+=a},l.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,"");for(var i,a,o,s,u=0,c=r=r||0;u<e.length;)i=p[e.charCodeAt(u++)-43],a=p[e.charCodeAt(u++)-43],o=p[e.charCodeAt(u++)-43],s=p[e.charCodeAt(u++)-43],n[c++]=i<<2|a>>4,64!==o&&(n[c++]=(15&a)<<4|o>>2,64!==s&&(n[c++]=(3&o)<<6|s));return t?c-r:n.subarray(0,c)},l.binary.base58.encode=function(e,t){return l.binary.baseN.encode(e,h,t)},l.binary.base58.decode=function(e,t){return l.binary.baseN.decode(e,h,t)},l.text={utf8:{},utf16:{}},l.text.utf8.encode=function(e,t,r){e=l.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,a=0;a<e.length;++a)n[i++]=e.charCodeAt(a);return t?i-r:n},l.text.utf8.decode=function(e){return l.decodeUtf8(String.fromCharCode.apply(null,e))},l.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(2*e.length));for(var i=new Uint16Array(n.buffer),a=r=r||0,o=r,s=0;s<e.length;++s)i[o++]=e.charCodeAt(s),a+=2;return t?a-r:n},l.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},l.deflate=function(e,t,r){if(t=l.decode64(e.deflate(l.encode64(t)).rval),r){var n=2;32&t.charCodeAt(1)&&(n=6),t=t.substring(n,t.length-4)}return t},l.inflate=function(e,t,r){var n=e.inflate(l.encode64(t)).rval;return null===n?null:l.decode64(n)};var d=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var n;if(null===r?n=e.removeItem(t):(r=l.encode64(JSON.stringify(r)),n=e.setItem(t,r)),void 0!==n&&!0!==n.rval){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},y=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(l.decode64(r))),r},g=function(e,t,r,n){var i=y(e,t);null===i&&(i={}),i[r]=n,d(e,t,i)},v=function(e,t,r){var n=y(e,t);return null!==n&&(n=r in n?n[r]:null),n},m=function(e,t,r){var n=y(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),d(e,t,n)}},b=function(e,t){d(e,t,null)},C=function(e,t,r){var n=null;void 0===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(e){o=e}if(a)break}if(!a)throw o;return n};l.setItem=function(e,t,r,n,i){C(g,arguments,i)},l.getItem=function(e,t,r,n){return C(v,arguments,n)},l.removeItem=function(e,t,r,n){C(m,arguments,n)},l.clearItems=function(e,t,r){C(b,arguments,r)},l.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 E=null;l.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 void 0===e?(null===E&&(E="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=E):t=r(e),t},l.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var i=t.split("/");return i.length>0&&""===i[0]&&i.shift(),{pathString:t,queryString:r,path:i,query:""===r?{}:l.getQueryVariables(r)}},l.makeRequest=function(e){var t=l.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};return r},l.makeLink=function(e,t,r){e=null.isArray(e)?e.join("/"):e;var n=null.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},l.setPath=function(e,t,r){if("object"==typeof e&&null!==e)for(var n=0,i=t.length;n<i;){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]}}},l.getPath=function(e,t,r){for(var n=0,i=t.length,a=!0;a&&n<i&&"object"==typeof e&&null!==e;){var o=t[n++];(a=o in e)&&(e=e[o])}return a?e:r},l.deletePath=function(e,t){if("object"==typeof e&&null!==e)for(var r=0,n=t.length;r<n;){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]}}},l.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},l.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)).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[1+i++]):a.push("<?>");break;case"%":a.push("%");break;default:a.push("<%"+s+"?>")}}return a.push(e.substring(o)),a.join("")},l.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=i<0?"-":"",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):"")},l.formatSize=function(e){return e=e>=1073741824?l.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?l.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?l.formatNumber(e/1024,0)+" KiB":l.formatNumber(e,0)+" bytes"},l.bytesFromIP=function(e){return-1!==e.indexOf(".")?l.bytesFromIPv4(e):-1!==e.indexOf(":")?l.bytesFromIPv6(e):null},l.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=l.createBuffer(),r=0;r<e.length;++r){var n=parseInt(e[r],10);if(isNaN(n))return null;t.putByte(n)}return t.getBytes()},l.bytesFromIPv6=function(e){for(var t=0,r=2*(8-(e=e.split(":").filter(function(e){return 0===e.length&&++t,!0})).length+t),n=l.createBuffer(),i=0;i<8;++i)if(e[i]&&0!==e[i].length){var a=l.hexToBytes(e[i]);a.length<2&&n.putByte(0),n.putBytes(a)}else n.fillWithByte(0,r),r=0;return n.getBytes()},l.bytesToIP=function(e){return 4===e.length?l.bytesToIPv4(e):16===e.length?l.bytesToIPv6(e):null},l.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(".")},l.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],n=0,i=0;i<e.length;i+=2){for(var a=l.bytesToHex(e[i]+e[i+1]);"0"===a[0]&&"0"!==a;)a=a.substr(1);if("0"===a){var o=r[r.length-1],s=t.length;o&&s===o.end+1?(o.end=s,o.end-o.start>r[n].end-r[n].start&&(n=r.length-1)):r.push({start:s,end:s})}t.push(a)}if(r.length>0){var u=r[n];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},l.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in l&&!e.update)return t(null,l.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return l.cores=navigator.hardwareConcurrency,t(null,l.cores);if("undefined"==typeof Worker)return l.cores=1,t(null,l.cores);if("undefined"==typeof Blob)return l.cores=2,t(null,l.cores);var r=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"}));!function e(n,i,a){if(0===i){var o=Math.floor(n.reduce(function(e,t){return e+t},0)/n.length);return l.cores=Math.max(1,o),URL.revokeObjectURL(r),t(null,l.cores)}!function(e,t){for(var n=[],i=[],a=0;a<e;++a){var o=new Worker(r);o.addEventListener("message",function(r){if(i.push(r.data),i.length===e){for(var a=0;a<e;++a)n[a].terminate();t(null,i)}}),n.push(o)}for(var a=0;a<e;++a)n[a].postMessage(a)}(a,function(t,r){n.push(function(e,t){for(var r=[],n=0;n<e;++n)for(var i=t[n],a=r[n]=[],o=0;o<e;++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)}(a,r)),e(n,i-1,a)})}([],5,16)}},function(e,t,r){var n=r(0);r(5),r(23),r(24),r(1),n.random&&n.random.getBytes?e.exports=n.random:function(t){function r(){var e=n.prng.create(i);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}var i={},a=new Array(4),o=n.util.createBuffer();i.formatKey=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1)},i.formatSeed=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},i.cipher=function(e,t){return n.aes._updateBlock(e,t,a,!1),o.putInt32(a[0]),o.putInt32(a[1]),o.putInt32(a[2]),o.putInt32(a[3]),o.getBytes()},i.increment=function(e){return++e[3],e},i.md=n.md.sha256;var s=r(),u=null;if("undefined"!=typeof window){var c=window.crypto||window.msCrypto;c&&c.getRandomValues&&(u=function(e){return c.getRandomValues(e)})}if(n.options.usePureJavaScript||!n.util.isNodejs&&!u){if("undefined"==typeof window||window.document,s.collectInt(+new Date,32),"undefined"!=typeof navigator){var l="";for(var f in navigator)try{"string"==typeof navigator[f]&&(l+=navigator[f])}catch(e){}s.collect(l),l=null}t&&(t().mousemove(function(e){s.collectInt(e.clientX,16),s.collectInt(e.clientY,16)}),t().keypress(function(e){s.collectInt(e.charCode,8)}))}if(n.random)for(var f in s)n.random[f]=s[f];else n.random=s;n.random.createInstance=r,e.exports=n.random}(null)},function(e,t,r){function n(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}var i=r(0);r(1),r(6);var a=e.exports=i.asn1=i.asn1||{};a.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},a.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},a.create=function(e,t,r,n,o){if(i.util.isArray(n)){for(var s=[],u=0;u<n.length;++u)void 0!==n[u]&&s.push(n[u]);n=s}var c={tagClass:e,type:t,constructed:r,composed:r||i.util.isArray(n),value:n};return o&&"bitStringContents"in o&&(c.bitStringContents=o.bitStringContents,c.original=a.copy(c)),c},a.copy=function(e,t){var r;if(i.util.isArray(e)){r=[];for(var n=0;n<e.length;++n)r.push(a.copy(e[n],t));return r}return"string"==typeof e?e:(r={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:a.copy(e.value,t)},t&&!t.excludeBitStringContents&&(r.bitStringContents=e.bitStringContents),r)},a.equals=function(e,t,r){if(i.util.isArray(e)){if(!i.util.isArray(t))return!1;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!a.equals(e[n],t[n]))return!1;return!0}if(typeof e!=typeof t)return!1;if("string"==typeof e)return e===t;var o=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&a.equals(e.value,t.value);return r&&r.includeBitStringContents&&(o=o&&e.bitStringContents===t.bitStringContents),o},a.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};var o=function(e,t){var r=e.getByte();if(t--,128!==r){var i;if(128&r){var a=127&r;n(e,t,a),i=e.getInt(a<<3)}else i=r;if(i<0)throw new Error("Negative length: "+i);return i}};a.fromDer=function(e,t){return void 0===t&&(t={strict:!0,decodeBitStrings:!0}),"boolean"==typeof t&&(t={strict:t,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"==typeof e&&(e=i.util.createBuffer(e)),function e(t,r,i,s){var u;n(t,r,2);var c=t.getByte();r--;var l=192&c,f=31&c;u=t.length();var p=o(t,r);if(r-=u-t.length(),void 0!==p&&p>r){if(s.strict){var h=new Error("Too few bytes to read ASN.1 value.");throw h.available=t.length(),h.remaining=r,h.requested=p,h}p=r}var d,y,g=32==(32&c);if(g)if(d=[],void 0===p)for(;;){if(n(t,r,2),t.bytes(2)===String.fromCharCode(0,0)){t.getBytes(2),r-=2;break}u=t.length(),d.push(e(t,r,i+1,s)),r-=u-t.length()}else for(;p>0;)u=t.length(),d.push(e(t,p,i+1,s)),r-=u-t.length(),p-=u-t.length();if(void 0===d&&l===a.Class.UNIVERSAL&&f===a.Type.BITSTRING&&(y=t.bytes(p)),void 0===d&&s.decodeBitStrings&&l===a.Class.UNIVERSAL&&f===a.Type.BITSTRING&&p>1){var v=t.read,m=r,b=0;if(f===a.Type.BITSTRING&&(n(t,r,1),b=t.getByte(),r--),0===b)try{u=t.length();var C={verbose:s.verbose,strict:!0,decodeBitStrings:!0},E=e(t,r,i+1,C),S=u-t.length();r-=S,f==a.Type.BITSTRING&&S++;var T=E.tagClass;S!==p||T!==a.Class.UNIVERSAL&&T!==a.Class.CONTEXT_SPECIFIC||(d=[E])}catch(t){}void 0===d&&(t.read=v,r=m)}if(void 0===d){if(void 0===p){if(s.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");p=r}if(f===a.Type.BMPSTRING)for(d="";p>0;p-=2)n(t,r,2),d+=String.fromCharCode(t.getInt16()),r-=2;else d=t.getBytes(p)}var A=void 0===y?null:{bitStringContents:y};return a.create(l,f,g,d,A)}(e,e.length(),0,t)},a.toDer=function(e){var t=i.util.createBuffer(),r=e.tagClass|e.type,n=i.util.createBuffer(),o=!1;if("bitStringContents"in e&&(o=!0,e.original&&(o=a.equals(e,e.original))),o)n.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:n.putByte(0);for(var s=0;s<e.value.length;++s)void 0!==e.value[s]&&n.putBuffer(a.toDer(e.value[s]))}else if(e.type===a.Type.BMPSTRING)for(var s=0;s<e.value.length;++s)n.putInt16(e.value.charCodeAt(s));else e.type===a.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?n.putBytes(e.value.substr(1)):n.putBytes(e.value);if(t.putByte(r),n.length()<=127)t.putByte(127&n.length());else{var u=n.length(),c="";do{c+=String.fromCharCode(255&u),u>>>=8}while(u>0);t.putByte(128|c.length);for(var s=c.length-1;s>=0;--s)t.putByte(c.charCodeAt(s))}return t.putBuffer(n),t},a.oidToDer=function(e){var t=e.split("."),r=i.util.createBuffer();r.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var n,a,o,s,u=2;u<t.length;++u){n=!0,a=[],o=parseInt(t[u],10);do{s=127&o,o>>>=7,n||(s|=128),a.push(s),n=!1}while(o>0);for(var c=a.length-1;c>=0;--c)r.putByte(a[c])}return r},a.derToOid=function(e){var t;"string"==typeof e&&(e=i.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)r=e.getByte(),n<<=7,128&r?n+=127&r:(t+="."+(n+r),n=0);return t},a.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)){var l=parseInt(e.substr(c+1,2),10),f=parseInt(e.substr(c+4,2),10),p=60*l+f;p*=6e4,"+"===u?t.setTime(+t-p):t.setTime(+t+p)}return t},a.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,p=e.charAt(f);return"+"!==p&&"-"!==p||(c=60*parseInt(e.substr(f+1,2),10)+parseInt(e.substr(f+4,2),10),c*=6e4,"+"===p&&(c*=-1),l=!0),"."===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},a.dateToUtcTime=function(e){if("string"==typeof e)return 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"},a.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),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"},a.integerToDer=function(e){var t=i.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},a.derToInteger=function(e){"string"==typeof e&&(e=i.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)},a.validate=function(e,t,r,n){var o=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)n&&(e.tagClass!==t.tagClass&&n.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&n.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(o=!0,t.value&&i.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=a.validate(e.value[s],t.value[u],r,n))?++s:t.value[u].optional&&(o=!0)),!o&&n&&n.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');if(o&&r&&(t.capture&&(r[t.capture]=e.value),t.captureAsn1&&(r[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(r[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e))if(e.bitStringContents.length<2)r[t.captureBitStringValue]="";else{var c=e.bitStringContents.charCodeAt(0);if(0!==c)throw new Error("captureBitStringValue only supported for zero unused bits");r[t.captureBitStringValue]=e.bitStringContents.slice(1)}}else n&&n.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');return o};var s=/[^\\u0000-\\u00ff]/;a.prettyPrint=function(e,t,r){var n="";r=r||2,(t=t||0)>0&&(n+="\n");for(var o="",u=0;u<t*r;++u)o+=" ";switch(n+=o+"Tag: ",e.tagClass){case a.Class.UNIVERSAL:n+="Universal:";break;case a.Class.APPLICATION:n+="Application:";break;case a.Class.CONTEXT_SPECIFIC:n+="Context-Specific:";break;case a.Class.PRIVATE:n+="Private:"}if(e.tagClass===a.Class.UNIVERSAL)switch(n+=e.type,e.type){case a.Type.NONE:n+=" (None)";break;case a.Type.BOOLEAN:n+=" (Boolean)";break;case a.Type.INTEGER:n+=" (Integer)";break;case a.Type.BITSTRING:n+=" (Bit string)";break;case a.Type.OCTETSTRING:n+=" (Octet string)";break;case a.Type.NULL:n+=" (Null)";break;case a.Type.OID:n+=" (Object Identifier)";break;case a.Type.ODESC:n+=" (Object Descriptor)";break;case a.Type.EXTERNAL:n+=" (External or Instance of)";break;case a.Type.REAL:n+=" (Real)";break;case a.Type.ENUMERATED:n+=" (Enumerated)";break;case a.Type.EMBEDDED:n+=" (Embedded PDV)";break;case a.Type.UTF8:n+=" (UTF8)";break;case a.Type.ROID:n+=" (Relative Object Identifier)";break;case a.Type.SEQUENCE:n+=" (Sequence)";break;case a.Type.SET:n+=" (Set)";break;case a.Type.PRINTABLESTRING:n+=" (Printable String)";break;case a.Type.IA5String:n+=" (IA5String (ASCII))";break;case a.Type.UTCTIME:n+=" (UTC time)";break;case a.Type.GENERALIZEDTIME:n+=" (Generalized time)";break;case a.Type.BMPSTRING:n+=" (BMP String)"}else n+=e.type;if(n+="\n",n+=o+"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+=a.prettyPrint(e.value[u],t+1,r),u+1<e.value.length&&(l+=","));n+=o+"Sub values: "+c+l}else{if(n+=o+"Value: ",e.type===a.Type.OID){var f=a.derToOid(e.value);n+=f,i.pki&&i.pki.oids&&f in i.pki.oids&&(n+=" ("+i.pki.oids[f]+") ")}if(e.type===a.Type.INTEGER)try{n+=a.derToInteger(e.value)}catch(t){n+="0x"+i.util.bytesToHex(e.value)}else if(e.type===a.Type.BITSTRING){if(e.value.length>1?n+="0x"+i.util.bytesToHex(e.value.slice(1)):n+="(none)",e.value.length>0){var p=e.value.charCodeAt(0);1==p?n+=" (1 unused bit shown)":p>1&&(n+=" ("+p+" unused bits shown)")}}else e.type===a.Type.OCTETSTRING?(s.test(e.value)||(n+="("+e.value+") "),n+="0x"+i.util.bytesToHex(e.value)):e.type===a.Type.UTF8?n+=i.util.decodeUtf8(e.value):e.type===a.Type.PRINTABLESTRING||e.type===a.Type.IA5String?n+=e.value:s.test(e.value)?n+="0x"+i.util.bytesToHex(e.value):0===e.value.length?n+="[null]":n+=e.value}return n}},function(e,t,r){var n=r(0);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){function n(e,t){u.cipher.registerAlgorithm(e,function(){return new u.aes.Algorithm(e,t)})}function i(){d=!0,f=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;c=new Array(256),l=new Array(256),p=new Array(4),h=new Array(4);for(var t=0;t<4;++t)p[t]=new Array(256),h[t]=new Array(256);for(var r,n,i,a,o,s,u,y=0,g=0,t=0;t<256;++t){a=(a=g^g<<1^g<<2^g<<3^g<<4)>>8^255&a^99,c[y]=a,l[a]=y,o=e[a],r=e[y],n=e[r],i=e[n],s=o<<24^a<<16^a<<8^a^o,u=(r^n^i)<<24^(y^i)<<16^(y^n^i)<<8^y^r^i;for(var v=0;v<4;++v)p[v][y]=s,h[v][a]=u,s=s<<24|s>>>8,u=u<<24|u>>>8;0===y?y=g=1:(y=r^e[e[e[r^i]]],g^=e[e[g]])}}function a(e,t){for(var r,n=e.slice(0),i=1,a=n.length,o=a+6+1,s=y*o,u=a;u<s;++u)r=n[u-1],u%a==0?(r=c[r>>>16&255]<<24^c[r>>>8&255]<<16^c[255&r]<<8^c[r>>>24]^f[i]<<24,i++):a>6&&u%a==4&&(r=c[r>>>24]<<24^c[r>>>16&255]<<16^c[r>>>8&255]<<8^c[255&r]),n[u]=n[u-a]^r;if(t){var l,p=h[0],d=h[1],g=h[2],v=h[3],m=n.slice(0);s=n.length;for(var u=0,b=s-y;u<s;u+=y,b-=y)if(0===u||u===s-y)m[u]=n[b],m[u+1]=n[b+3],m[u+2]=n[b+2],m[u+3]=n[b+1];else for(var C=0;C<y;++C)l=n[b+C],m[u+(3&-C)]=p[c[l>>>24]]^d[c[l>>>16&255]]^g[c[l>>>8&255]]^v[c[255&l]];n=m}return n}function o(e,t,r,n){var i,a,o,s,u,f,d,y,g,v,m,b,C=e.length/4-1;n?(i=h[0],a=h[1],o=h[2],s=h[3],u=l):(i=p[0],a=p[1],o=p[2],s=p[3],u=c),f=t[0]^e[0],d=t[n?3:1]^e[1],y=t[2]^e[2],g=t[n?1:3]^e[3];for(var E=3,S=1;S<C;++S)v=i[f>>>24]^a[d>>>16&255]^o[y>>>8&255]^s[255&g]^e[++E],m=i[d>>>24]^a[y>>>16&255]^o[g>>>8&255]^s[255&f]^e[++E],b=i[y>>>24]^a[g>>>16&255]^o[f>>>8&255]^s[255&d]^e[++E],g=i[g>>>24]^a[f>>>16&255]^o[d>>>8&255]^s[255&y]^e[++E],f=v,d=m,y=b;r[0]=u[f>>>24]<<24^u[d>>>16&255]<<16^u[y>>>8&255]<<8^u[255&g]^e[++E],r[n?3:1]=u[d>>>24]<<24^u[y>>>16&255]<<16^u[g>>>8&255]<<8^u[255&f]^e[++E],r[2]=u[y>>>24]<<24^u[g>>>16&255]<<16^u[f>>>8&255]<<8^u[255&d]^e[++E],r[n?1:3]=u[g>>>24]<<24^u[f>>>16&255]<<16^u[d>>>8&255]<<8^u[255&y]^e[++E]}function s(e){var t,r=((e=e||{}).mode||"CBC").toUpperCase(),n="AES-"+r,i=(t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key)).start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),(r=r||{}).output=n,r.iv=e,i.call(t,r)},t}var u=r(0);r(13),r(18),r(1),e.exports=u.aes=u.aes||{},u.aes.startEncrypting=function(e,t,r,n){var i=s({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},u.aes.createEncryptionCipher=function(e,t){return s({key:e,output:null,decrypt:!1,mode:t})},u.aes.startDecrypting=function(e,t,r,n){var i=s({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},u.aes.createDecryptionCipher=function(e,t){return s({key:e,output:null,decrypt:!0,mode:t})},u.aes.Algorithm=function(e,t){d||i();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return o(r._w,e,t,!1)},decrypt:function(e,t){return o(r._w,e,t,!0)}}}),r._init=!1},u.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(u.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=u.util.createBuffer();for(var n=0;n<t.length;++n)r.putByte(t[n])}}else r=u.util.createBuffer(r);if(!u.util.isArray(r)){t=r,r=[];var i=t.length();if(16===i||24===i||32===i){i>>>=2;for(var n=0;n<i;++n)r.push(t.getInt32())}}if(!u.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var o=this.mode.name,s=-1!==["CFB","OFB","CTR","GCM"].indexOf(o);this._w=a(r,e.decrypt&&!s),this._init=!0}},u.aes._expandKey=function(e,t){return d||i(),a(e,t)},u.aes._updateBlock=o,n("AES-ECB",u.cipher.modes.ecb),n("AES-CBC",u.cipher.modes.cbc),n("AES-CFB",u.cipher.modes.cfb),n("AES-OFB",u.cipher.modes.ofb),n("AES-CTR",u.cipher.modes.ctr),n("AES-GCM",u.cipher.modes.gcm);var c,l,f,p,h,d=!1,y=4},function(e,t,r){function n(e,t){o[e]=t,o[t]=e}function i(e,t){o[e]=t}var a=r(0);a.pki=a.pki||{};var o=e.exports=a.pki.oids=a.oids=a.oids||{};n("1.2.840.113549.1.1.1","rsaEncryption"),n("1.2.840.113549.1.1.4","md5WithRSAEncryption"),n("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),n("1.2.840.113549.1.1.7","RSAES-OAEP"),n("1.2.840.113549.1.1.8","mgf1"),n("1.2.840.113549.1.1.9","pSpecified"),n("1.2.840.113549.1.1.10","RSASSA-PSS"),n("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),n("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),n("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),n("1.2.840.10040.4.3","dsa-with-sha1"),n("1.3.14.3.2.7","desCBC"),n("1.3.14.3.2.26","sha1"),n("2.16.840.1.101.3.4.2.1","sha256"),n("2.16.840.1.101.3.4.2.2","sha384"),n("2.16.840.1.101.3.4.2.3","sha512"),n("1.2.840.113549.2.5","md5"),n("1.2.840.113549.1.7.1","data"),n("1.2.840.113549.1.7.2","signedData"),n("1.2.840.113549.1.7.3","envelopedData"),n("1.2.840.113549.1.7.4","signedAndEnvelopedData"),n("1.2.840.113549.1.7.5","digestedData"),n("1.2.840.113549.1.7.6","encryptedData"),n("1.2.840.113549.1.9.1","emailAddress"),n("1.2.840.113549.1.9.2","unstructuredName"),n("1.2.840.113549.1.9.3","contentType"),n("1.2.840.113549.1.9.4","messageDigest"),n("1.2.840.113549.1.9.5","signingTime"),n("1.2.840.113549.1.9.6","counterSignature"),n("1.2.840.113549.1.9.7","challengePassword"),n("1.2.840.113549.1.9.8","unstructuredAddress"),n("1.2.840.113549.1.9.14","extensionRequest"),n("1.2.840.113549.1.9.20","friendlyName"),n("1.2.840.113549.1.9.21","localKeyId"),n("1.2.840.113549.1.9.22.1","x509Certificate"),n("1.2.840.113549.1.12.10.1.1","keyBag"),n("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),n("1.2.840.113549.1.12.10.1.3","certBag"),n("1.2.840.113549.1.12.10.1.4","crlBag"),n("1.2.840.113549.1.12.10.1.5","secretBag"),n("1.2.840.113549.1.12.10.1.6","safeContentsBag"),n("1.2.840.113549.1.5.13","pkcs5PBES2"),n("1.2.840.113549.1.5.12","pkcs5PBKDF2"),n("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),n("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),n("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),n("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),n("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),n("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),n("1.2.840.113549.2.7","hmacWithSHA1"),n("1.2.840.113549.2.8","hmacWithSHA224"),n("1.2.840.113549.2.9","hmacWithSHA256"),n("1.2.840.113549.2.10","hmacWithSHA384"),n("1.2.840.113549.2.11","hmacWithSHA512"),n("1.2.840.113549.3.7","des-EDE3-CBC"),n("2.16.840.1.101.3.4.1.2","aes128-CBC"),n("2.16.840.1.101.3.4.1.22","aes192-CBC"),n("2.16.840.1.101.3.4.1.42","aes256-CBC"),n("2.5.4.3","commonName"),n("2.5.4.5","serialName"),n("2.5.4.6","countryName"),n("2.5.4.7","localityName"),n("2.5.4.8","stateOrProvinceName"),n("2.5.4.10","organizationName"),n("2.5.4.11","organizationalUnitName"),n("2.16.840.1.113730.1.1","nsCertType"),i("2.5.29.1","authorityKeyIdentifier"),i("2.5.29.2","keyAttributes"),i("2.5.29.3","certificatePolicies"),i("2.5.29.4","keyUsageRestriction"),i("2.5.29.5","policyMapping"),i("2.5.29.6","subtreesConstraint"),i("2.5.29.7","subjectAltName"),i("2.5.29.8","issuerAltName"),i("2.5.29.9","subjectDirectoryAttributes"),i("2.5.29.10","basicConstraints"),i("2.5.29.11","nameConstraints"),i("2.5.29.12","policyConstraints"),i("2.5.29.13","basicConstraints"),n("2.5.29.14","subjectKeyIdentifier"),n("2.5.29.15","keyUsage"),i("2.5.29.16","privateKeyUsagePeriod"),n("2.5.29.17","subjectAltName"),n("2.5.29.18","issuerAltName"),n("2.5.29.19","basicConstraints"),i("2.5.29.20","cRLNumber"),i("2.5.29.21","cRLReason"),i("2.5.29.22","expirationDate"),i("2.5.29.23","instructionCode"),i("2.5.29.24","invalidityDate"),i("2.5.29.25","cRLDistributionPoints"),i("2.5.29.26","issuingDistributionPoint"),i("2.5.29.27","deltaCRLIndicator"),i("2.5.29.28","issuingDistributionPoint"),i("2.5.29.29","certificateIssuer"),i("2.5.29.30","nameConstraints"),n("2.5.29.31","cRLDistributionPoints"),n("2.5.29.32","certificatePolicies"),i("2.5.29.33","policyMappings"),i("2.5.29.34","policyConstraints"),n("2.5.29.35","authorityKeyIdentifier"),i("2.5.29.36","policyConstraints"),n("2.5.29.37","extKeyUsage"),i("2.5.29.46","freshestCRL"),i("2.5.29.54","inhibitAnyPolicy"),n("1.3.6.1.4.1.11129.2.4.2","timestampList"),n("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),n("1.3.6.1.5.5.7.3.1","serverAuth"),n("1.3.6.1.5.5.7.3.2","clientAuth"),n("1.3.6.1.5.5.7.3.3","codeSigning"),n("1.3.6.1.5.5.7.3.4","emailProtection"),n("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,r){function n(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"!==t[i]&&","!==t[i]||(o=i);return t}function i(e){return e.replace(/^\s+/,"")}var a=r(0);r(1);var o=e.exports=a.pem=a.pem||{};o.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},i+=n(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},i+=n(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),i+=n(r)),e.headers)for(var o=0;o<e.headers.length;++o)i+=n(e.headers[o]);return e.procType&&(i+="\r\n"),i+=a.util.encode64(e.body,t.maxline||64)+"\r\n",i+="-----END "+e.type+"-----\r\n"},o.decode=function(e){for(var t,r=[],n=/\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/;t=n.exec(e);){var u={type:t[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.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+$/,""),p=l+1;p<c.length;++p){var h=c[p];if(!/\s/.test(h[0]))break;f+=h,l=p}if(t=f.match(o)){for(var d={name:t[1],values:[]},y=t[2].split(","),g=0;g<y.length;++g)d.values.push(i(y[g]));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:y[0],parameters:y[1]||null}}else u.contentDomain=y[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:y[0],type:y[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}},function(e,t,r){var n=r(0);r(4),r(1),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,i=null,a={start:function(a,o){if(null!==a)if("string"==typeof a){if(!((a=a.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+a+'"');t=n.md.algorithms[a].create()}else t=a;if(null===o)o=e;else{if("string"==typeof o)o=n.util.createBuffer(o);else if(n.util.isArray(o)){var s=o;o=n.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()),r=n.util.createBuffer(),i=n.util.createBuffer(),c=o.length();for(var u=0;u<c;++u){var s=o.at(u);r.putByte(54^s),i.putByte(92^s)}if(c<t.blockLength)for(var s=t.blockLength-c,u=0;u<s;++u)r.putByte(54),i.putByte(92);e=o,r=r.bytes(),i=i.bytes()}t.start(),t.update(r)},update:function(e){t.update(e)},getMac:function(){var e=t.digest().bytes();return t.start(),t.update(i),t.update(e),t.digest()}};return a.digest=a.getMac,a}},function(e,t,r){function n(e,t,r){for(var n,i,a,o,s,u,c,l=r.length();l>=64;){for(i=e.h0,a=e.h1,o=e.h2,s=e.h3,u=e.h4,c=0;c<16;++c)n=r.getInt32(),t[c]=n,n=(i<<5|i>>>27)+(s^a&(o^s))+u+1518500249+n,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<20;++c)n=(n=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|n>>>31,t[c]=n,n=(i<<5|i>>>27)+(s^a&(o^s))+u+1518500249+n,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<32;++c)n=(n=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|n>>>31,t[c]=n,n=(i<<5|i>>>27)+(a^o^s)+u+1859775393+n,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<40;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(a^o^s)+u+1859775393+n,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<60;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(a&o|s&(a^o))+u+2400959708+n,u=s,s=o,o=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<80;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(a^o^s)+u+3395469782+n,u=s,s=o,o=(a<<30|a>>>2)>>>0,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,l-=64}}var i=r(0);r(4),r(1);var a=e.exports=i.sha1=i.sha1||{};i.md.sha1=i.md.algorithms.sha1=a,a.create=function(){s||(o=String.fromCharCode(128),o+=i.util.fillString(String.fromCharCode(0),64),s=!0);var e=null,t=i.util.createBuffer(),r=new Array(80),a={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){a.messageLength=0,a.fullMessageLength=a.messageLength64=[];for(var r=a.messageLengthSize/4,n=0;n<r;++n)a.fullMessageLength.push(0);return t=i.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},a}};return a.start(),a.update=function(o,s){"utf8"===s&&(o=i.util.encodeUtf8(o));var u=o.length;a.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var c=a.fullMessageLength.length-1;c>=0;--c)a.fullMessageLength[c]+=u[1],u[1]=u[0]+(a.fullMessageLength[c]/4294967296>>>0),a.fullMessageLength[c]=a.fullMessageLength[c]>>>0,u[0]=u[1]/4294967296>>>0;return t.putBytes(o),n(e,r,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var s=i.util.createBuffer();s.putBytes(t.bytes());var u=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,c=u&a.blockLength-1;s.putBytes(o.substr(0,a.blockLength-c));for(var l,f=8*a.fullMessageLength[0],p=0;p<a.fullMessageLength.length-1;++p)l=8*a.fullMessageLength[p+1],f+=l/4294967296>>>0,s.putInt32(f>>>0),f=l>>>0;s.putInt32(f);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};n(h,r,s);var d=i.util.createBuffer();return d.putInt32(h.h0),d.putInt32(h.h1),d.putInt32(h.h2),d.putInt32(h.h3),d.putInt32(h.h4),d},a};var o=null,s=!1},function(e,t,r){function n(e,t){o.cipher.registerAlgorithm(e,function(){return new o.des.Algorithm(e,t)})}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,y=t[0],g=t[1];y^=(o=252645135&(y>>>4^g))<<4,y^=(o=65535&(y>>>16^(g^=o)))<<16,y^=o=858993459&((g^=o)>>>2^y),y^=o=16711935&((g^=o<<2)>>>8^y),y=(y^=(o=1431655765&(y>>>1^(g^=o<<8)))<<1)<<1|y>>>31,g=(g^=o)<<1|g>>>31;for(var v=0;v<a;v+=3){for(var m=i[v+1],b=i[v+2],C=i[v];C!=m;C+=b){var E=g^e[C],S=(g>>>4|g<<28)^e[C+1];o=y,y=g,g=o^(u[E>>>24&63]|l[E>>>16&63]|p[E>>>8&63]|d[63&E]|s[S>>>24&63]|c[S>>>16&63]|f[S>>>8&63]|h[63&S])}o=y,y=g,g=o}g=g>>>1|g<<31,g^=o=1431655765&((y=y>>>1|y<<31)>>>1^g),g^=(o=16711935&(g>>>8^(y^=o<<1)))<<8,g^=(o=858993459&(g>>>2^(y^=o)))<<2,g^=o=65535&((y^=o)>>>16^g),g^=o=252645135&((y^=o<<16)>>>4^g),y^=o<<4,r[0]=y,r[1]=g}function a(e){var t,r=((e=e||{}).mode||"CBC").toUpperCase(),n="DES-"+r,i=(t=e.decrypt?o.cipher.createDecipher(n,e.key):o.cipher.createCipher(n,e.key)).start;return t.start=function(e,r){var n=null;r instanceof o.util.ByteBuffer&&(n=r,r={}),(r=r||{}).output=n,r.iv=e,i.call(t,r)},t}var o=r(0);r(13),r(18),r(1),e.exports=o.des=o.des||{},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=function(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],p=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],h=[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],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=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,C=0;C<g;C++){var E=e.getInt32(),S=e.getInt32();E^=(t=252645135&(E>>>4^S))<<4,E^=t=65535&((S^=t)>>>-16^E),E^=(t=858993459&(E>>>2^(S^=t<<-16)))<<2,E^=t=65535&((S^=t)>>>-16^E),E^=(t=1431655765&(E>>>1^(S^=t<<-16)))<<1,E^=t=16711935&((S^=t)>>>8^E),t=(E^=(t=1431655765&(E>>>1^(S^=t<<8)))<<1)<<8|(S^=t)>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T<m.length;++T){m[T]?(E=E<<2|E>>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27);var A=r[(E&=-15)>>>28]|n[E>>>24&15]|i[E>>>20&15]|a[E>>>16&15]|o[E>>>12&15]|s[E>>>8&15]|u[E>>>4&15],B=c[(S&=-15)>>>28]|l[S>>>24&15]|f[S>>>20&15]|p[S>>>16&15]|h[S>>>12&15]|d[S>>>8&15]|y[S>>>4&15];t=65535&(B>>>16^A),v[b++]=A^t,v[b++]=B^t<<16}}return v}(t),this._init=!0}},n("DES-ECB",o.cipher.modes.ecb),n("DES-CBC",o.cipher.modes.cbc),n("DES-CFB",o.cipher.modes.cfb),n("DES-OFB",o.cipher.modes.ofb),n("DES-CTR",o.cipher.modes.ctr),n("3DES-ECB",o.cipher.modes.ecb),n("3DES-CBC",o.cipher.modes.cbc),n("3DES-CFB",o.cipher.modes.cfb),n("3DES-OFB",o.cipher.modes.ofb),n("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],p=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],h=[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]},function(e,t,r){function n(e,t,r){var n=l.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,s=i-3-e.length;if(0===r||1===r){o=0===r?0:255;for(var u=0;u<s;++u)n.putByte(o)}else for(;s>0;){for(var c=0,f=l.random.getBytes(s),u=0;u<s;++u)0===(o=f.charCodeAt(u))?++c:n.putByte(o);s=c}return n.putByte(0),n.putBytes(e),n}function i(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8),a=l.util.createBuffer(e),o=a.getByte(),s=a.getByte();if(0!==o||r&&0!==s&&1!==s||!r&&2!=s||r&&0===s&&void 0===n)throw new Error("Encryption block is invalid.");var u=0;if(0===s){u=i-3-n;for(var c=0;c<u;++c)if(0!==a.getByte())throw new Error("Encryption block is invalid.")}else if(1===s)for(u=0;a.length()>1;){if(255!==a.getByte()){--a.read;break}++u}else if(2===s)for(u=0;a.length()>1;){if(0===a.getByte()){--a.read;break}++u}if(0!==a.getByte()||u!==i-3-a.length())throw new Error("Encryption block is invalid.");return a.getBytes()}function a(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=l.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function o(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function s(e){return"undefined"!=typeof window&&"object"==typeof window.crypto&&"object"==typeof window.crypto.subtle&&"function"==typeof window.crypto.subtle[e]}function u(e){return"undefined"!=typeof window&&"object"==typeof window.msCrypto&&"object"==typeof window.msCrypto.subtle&&"function"==typeof window.msCrypto.subtle[e]}function c(e){for(var t=l.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r}var l=r(0);if(r(3),r(12),r(6),r(26),r(27),r(2),r(1),void 0===f)var f=l.jsbn.BigInteger;var p=l.asn1;l.pki=l.pki||{},e.exports=l.pki.rsa=l.rsa=l.rsa||{};var h=l.pki,d=[6,4,2,4,2,4,6,2],y={name:"PrivateKeyInfo",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:p.Class.UNIVERSAL,type:p.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:p.Class.UNIVERSAL,type:p.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},g={name:"RSAPrivateKey",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},v={name:"RSAPublicKey",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},m=l.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:p.Class.UNIVERSAL,type:p.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:p.Class.UNIVERSAL,type:p.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},b=function(e){var t;if(!(e.algorithm in h.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=h.oids[e.algorithm];var n=p.oidToDer(t).getBytes(),i=p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[]),a=p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[]);a.value.push(p.create(p.Class.UNIVERSAL,p.Type.OID,!1,n)),a.value.push(p.create(p.Class.UNIVERSAL,p.Type.NULL,!1,""));var o=p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(a),i.value.push(o),p.toDer(i).getBytes()},C=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);var n;t.dP||(t.dP=t.d.mod(t.p.subtract(f.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(f.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{n=new f(l.util.bytesToHex(l.random.getBytes(t.n.bitLength()/8)),16)}while(n.compareTo(t.n)>=0||!n.gcd(t.n).equals(f.ONE));for(var i=(e=e.multiply(n.modPow(t.e,t.n)).mod(t.n)).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)};h.rsa.encrypt=function(e,t,r){var i,a=r,o=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(a=2===r,i=n(e,t,r)):(i=l.util.createBuffer()).putBytes(e);for(var s=new f(i.toHex(),16),u=C(s,t,a),c=u.toString(16),p=l.util.createBuffer(),h=o-Math.ceil(c.length/2);h>0;)p.putByte(0),--h;return p.putBytes(l.util.hexToBytes(c)),p.getBytes()},h.rsa.decrypt=function(e,t,r,n){var a=Math.ceil(t.n.bitLength()/8);if(e.length!==a){var o=new Error("Encrypted message length is invalid.");throw o.length=e.length,o.expected=a,o}var s=new f(l.util.createBuffer(e).toHex(),16);if(s.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=C(s,t,r),c=u.toString(16),p=l.util.createBuffer(),h=a-Math.ceil(c.length/2);h>0;)p.putByte(0),--h;return p.putBytes(l.util.hexToBytes(c)),!1!==n?i(p.getBytes(),t,r):p.getBytes()},h.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var n,i=(r=r||{}).prng||l.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 f(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(n.eInt),n},h.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new f(null);r.fromInt(30);for(var n,i=0,a=function(e,t){return e|t},s=+new Date,u=0;null===e.keys&&(t<=0||u<t);){if(0===e.state){var c=null===e.p?e.pBits:e.qBits,l=c-1;0===e.pqState?(e.num=new f(c,e.rng),e.num.testBit(l)||e.num.bitwiseTo(f.ONE.shiftLeft(l),a,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),i=0,++e.pqState):1===e.pqState?e.num.bitLength()>c?e.pqState=0:e.num.isProbablePrime(o(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(d[i++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(f.ONE).gcd(e.e).compareTo(f.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(f.ONE),e.q1=e.q.subtract(f.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(f.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 p=e.e.modInverse(e.phi);e.keys={privateKey:h.rsa.setPrivateKey(e.n,e.e,p,e.p,e.q,p.mod(e.p1),p.mod(e.q1),e.q.modInverse(e.p)),publicKey:h.rsa.setPublicKey(e.n,e.e)}}n=+new Date,u+=n-s,s=n}return null!==e.keys},h.rsa.generateKeyPair=function(e,t,r,n){if(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),!l.options.usePureJavaScript&&n&&e>=256&&e<=16384&&(65537===t||3===t)){if(s("generateKey")&&s("exportKey"))return window.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:c(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return window.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){n(e)}).then(function(e){if(e){var t=h.privateKeyFromAsn1(p.fromDer(l.util.createBuffer(e)));n(null,{privateKey:t,publicKey:h.setRsaPublicKey(t.n,t.e)})}});if(u("generateKey")&&u("exportKey")){var i=window.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:c(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return i.oncomplete=function(e){var t=e.target.result,r=window.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=h.privateKeyFromAsn1(p.fromDer(l.util.createBuffer(t)));n(null,{privateKey:r,publicKey:h.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){n(e)}},void(i.onerror=function(e){n(e)})}}var a=h.rsa.createKeyPairGenerationState(e,t,r);if(!n)return h.rsa.stepKeyPairGenerationState(a,0),a.keys;!function(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){l.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(f.ONE).gcd(e.e).compareTo(f.ONE))return e.p=null,void n();if(0!==e.q.subtract(f.ONE).gcd(e.e).compareTo(f.ONE))return e.q=null,void i(e.qBits,a);if(e.p1=e.p.subtract(f.ONE),e.q1=e.q.subtract(f.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(f.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 u=e.e.modInverse(e.phi);e.keys={privateKey:h.rsa.setPrivateKey(e.n,e.e,u,e.p,e.q,u.mod(e.p1),u.mod(e.q1),e.q.modInverse(e.p)),publicKey:h.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"function"==typeof t&&(r=t,t={});var o={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(o.prng=t.prng),n()}(a,r,n)},h.setRsaPublicKey=h.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,i){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,r){return n(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return l.pkcs1.encode_rsa_oaep(t,e,i)}};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,r,!0);return h.rsa.encrypt(a,r,!0)},verify:function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=i(t,r,!0),e===p.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return t=i(t,r,!0),e===t}});var a=h.rsa.decrypt(t,r,!0,!1);return n.verify(e,a,r.n.bitLength())}};return r},h.setRsaPrivateKey=h.rsa.setPrivateKey=function(e,t,r,n,a,o,s,u){var c={n:e,e:t,d:r,p:n,q:a,dP:o,dQ:s,qInv:u,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var n=h.rsa.decrypt(e,c,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:i};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return l.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(n,c,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:b},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,c.n.bitLength());return h.rsa.encrypt(n,c,r)}};return c},h.wrapRsaPrivateKey=function(e){return p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,p.integerToDer(0).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(h.oids.rsaEncryption).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.NULL,!1,"")]),p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,p.toDer(e).getBytes())])},h.privateKeyFromAsn1=function(e){var t,r,n,i,a,o,s,u,c={},d=[];if(p.validate(e,y,c,d)&&(e=p.fromDer(l.util.createBuffer(c.privateKey))),c={},d=[],!p.validate(e,g,c,d)){var v=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw v.errors=d,v}return t=l.util.createBuffer(c.privateKeyModulus).toHex(),r=l.util.createBuffer(c.privateKeyPublicExponent).toHex(),n=l.util.createBuffer(c.privateKeyPrivateExponent).toHex(),i=l.util.createBuffer(c.privateKeyPrime1).toHex(),a=l.util.createBuffer(c.privateKeyPrime2).toHex(),o=l.util.createBuffer(c.privateKeyExponent1).toHex(),s=l.util.createBuffer(c.privateKeyExponent2).toHex(),u=l.util.createBuffer(c.privateKeyCoefficient).toHex(),h.setRsaPrivateKey(new f(t,16),new f(r,16),new f(n,16),new f(i,16),new f(a,16),new f(o,16),new f(s,16),new f(u,16))},h.privateKeyToAsn1=h.privateKeyToRSAPrivateKey=function(e){return p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,p.integerToDer(0).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,a(e.n)),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,a(e.e)),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,a(e.d)),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,a(e.p)),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,a(e.q)),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,a(e.dP)),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,a(e.dQ)),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,a(e.qInv))])},h.publicKeyFromAsn1=function(e){var t={},r=[];if(p.validate(e,m,t,r)){var n=p.derToOid(t.publicKeyOid);if(n!==h.oids.rsaEncryption){var i=new Error("Cannot read public key. Unknown OID.");throw i.oid=n,i}e=t.rsaPublicKey}if(r=[],!p.validate(e,v,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=l.util.createBuffer(t.publicKeyModulus).toHex(),o=l.util.createBuffer(t.publicKeyExponent).toHex();return h.setRsaPublicKey(new f(a,16),new f(o,16))},h.publicKeyToAsn1=h.publicKeyToSubjectPublicKeyInfo=function(e){return p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(h.oids.rsaEncryption).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.NULL,!1,"")]),p.create(p.Class.UNIVERSAL,p.Type.BITSTRING,!1,[h.publicKeyToRSAPublicKey(e)])])},h.publicKeyToRSAPublicKey=function(e){return p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,a(e.n)),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,a(e.e))])}},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function i(){return new n(null)}function a(e,t,r,n,i,a){for(var o=16383&t,s=t>>14;--a>=0;){var u=16383&this.data[e],c=this.data[e++]>>14,l=s*u+c*o;u=o*u+((16383&l)<<14)+r.data[n]+i,i=(u>>28)+(l>>14)+s*c,r.data[n++]=268435455&u}return i}function o(e){return B.charAt(e)}function s(e,t){var r=w[e.charCodeAt(t)];return null==r?-1:r}function u(e){var t=i();return t.fromInt(e),t}function c(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 l(e){this.m=e}function f(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 p(e,t){return e&t}function h(e,t){return e|t}function d(e,t){return e^t}function y(e,t){return e&~t}function g(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 v(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function m(){}function b(e){return e}function C(e){this.r2=i(),this.q3=i(),n.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}var E,S=r(0);e.exports=S.jsbn=S.jsbn||{},S.jsbn.BigInteger=n,"undefined"==typeof navigator?(n.prototype.am=a,E=28):"Microsoft Internet Explorer"==navigator.appName?(n.prototype.am=function(e,t,r,n,i,a){for(var o=32767&t,s=t>>15;--a>=0;){var u=32767&this.data[e],c=this.data[e++]>>15,l=s*u+c*o;u=o*u+((32767&l)<<15)+r.data[n]+(1073741823&i),i=(u>>>30)+(l>>>15)+s*c+(i>>>30),r.data[n++]=1073741823&u}return i},E=30):"Netscape"!=navigator.appName?(n.prototype.am=function(e,t,r,n,i,a){for(;--a>=0;){var o=t*this.data[e++]+r.data[n]+i;i=Math.floor(o/67108864),r.data[n++]=67108863&o}return i},E=26):(n.prototype.am=a,E=28),n.prototype.DB=E,n.prototype.DM=(1<<E)-1,n.prototype.DV=1<<E,n.prototype.FV=Math.pow(2,52),n.prototype.F1=52-E,n.prototype.F2=2*E-52;var T,A,B="0123456789abcdefghijklmnopqrstuvwxyz",w=new Array;for(T="0".charCodeAt(0),A=0;A<=9;++A)w[T++]=A;for(T="a".charCodeAt(0),A=10;A<36;++A)w[T++]=A;for(T="A".charCodeAt(0),A=10;A<36;++A)w[T++]=A;l.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},l.prototype.revert=function(e){return e},l.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},l.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},l.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},f.prototype.convert=function(e){var t=i();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(n.ZERO)>0&&this.m.subTo(t,t),t},f.prototype.revert=function(e){var t=i();return e.copyTo(t),this.reduce(t),t},f.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},f.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},f.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},n.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},n.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},n.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var i=e.length,a=!1,o=0;--i>=0;){var u=8==r?255&e[i]:s(e,i);u<0?"-"==e.charAt(i)&&(a=!0):(a=!1,0==o?this.data[this.t++]=u:o+r>this.DB?(this.data[this.t-1]|=(u&(1<<this.DB-o)-1)<<o,this.data[this.t++]=u>>this.DB-o):this.data[this.t-1]|=u<<o,(o+=r)>=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),a&&n.ZERO.subTo(this,this)},n.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},n.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},n.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},n.prototype.lShiftTo=function(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.data[r+o+1]=this.data[r]>>i|s,s=(this.data[r]&a)<<n;for(r=o-1;r>=0;--r)t.data[r]=0;t.data[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()},n.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,a=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var o=r+1;o<this.t;++o)t.data[o-r-1]|=(this.data[o]&a)<<i,t.data[o-r]=this.data[o]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&a)<<i),t.t=this.t-r,t.clamp()}},n.prototype.subTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},n.prototype.multiplyTo=function(e,t){var r=this.abs(),i=e.abs(),a=r.t;for(t.t=a+i.t;--a>=0;)t.data[a]=0;for(a=0;a<i.t;++a)t.data[a+r.t]=r.am(0,i.data[a],t,a,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&n.ZERO.subTo(t,t)},n.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},n.prototype.divRemTo=function(e,t,r){var a=e.abs();if(!(a.t<=0)){var o=this.abs();if(o.t<a.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=i());var s=i(),u=this.s,l=e.s,f=this.DB-c(a.data[a.t-1]);f>0?(a.lShiftTo(f,s),o.lShiftTo(f,r)):(a.copyTo(s),o.copyTo(r));var p=s.t,h=s.data[p-1];if(0!=h){var d=h*(1<<this.F1)+(p>1?s.data[p-2]>>this.F2:0),y=this.FV/d,g=(1<<this.F1)/d,v=1<<this.F2,m=r.t,b=m-p,C=null==t?i():t;for(s.dlShiftTo(b,C),r.compareTo(C)>=0&&(r.data[r.t++]=1,r.subTo(C,r)),n.ONE.dlShiftTo(p,C),C.subTo(s,s);s.t<p;)s.data[s.t++]=0;for(;--b>=0;){var E=r.data[--m]==h?this.DM:Math.floor(r.data[m]*y+(r.data[m-1]+v)*g);if((r.data[m]+=s.am(0,E,r,b,0,p))<E)for(s.dlShiftTo(b,C),r.subTo(C,r);r.data[m]<--E;)r.subTo(C,r)}null!=t&&(r.drShiftTo(p,t),u!=l&&n.ZERO.subTo(t,t)),r.t=p,r.clamp(),f>0&&r.rShiftTo(f,r),u<0&&n.ZERO.subTo(r,r)}}},n.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},n.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},n.prototype.exp=function(e,t){if(e>4294967295||e<1)return n.ONE;var r=i(),a=i(),o=t.convert(this),s=c(e)-1;for(o.copyTo(r);--s>=0;)if(t.sqrTo(r,a),(e&1<<s)>0)t.mulTo(a,o,r);else{var u=r;r=a,a=u}return t.revert(r)},n.prototype.toString=function(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="",s=this.t,u=this.DB-s*this.DB%t;if(s-- >0)for(u<this.DB&&(r=this.data[s]>>u)>0&&(i=!0,a=o(r));s>=0;)u<t?(r=(this.data[s]&(1<<u)-1)<<t-u,r|=this.data[--s]>>(u+=this.DB-t)):(r=this.data[s]>>(u-=t)&n,u<=0&&(u+=this.DB,--s)),r>0&&(i=!0),i&&(a+=o(r));return i?a:"0"},n.prototype.negate=function(){var e=i();return n.ZERO.subTo(this,e),e},n.prototype.abs=function(){return this.s<0?this.negate():this},n.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},n.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+c(this.data[this.t-1]^this.s&this.DM)},n.prototype.mod=function(e){var t=i();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t},n.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new l(t):new f(t),this.exp(e,r)},n.ZERO=u(0),n.ONE=u(1),m.prototype.convert=b,m.prototype.revert=b,m.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},m.prototype.sqrTo=function(e,t){e.squareTo(t)},C.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=i();return e.copyTo(t),this.reduce(t),t},C.prototype.revert=function(e){return e},C.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},C.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},C.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var I=[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],_=(1<<26)/I[I.length-1];n.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},n.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=u(r),a=i(),o=i(),s="";for(this.divRemTo(n,a,o);a.signum()>0;)s=(r+o.intValue()).toString(e).substr(1)+s,a.divRemTo(n,a,o);return o.intValue().toString(e)+s},n.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),i=Math.pow(t,r),a=!1,o=0,u=0,c=0;c<e.length;++c){var l=s(e,c);l<0?"-"==e.charAt(c)&&0==this.signum()&&(a=!0):(u=t*u+l,++o>=r&&(this.dMultiply(i),this.dAddOffset(u,0),o=0,u=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(u,0)),a&&n.ZERO.subTo(this,this)},n.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(n.ONE.shiftLeft(e-1),h,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(n.ONE.shiftLeft(e-1),this);else{var i=new Array,a=7&e;i.length=1+(e>>3),t.nextBytes(i),a>0?i[0]&=(1<<a)-1:i[0]=0,this.fromString(i,256)}},n.prototype.bitwiseTo=function(e,t,r){var n,i,a=Math.min(e.t,this.t);for(n=0;n<a;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(i=e.s&this.DM,n=a;n<this.t;++n)r.data[n]=t(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=a;n<e.t;++n)r.data[n]=t(i,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},n.prototype.changeBit=function(e,t){var r=n.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},n.prototype.addTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},n.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},n.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},n.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i<n;++i)r.data[i+this.t]=this.am(0,e.data[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e.data[i],r,i,0,t-i);r.clamp()},n.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},n.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},n.prototype.millerRabin=function(e){var t=this.subtract(n.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var i,a=t.shiftRight(r),o={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},s=0;s<e;++s){do{i=new n(this.bitLength(),o)}while(i.compareTo(n.ONE)<=0||i.compareTo(t)>=0);var u=i.modPow(a,this);if(0!=u.compareTo(n.ONE)&&0!=u.compareTo(t)){for(var c=1;c++<r&&0!=u.compareTo(t);)if(0==(u=u.modPowInt(2,this)).compareTo(n.ONE))return!1;if(0!=u.compareTo(t))return!1}}return!0},n.prototype.clone=function(){var e=i();return this.copyTo(e),e},n.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},n.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},n.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},n.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},n.prototype.toByteArray=function(){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.data[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(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},n.prototype.equals=function(e){return 0==this.compareTo(e)},n.prototype.min=function(e){return this.compareTo(e)<0?this:e},n.prototype.max=function(e){return this.compareTo(e)>0?this:e},n.prototype.and=function(e){var t=i();return this.bitwiseTo(e,p,t),t},n.prototype.or=function(e){var t=i();return this.bitwiseTo(e,h,t),t},n.prototype.xor=function(e){var t=i();return this.bitwiseTo(e,d,t),t},n.prototype.andNot=function(e){var t=i();return this.bitwiseTo(e,y,t),t},n.prototype.not=function(){for(var e=i(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},n.prototype.shiftLeft=function(e){var t=i();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},n.prototype.shiftRight=function(e){var t=i();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},n.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+g(this.data[e]);return this.s<0?this.t*this.DB:-1},n.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=v(this.data[r]^t);return e},n.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)},n.prototype.setBit=function(e){return this.changeBit(e,h)},n.prototype.clearBit=function(e){return this.changeBit(e,y)},n.prototype.flipBit=function(e){return this.changeBit(e,d)},n.prototype.add=function(e){var t=i();return this.addTo(e,t),t},n.prototype.subtract=function(e){var t=i();return this.subTo(e,t),t},n.prototype.multiply=function(e){var t=i();return this.multiplyTo(e,t),t},n.prototype.divide=function(e){var t=i();return this.divRemTo(e,t,null),t},n.prototype.remainder=function(e){var t=i();return this.divRemTo(e,null,t),t},n.prototype.divideAndRemainder=function(e){var t=i(),r=i();return this.divRemTo(e,t,r),new Array(t,r)},n.prototype.modPow=function(e,t){var r,n,a=e.bitLength(),o=u(1);if(a<=0)return o;r=a<18?1:a<48?3:a<144?4:a<768?5:6,n=a<8?new l(t):t.isEven()?new C(t):new f(t);var s=new Array,p=3,h=r-1,d=(1<<r)-1;if(s[1]=n.convert(this),r>1){var y=i();for(n.sqrTo(s[1],y);p<=d;)s[p]=i(),n.mulTo(y,s[p-2],s[p]),p+=2}var g,v,m=e.t-1,b=!0,E=i();for(a=c(e.data[m])-1;m>=0;){for(a>=h?g=e.data[m]>>a-h&d:(g=(e.data[m]&(1<<a+1)-1)<<h-a,m>0&&(g|=e.data[m-1]>>this.DB+a-h)),p=r;0==(1&g);)g>>=1,--p;if((a-=p)<0&&(a+=this.DB,--m),b)s[g].copyTo(o),b=!1;else{for(;p>1;)n.sqrTo(o,E),n.sqrTo(E,o),p-=2;p>0?n.sqrTo(o,E):(v=o,o=E,E=v),n.mulTo(E,s[g],o)}for(;m>=0&&0==(e.data[m]&1<<a);)n.sqrTo(o,E),v=o,o=E,E=v,--a<0&&(a=this.DB-1,--m)}return n.revert(o)},n.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return n.ZERO;for(var r=e.clone(),i=this.clone(),a=u(1),o=u(0),s=u(0),c=u(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(a.isEven()&&o.isEven()||(a.addTo(this,a),o.subTo(e,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),t?(s.isEven()&&c.isEven()||(s.addTo(this,s),c.subTo(e,c)),s.rShiftTo(1,s)):c.isEven()||c.subTo(e,c),c.rShiftTo(1,c);r.compareTo(i)>=0?(r.subTo(i,r),t&&a.subTo(s,a),o.subTo(c,o)):(i.subTo(r,i),t&&s.subTo(a,s),c.subTo(o,c))}return 0!=i.compareTo(n.ONE)?n.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},n.prototype.pow=function(e){return this.exp(e,new m)},n.prototype.gcd=function(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(a<0)return t;for(i<a&&(a=i),a>0&&(t.rShiftTo(a,t),r.rShiftTo(a,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&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},n.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=I[I.length-1]){for(t=0;t<I.length;++t)if(r.data[0]==I[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<I.length;){for(var n=I[t],i=t+1;i<I.length&&n<_;)n*=I[i++];for(n=r.modInt(n);t<i;)if(n%I[t++]==0)return!1}return r.millerRabin(e)}},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in n.cipher.algorithms?n.cipher.algorithms[e]:null};var i=n.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)};i.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},i.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"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)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(e,t,r){for(var n,i,a,o,l,f,p,h=r.length();h>=64;){for(i=e.h0,a=e.h1,o=e.h2,l=e.h3,p=0;p<16;++p)t[p]=r.getInt32Le(),n=i+(l^a&(o^l))+c[p]+t[p],f=u[p],i=l,l=o,o=a,a+=n<<f|n>>>32-f;for(;p<32;++p)n=i+(o^l&(a^o))+c[p]+t[s[p]],f=u[p],i=l,l=o,o=a,a+=n<<f|n>>>32-f;for(;p<48;++p)n=i+(a^o^l)+c[p]+t[s[p]],f=u[p],i=l,l=o,o=a,a+=n<<f|n>>>32-f;for(;p<64;++p)n=i+(o^(a|~l))+c[p]+t[s[p]],f=u[p],i=l,l=o,o=a,a+=n<<f|n>>>32-f;e.h0=e.h0+i|0,e.h1=e.h1+a|0,e.h2=e.h2+o|0,e.h3=e.h3+l|0,h-=64}}var i=r(0);r(4),r(1);var a=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=a,a.create=function(){l||function(){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;e<64;++e)c[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));l=!0}();var e=null,t=i.util.createBuffer(),r=new Array(16),a={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){a.messageLength=0,a.fullMessageLength=a.messageLength64=[];for(var r=a.messageLengthSize/4,n=0;n<r;++n)a.fullMessageLength.push(0);return t=i.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},a}};return a.start(),a.update=function(o,s){"utf8"===s&&(o=i.util.encodeUtf8(o));var u=o.length;a.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var c=a.fullMessageLength.length-1;c>=0;--c)a.fullMessageLength[c]+=u[1],u[1]=u[0]+(a.fullMessageLength[c]/4294967296>>>0),a.fullMessageLength[c]=a.fullMessageLength[c]>>>0,u[0]=u[1]/4294967296>>>0;return t.putBytes(o),n(e,r,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var s=i.util.createBuffer();s.putBytes(t.bytes());var u=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,c=u&a.blockLength-1;s.putBytes(o.substr(0,a.blockLength-c));for(var l,f=0,p=a.fullMessageLength.length-1;p>=0;--p)l=8*a.fullMessageLength[p]+f,f=l/4294967296>>>0,s.putInt32Le(l>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};n(h,r,s);var d=i.util.createBuffer();return d.putInt32Le(h.h0),d.putInt32Le(h.h1),d.putInt32Le(h.h2),d.putInt32Le(h.h3),d},a};var o=null,s=null,u=null,c=null,l=!1},function(e,r,n){var i=n(0);n(8),n(4),n(1);var a,o=i.pkcs5=i.pkcs5||{};i.util.isNodejs&&!i.options.usePureJavaScript&&(a=n(22)),e.exports=i.pbkdf2=o.pbkdf2=function(e,r,n,o,s,u){function c(){if(C>h)return u(null,b);y.start(null,null),y.update(r),y.update(i.util.int32ToBytes(C)),g=m=y.digest().getBytes(),E=2,l()}function l(){if(E<=n)return y.start(null,null),y.update(m),v=y.digest().getBytes(),g=i.util.xorBytes(g,v,f),m=v,++E,i.util.setImmediate(l);b+=C<h?g:g.substr(0,d),++C,c()}if("function"==typeof s&&(u=s,s=null),i.util.isNodejs&&!i.options.usePureJavaScript&&a.pbkdf2&&(null===s||"object"!=typeof s)&&(a.pbkdf2Sync.length>4||!s||"sha1"===s))return"string"!=typeof s&&(s="sha1"),e=new t(e,"binary"),r=new t(r,"binary"),u?4===a.pbkdf2Sync.length?a.pbkdf2(e,r,n,o,function(e,t){if(e)return u(e);u(null,t.toString("binary"))}):a.pbkdf2(e,r,n,o,s,function(e,t){if(e)return u(e);u(null,t.toString("binary"))}):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,r,n,o).toString("binary"):a.pbkdf2Sync(e,r,n,o,s).toString("binary");if(null!=s||(s="sha1"),"string"==typeof s){if(!(s in i.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=i.md[s].create()}var f=s.digestLength;if(o>4294967295*f){var p=new Error("Derived key is too long.");if(u)return u(p);throw p}var h=Math.ceil(o/f),d=o-(h-1)*f,y=i.hmac.create();y.start(s,e);var g,v,m,b="";if(!u){for(var C=1;C<=h;++C){y.start(null,null),y.update(r),y.update(i.util.int32ToBytes(C)),g=m=y.digest().getBytes();for(var E=2;E<=n;++E)y.start(null,null),y.update(m),v=y.digest().getBytes(),g=i.util.xorBytes(g,v,f),m=v;b+=C<h?g:g.substr(0,d)}return b}var C=1;c()}},function(e,t,r){function n(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 i(e){for(var t,r,n=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),i=e.attributes,a=0;a<i.length;++a){var o=(t=i[a]).value,s=l.Type.PRINTABLESTRING;"valueTagClass"in t&&(s=t.valueTagClass)===l.Type.UTF8&&(o=c.util.encodeUtf8(o)),r=l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(t.type).getBytes()),l.create(l.Class.UNIVERSAL,s,!1,o)])]),n.value.push(r)}return n}function a(e){for(var t,r=0;r<e.length;++r){if(void 0===(t=e[r]).name&&(t.type&&t.type in f.oids?t.name=f.oids[t.type]:t.shortName&&t.shortName in h&&(t.name=f.oids[h[t.shortName]])),void 0===t.type){if(!(t.name&&t.name in f.oids)){var n=new Error("Attribute type not specified.");throw n.attribute=t,n}t.type=f.oids[t.name]}if(void 0===t.shortName&&t.name&&t.name in h&&(t.shortName=h[t.name]),t.type===p.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=l.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var i=0;i<t.extensions.length;++i)t.value.push(f.certificateExtensionToAsn1(o(t.extensions[i])))}if(void 0===t.value){var n=new Error("Attribute value not specified.");throw n.attribute=t,n}}}function o(e,t){if(t=t||{},void 0===e.name&&e.id&&e.id in f.oids&&(e.name=f.oids[e.id]),void 0===e.id){if(!(e.name&&e.name in f.oids)){var r=new Error("Extension ID not specified.");throw r.extension=e,r}e.id=f.oids[e.name]}if(void 0!==e.value)return e;if("keyUsage"===e.name){var n=0,a=0,o=0;e.digitalSignature&&(a|=128,n=7),e.nonRepudiation&&(a|=64,n=6),e.keyEncipherment&&(a|=32,n=5),e.dataEncipherment&&(a|=16,n=4),e.keyAgreement&&(a|=8,n=3),e.keyCertSign&&(a|=4,n=2),e.cRLSign&&(a|=2,n=1),e.encipherOnly&&(a|=1,n=0),e.decipherOnly&&(o|=128,n=7);var s=String.fromCharCode(n);0!==o?s+=String.fromCharCode(a)+String.fromCharCode(o):0!==a&&(s+=String.fromCharCode(a)),e.value=l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,s)}else if("basicConstraints"===e.name)e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(l.create(l.Class.UNIVERSAL,l.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var u=e.value.value;for(var h in e)!0===e[h]&&(h in p?u.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(p[h]).getBytes())):-1!==h.indexOf(".")&&u.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(h).getBytes())))}else if("nsCertType"===e.name){var n=0,a=0;e.client&&(a|=128,n=7),e.server&&(a|=64,n=6),e.email&&(a|=32,n=5),e.objsign&&(a|=16,n=4),e.reserved&&(a|=8,n=3),e.sslCA&&(a|=4,n=2),e.emailCA&&(a|=2,n=1),e.objCA&&(a|=1,n=0);var s=String.fromCharCode(n);0!==a&&(s+=String.fromCharCode(a)),e.value=l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,s)}else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var d=0;d<e.altNames.length;++d){var s=(b=e.altNames[d]).value;if(7===b.type&&b.ip){if(null===(s=c.util.bytesFromIP(b.ip))){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=e,r}}else 8===b.type&&(s=b.oid?l.oidToDer(l.oidToDer(b.oid)):l.oidToDer(s));e.value.value.push(l.create(l.Class.CONTEXT_SPECIFIC,b.type,!1,s))}}else if("subjectKeyIdentifier"===e.name&&t.cert){var y=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=y.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,y.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var u=e.value.value;if(e.keyIdentifier){var g=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;u.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,g))}if(e.authorityCertIssuer){var v=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[i(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];u.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,v))}if(e.serialNumber){var m=c.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);u.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,m))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var b,u=e.value.value,C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),E=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),d=0;d<e.altNames.length;++d){var s=(b=e.altNames[d]).value;if(7===b.type&&b.ip){if(null===(s=c.util.bytesFromIP(b.ip))){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=e,r}}else 8===b.type&&(s=b.oid?l.oidToDer(l.oidToDer(b.oid)):l.oidToDer(s));E.value.push(l.create(l.Class.CONTEXT_SPECIFIC,b.type,!1,s))}C.value.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[E])),u.push(C)}if(void 0===e.value){var r=new Error("Extension value not specified.");throw r.extension=e,r}return e}function s(e,t){switch(e){case p["RSASSA-PSS"]:var r=[];return void 0!==t.hash.algorithmOid&&r.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(t.hash.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")])])),void 0!==t.mgf.algorithmOid&&r.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(t.mgf.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(t.mgf.hash.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")])])])),void 0!==t.saltLength&&r.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(t.saltLength).getBytes())])),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,r);default:return l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")}}function u(e){var t=l.create(l.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=l.Type.UTF8;"valueTagClass"in i&&(o=i.valueTagClass),o===l.Type.UTF8&&(a=c.util.encodeUtf8(a));var s=!1;"valueConstructed"in i&&(s=i.valueConstructed);var u=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(i.type).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,o,s,a)])]);t.value.push(u)}return t}var c=r(0);r(5),r(3),r(10),r(4),r(38),r(6),r(7),r(17),r(11),r(1);var l=c.asn1,f=e.exports=c.pki=c.pki||{},p=f.oids,h={};h.CN=p.commonName,h.commonName="CN",h.C=p.countryName,h.countryName="C",h.L=p.localityName,h.localityName="L",h.ST=p.stateOrProvinceName,h.stateOrProvinceName="ST",h.O=p.organizationName,h.organizationName="O",h.OU=p.organizationalUnitName,h.organizationalUnitName="OU",h.E=p.emailAddress,h.emailAddress="E";var d=c.pki.rsa.publicKeyValidator,y={name:"Certificate",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:l.Class.UNIVERSAL,type:l.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:l.Class.UNIVERSAL,type:l.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:l.Class.UNIVERSAL,type:l.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:l.Class.UNIVERSAL,type:l.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},d,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:l.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:l.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:l.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},g={name:"rsapss",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL,type:l.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:l.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL,type:l.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:l.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:l.Class.UNIVERSAL,type:l.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:l.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:l.Class.UNIVERSAL,type:l.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},v={name:"CertificationRequestInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},d,{name:"CertificationRequestInfo.attributes",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:l.Class.UNIVERSAL,type:l.Type.SET,constructed:!0}]}]}]},m={name:"CertificationRequest",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[v,{name:"CertificationRequest.signatureAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};f.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=l.derToOid(n.value[0].value),i.value=n.value[1].value,i.valueTagClass=n.value[1].type,i.type in p&&(i.name=p[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},f.CRIAttributesAsArray=function(e){for(var t=[],r=0;r<e.length;++r)for(var n=e[r],i=l.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 p&&(s.name=p[s.type],s.name in h&&(s.shortName=h[s.name])),s.type===p.extensionRequest){s.extensions=[];for(var u=0;u<s.value.length;++u)s.extensions.push(f.certificateExtensionFromAsn1(s.value[u]))}t.push(s)}return t};var b=function(e,t,r){var n={};if(e!==p["RSASSA-PSS"])return n;r&&(n={hash:{algorithmOid:p.sha1},mgf:{algorithmOid:p.mgf1,hash:{algorithmOid:p.sha1}},saltLength:20});var i={},a=[];if(!l.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=l.derToOid(i.hashOid)),void 0!==i.maskGenOid&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=l.derToOid(i.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=l.derToOid(i.maskGenHashOid)),void 0!==i.saltLength&&(n.saltLength=i.saltLength.charCodeAt(0)),n};f.certificateFromPem=function(e,t,r){var n=c.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=l.fromDer(n.body,r);return f.certificateFromAsn1(a,t)},f.certificateToPem=function(e,t){var r={type:"CERTIFICATE",body:l.toDer(f.certificateToAsn1(e)).getBytes()};return c.pem.encode(r,{maxline:t})},f.publicKeyFromPem=function(e){var t=c.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=l.fromDer(t.body);return f.publicKeyFromAsn1(n)},f.publicKeyToPem=function(e,t){var r={type:"PUBLIC KEY",body:l.toDer(f.publicKeyToAsn1(e)).getBytes()};return c.pem.encode(r,{maxline:t})},f.publicKeyToRSAPublicKeyPem=function(e,t){var r={type:"RSA PUBLIC KEY",body:l.toDer(f.publicKeyToRSAPublicKey(e)).getBytes()};return c.pem.encode(r,{maxline:t})},f.getPublicKeyFingerprint=function(e,t){var r,n=(t=t||{}).md||c.md.sha1.create(),i=t.type||"RSAPublicKey";switch(i){case"RSAPublicKey":r=l.toDer(f.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":r=l.toDer(f.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},f.certificationRequestFromPem=function(e,t,r){var n=c.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=l.fromDer(n.body,r);return f.certificationRequestFromAsn1(a,t)},f.certificationRequestToPem=function(e,t){var r={type:"CERTIFICATE REQUEST",body:l.toDer(f.certificationRequestToAsn1(e)).getBytes()};return c.pem.encode(r,{maxline:t})},f.createCertificate=function(){var e={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return n(e.issuer,t)},e.issuer.addField=function(t){a([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return n(e.subject,t)},e.subject.addField=function(t){a([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){a(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){a(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)o(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||c.md.sha1.create();var n=p[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=f.getTBSCertificate(e);var a=l.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 p)switch(p[t.signatureOid]){case"sha1WithRSAEncryption":o=c.md.sha1.create();break;case"md5WithRSAEncryption":o=c.md.md5.create();break;case"sha256WithRSAEncryption":o=c.md.sha256.create();break;case"sha384WithRSAEncryption":o=c.md.sha384.create();break;case"sha512WithRSAEncryption":o=c.md.sha512.create();break;case"RSASSA-PSS":o=c.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 s=t.tbsCertificate||f.getTBSCertificate(t),u=l.toDer(s);o.update(u.getBytes())}if(null!==o){var h;switch(t.signatureOid){case p.sha1WithRSAEncryption:h=void 0;break;case p["RSASSA-PSS"]:var d,y;if(void 0===(d=p[t.signatureParameters.mgf.hash.algorithmOid])||void 0===c.md[d]){var a=new Error("Unsupported MGF hash function.");throw a.oid=t.signatureParameters.mgf.hash.algorithmOid,a.name=d,a}if(void 0===(y=p[t.signatureParameters.mgf.algorithmOid])||void 0===c.mgf[y]){var a=new Error("Unsupported MGF function.");throw a.oid=t.signatureParameters.mgf.algorithmOid,a.name=y,a}if(y=c.mgf[y].create(c.md[d].create()),void 0===(d=p[t.signatureParameters.hash.algorithmOid])||void 0===c.md[d])throw{message:"Unsupported RSASSA-PSS hash function.",oid:t.signatureParameters.hash.algorithmOid,name:d};h=c.pss.create(c.md[d].create(),y,t.signatureParameters.saltLength)}r=e.publicKey.verify(o.digest().getBytes(),t.signature,h)}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 f.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=p.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var n=e.extensions[r];if(n.id===t){var i=e.generateSubjectKeyIdentifier().getBytes();return c.util.hexToBytes(n.subjectKeyIdentifier)===i}}return!1},e},f.certificateFromAsn1=function(e,t){var r={},i=[];if(!l.validate(e,y,r,i)){var o=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw o.errors=i,o}var s=l.derToOid(r.publicKeyOid);if(s!==f.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var u=f.createCertificate();u.version=r.certVersion?r.certVersion.charCodeAt(0):0;var h=c.util.createBuffer(r.certSerialNumber);u.serialNumber=h.toHex(),u.signatureOid=c.asn1.derToOid(r.certSignatureOid),u.signatureParameters=b(u.signatureOid,r.certSignatureParams,!0),u.siginfo.algorithmOid=c.asn1.derToOid(r.certinfoSignatureOid),u.siginfo.parameters=b(u.siginfo.algorithmOid,r.certinfoSignatureParams,!1),u.signature=r.certSignature;var d=[];if(void 0!==r.certValidity1UTCTime&&d.push(l.utcTimeToDate(r.certValidity1UTCTime)),void 0!==r.certValidity2GeneralizedTime&&d.push(l.generalizedTimeToDate(r.certValidity2GeneralizedTime)),void 0!==r.certValidity3UTCTime&&d.push(l.utcTimeToDate(r.certValidity3UTCTime)),void 0!==r.certValidity4GeneralizedTime&&d.push(l.generalizedTimeToDate(r.certValidity4GeneralizedTime)),d.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(d.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(u.validity.notBefore=d[0],u.validity.notAfter=d[1],u.tbsCertificate=r.tbsCertificate,t){if(u.md=null,u.signatureOid in p){var s=p[u.signatureOid];switch(s){case"sha1WithRSAEncryption":u.md=c.md.sha1.create();break;case"md5WithRSAEncryption":u.md=c.md.md5.create();break;case"sha256WithRSAEncryption":u.md=c.md.sha256.create();break;case"sha384WithRSAEncryption":u.md=c.md.sha384.create();break;case"sha512WithRSAEncryption":u.md=c.md.sha512.create();break;case"RSASSA-PSS":u.md=c.md.sha256.create()}}if(null===u.md){var o=new Error("Could not compute certificate digest. Unknown signature OID.");throw o.signatureOid=u.signatureOid,o}var g=l.toDer(u.tbsCertificate);u.md.update(g.getBytes())}var v=c.md.sha1.create();u.issuer.getField=function(e){return n(u.issuer,e)},u.issuer.addField=function(e){a([e]),u.issuer.attributes.push(e)},u.issuer.attributes=f.RDNAttributesAsArray(r.certIssuer,v),r.certIssuerUniqueId&&(u.issuer.uniqueId=r.certIssuerUniqueId),u.issuer.hash=v.digest().toHex();var m=c.md.sha1.create();return u.subject.getField=function(e){return n(u.subject,e)},u.subject.addField=function(e){a([e]),u.subject.attributes.push(e)},u.subject.attributes=f.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(u.subject.uniqueId=r.certSubjectUniqueId),u.subject.hash=m.digest().toHex(),r.certExtensions?u.extensions=f.certificateExtensionsFromAsn1(r.certExtensions):u.extensions=[],u.publicKey=f.publicKeyFromAsn1(r.subjectPublicKeyInfo),u},f.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(f.certificateExtensionFromAsn1(n.value[i]));return t},f.certificateExtensionFromAsn1=function(e){var t={};if(t.id=l.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===l.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 p)if(t.name=p[t.id],"keyUsage"===t.name){var r=l.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=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.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===l.Type.INTEGER?a=r.value[0].value:r.value.length>1&&(a=r.value[1].value),null!==a&&(t.pathLenConstraint=l.derToInteger(a))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),o=0;o<r.value.length;++o){var s=l.derToOid(r.value[o].value);s in p?t[p[s]]=!0:t[s]=!0}else if("nsCertType"===t.name){var r=l.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 u,r=l.fromDer(t.value),f=0;f<r.value.length;++f){var h={type:(u=r.value[f]).type,value:u.value};switch(t.altNames.push(h),u.type){case 1:case 2:case 6:break;case 7:h.ip=c.util.bytesToIP(u.value);break;case 8:h.oid=l.derToOid(u.value)}}}else if("subjectKeyIdentifier"===t.name){var r=l.fromDer(t.value);t.subjectKeyIdentifier=c.util.bytesToHex(r.value)}return t},f.certificationRequestFromAsn1=function(e,t){var r={},i=[];if(!l.validate(e,m,r,i)){var o=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw o.errors=i,o}var s=l.derToOid(r.publicKeyOid);if(s!==f.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var u=f.createCertificationRequest();if(u.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,u.signatureOid=c.asn1.derToOid(r.csrSignatureOid),u.signatureParameters=b(u.signatureOid,r.csrSignatureParams,!0),u.siginfo.algorithmOid=c.asn1.derToOid(r.csrSignatureOid),u.siginfo.parameters=b(u.siginfo.algorithmOid,r.csrSignatureParams,!1),u.signature=r.csrSignature,u.certificationRequestInfo=r.certificationRequestInfo,t){if(u.md=null,u.signatureOid in p){var s=p[u.signatureOid];switch(s){case"sha1WithRSAEncryption":u.md=c.md.sha1.create();break;case"md5WithRSAEncryption":u.md=c.md.md5.create();break;case"sha256WithRSAEncryption":u.md=c.md.sha256.create();break;case"sha384WithRSAEncryption":u.md=c.md.sha384.create();break;case"sha512WithRSAEncryption":u.md=c.md.sha512.create();break;case"RSASSA-PSS":u.md=c.md.sha256.create()}}if(null===u.md){var o=new Error("Could not compute certification request digest. Unknown signature OID.");throw o.signatureOid=u.signatureOid,o}var h=l.toDer(u.certificationRequestInfo);u.md.update(h.getBytes())}var d=c.md.sha1.create();return u.subject.getField=function(e){return n(u.subject,e)},u.subject.addField=function(e){a([e]),u.subject.attributes.push(e)},u.subject.attributes=f.RDNAttributesAsArray(r.certificationRequestInfoSubject,d),u.subject.hash=d.digest().toHex(),u.publicKey=f.publicKeyFromAsn1(r.subjectPublicKeyInfo),u.getAttribute=function(e){return n(u,e)},u.addAttribute=function(e){a([e]),u.attributes.push(e)},u.attributes=f.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),u},f.createCertificationRequest=function(){var e={version:0,signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return n(e.subject,t)},e.subject.addField=function(t){a([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return n(e,t)},e.addAttribute=function(t){a([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){a(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){a(t),e.attributes=t},e.sign=function(t,r){e.md=r||c.md.sha1.create();var n=p[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=f.getCertificationRequestInfo(e);var a=l.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 p)switch(p[e.signatureOid]){case"sha1WithRSAEncryption":r=c.md.sha1.create();break;case"md5WithRSAEncryption":r=c.md.md5.create();break;case"sha256WithRSAEncryption":r=c.md.sha256.create();break;case"sha384WithRSAEncryption":r=c.md.sha384.create();break;case"sha512WithRSAEncryption":r=c.md.sha512.create();break;case"RSASSA-PSS":r=c.md.sha256.create()}if(null===r){var n=new Error("Could not compute certification request digest. Unknown signature OID.");throw n.signatureOid=e.signatureOid,n}var i=e.certificationRequestInfo||f.getCertificationRequestInfo(e),a=l.toDer(i);r.update(a.getBytes())}if(null!==r){var o;switch(e.signatureOid){case p.sha1WithRSAEncryption:break;case p["RSASSA-PSS"]:var s,u;if(void 0===(s=p[e.signatureParameters.mgf.hash.algorithmOid])||void 0===c.md[s]){var n=new Error("Unsupported MGF hash function.");throw n.oid=e.signatureParameters.mgf.hash.algorithmOid,n.name=s,n}if(void 0===(u=p[e.signatureParameters.mgf.algorithmOid])||void 0===c.mgf[u]){var n=new Error("Unsupported MGF function.");throw n.oid=e.signatureParameters.mgf.algorithmOid,n.name=u,n}if(u=c.mgf[u].create(c.md[s].create()),void 0===(s=p[e.signatureParameters.hash.algorithmOid])||void 0===c.md[s]){var n=new Error("Unsupported RSASSA-PSS hash function.");throw n.oid=e.signatureParameters.hash.algorithmOid,n.name=s,n}o=c.pss.create(c.md[s].create(),u,e.signatureParameters.saltLength)}t=e.publicKey.verify(r.digest().getBytes(),e.signature,o)}return t},e},f.getTBSCertificate=function(e){var t=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes())]),l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,c.util.hexToBytes(e.serialNumber)),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.siginfo.algorithmOid).getBytes()),s(e.siginfo.algorithmOid,e.siginfo.parameters)]),i(e.issuer),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.UTCTIME,!1,l.dateToUtcTime(e.validity.notBefore)),l.create(l.Class.UNIVERSAL,l.Type.UTCTIME,!1,l.dateToUtcTime(e.validity.notAfter))]),i(e.subject),f.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&t.value.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,[l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&t.value.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!0,[l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&t.value.push(f.certificateExtensionsToAsn1(e.extensions)),t},f.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),i(e.subject),f.publicKeyToAsn1(e.publicKey),u(e)])},f.distinguishedNameToAsn1=function(e){return i(e)},f.certificateToAsn1=function(e){var t=e.tbsCertificate||f.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),s(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},f.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;n<e.length;++n)r.value.push(f.certificateExtensionToAsn1(e[n]));return t},f.certificateExtensionToAsn1=function(e){var t=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.id).getBytes())),e.critical&&t.value.push(l.create(l.Class.UNIVERSAL,l.Type.BOOLEAN,!1,String.fromCharCode(255)));var r=e.value;return"string"!=typeof e.value&&(r=l.toDer(r).getBytes()),t.value.push(l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,r)),t},f.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||f.getCertificationRequestInfo(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),s(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},f.createCaStore=function(e){function t(e){return r(e),n.certs[e.hash]||null}function r(e){if(!e.hash){var t=c.md.sha1.create();e.attributes=f.RDNAttributesAsArray(i(e),t),e.hash=t.digest().toHex()}}var n={certs:{},getIssuer:function(e){return t(e.issuer)},addCertificate:function(e){if("string"==typeof e&&(e=c.pki.certificateFromPem(e)),r(e.subject),!n.hasCertificate(e))if(e.subject.hash in n.certs){var t=n.certs[e.subject.hash];c.util.isArray(t)||(t=[t]),t.push(e),n.certs[e.subject.hash]=t}else n.certs[e.subject.hash]=e},hasCertificate:function(e){"string"==typeof e&&(e=c.pki.certificateFromPem(e));var r=t(e.subject);if(!r)return!1;c.util.isArray(r)||(r=[r]);for(var n=l.toDer(f.certificateToAsn1(e)).getBytes(),i=0;i<r.length;++i)if(n===l.toDer(f.certificateToAsn1(r[i])).getBytes())return!0;return!1},listAllCertificates:function(){var e=[];for(var t in n.certs)if(n.certs.hasOwnProperty(t)){var r=n.certs[t];if(c.util.isArray(r))for(var i=0;i<r.length;++i)e.push(r[i]);else e.push(r)}return e},removeCertificate:function(e){var i;if("string"==typeof e&&(e=c.pki.certificateFromPem(e)),r(e.subject),!n.hasCertificate(e))return null;var a=t(e.subject);if(!c.util.isArray(a))return i=n.certs[e.subject.hash],delete n.certs[e.subject.hash],i;for(var o=l.toDer(f.certificateToAsn1(e)).getBytes(),s=0;s<a.length;++s)o===l.toDer(f.certificateToAsn1(a[s])).getBytes()&&(i=a[s],a.splice(s,1));return 0===a.length&&delete n.certs[e.subject.hash],i}};if(e)for(var a=0;a<e.length;++a){var o=e[a];n.addCertificate(o)}return n},f.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"},f.verifyCertificateChain=function(e,t,r){var n=(t=t.slice(0)).slice(0),i=new Date,a=!0,o=null,s=0;do{var u=t.shift(),l=null,p=!1;if((i<u.validity.notBefore||i>u.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:f.certificateError.certificate_expired,notBefore:u.validity.notBefore,notAfter:u.validity.notAfter,now:i}),null===o){if(null===(l=t[0]||e.getIssuer(u))&&u.isIssuer(u)&&(p=!0,l=u),l){var h=l;c.util.isArray(h)||(h=[h]);for(var d=!1;!d&&h.length>0;){l=h.shift();try{d=l.verify(u)}catch(e){}}d||(o={message:"Certificate signature is invalid.",error:f.certificateError.bad_certificate})}null!==o||l&&!p||e.hasCertificate(u)||(o={message:"Certificate is not trusted.",error:f.certificateError.unknown_ca})}if(null===o&&l&&!u.isIssuer(l)&&(o={message:"Certificate issuer is invalid.",error:f.certificateError.bad_certificate}),null===o)for(var y={keyUsage:!0,basicConstraints:!0},g=0;null===o&&g<u.extensions.length;++g){var v=u.extensions[g];!v.critical||v.name in y||(o={message:"Certificate has an unsupported critical extension.",error:f.certificateError.unsupported_certificate})}if(null===o&&(!a||0===t.length&&(!l||p))){var m=u.getExtension("basicConstraints"),b=u.getExtension("keyUsage");null!==b&&(b.keyCertSign&&null!==m||(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:f.certificateError.bad_certificate})),null!==o||null===m||m.cA||(o={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:f.certificateError.bad_certificate}),null===o&&null!==b&&"pathLenConstraint"in m&&s-1>m.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:f.certificateError.bad_certificate})}var C=null===o||o.error,E=r?r(C,s,n):C;if(!0!==E)throw!0===C&&(o={message:"The application rejected the certificate.",error:f.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||c.util.isArray(E)?"string"==typeof E&&(o.error=E):(E.message&&(o.message=E.message),E.error&&(o.error=E.error))),o;o=null,a=!1,++s}while(t.length>0);return!0}},function(e,t,r){var n=r(0);r(2),r(1),(e.exports=n.pss=n.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,i=e.mgf,a=r.digestLength,o=e.salt||null;if("string"==typeof o&&(o=n.util.createBuffer(o)),"saltLength"in e)t=e.saltLength;else{if(null===o)throw new Error("Salt length not specified or specific salt not given.");t=o.length()}if(null!==o&&o.length()!==t)throw new Error("Given salt length does not match length of given salt.");var s=e.prng||n.random,u={encode:function(e,u){var c,l,f=u-1,p=Math.ceil(f/8),h=e.digest().getBytes();if(p<a+t+2)throw new Error("Message is too long to encrypt.");l=null===o?s.getBytesSync(t):o.bytes();var d=new n.util.ByteBuffer;d.fillWithByte(0,8),d.putBytes(h),d.putBytes(l),r.start(),r.update(d.getBytes());var y=r.digest().getBytes(),g=new n.util.ByteBuffer;g.fillWithByte(0,p-t-a-2),g.putByte(1),g.putBytes(l);var v=g.getBytes(),m=p-a-1,b=i.generate(y,m),C="";for(c=0;c<m;c++)C+=String.fromCharCode(v.charCodeAt(c)^b.charCodeAt(c));var E=65280>>8*p-f&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+y+String.fromCharCode(188)},verify:function(e,o,s){var u,c=s-1,l=Math.ceil(c/8);if(o=o.substr(-l),l<a+t+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==o.charCodeAt(l-1))throw new Error("Encoded message does not end in 0xBC.");var f=l-a-1,p=o.substr(0,f),h=o.substr(f,a),d=65280>>8*l-c&255;if(0!=(p.charCodeAt(0)&d))throw new Error("Bits beyond keysize not zero as expected.");var y=i.generate(h,f),g="";for(u=0;u<f;u++)g+=String.fromCharCode(p.charCodeAt(u)^y.charCodeAt(u));g=String.fromCharCode(g.charCodeAt(0)&~d)+g.substr(1);var v=l-a-t-2;for(u=0;u<v;u++)if(0!==g.charCodeAt(u))throw new Error("Leftmost octets not zero as expected");if(1!==g.charCodeAt(v))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var m=g.substr(-t),b=new n.util.ByteBuffer;return b.fillWithByte(0,8),b.putBytes(e),b.putBytes(m),r.start(),r.update(b.getBytes()),h===r.digest().getBytes()}};return u}},function(e,t,r){function n(e){if("string"==typeof e&&(e=o.util.createBuffer(e)),o.util.isArray(e)&&e.length>4){var t=e;e=o.util.createBuffer();for(var r=0;r<t.length;++r)e.putByte(t[r])}return o.util.isArray(e)||(e=[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]),e}function i(e){e[e.length-1]=e[e.length-1]+1&4294967295}function a(e){return[e/4294967296|0,4294967295&e]}var o=r(0);r(1),o.cipher=o.cipher||{};var s=e.exports=o.cipher.modes=o.cipher.modes||{};s.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},s.ecb.prototype.start=function(e){},s.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},s.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},s.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},s.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||(e.truncate(n),0))},s.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},s.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=n(e.iv),this._prev=this._iv.slice(0)}},s.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},s.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},s.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},s.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||(e.truncate(n),0))},s.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},s.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},s.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32()^this._outBlock[i],t.putInt32(this._inBlock[i]);else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(a>0)e.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},s.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32(),t.putInt32(this._inBlock[i]^this._outBlock[i]);else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(a>0)e.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},s.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},s.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},s.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(a>0)e.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},s.ofb.prototype.decrypt=s.ofb.prototype.encrypt,s.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0},s.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},s.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a<this._ints;++a)t.putInt32(e.getInt32()^this._outBlock[a]);else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var a=0;a<this._ints;++a)this._partialOutput.putInt32(e.getInt32()^this._outBlock[a]);if(o>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}i(this._inBlock)},s.ctr.prototype.decrypt=s.ctr.prototype.encrypt,s.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=o.util.createBuffer(),this._partialBytes=0,this._R=3774873600},s.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=o.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?o.util.createBuffer(e.additionalData):o.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=o.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._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=r.length();if(12===n)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*n)))}this._inBlock=this._j0.slice(0),i(this._inBlock),this._partialBytes=0,t=o.util.createBuffer(t),this._aDataLength=a(8*t.length());var s=t.length()%this.blockSize;for(s&&t.fillWithByte(0,this.blockSize-s),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},s.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var a=0;a<this._ints;++a)t.putInt32(this._outBlock[a]^=e.getInt32());this._cipherLength+=this.blockSize}else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var a=0;a<this._ints;++a)this._partialOutput.putInt32(e.getInt32()^this._outBlock[a]);if(0===o||r){if(r){var s=n%this.blockSize;this._cipherLength+=s,this._partialOutput.truncate(this.blockSize-s)}else this._cipherLength+=this.blockSize;for(var a=0;a<this._ints;++a)this._outBlock[a]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),i(this._inBlock)},s.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),i(this._inBlock),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 a=0;a<this._ints;++a)t.putInt32(this._outBlock[a]^this._hashBlock[a]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize},s.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=o.util.createBuffer();var n=this._aDataLength.concat(a(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,n);var i=[];this.cipher.encrypt(this._j0,i);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^i[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},s.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),i=0;i<128;++i)e[i/32|0]&1<<31-i%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n);return r},s.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)},s.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,i=e[n]>>>4*(7-r%8)&15,a=this._m[r][i];t[0]^=a[0],t[1]^=a[1],t[2]^=a[2],t[3]^=a[3]}return t},s.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)},s.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,a=new Array(i),o=0;o<i;++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},s.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;a<n;){for(var o=1;o<a;++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;a<r;++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}},function(e,t,r){var n=r(0);r(3),r(8),r(14),r(7),r(20),r(2),r(9),r(1);var i=function(e,t,r,i){var a=n.util.createBuffer(),o=e.length>>1,s=o+(1&e.length),u=e.substr(0,s),c=e.substr(o,s),l=n.util.createBuffer(),f=n.hmac.create();r=t+r;var p=Math.ceil(i/16),h=Math.ceil(i/20);f.start("MD5",u);var d=n.util.createBuffer();l.putBytes(r);for(var y=0;y<p;++y)f.start(null,null),f.update(l.getBytes()),l.putBuffer(f.digest()),f.start(null,null),f.update(l.bytes()+r),d.putBuffer(f.digest());f.start("SHA1",c);var g=n.util.createBuffer();l.clear(),l.putBytes(r);for(var y=0;y<h;++y)f.start(null,null),f.update(l.getBytes()),l.putBuffer(f.digest()),f.start(null,null),f.update(l.bytes()+r),g.putBuffer(f.digest());return a.putBytes(n.util.xorBytes(d.getBytes(),g.getBytes(),i)),a},a=function(e,t,r){var i=!1;try{var a=e.deflate(t.fragment.getBytes());t.fragment=n.util.createBuffer(a),t.length=a.length,i=!0}catch(e){}return i},o=function(e,t,r){var i=!1;try{var a=e.inflate(t.fragment.getBytes());t.fragment=n.util.createBuffer(a),t.length=a.length,i=!0}catch(e){}return i},s=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 n.util.createBuffer(e.getBytes(r))},u=function(e,t,r){e.putInt(r.length(),t<<3),e.putBuffer(r)},c={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}}};c.SupportedVersions=[c.Versions.TLS_1_1,c.Versions.TLS_1_0],c.Version=c.SupportedVersions[0],c.MaxFragment=15360,c.ConnectionEnd={server:0,client:1},c.PRFAlgorithm={tls_prf_sha256:0},c.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},c.CipherType={stream:0,block:1,aead:2},c.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},c.CompressionMethod={none:0,deflate:1},c.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},c.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},c.Alert={},c.Alert.Level={warning:1,fatal:2},c.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},c.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},c.CipherSuites={},c.getCipherSuite=function(e){var t=null;for(var r in c.CipherSuites){var n=c.CipherSuites[r];if(n.id[0]===e.charCodeAt(0)&&n.id[1]===e.charCodeAt(1)){t=n;break}}return t},c.handleUnexpected=function(e,t){!e.open&&e.entity===c.ConnectionEnd.client||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.unexpected_message}})},c.handleHelloRequest=function(e,t,r){!e.handshaking&&e.handshakes>0&&(c.queue(e,c.createAlert(e,{level:c.Alert.Level.warning,description:c.Alert.Description.no_renegotiation})),c.flush(e)),e.process()},c.parseHelloMessage=function(e,t,r){var i=null,a=e.entity===c.ConnectionEnd.client;if(r<38)e.error(e,{message:a?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});else{var o=t.fragment,u=o.length();if(i={version:{major:o.getByte(),minor:o.getByte()},random:n.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},a?(i.cipher_suite=o.getBytes(2),i.compression_method=o.getByte()):(i.cipher_suites=s(o,2),i.compression_methods=s(o,1)),(u=r-(u-o.length()))>0){for(var l=s(o,2);l.length()>0;)i.extensions.push({type:[l.getByte(),l.getByte()],data:s(l,2)});if(!a)for(var f=0;f<i.extensions.length;++f){var p=i.extensions[f];if(0===p.type[0]&&0===p.type[1])for(var h=s(p.data,2);h.length()>0;){var d=h.getByte();if(0!==d)break;e.session.extensions.server_name.serverNameList.push(s(h,2).getBytes())}}}if(e.session.version&&(i.version.major!==e.session.version.major||i.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.protocol_version}});if(a)e.session.cipherSuite=c.getCipherSuite(i.cipher_suite);else for(var y=n.util.createBuffer(i.cipher_suites.bytes());y.length()>0&&(e.session.cipherSuite=c.getCipherSuite(y.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:c.Alert.Level.fatal,description:c.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(i.cipher_suite)});e.session.compressionMethod=a?i.compression_method:c.CompressionMethod.none}return i},c.createSecurityParameters=function(e,t){var r=e.entity===c.ConnectionEnd.client,n=t.random.bytes(),i=r?e.session.sp.client_random:n,a=r?n:c.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:c.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}},c.handleServerHello=function(e,t,r){var n=c.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:c.Alert.Level.fatal,description:c.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,c.createSecurityParameters(e,n)),e.session.id=i,e.process()}},c.handleClientHello=function(e,t,r){var i=c.parseHelloMessage(e,t,r);if(!e.fail){var a=i.session_id.bytes(),o=null;if(e.sessionCache&&(null===(o=e.sessionCache.getSession(a))?a="":(o.version.major!==i.version.major||o.version.minor>i.version.minor)&&(o=null,a="")),0===a.length&&(a=n.random.getBytes(32)),e.session.id=a,e.session.clientHelloVersion=i.version,e.session.sp={},o)e.version=e.session.version=o.version,e.session.sp=o.sp;else{for(var s,u=1;u<c.SupportedVersions.length&&!((s=c.SupportedVersions[u]).minor<=i.version.minor);++u);e.version={major:s.major,minor:s.minor},e.session.version=e.version}null!==o?(e.expect=E,e.session.resuming=!0,e.session.sp.client_random=i.random.bytes()):(e.expect=!1!==e.verifyClient?m:b,e.session.resuming=!1,c.createSecurityParameters(e,i)),e.open=!0,c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createServerHello(e)})),e.session.resuming?(c.queue(e,c.createRecord(e,{type:c.ContentType.change_cipher_spec,data:c.createChangeCipherSpec()})),e.state.pending=c.createConnectionState(e),e.state.current.write=e.state.pending.write,c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createFinished(e)}))):(c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createCertificate(e)})),e.fail||(c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createServerKeyExchange(e)})),!1!==e.verifyClient&&c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createCertificateRequest(e)})),c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createServerHelloDone(e)})))),c.flush(e),e.process()}},c.handleCertificate=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var i,a,o=t.fragment,u={certificate_list:s(o,3)},l=[];try{for(;u.certificate_list.length()>0;)i=s(u.certificate_list,3),a=n.asn1.fromDer(i),i=n.pki.certificateFromAsn1(a,!0),l.push(i)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.bad_certificate}})}var p=e.entity===c.ConnectionEnd.client;!p&&!0!==e.verifyClient||0!==l.length?0===l.length?e.expect=p?f:b:(p?e.session.serverCertificate=l[0]:e.session.clientCertificate=l[0],c.verifyCertificateChain(e,l)&&(e.expect=p?f:b)):e.error(e,{message:p?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}}),e.process()},c.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.unsupported_certificate}});e.expect=p,e.process()},c.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.unsupported_certificate}});var i=t.fragment,a={enc_pre_master_secret:s(i,2).getBytes()},o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.serverCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}})}if(null===o)return e.error(e,{message:"No private key set.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}});try{var u=e.session.sp;u.pre_master_secret=o.decrypt(a.enc_pre_master_secret);var l=e.session.clientHelloVersion;if(l.major!==u.pre_master_secret.charCodeAt(0)||l.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){u.pre_master_secret=n.random.getBytes(48)}e.expect=E,null!==e.session.clientCertificate&&(e.expect=C),e.process()},c.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var n=t.fragment,i={certificate_types:s(n,1),certificate_authorities:s(n,2)};e.session.certificateRequest=i,e.expect=h,e.process()},c.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var i=t.fragment;i.read-=4;var a=i.bytes();i.read+=4;var o={signature:s(i,2).getBytes()},u=n.util.createBuffer();u.putBuffer(e.session.md5.digest()),u.putBuffer(e.session.sha1.digest()),u=u.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(u,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(a),e.session.sha1.update(a)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.handshake_failure}})}e.expect=E,e.process()},c.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.record_overflow}});if(null===e.serverCertificate){var i={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.insufficient_security}},a=e.verify(e,i.alert.description,0,[]);if(!0!==a)return(a||0===a)&&("object"!=typeof a||n.util.isArray(a)?"number"==typeof a&&(i.alert.description=a):(a.message&&(i.message=a.message),a.alert&&(i.alert.description=a.alert))),e.error(e,i)}null!==e.session.certificateRequest&&(t=c.createRecord(e,{type:c.ContentType.handshake,data:c.createCertificate(e)}),c.queue(e,t)),t=c.createRecord(e,{type:c.ContentType.handshake,data:c.createClientKeyExchange(e)}),c.queue(e,t),e.expect=v;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createCertificateVerify(e,t)})),c.queue(e,c.createRecord(e,{type:c.ContentType.change_cipher_spec,data:c.createChangeCipherSpec()})),e.state.pending=c.createConnectionState(e),e.state.current.write=e.state.pending.write,c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createFinished(e)})),e.expect=d,c.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return o(e,null);c.getClientSignature(e,o)},c.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var r=e.entity===c.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=c.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?y:S,e.process()},c.handleFinished=function(e,t,r){var a=t.fragment;a.read-=4;var o=a.bytes();a.read+=4;var s=t.fragment.getBytes();(a=n.util.createBuffer()).putBuffer(e.session.md5.digest()),a.putBuffer(e.session.sha1.digest());var u=e.entity===c.ConnectionEnd.client,l=u?"server finished":"client finished",f=e.session.sp;if((a=i(f.master_secret,l,a.getBytes(),12)).getBytes()!==s)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&u||!e.session.resuming&&!u)&&(c.queue(e,c.createRecord(e,{type:c.ContentType.change_cipher_spec,data:c.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,c.queue(e,c.createRecord(e,{type:c.ContentType.handshake,data:c.createFinished(e)}))),e.expect=u?g:T,e.handshaking=!1,++e.handshakes,e.peerCertificate=u?e.session.serverCertificate:e.session.clientCertificate,c.flush(e),e.isConnected=!0,e.connected(e),e.process()},c.handleAlert=function(e,t){var r,n=t.fragment,i={level:n.getByte(),description:n.getByte()};switch(i.description){case c.Alert.Description.close_notify:r="Connection closed.";break;case c.Alert.Description.unexpected_message:r="Unexpected message.";break;case c.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case c.Alert.Description.decryption_failed:r="Decryption failed.";break;case c.Alert.Description.record_overflow:r="Record overflow.";break;case c.Alert.Description.decompression_failure:r="Decompression failed.";break;case c.Alert.Description.handshake_failure:r="Handshake failure.";break;case c.Alert.Description.bad_certificate:r="Bad certificate.";break;case c.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case c.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case c.Alert.Description.certificate_expired:r="Certificate expired.";break;case c.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case c.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case c.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case c.Alert.Description.access_denied:r="Access denied.";break;case c.Alert.Description.decode_error:r="Decode error.";break;case c.Alert.Description.decrypt_error:r="Decrypt error.";break;case c.Alert.Description.export_restriction:r="Export restriction.";break;case c.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case c.Alert.Description.insufficient_security:r="Insufficient security.";break;case c.Alert.Description.internal_error:r="Internal error.";break;case c.Alert.Description.user_canceled:r="User canceled.";break;case c.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(i.description===c.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===c.ConnectionEnd.client?"server":"client",alert:i}),e.process()},c.handleHandshake=function(e,t){var r=t.fragment,i=r.getByte(),a=r.getInt24();if(a>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var o=r.bytes(a+4);r.read+=4,i in F[e.entity][e.expect]?(e.entity!==c.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:n.md.md5.create(),sha1:n.md.sha1.create()}),i!==c.HandshakeType.hello_request&&i!==c.HandshakeType.certificate_verify&&i!==c.HandshakeType.finished&&(e.session.md5.update(o),e.session.sha1.update(o)),F[e.entity][e.expect][i](e,t,a)):c.handleUnexpected(e,t)},c.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},c.handleHeartbeat=function(e,t){var r=t.fragment,i=r.getByte(),a=r.getInt16(),o=r.getBytes(a);if(i===c.HeartbeatMessageType.heartbeat_request){if(e.handshaking||a>o.length)return e.process();c.queue(e,c.createRecord(e,{type:c.ContentType.heartbeat,data:c.createHeartbeat(c.HeartbeatMessageType.heartbeat_response,o)})),c.flush(e)}else if(i===c.HeartbeatMessageType.heartbeat_response){if(o!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(o))}e.process()};var l=1,f=2,p=3,h=4,d=5,y=6,g=7,v=8,m=1,b=2,C=3,E=4,S=5,T=6,A=c.handleUnexpected,B=c.handleChangeCipherSpec,w=c.handleAlert,I=c.handleHandshake,_=c.handleApplicationData,k=c.handleHeartbeat,R=[];R[c.ConnectionEnd.client]=[[A,w,I,A,k],[A,w,I,A,k],[A,w,I,A,k],[A,w,I,A,k],[A,w,I,A,k],[B,w,A,A,k],[A,w,I,A,k],[A,w,I,_,k],[A,w,I,A,k]],R[c.ConnectionEnd.server]=[[A,w,I,A,k],[A,w,I,A,k],[A,w,I,A,k],[A,w,I,A,k],[B,w,A,A,k],[A,w,I,A,k],[A,w,I,_,k],[A,w,I,A,k]];var N=c.handleHelloRequest,L=c.handleServerHello,D=c.handleCertificate,O=c.handleServerKeyExchange,U=c.handleCertificateRequest,P=c.handleServerHelloDone,x=c.handleFinished,F=[];F[c.ConnectionEnd.client]=[[A,A,L,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,D,O,U,P,A,A,A,A,A,A],[N,A,A,A,A,A,A,A,A,A,A,A,O,U,P,A,A,A,A,A,A],[N,A,A,A,A,A,A,A,A,A,A,A,A,U,P,A,A,A,A,A,A],[N,A,A,A,A,A,A,A,A,A,A,A,A,A,P,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,x],[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 V=c.handleClientHello,M=c.handleClientKeyExchange,j=c.handleCertificateVerify;F[c.ConnectionEnd.server]=[[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,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,M,A,A,A,A],[A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,j,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,x],[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]],c.generateKeys=function(e,t){var r=i,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var a=2*t.mac_key_length+2*t.enc_key_length,o=e.version.major===c.Versions.TLS_1_0.major&&e.version.minor===c.Versions.TLS_1_0.minor;o&&(a+=2*t.fixed_iv_length);var s=r(t.master_secret,"key expansion",n,a),u={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&&(u.client_write_IV=s.getBytes(t.fixed_iv_length),u.server_write_IV=s.getBytes(t.fixed_iv_length)),u},c.createConnectionState=function(e){var t=e.entity===c.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:c.Alert.Level.fatal,description:c.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.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:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}}),!e.fail},e.session){var i=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(i),i.keys=c.generateKeys(e,i),n.read.macKey=t?i.keys.server_write_MAC_key:i.keys.client_write_MAC_key,n.write.macKey=t?i.keys.client_write_MAC_key:i.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,i),i.compression_algorithm){case c.CompressionMethod.none:break;case c.CompressionMethod.deflate:n.read.compressFunction=o,n.write.compressFunction=a;break;default:throw new Error("Unsupported compression algorithm.")}}return n},c.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=n.util.createBuffer();return r.putInt32(t),r.putBytes(n.random.getBytes(28)),r},c.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},c.createAlert=function(e,t){var r=n.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),c.createRecord(e,{type:c.ContentType.alert,data:r})},c.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=n.util.createBuffer(),r=0;r<e.cipherSuites.length;++r){var i=e.cipherSuites[r];t.putByte(i.id[0]),t.putByte(i.id[1])}var a=t.length(),o=n.util.createBuffer();o.putByte(c.CompressionMethod.none);var s=o.length(),l=n.util.createBuffer();if(e.virtualHost){var f=n.util.createBuffer();f.putByte(0),f.putByte(0);var p=n.util.createBuffer();p.putByte(0),u(p,2,n.util.createBuffer(e.virtualHost));var h=n.util.createBuffer();u(h,2,p),u(f,2,h),l.putBuffer(f)}var d=l.length();d>0&&(d+=2);var y=e.session.id,g=y.length+1+2+4+28+2+a+1+s+d,v=n.util.createBuffer();return v.putByte(c.HandshakeType.client_hello),v.putInt24(g),v.putByte(e.version.major),v.putByte(e.version.minor),v.putBytes(e.session.sp.client_random),u(v,1,n.util.createBuffer(y)),u(v,2,t),u(v,1,o),d>0&&u(v,2,l),v},c.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,i=n.util.createBuffer();return i.putByte(c.HandshakeType.server_hello),i.putInt24(r),i.putByte(e.version.major),i.putByte(e.version.minor),i.putBytes(e.session.sp.server_random),u(i,1,n.util.createBuffer(t)),i.putByte(e.session.cipherSuite.id[0]),i.putByte(e.session.cipherSuite.id[1]),i.putByte(e.session.compressionMethod),i},c.createCertificate=function(e){var t,r=e.entity===c.ConnectionEnd.client,i=null;e.getCertificate&&(t=r?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,i=e.getCertificate(e,t));var a=n.util.createBuffer();if(null!==i)try{n.util.isArray(i)||(i=[i]);for(var o=null,s=0;s<i.length;++s){var l=n.pem.decode(i[s])[0];if("CERTIFICATE"!==l.type&&"X509 CERTIFICATE"!==l.type&&"TRUSTED CERTIFICATE"!==l.type){var f=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw f.headerType=l.type,f}if(l.procType&&"ENCRYPTED"===l.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var p=n.util.createBuffer(l.body);null===o&&(o=n.asn1.fromDer(p.bytes(),!1));var h=n.util.createBuffer();u(h,3,p),a.putBuffer(h)}i=n.pki.certificateFromAsn1(o),r?e.session.clientCertificate=i:e.session.serverCertificate=i}catch(r){return e.error(e,{message:"Could not send certificate list.",cause:r,send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.bad_certificate}})}var d=3+a.length(),y=n.util.createBuffer();return y.putByte(c.HandshakeType.certificate),y.putInt24(d),u(y,3,a),y},c.createClientKeyExchange=function(e){var t=n.util.createBuffer();t.putByte(e.session.clientHelloVersion.major),t.putByte(e.session.clientHelloVersion.minor),t.putBytes(n.random.getBytes(46));var r=e.session.sp;r.pre_master_secret=t.getBytes();var i=(t=e.session.serverCertificate.publicKey.encrypt(r.pre_master_secret)).length+2,a=n.util.createBuffer();return a.putByte(c.HandshakeType.client_key_exchange),a.putInt24(i),a.putInt16(t.length),a.putBytes(t),a},c.createServerKeyExchange=function(e){var t=n.util.createBuffer();return t},c.getClientSignature=function(e,t){var r=n.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 i=null;if(e.getPrivateKey)try{i=e.getPrivateKey(e,e.session.clientCertificate),i=n.pki.privateKeyFromPem(i)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}})}null===i?e.error(e,{message:"No private key set.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}}):t=i.sign(t,null),r(e,t)},e.getSignature(e,r,t)},c.createCertificateVerify=function(e,t){var r=t.length+2,i=n.util.createBuffer();return i.putByte(c.HandshakeType.certificate_verify),i.putInt24(r),i.putInt16(t.length),i.putBytes(t),i},c.createCertificateRequest=function(e){var t=n.util.createBuffer();t.putByte(1);var r=n.util.createBuffer();for(var i in e.caStore.certs){var a=e.caStore.certs[i],o=n.pki.distinguishedNameToAsn1(a.subject),s=n.asn1.toDer(o);r.putInt16(s.length()),r.putBuffer(s)}var l=1+t.length()+2+r.length(),f=n.util.createBuffer();return f.putByte(c.HandshakeType.certificate_request),f.putInt24(l),u(f,1,t),u(f,2,r),f},c.createServerHelloDone=function(e){var t=n.util.createBuffer();return t.putByte(c.HandshakeType.server_hello_done),t.putInt24(0),t},c.createChangeCipherSpec=function(){var e=n.util.createBuffer();return e.putByte(1),e},c.createFinished=function(e){var t=n.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var r=e.entity===c.ConnectionEnd.client,a=e.session.sp,o=i,s=r?"client finished":"server finished";t=o(a.master_secret,s,t.getBytes(),12);var u=n.util.createBuffer();return u.putByte(c.HandshakeType.finished),u.putInt24(t.length()),u.putBuffer(t),u},c.createHeartbeat=function(e,t,r){void 0===r&&(r=t.length);var i=n.util.createBuffer();i.putByte(e),i.putInt16(r),i.putBytes(t);var a=i.length(),o=Math.max(16,a-r-3);return i.putBytes(n.random.getBytes(o)),i},c.queue=function(e,t){if(t&&(0!==t.fragment.length()||t.type!==c.ContentType.handshake&&t.type!==c.ContentType.alert&&t.type!==c.ContentType.change_cipher_spec)){if(t.type===c.ContentType.handshake){var r=t.fragment.bytes();e.session.md5.update(r),e.session.sha1.update(r),r=null}var i;if(t.fragment.length()<=c.MaxFragment)i=[t];else{i=[];for(var a=t.fragment.bytes();a.length>c.MaxFragment;)i.push(c.createRecord(e,{type:t.type,data:n.util.createBuffer(a.slice(0,c.MaxFragment))})),a=a.slice(c.MaxFragment);a.length>0&&i.push(c.createRecord(e,{type:t.type,data:n.util.createBuffer(a)}))}for(var o=0;o<i.length&&!e.fail;++o){var s=i[o];e.state.current.write.update(e,s)&&e.records.push(s)}}},c.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 K=function(e){switch(e){case!0:return!0;case n.pki.certificateError.bad_certificate:return c.Alert.Description.bad_certificate;case n.pki.certificateError.unsupported_certificate:return c.Alert.Description.unsupported_certificate;case n.pki.certificateError.certificate_revoked:return c.Alert.Description.certificate_revoked;case n.pki.certificateError.certificate_expired:return c.Alert.Description.certificate_expired;case n.pki.certificateError.certificate_unknown:return c.Alert.Description.certificate_unknown;case n.pki.certificateError.unknown_ca:return c.Alert.Description.unknown_ca;default:return c.Alert.Description.bad_certificate}};for(var H in c.verifyCertificateChain=function(e,t){try{n.pki.verifyCertificateChain(e.caStore,t,function(t,r,i){var a=(K(t),e.verify(e,t,r,i));if(!0!==a){if("object"==typeof a&&!n.util.isArray(a)){var o=new Error("The application rejected the certificate.");throw o.send=!0,o.alert={level:c.Alert.Level.fatal,description:c.Alert.Description.bad_certificate},a.message&&(o.message=a.message),a.alert&&(o.alert.description=a.alert),o}a!==t&&(a=function(e){switch(e){case!0:return!0;case c.Alert.Description.bad_certificate:return n.pki.certificateError.bad_certificate;case c.Alert.Description.unsupported_certificate:return n.pki.certificateError.unsupported_certificate;case c.Alert.Description.certificate_revoked:return n.pki.certificateError.certificate_revoked;case c.Alert.Description.certificate_expired:return n.pki.certificateError.certificate_expired;case c.Alert.Description.certificate_unknown:return n.pki.certificateError.certificate_unknown;case c.Alert.Description.unknown_ca:return n.pki.certificateError.unknown_ca;default:return n.pki.certificateError.bad_certificate}}(a))}return a})}catch(t){var r=t;("object"!=typeof r||n.util.isArray(r))&&(r={send:!0,alert:{level:c.Alert.Level.fatal,description:K(t)}}),"send"in r||(r.send=!0),"alert"in r||(r.alert={level:c.Alert.Level.fatal,description:K(r.error)}),e.error(e,r)}return!e.fail},c.createSessionCache=function(e,t){var r=null;if(e&&e.getSession&&e.setSession&&e.order)r=e;else{for(var i in(r={}).cache=e||{},r.capacity=Math.max(t||100,1),r.order=[],e)r.order.length<=t?r.order.push(i):delete e[i];r.getSession=function(e){var t=null,i=null;if(e?i=n.util.bytesToHex(e):r.order.length>0&&(i=r.order[0]),null!==i&&i in r.cache)for(var a in t=r.cache[i],delete r.cache[i],r.order)if(r.order[a]===i){r.order.splice(a,1);break}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var i=r.order.shift();delete r.cache[i]}var i=n.util.bytesToHex(e);r.order.push(i),r.cache[i]=t}}return r},c.createConnection=function(e){var t=null;t=e.caStore?n.util.isArray(e.caStore)?n.pki.createCaStore(e.caStore):e.caStore:n.pki.createCaStore();var r=e.cipherSuites||null;if(null===r)for(var i in r=[],c.CipherSuites)r.push(c.CipherSuites[i]);var a=e.server?c.ConnectionEnd.server:c.ConnectionEnd.client,o=e.sessionCache?c.createSessionCache(e.sessionCache):null,s={version:{major:c.Version.major,minor:c.Version.minor},entity:a,sessionId:e.sessionId,caStore:t,sessionCache:o,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:n.util.createBuffer(),tlsData:n.util.createBuffer(),data:n.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===c.ConnectionEnd.client?"client":"server"),r.send&&(c.queue(t,c.createAlert(t,r.alert)),c.flush(t));var n=!1!==r.fatal;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null,reset:function(e){s.version={major:c.Version.major,minor:c.Version.minor},s.record=null,s.session=null,s.peerCertificate=null,s.state={pending:null,current:null},s.expect=(s.entity,c.ConnectionEnd.client,0),s.fragmented=null,s.records=[],s.open=!1,s.handshakes=0,s.handshaking=!1,s.isConnected=!1,s.fail=!(e||void 0===e),s.input.clear(),s.tlsData.clear(),s.data.clear(),s.state.current=c.createConnectionState(s)}};return s.reset(),s.handshake=function(e){if(s.entity!==c.ConnectionEnd.client)s.error(s,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(s.handshaking)s.error(s,{message:"Handshake already in progress.",fatal:!1});else{s.fail&&!s.open&&0===s.handshakes&&(s.fail=!1),s.handshaking=!0;var t=null;(e=e||"").length>0&&(s.sessionCache&&(t=s.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&s.sessionCache&&null!==(t=s.sessionCache.getSession())&&(e=t.id),s.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:n.md.md5.create(),sha1:n.md.sha1.create()},t&&(s.version=t.version,s.session.sp=t.sp),s.session.sp.client_random=c.createRandom().getBytes(),s.open=!0,c.queue(s,c.createRecord(s,{type:c.ContentType.handshake,data:c.createClientHello(s)})),c.flush(s)}},s.process=function(e){var t=0;return e&&s.input.putBytes(e),s.fail||(null!==s.record&&s.record.ready&&s.record.fragment.isEmpty()&&(s.record=null),null===s.record&&(t=function(e){var t=0,r=e.input,i=r.length();if(i<5)t=5-i;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:n.util.createBuffer(),ready:!1};var a=e.record.version.major===e.version.major;a&&e.session&&e.session.version&&(a=e.record.version.minor===e.version.minor),a||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.protocol_version}})}return t}(s)),s.fail||null===s.record||s.record.ready||(t=function(e){var t=0,r=e.input,n=r.length();return n<e.record.length?t=e.record.length-n:(e.record.fragment.putBytes(r.getBytes(e.record.length)),r.compact(),e.state.current.read.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:c.Alert.Level.fatal,description:c.Alert.Description.unexpected_message}})),e.record.ready=!0)),t}(s)),!s.fail&&null!==s.record&&s.record.ready&&function(e,t){var r=t.type-c.ContentType.change_cipher_spec,n=R[e.entity][e.expect];r in n?n[r](e,t):c.handleUnexpected(e,t)}(s,s.record)),t},s.prepare=function(e){return c.queue(s,c.createRecord(s,{type:c.ContentType.application_data,data:n.util.createBuffer(e)})),c.flush(s)},s.prepareHeartbeatRequest=function(e,t){return e instanceof n.util.ByteBuffer&&(e=e.bytes()),void 0===t&&(t=e.length),s.expectedHeartbeatPayload=e,c.queue(s,c.createRecord(s,{type:c.ContentType.heartbeat,data:c.createHeartbeat(c.HeartbeatMessageType.heartbeat_request,e,t)})),c.flush(s)},s.close=function(e){if(!s.fail&&s.sessionCache&&s.session){var t={id:s.session.id,version:s.session.version,sp:s.session.sp};t.sp.keys=null,s.sessionCache.setSession(t.id,t)}s.open&&(s.open=!1,s.input.clear(),(s.isConnected||s.handshaking)&&(s.isConnected=s.handshaking=!1,c.queue(s,c.createAlert(s,{level:c.Alert.Level.warning,description:c.Alert.Description.close_notify})),c.flush(s)),s.closed(s)),s.reset(e)},s},e.exports=n.tls=n.tls||{},c)"function"!=typeof c[H]&&(n.tls[H]=c[H]);n.tls.prf_tls1=i,n.tls.hmac_sha1=function(e,t,r){var i=n.hmac.create();i.start("SHA1",e);var a=n.util.createBuffer();return a.putInt32(t[0]),a.putInt32(t[1]),a.putByte(r.type),a.putByte(r.version.major),a.putByte(r.version.minor),a.putInt16(r.length),a.putBytes(r.fragment.bytes()),i.update(a.getBytes()),i.digest().getBytes()},n.tls.createSessionCache=c.createSessionCache,n.tls.createConnection=c.createConnection},function(e,t,r){var n=r(0);r(3),r(6),r(21),r(7),r(15),r(28),r(17),r(11),r(1),r(16);var i=n.asn1,a=e.exports=n.pki=n.pki||{};a.pemToDer=function(e){var t=n.pem.decode(e)[0];if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return n.util.createBuffer(t.body)},a.privateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PRIVATE KEY"!==t.type&&"RSA PRIVATE KEY"!==t.type){var r=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var o=i.fromDer(t.body);return a.privateKeyFromAsn1(o)},a.privateKeyToPem=function(e,t){var r={type:"RSA PRIVATE KEY",body:i.toDer(a.privateKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},a.privateKeyInfoToPem=function(e,t){var r={type:"PRIVATE KEY",body:i.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})}},function(e,t,r){function n(e,t){return e.start().update(t).digest().getBytes()}function i(e){var t;if(e){if(!(t=c.oids[u.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return a(t)}function a(e){var t=o.md;switch(e){case"hmacWithSHA224":t=o.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!(t&&e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}var o=r(0);if(r(5),r(3),r(10),r(4),r(6),r(15),r(7),r(2),r(25),r(11),r(1),void 0===s)var s=o.jsbn.BigInteger;var u=o.asn1,c=o.pki=o.pki||{};e.exports=c.pbe=o.pbe=o.pbe||{};var l=c.oids,f={name:"EncryptedPrivateKeyInfo",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:u.Class.UNIVERSAL,type:u.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},p={name:"PBES2Algorithms",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:u.Class.UNIVERSAL,type:u.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:u.Class.UNIVERSAL,type:u.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},h={name:"pkcs-12PbeParams",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:u.Class.UNIVERSAL,type:u.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"iterations"}]};c.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var n,i,s,f=o.random.getBytesSync(r.saltSize),p=r.count,h=u.integerToDer(p);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var d,y,g;switch(r.algorithm){case"aes128":n=16,d=16,y=l["aes128-CBC"],g=o.aes.createEncryptionCipher;break;case"aes192":n=24,d=16,y=l["aes192-CBC"],g=o.aes.createEncryptionCipher;break;case"aes256":n=32,d=16,y=l["aes256-CBC"],g=o.aes.createEncryptionCipher;break;case"des":n=8,d=8,y=l.desCBC,g=o.des.createEncryptionCipher;break;default:var v=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw v.algorithm=r.algorithm,v}var m="hmacWith"+r.prfAlgorithm.toUpperCase(),b=a(m),C=o.pkcs5.pbkdf2(t,f,p,n,b),E=o.random.getBytesSync(d),S=g(C);S.start(E),S.update(u.toDer(e)),S.finish(),s=S.output.getBytes();var T=function(e,t,r,n){var i=u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OCTETSTRING,!1,e),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==n&&i.value.push(u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,o.util.hexToBytes(r.toString(16))),u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(c.oids[n]).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.NULL,!1,"")])),i}(f,h,n,m);i=u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(l.pkcs5PBES2).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(l.pkcs5PBKDF2).getBytes()),T]),u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(y).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.OCTETSTRING,!1,E)])])])}else{if("3des"!==r.algorithm){var v=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw v.algorithm=r.algorithm,v}n=24;var A=new o.util.ByteBuffer(f),C=c.pbe.generatePkcs12Key(t,A,1,p,n),E=c.pbe.generatePkcs12Key(t,A,2,p,n),S=o.des.createEncryptionCipher(C);S.start(E),S.update(u.toDer(e)),S.finish(),s=S.output.getBytes(),i=u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(l["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OCTETSTRING,!1,f),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,h.getBytes())])])}return u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[i,u.create(u.Class.UNIVERSAL,u.Type.OCTETSTRING,!1,s)])},c.decryptPrivateKeyInfo=function(e,t){var r=null,n={},i=[];if(!u.validate(e,f,n,i)){var a=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw a.errors=i,a}var s=u.derToOid(n.encryptionOid),l=c.pbe.getCipher(s,n.encryptionParams,t),p=o.util.createBuffer(n.encryptedData);return l.update(p),l.finish()&&(r=u.fromDer(l.output)),r},c.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:u.toDer(e).getBytes()};return o.pem.encode(r,{maxline:t})},c.encryptedPrivateKeyFromPem=function(e){var t=o.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return u.fromDer(t.body)},c.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var n=c.wrapRsaPrivateKey(c.privateKeyToAsn1(e));return n=c.encryptPrivateKeyInfo(n,t,r),c.encryptedPrivateKeyToPem(n)}var i,a,s,l;switch(r.algorithm){case"aes128":i="AES-128-CBC",s=16,a=o.random.getBytesSync(16),l=o.aes.createEncryptionCipher;break;case"aes192":i="AES-192-CBC",s=24,a=o.random.getBytesSync(16),l=o.aes.createEncryptionCipher;break;case"aes256":i="AES-256-CBC",s=32,a=o.random.getBytesSync(16),l=o.aes.createEncryptionCipher;break;case"3des":i="DES-EDE3-CBC",s=24,a=o.random.getBytesSync(8),l=o.des.createEncryptionCipher;break;case"des":i="DES-CBC",s=8,a=o.random.getBytesSync(8),l=o.des.createEncryptionCipher;break;default:var f=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw f.algorithm=r.algorithm,f}var p=o.pbe.opensslDeriveBytes(t,a.substr(0,8),s),h=l(p);h.start(a),h.update(u.toDer(c.privateKeyToAsn1(e))),h.finish();var d={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:i,parameters:o.util.bytesToHex(a).toUpperCase()},body:h.output.getBytes()};return o.pem.encode(d)},c.decryptRsaPrivateKey=function(e,t){var r=null,n=o.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==n.type&&"PRIVATE KEY"!==n.type&&"RSA PRIVATE KEY"!==n.type){var i=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw i.headerType=i,i}if(n.procType&&"ENCRYPTED"===n.procType.type){var a,s;switch(n.dekInfo.algorithm){case"DES-CBC":a=8,s=o.des.createDecryptionCipher;break;case"DES-EDE3-CBC":a=24,s=o.des.createDecryptionCipher;break;case"AES-128-CBC":a=16,s=o.aes.createDecryptionCipher;break;case"AES-192-CBC":a=24,s=o.aes.createDecryptionCipher;break;case"AES-256-CBC":a=32,s=o.aes.createDecryptionCipher;break;case"RC2-40-CBC":a=5,s=function(e){return o.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":a=8,s=function(e){return o.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":a=16,s=function(e){return o.rc2.createDecryptionCipher(e,128)};break;default:var i=new Error('Could not decrypt private key; unsupported encryption algorithm "'+n.dekInfo.algorithm+'".');throw i.algorithm=n.dekInfo.algorithm,i}var l=o.util.hexToBytes(n.dekInfo.parameters),f=o.pbe.opensslDeriveBytes(t,l.substr(0,8),a),p=s(f);if(p.start(l),p.update(o.util.createBuffer(n.body)),!p.finish())return r;r=p.output.getBytes()}else r=n.body;return null!==(r="ENCRYPTED PRIVATE KEY"===n.type?c.decryptPrivateKeyInfo(u.fromDer(r),t):u.fromDer(r))&&(r=c.privateKeyFromAsn1(r)),r},c.pbe.generatePkcs12Key=function(e,t,r,n,i,a){var s,u;if(null==a){if(!("sha1"in o.md))throw new Error('"sha1" hash algorithm unavailable.');a=o.md.sha1.create()}var c=a.digestLength,l=a.blockLength,f=new o.util.ByteBuffer,p=new o.util.ByteBuffer;if(null!=e){for(u=0;u<e.length;u++)p.putInt16(e.charCodeAt(u));p.putInt16(0)}var h=p.length(),d=t.length(),y=new o.util.ByteBuffer;y.fillWithByte(r,l);var g=l*Math.ceil(d/l),v=new o.util.ByteBuffer;for(u=0;u<g;u++)v.putByte(t.at(u%d));var m=l*Math.ceil(h/l),b=new o.util.ByteBuffer;for(u=0;u<m;u++)b.putByte(p.at(u%h));var C=v;C.putBuffer(b);for(var E=Math.ceil(i/c),S=1;S<=E;S++){var T=new o.util.ByteBuffer;T.putBytes(y.bytes()),T.putBytes(C.bytes());for(var A=0;A<n;A++)a.start(),a.update(T.getBytes()),T=a.digest();var B=new o.util.ByteBuffer;for(u=0;u<l;u++)B.putByte(T.at(u%c));var w=Math.ceil(d/l)+Math.ceil(h/l),I=new o.util.ByteBuffer;for(s=0;s<w;s++){var _=new o.util.ByteBuffer(C.getBytes(l)),k=511;for(u=B.length()-1;u>=0;u--)k>>=8,k+=B.at(u)+_.at(u),_.setAt(u,255&k);I.putBuffer(_)}C=I,f.putBuffer(T)}return f.truncate(f.length()-i),f},c.pbe.getCipher=function(e,t,r){switch(e){case c.oids.pkcs5PBES2:return c.pbe.getCipherForPBES2(e,t,r);case c.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case c.oids["pbewithSHAAnd40BitRC2-CBC"]:return c.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},c.pbe.getCipherForPBES2=function(e,t,r){var n={},a=[];if(!u.validate(t,p,n,a)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=a,s}if((e=u.derToOid(n.kdfOid))!==c.oids.pkcs5PBKDF2){var s=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw s.oid=e,s.supportedOids=["pkcs5PBKDF2"],s}if((e=u.derToOid(n.encOid))!==c.oids["aes128-CBC"]&&e!==c.oids["aes192-CBC"]&&e!==c.oids["aes256-CBC"]&&e!==c.oids["des-EDE3-CBC"]&&e!==c.oids.desCBC){var s=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw s.oid=e,s.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],s}var l,f,h=n.kdfSalt,d=o.util.createBuffer(n.kdfIterationCount);switch(d=d.getInt(d.length()<<3),c.oids[e]){case"aes128-CBC":l=16,f=o.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,f=o.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,f=o.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,f=o.des.createDecryptionCipher;break;case"desCBC":l=8,f=o.des.createDecryptionCipher}var y=i(n.prfOid),g=o.pkcs5.pbkdf2(r,h,d,l,y),v=n.encIv,m=f(g);return m.start(v),m},c.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},a=[];if(!u.validate(t,h,n,a)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=a,s}var l,f,p,d=o.util.createBuffer(n.salt),y=o.util.createBuffer(n.iterations);switch(y=y.getInt(y.length()<<3),e){case c.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:l=24,f=8,p=o.des.startDecrypting;break;case c.oids["pbewithSHAAnd40BitRC2-CBC"]:l=5,f=8,p=function(e,t){var r=o.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=e,s}var g=i(n.prfOid),v=c.pbe.generatePkcs12Key(r,d,1,y,l,g);return g.start(),p(v,c.pbe.generatePkcs12Key(r,d,2,y,f,g))},c.pbe.opensslDeriveBytes=function(e,t,r,i){if(null==i){if(!("md5"in o.md))throw new Error('"md5" hash algorithm unavailable.');i=o.md.md5.create()}null===t&&(t="");for(var a=[n(i,e+t)],s=16,u=1;s<r;++u,s+=16)a.push(n(i,a[u-1]+e+t));return a.join("").substr(0,r)}},function(e,t){},function(e,t,r){function n(e,t,r){for(var n,i,a,o,s,c,l,f,p,h,d,y,g,v=r.length();v>=64;){for(s=0;s<16;++s)t[s]=r.getInt32();for(;s<64;++s)n=((n=t[s-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=((i=t[s-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[s]=n+t[s-7]+i+t[s-16]|0;for(c=e.h0,l=e.h1,f=e.h2,p=e.h3,h=e.h4,d=e.h5,y=e.h6,g=e.h7,s=0;s<64;++s)a=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),o=c&l|f&(c^l),n=g+((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(y^h&(d^y))+u[s]+t[s],g=y,y=d,d=h,h=p+n>>>0,p=f,f=l,l=c,c=n+(i=a+o)>>>0;e.h0=e.h0+c|0,e.h1=e.h1+l|0,e.h2=e.h2+f|0,e.h3=e.h3+p|0,e.h4=e.h4+h|0,e.h5=e.h5+d|0,e.h6=e.h6+y|0,e.h7=e.h7+g|0,v-=64}}var i=r(0);r(4),r(1);var a=e.exports=i.sha256=i.sha256||{};i.md.sha256=i.md.algorithms.sha256=a,a.create=function(){s||(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,2756734187,3204031479,3329325298],s=!0);var e=null,t=i.util.createBuffer(),r=new Array(64),a={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){a.messageLength=0,a.fullMessageLength=a.messageLength64=[];for(var r=a.messageLengthSize/4,n=0;n<r;++n)a.fullMessageLength.push(0);return t=i.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},a}};return a.start(),a.update=function(o,s){"utf8"===s&&(o=i.util.encodeUtf8(o));var u=o.length;a.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var c=a.fullMessageLength.length-1;c>=0;--c)a.fullMessageLength[c]+=u[1],u[1]=u[0]+(a.fullMessageLength[c]/4294967296>>>0),a.fullMessageLength[c]=a.fullMessageLength[c]>>>0,u[0]=u[1]/4294967296>>>0;return t.putBytes(o),n(e,r,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var s=i.util.createBuffer();s.putBytes(t.bytes());var u=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,c=u&a.blockLength-1;s.putBytes(o.substr(0,a.blockLength-c));for(var l,f=8*a.fullMessageLength[0],p=0;p<a.fullMessageLength.length-1;++p)l=8*a.fullMessageLength[p+1],f+=l/4294967296>>>0,s.putInt32(f>>>0),f=l>>>0;s.putInt32(f);var h={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(h,r,s);var d=i.util.createBuffer();return d.putInt32(h.h0),d.putInt32(h.h1),d.putInt32(h.h2),d.putInt32(h.h3),d.putInt32(h.h4),d.putInt32(h.h5),d.putInt32(h.h6),d.putInt32(h.h7),d},a};var o=null,s=!1,u=null},function(e,t,n){var i=n(0);n(1);var a=null;!i.util.isNodejs||i.options.usePureJavaScript||r.versions["node-webkit"]||(a=n(22)),(e.exports=i.prng=i.prng||{}).create=function(e){function t(e){if(s.pools[0].messageLength>=32)return n(),e();var t=32-s.pools[0].messageLength<<5;s.seedFile(t,function(t,r){if(t)return e(t);s.collect(r),n(),e()})}function r(){if(s.pools[0].messageLength>=32)return n();var e=32-s.pools[0].messageLength<<5;s.collect(s.seedFileSync(e)),n()}function n(){s.reseeds=4294967295===s.reseeds?0:s.reseeds+1;var e=s.plugin.md.create();e.update(s.keyBytes);for(var t=1,r=0;r<32;++r)s.reseeds%t==0&&(e.update(s.pools[r].digest().getBytes()),s.pools[r].start()),t<<=1;s.keyBytes=e.digest().getBytes(),e.start(),e.update(s.keyBytes);var n=e.digest().getBytes();s.key=s.plugin.formatKey(s.keyBytes),s.seed=s.plugin.formatSeed(n),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 n=i.util.createBuffer();if(t)for(;n.length()<e;){var a=Math.max(1,Math.min(e-n.length(),65536)/4),o=new Uint32Array(Math.floor(a));try{t(o);for(var s=0;s<o.length;++s)n.putInt32(o[s])}catch(e){if(!("undefined"!=typeof QuotaExceededError&&e instanceof QuotaExceededError))throw e}}if(n.length()<e)for(var u,c,l,f=Math.floor(65536*Math.random());n.length()<e;){c=16807*(65535&f),c+=(32767&(u=16807*(f>>16)))<<16,f=4294967295&(c=(2147483647&(c+=u>>15))+(c>>31));for(var s=0;s<3;++s)l=f>>>(s<<3),l^=Math.floor(256*Math.random()),n.putByte(String.fromCharCode(255&l))}return n.getBytes(e)}for(var s={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},u=e.md,c=new Array(32),l=0;l<32;++l)c[l]=u.create();return s.pools=c,s.pool=0,s.generate=function(e,r){if(!r)return s.generateSync(e);var n=s.plugin.cipher,a=s.plugin.increment,o=s.plugin.formatKey,u=s.plugin.formatSeed,c=i.util.createBuffer();s.key=null,function l(f){if(f)return r(f);if(c.length()>=e)return r(null,c.getBytes(e));if(s.generated>1048575&&(s.key=null),null===s.key)return i.util.nextTick(function(){t(l)});var p=n(s.key,s.seed);s.generated+=p.length,c.putBytes(p),s.key=o(n(s.key,a(s.seed))),s.seed=u(n(s.key,s.seed)),i.util.setImmediate(l)}()},s.generateSync=function(e){var t=s.plugin.cipher,n=s.plugin.increment,a=s.plugin.formatKey,o=s.plugin.formatSeed;s.key=null;for(var u=i.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,n(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){if(e)return t(e);t(null,r.toString())})},s.seedFileSync=function(e){return a.randomBytes(e).toString()}):(s.seedFile=function(e,t){try{t(null,o(e))}catch(e){t(e)}},s.seedFileSync=o),s.collect=function(e){for(var t=e.length,r=0;r<t;++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;n<t;n+=8)r+=String.fromCharCode(e>>n&255);s.collect(r)},s.registerWorker=function(e){e===self?s.seedFile=function(e,t){self.addEventListener("message",function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))}),self.postMessage({forge:{prng:{needed:e}}})}:e.addEventListener("message",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}}})})})},s}},function(e,t,r){var n=r(0);r(1);var i=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],a=[1,2,3,5],o=function(e,t){return e<<t&65535|(65535&e)>>16-t},s=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"==typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,a=e,o=e.length(),s=t,u=Math.ceil(s/8),c=255>>(7&s);for(r=o;r<128;r++)a.putByte(i[a.at(r-1)+a.at(r-o)&255]);for(a.setAt(128-u,i[a.at(128-u)&c]),r=127-u;r>=0;r--)a.setAt(r,i[a.at(r+1)^a.at(r+u)]);return a};var u=function(e,t,r){var i,u,c,l,f=!1,p=null,h=null,d=null,y=[];for(e=n.rc2.expandKey(e,t),c=0;c<64;c++)y.push(e.getInt16Le());r?(i=function(e){for(c=0;c<4;c++)e[c]+=y[l]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),e[c]=o(e[c],a[c]),l++},u=function(e){for(c=0;c<4;c++)e[c]+=y[63&e[(c+3)%4]]}):(i=function(e){for(c=3;c>=0;c--)e[c]=s(e[c],a[c]),e[c]-=y[l]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),l--},u=function(e){for(c=3;c>=0;c--)e[c]-=y[63&e[(c+3)%4]]});var g=function(e){var t=[];for(c=0;c<4;c++){var n=p.getInt16Le();null!==d&&(r?n^=d.getInt16Le():d.putInt16Le(n)),t.push(65535&n)}l=r?0:63;for(var i=0;i<e.length;i++)for(var a=0;a<e[i][0];a++)e[i][1](t);for(c=0;c<4;c++)null!==d&&(r?d.putInt16Le(t[c]):t[c]^=d.getInt16Le()),h.putInt16Le(t[c])},v=null;return v={start:function(e,t){e&&"string"==typeof e&&(e=n.util.createBuffer(e)),f=!1,p=n.util.createBuffer(),h=t||new n.util.createBuffer,d=e,v.output=h},update:function(e){for(f||p.putBuffer(e);p.length()>=8;)g([[5,i],[1,u],[6,i],[1,u],[5,i]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,p,!r);else{var n=8===p.length()?8:8-p.length();p.fillWithByte(n,n)}if(t&&(f=!0,v.update()),!r&&(t=0===p.length()))if(e)t=e(8,h,!r);else{var i=h.length(),a=h.at(i-1);a>i?t=!1:h.truncate(a)}return t}}};n.rc2.startEncrypting=function(e,t,r){var i=n.rc2.createEncryptionCipher(e,128);return i.start(t,r),i},n.rc2.createEncryptionCipher=function(e,t){return u(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var i=n.rc2.createDecryptionCipher(e,128);return i.start(t,r),i},n.rc2.createDecryptionCipher=function(e,t){return u(e,t,!1)}},function(e,t,r){function n(e,t,r){r||(r=i.md.sha1.create());for(var n="",a=Math.ceil(t/r.digestLength),o=0;o<a;++o){var s=String.fromCharCode(o>>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+s),n+=r.digest().getBytes()}return n.substring(0,t)}var i=r(0);r(1),r(2),r(9);var a=e.exports=i.pkcs1=i.pkcs1||{};a.encode_rsa_oaep=function(e,t,r){var a,o,s,u;"string"==typeof r?(a=r,o=arguments[3]||void 0,s=arguments[4]||void 0):r&&(a=r.label||void 0,o=r.seed||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(u=r.mgf1.md)),s?s.start():s=i.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 p=s.digest(),h="",d=l-t.length,y=0;y<d;y++)h+="\0";var g=p.getBytes()+h+""+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=i.random.getBytes(s.digestLength);var v=n(o,c-s.digestLength-1,u),m=i.util.xorBytes(g,v,g.length),b=n(m,s.digestLength,u);return"\0"+i.util.xorBytes(o,b,o.length)+m},a.decode_rsa_oaep=function(e,t,r){var a,o,s;"string"==typeof r?(a=r,o=arguments[3]||void 0):r&&(a=r.label||void 0,o=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.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=i.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),p=t.substring(1,o.digestLength+1),h=t.substring(1+o.digestLength),d=n(h,o.digestLength,s),y=i.util.xorBytes(p,d,p.length),g=n(y,u-o.digestLength-1,s),v=i.util.xorBytes(h,g,h.length),m=v.substring(0,o.digestLength),c="\0"!==f,b=0;b<o.digestLength;++b)c|=l.charAt(b)!==m.charAt(b);for(var C=1,E=o.digestLength,S=o.digestLength;S<v.length;S++){var T=v.charCodeAt(S),A=1&T^1;c|=T&(C?65534:0),E+=C&=A}if(c||1!==v.charCodeAt(E))throw new Error("Invalid RSAES-OAEP padding.");return v.substring(E+1)}},function(e,t,r){var n=r(0);r(1),r(12),r(2),function(){function t(e,t,n,i){return"workers"in n?a(e,t,n,i):r(e,t,n,i)}function r(e,t,r,n){var a=o(e,t),s=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(a.bitLength());"millerRabinTests"in r&&(s=r.millerRabinTests);var u=10;"maxBlockTime"in r&&(u=r.maxBlockTime),i(a,e,t,0,s,u,n)}function i(e,t,r,a,s,u,l){var f=+new Date;do{if(e.bitLength()>t&&(e=o(t,r)),e.isProbablePrime(s))return l(null,e);e.dAddOffset(c[a++%8],0)}while(u<0||+new Date-f<u);n.util.setImmediate(function(){i(e,t,r,a,s,u,l)})}function a(e,t,i,a){function s(){function r(r){if(!s){var i=r.data;if(i.found){for(var l=0;l<n.length;++l)n[l].terminate();return s=!0,a(null,new u(i.prime,16))}c.bitLength()>e&&(c=o(e,t));var h=c.toString(16);r.target.postMessage({hex:h,workLoad:f}),c.dAddOffset(p,0)}}l=Math.max(1,l);for(var n=[],i=0;i<l;++i)n[i]=new Worker(h);for(var i=0;i<l;++i)n[i].addEventListener("message",r);var s=!1}if("undefined"==typeof Worker)return r(e,t,i,a);var c=o(e,t),l=i.workers,f=i.workLoad||100,p=30*f/8,h=i.workerScript||"forge/prime.worker.js";if(-1===l)return n.util.estimateCores(function(e,t){e&&(t=2),l=t-1,s()});s()}function o(e,t){var r=new u(e,t),n=e-1;return r.testBit(n)||r.bitwiseTo(u.ONE.shiftLeft(n),f,r),r.dAddOffset(31-r.mod(l).byteValue(),0),r}if(n.prime)e.exports=n.prime;else{var s=e.exports=n.prime=n.prime||{},u=n.jsbn.BigInteger,c=[6,4,2,4,2,4,6,2],l=new u(null);l.fromInt(30);var f=function(e,t){return e|t};s.generateProbablePrime=function(e,r,i){"function"==typeof r&&(i=r,r={});var a=(r=r||{}).algorithm||"PRIMEINC";"string"==typeof a&&(a={name:a}),a.options=a.options||{};var o=r.prng||n.random,s={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===a.name)return t(e,s,a.options,i);throw new Error("Invalid prime generation algorithm: "+a.name)}}}()},function(e,t,r){function n(e,t,r,n){for(var i=[],a=0;a<e.length;a++)for(var o=0;o<e[a].safeBags.length;o++){var s=e[a].safeBags[o];void 0!==n&&s.type!==n||(null!==t?void 0!==s.attributes[t]&&s.attributes[t].indexOf(r)>=0&&i.push(s):i.push(s))}return i}function i(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r<e.value.length;++r)t.putBytes(e.value[r].value);e.composed=e.constructed=!1,e.value=t.getBytes()}return e}function a(e,t,r,n){if((t=l.fromDer(t,r)).tagClass!==l.Class.UNIVERSAL||t.type!==l.Type.SEQUENCE||!0!==t.constructed)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var a=0;a<t.value.length;a++){var u=t.value[a],c={},p=[];if(!l.validate(u,h,c,p)){var d=new Error("Cannot read ContentInfo.");throw d.errors=p,d}var y={encrypted:!1},g=null,v=c.content.value[0];switch(l.derToOid(c.contentType)){case f.oids.data:if(v.tagClass!==l.Class.UNIVERSAL||v.type!==l.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");g=i(v).value;break;case f.oids.encryptedData:g=o(v,n),y.encrypted=!0;break;default:var d=new Error("Unsupported PKCS#12 contentType.");throw d.contentType=l.derToOid(c.contentType),d}y.safeBags=s(g,r,n),e.safeContents.push(y)}}function o(e,t){var r={},n=[];if(!l.validate(e,c.pkcs7.asn1.encryptedDataValidator,r,n)){var a=new Error("Cannot read EncryptedContentInfo.");throw a.errors=n,a}var o=l.derToOid(r.contentType);if(o!==f.oids.data){var a=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw a.oid=o,a}o=l.derToOid(r.encAlgorithm);var s=f.pbe.getCipher(o,r.encParameter,t),u=i(r.encryptedContentAsn1),p=c.util.createBuffer(u.value);if(s.update(p),!s.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return s.output.getBytes()}function s(e,t,r){if(!t&&0===e.length)return[];if((e=l.fromDer(e,t)).tagClass!==l.Class.UNIVERSAL||e.type!==l.Type.SEQUENCE||!0!==e.constructed)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var n=[],i=0;i<e.value.length;i++){var a=e.value[i],o={},s=[];if(!l.validate(a,y,o,s)){var c=new Error("Cannot read SafeBag.");throw c.errors=s,c}var p={type:l.derToOid(o.bagId),attributes:u(o.bagAttributes)};n.push(p);var h,d,g=o.bagValue.value[0];switch(p.type){case f.oids.pkcs8ShroudedKeyBag:if(null===(g=f.decryptPrivateKeyInfo(g,r)))throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case f.oids.keyBag:try{p.key=f.privateKeyFromAsn1(g)}catch(e){p.key=null,p.asn1=g}continue;case f.oids.certBag:h=v,d=function(){if(l.derToOid(o.certId)!==f.oids.x509Certificate){var e=new Error("Unsupported certificate type, only X.509 supported.");throw e.oid=l.derToOid(o.certId),e}var r=l.fromDer(o.cert,t);try{p.cert=f.certificateFromAsn1(r,!0)}catch(e){p.cert=null,p.asn1=r}};break;default:var c=new Error("Unsupported PKCS#12 SafeBag type.");throw c.oid=p.type,c}if(void 0!==h&&!l.validate(g,h,o,s)){var c=new Error("Cannot read PKCS#12 "+h.name);throw c.errors=s,c}d()}return n}function u(e){var t={};if(void 0!==e)for(var r=0;r<e.length;++r){var n={},i=[];if(!l.validate(e[r],g,n,i)){var a=new Error("Cannot read PKCS#12 BagAttribute.");throw a.errors=i,a}var o=l.derToOid(n.oid);if(void 0!==f.oids[o]){t[f.oids[o]]=[];for(var s=0;s<n.values.length;++s)t[f.oids[o]].push(n.values[s].value)}}return t}var c=r(0);r(3),r(8),r(6),r(29),r(21),r(2),r(11),r(9),r(1),r(16);var l=c.asn1,f=c.pki,p=e.exports=c.pkcs12=c.pkcs12||{},h={name:"ContentInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:l.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},d={name:"PFX",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"version"},h,{name:"PFX.macData",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:l.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},y={name:"SafeBag",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:l.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:l.Class.UNIVERSAL,type:l.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},g={name:"Attribute",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:l.Class.UNIVERSAL,type:l.Type.SET,constructed:!0,capture:"values"}]},v={name:"CertBag",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:l.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:l.Class.UNIVERSAL,type:l.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};p.pkcs12FromAsn1=function(e,t,r){"string"==typeof t?(r=t,t=!0):void 0===t&&(t=!0);var o={};if(!l.validate(e,d,o,[])){var s=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw s.errors=s,s}var u={version:o.version.charCodeAt(0),safeContents:[],getBags:function(e){var t,r={};return"localKeyId"in e?t=e.localKeyId:"localKeyIdHex"in e&&(t=c.util.hexToBytes(e.localKeyIdHex)),void 0===t&&!("friendlyName"in e)&&"bagType"in e&&(r[e.bagType]=n(u.safeContents,null,null,e.bagType)),void 0!==t&&(r.localKeyId=n(u.safeContents,"localKeyId",t,e.bagType)),"friendlyName"in e&&(r.friendlyName=n(u.safeContents,"friendlyName",e.friendlyName,e.bagType)),r},getBagsByFriendlyName:function(e,t){return n(u.safeContents,"friendlyName",e,t)},getBagsByLocalKeyId:function(e,t){return n(u.safeContents,"localKeyId",e,t)}};if(3!==o.version.charCodeAt(0)){var s=new Error("PKCS#12 PFX of version other than 3 not supported.");throw s.version=o.version.charCodeAt(0),s}if(l.derToOid(o.contentType)!==f.oids.data){var s=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw s.oid=l.derToOid(o.contentType),s}var h=o.content.value[0];if(h.tagClass!==l.Class.UNIVERSAL||h.type!==l.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(h=i(h),o.mac){var y=null,g=0,v=l.derToOid(o.macAlgorithm);switch(v){case f.oids.sha1:y=c.md.sha1.create(),g=20;break;case f.oids.sha256:y=c.md.sha256.create(),g=32;break;case f.oids.sha384:y=c.md.sha384.create(),g=48;break;case f.oids.sha512:y=c.md.sha512.create(),g=64;break;case f.oids.md5:y=c.md.md5.create(),g=16}if(null===y)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+v);var m=new c.util.ByteBuffer(o.macSalt),b="macIterations"in o?parseInt(c.util.bytesToHex(o.macIterations),16):1,C=p.generateKey(r,m,3,b,g,y),E=c.hmac.create();if(E.start(y,C),E.update(h.value),E.getMac().getBytes()!==o.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return a(u,h.value,t,r),u},p.toPkcs12Asn1=function(e,t,r,n){(n=n||{}).saltSize=n.saltSize||8,n.count=n.count||2048,n.algorithm=n.algorithm||n.encAlgorithm||"aes128","useMac"in n||(n.useMac=!0),"localKeyId"in n||(n.localKeyId=null),"generateLocalKeyId"in n||(n.generateLocalKeyId=!0);var i,a=n.localKeyId;if(null!==a)a=c.util.hexToBytes(a);else if(n.generateLocalKeyId)if(t){var o=c.util.isArray(t)?t[0]:t;"string"==typeof o&&(o=f.certificateFromPem(o));var s=c.md.sha1.create();s.update(l.toDer(f.certificateToAsn1(o)).getBytes()),a=s.digest().getBytes()}else a=c.random.getBytes(20);var u=[];null!==a&&u.push(l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.localKeyId).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,a)])])),"friendlyName"in n&&u.push(l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.friendlyName).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,l.Type.BMPSTRING,!1,n.friendlyName)])])),u.length>0&&(i=l.create(l.Class.UNIVERSAL,l.Type.SET,!0,u));var h=[],d=[];null!==t&&(d=c.util.isArray(t)?t:[t]);for(var y=[],g=0;g<d.length;++g){"string"==typeof(t=d[g])&&(t=f.certificateFromPem(t));var v=0===g?i:void 0,m=f.certificateToAsn1(t),b=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.certBag).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.x509Certificate).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,l.toDer(m).getBytes())])])]),v]);y.push(b)}if(y.length>0){var C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,y),E=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.data).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,l.toDer(C).getBytes())])]);h.push(E)}var S=null;if(null!==e){var T=f.wrapRsaPrivateKey(f.privateKeyToAsn1(e));S=null===r?l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.keyBag).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[T]),i]):l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.pkcs8ShroudedKeyBag).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[f.encryptPrivateKeyInfo(T,r,n)]),i]);var A=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[S]),B=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.data).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,l.toDer(A).getBytes())])]);h.push(B)}var w,I=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,h);if(n.useMac){var s=c.md.sha1.create(),_=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),k=n.count,e=p.generateKey(r,_,3,k,20),R=c.hmac.create();R.start(s,e),R.update(l.toDer(I).getBytes());var N=R.getMac();w=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.sha1).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")]),l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,N.getBytes())]),l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,_.getBytes()),l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(k).getBytes())])}return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(3).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.data).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,l.toDer(I).getBytes())])]),w])},p.generateKey=c.pbe.generatePkcs12Key},function(e,t,r){var n=r(0);r(3),r(1);var i=n.asn1,a=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=a;var o={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};a.contentInfoValidator=o;var s={name:"EncryptedContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};a.envelopedDataValidator={name:"EnvelopedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(s)},a.encryptedDataValidator={name:"EncryptedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"}].concat(s)};var u={name:"SignerInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};a.signedDataValidator={name:"SignedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},o,{name:"SignedData.Certificates",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,capture:"signerInfos",optional:!0,value:[u]}]},a.recipientInfoValidator={name:"RecipientInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(e,t,r){var n=r(0);r(1),n.mgf=n.mgf||{},(e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{}).create=function(e){return{generate:function(t,r){for(var i=new n.util.ByteBuffer,a=Math.ceil(r/e.digestLength),o=0;o<a;o++){var s=new n.util.ByteBuffer;s.putInt32(o),e.start(),e.update(t+s.getBytes()),i.putBuffer(e.digest())}return i.truncate(i.length()-r),i.getBytes()}}}},function(e,t,r){var n=r(0);e.exports=n.debug=n.debug||{},n.debug.storage={},n.debug.get=function(e,t){var r;return void 0===e?r=n.debug.storage:e in n.debug.storage&&(r=void 0===t?n.debug.storage[e]:n.debug.storage[e][t]),r},n.debug.set=function(e,t,r){e in n.debug.storage||(n.debug.storage[e]={}),n.debug.storage[e][t]=r},n.debug.clear=function(e,t){void 0===e?n.debug.storage={}:e in n.debug.storage&&(void 0===t?delete n.debug.storage[e]:delete n.debug.storage[e][t])}},function(e,t,r){function n(){u=String.fromCharCode(128),u+=a.util.fillString(String.fromCharCode(0),128),l=[[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"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],f["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],f["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],f["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],c=!0}function i(e,t,r){for(var n,i,a,o,s,u,c,f,p,h,d,y,g,v,m,b,C,E,S,T,A,B,w,I,_,k,R,N,L,D,O,U,P,x=r.length();x>=128;){for(R=0;R<16;++R)t[R][0]=r.getInt32()>>>0,t[R][1]=r.getInt32()>>>0;for(;R<80;++R)D=t[R-2],N=D[0],L=D[1],n=((N>>>19|L<<13)^(L>>>29|N<<3)^N>>>6)>>>0,i=((N<<13|L>>>19)^(L<<3|N>>>29)^(N<<26|L>>>6))>>>0,U=t[R-15],N=U[0],L=U[1],a=((N>>>1|L<<31)^(N>>>8|L<<24)^N>>>7)>>>0,o=((N<<31|L>>>1)^(N<<24|L>>>8)^(N<<25|L>>>7))>>>0,O=t[R-7],P=t[R-16],L=i+O[1]+o+P[1],t[R][0]=n+O[0]+a+P[0]+(L/4294967296>>>0)>>>0,t[R][1]=L>>>0;for(d=e[0][0],y=e[0][1],g=e[1][0],v=e[1][1],m=e[2][0],b=e[2][1],C=e[3][0],E=e[3][1],S=e[4][0],T=e[4][1],A=e[5][0],B=e[5][1],w=e[6][0],I=e[6][1],_=e[7][0],k=e[7][1],R=0;R<80;++R)c=((S>>>14|T<<18)^(S>>>18|T<<14)^(T>>>9|S<<23))>>>0,f=(w^S&(A^w))>>>0,s=((d>>>28|y<<4)^(y>>>2|d<<30)^(y>>>7|d<<25))>>>0,u=((d<<4|y>>>28)^(y<<30|d>>>2)^(y<<25|d>>>7))>>>0,p=(d&g|m&(d^g))>>>0,h=(y&v|b&(y^v))>>>0,L=k+(((S<<18|T>>>14)^(S<<14|T>>>18)^(T<<23|S>>>9))>>>0)+((I^T&(B^I))>>>0)+l[R][1]+t[R][1],n=_+c+f+l[R][0]+t[R][0]+(L/4294967296>>>0)>>>0,i=L>>>0,a=s+p+((L=u+h)/4294967296>>>0)>>>0,o=L>>>0,_=w,k=I,w=A,I=B,A=S,B=T,S=C+n+((L=E+i)/4294967296>>>0)>>>0,T=L>>>0,C=m,E=b,m=g,b=v,g=d,v=y,d=n+a+((L=i+o)/4294967296>>>0)>>>0,y=L>>>0;L=e[0][1]+y,e[0][0]=e[0][0]+d+(L/4294967296>>>0)>>>0,e[0][1]=L>>>0,L=e[1][1]+v,e[1][0]=e[1][0]+g+(L/4294967296>>>0)>>>0,e[1][1]=L>>>0,L=e[2][1]+b,e[2][0]=e[2][0]+m+(L/4294967296>>>0)>>>0,e[2][1]=L>>>0,L=e[3][1]+E,e[3][0]=e[3][0]+C+(L/4294967296>>>0)>>>0,e[3][1]=L>>>0,L=e[4][1]+T,e[4][0]=e[4][0]+S+(L/4294967296>>>0)>>>0,e[4][1]=L>>>0,L=e[5][1]+B,e[5][0]=e[5][0]+A+(L/4294967296>>>0)>>>0,e[5][1]=L>>>0,L=e[6][1]+I,e[6][0]=e[6][0]+w+(L/4294967296>>>0)>>>0,e[6][1]=L>>>0,L=e[7][1]+k,e[7][0]=e[7][0]+_+(L/4294967296>>>0)>>>0,e[7][1]=L>>>0,x-=128}}var a=r(0);r(4),r(1);var o=e.exports=a.sha512=a.sha512||{};a.md.sha512=a.md.algorithms.sha512=o;var s=a.sha384=a.sha512.sha384=a.sha512.sha384||{};s.create=function(){return o.create("SHA-384")},a.md.sha384=a.md.algorithms.sha384=s,a.sha512.sha256=a.sha512.sha256||{create:function(){return o.create("SHA-512/256")}},a.md["sha512/256"]=a.md.algorithms["sha512/256"]=a.sha512.sha256,a.sha512.sha224=a.sha512.sha224||{create:function(){return o.create("SHA-512/224")}},a.md["sha512/224"]=a.md.algorithms["sha512/224"]=a.sha512.sha224,o.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in f))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=f[e],r=null,o=a.util.createBuffer(),s=new Array(80),l=0;l<80;++l)s[l]=new Array(2);var p=64;switch(e){case"SHA-384":p=48;break;case"SHA-512/256":p=32;break;case"SHA-512/224":p=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:p,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,n=0;n<e;++n)h.fullMessageLength.push(0);o=a.util.createBuffer(),r=new Array(t.length);for(var n=0;n<t.length;++n)r[n]=t[n].slice(0);return h}};return h.start(),h.update=function(e,t){"utf8"===t&&(e=a.util.encodeUtf8(e));var n=e.length;h.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var u=h.fullMessageLength.length-1;u>=0;--u)h.fullMessageLength[u]+=n[1],n[1]=n[0]+(h.fullMessageLength[u]/4294967296>>>0),h.fullMessageLength[u]=h.fullMessageLength[u]>>>0,n[0]=n[1]/4294967296>>>0;return o.putBytes(e),i(r,s,o),(o.read>2048||0===o.length())&&o.compact(),h},h.digest=function(){var t=a.util.createBuffer();t.putBytes(o.bytes());var n=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize,c=n&h.blockLength-1;t.putBytes(u.substr(0,h.blockLength-c));for(var l,f=8*h.fullMessageLength[0],p=0;p<h.fullMessageLength.length-1;++p)l=8*h.fullMessageLength[p+1],f+=l/4294967296>>>0,t.putInt32(f>>>0),f=l>>>0;t.putInt32(f);for(var d=new Array(r.length),p=0;p<r.length;++p)d[p]=r[p].slice(0);i(d,s,t);var y,g=a.util.createBuffer();y="SHA-512"===e?d.length:"SHA-384"===e?d.length-2:d.length-4;for(var p=0;p<y;++p)g.putInt32(d[p][0]),p===y-1&&"SHA-512/224"===e||g.putInt32(d[p][1]);return g},h};var u=null,c=!1,l=null,f=null},function(e,t,r){var n=r(0);r(1),e.exports=n.log=n.log||{},n.log.levels=["none","error","warning","info","debug","verbose","max"];var i={},a=[],o=null;n.log.LEVEL_LOCKED=2,n.log.NO_LEVEL_CHECK=4,n.log.INTERPOLATE=8;for(var s=0;s<n.log.levels.length;++s){var u=n.log.levels[s];i[u]={index:s,name:u.toUpperCase()}}n.log.logMessage=function(e){for(var t=i[e.level].index,r=0;r<a.length;++r){var o=a[r];o.flags&n.log.NO_LEVEL_CHECK?o.f(e):t<=i[o.level].index&&o.f(o,e)}},n.log.prepareStandard=function(e){"standard"in e||(e.standard=i[e.level].name+" ["+e.category+"] "+e.message)},n.log.prepareFull=function(e){if(!("full"in e)){var t=[e.message];t=t.concat([]||!1),e.full=n.util.format.apply(this,t)}},n.log.prepareStandardFull=function(e){"standardFull"in e||(n.log.prepareStandard(e),e.standardFull=e.standard)};for(var c=["error","warning","info","debug","verbose"],s=0;s<c.length;++s)!function(e){n.log[e]=function(t,r){var i=Array.prototype.slice.call(arguments).slice(2),a={timestamp:new Date,level:e,category:t,message:r,arguments:i};n.log.logMessage(a)}}(c[s]);if(n.log.makeLogger=function(e){var t={flags:0,f:e};return n.log.setLevel(t,"none"),t},n.log.setLevel=function(e,t){var r=!1;if(e&&!(e.flags&n.log.LEVEL_LOCKED))for(var i=0;i<n.log.levels.length;++i){var a=n.log.levels[i];if(t==a){e.level=t,r=!0;break}}return r},n.log.lock=function(e,t){void 0===t||t?e.flags|=n.log.LEVEL_LOCKED:e.flags&=~n.log.LEVEL_LOCKED},n.log.addLogger=function(e){a.push(e)},"undefined"!=typeof console&&"log"in console){var l;if(console.error&&console.warn&&console.info&&console.debug){var f={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},p=function(e,t){n.log.prepareStandard(t);var r=f[t.level],i=[t.standard];i=i.concat(t.arguments.slice()),r.apply(console,i)};l=n.log.makeLogger(p)}else{var p=function(e,t){n.log.prepareStandardFull(t),console.log(t.standardFull)};l=n.log.makeLogger(p)}n.log.setLevel(l,"debug"),n.log.addLogger(l),o=l}else console={log:function(){}};if(null!==o){var h=n.util.getQueryVariables();"console.level"in h&&n.log.setLevel(o,h["console.level"].slice(-1)[0]),"console.lock"in h&&"true"==h["console.lock"].slice(-1)[0]&&n.log.lock(o)}n.log.consoleLogger=o},function(e,t,r){e.exports=r(35)},function(e,t,r){e.exports=r(0),r(5),r(37),r(3),r(13),r(31),r(10),r(39),r(8),r(40),r(33),r(41),r(30),r(15),r(7),r(26),r(28),r(42),r(20),r(27),r(24),r(17),r(2),r(25),r(43),r(44),r(19),r(1)},function(e,r){var n={};e.exports=n;var i={};n.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var i=0,a=t.length,o=t.charAt(0),s=[0];for(i=0;i<e.length;++i){for(var u=0,c=e[i];u<s.length;++u)c+=s[u]<<8,s[u]=c%a,c=c/a|0;for(;c>0;)s.push(c%a),c=c/a|0}for(i=0;0===e[i]&&i<e.length-1;++i)n+=o;for(i=s.length-1;i>=0;--i)n+=t[s[i]]}else n=function(e,t){var r=0,n=t.length,i=t.charAt(0),a=[0];for(r=0;r<e.length();++r){for(var o=0,s=e.at(r);o<a.length;++o)s+=a[o]<<8,a[o]=s%n,s=s/n|0;for(;s>0;)a.push(s%n),s=s/n|0}var u="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)u+=i;for(r=a.length-1;r>=0;--r)u+=t[a[r]];return u}(e,t);if(r){var l=new RegExp(".{1,"+r+"}","g");n=n.match(l).join("\r\n")}return n},n.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=i[r];if(!n){n=i[r]=[];for(var a=0;a<r.length;++a)n[r.charCodeAt(a)]=a}e=e.replace(/\s/g,"");for(var o=r.length,s=r.charAt(0),u=[0],a=0;a<e.length;a++){var c=n[e.charCodeAt(a)];if(void 0===c)return;for(var l=0,f=c;l<u.length;++l)f+=u[l]*o,u[l]=255&f,f>>=8;for(;f>0;)u.push(255&f),f>>=8}for(var p=0;e[p]===s&&p<e.length-1;++p)u.push(0);return void 0!==t?t.from(u.reverse()):new Uint8Array(u.reverse())}},function(e,t,r){function n(e,t,r){var n=t.entity===u.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:u.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:u.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=s,e.write.cipherFunction=i,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=c.hmac_sha1}function i(e,t){var r,n=!1,i=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(i),t.updateSequenceNumber(),r=e.version.minor===c.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:u.random.getBytesSync(16),t.cipherState.init=!0;var o=t.cipherState.cipher;return o.start({iv:r}),e.version.minor>=c.Versions.TLS_1_1.minor&&o.output.putBytes(r),o.update(e.fragment),o.finish(a)&&(e.fragment=o.output,e.length=e.fragment.length(),n=!0),n}function a(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function o(e,t,r){var n=!0;if(r){for(var i=t.length(),a=t.last(),o=i-1-a;o<i-1;++o)n=n&&t.at(o)==a;n&&t.truncate(a+1)}return n}function s(e,t){var r,n=!1;r=e.version.minor===c.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:e.fragment.getBytes(16),t.cipherState.init=!0;var i=t.cipherState.cipher;i.start({iv:r}),i.update(e.fragment),n=i.finish(o);var a=t.macLength,s=u.random.getBytesSync(a),l=i.output.length();l>=a?(e.fragment=i.output.getBytes(l-a),s=i.output.getBytes(a)):e.fragment=i.output.getBytes(),e.fragment=u.util.createBuffer(e.fragment),e.length=e.fragment.length();var f=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),n=function(e,t,r){var n=u.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}(t.macKey,s,f)&&n}var u=r(0);r(5),r(19);var c=e.exports=u.tls;c.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=c.BulkCipherAlgorithm.aes,e.cipher_type=c.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=c.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},c.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=c.BulkCipherAlgorithm.aes,e.cipher_type=c.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=c.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n}},function(e,t,r){var n=r(0);r(30),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},function(e,r,n){function i(e){var r=e.message;if(r instanceof Uint8Array)return r;var n=e.encoding;if(void 0===r){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');r=e.md.digest().getBytes(),n="binary"}if("string"==typeof r&&!n)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof r){if(void 0!==t)return new t(r,n);r=new R(r,n)}else if(!(r instanceof R))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var i=new N(r.length()),a=0;a<i.length;++a)i[a]=r.at(a);return i}function a(e,r){var n=_.md.sha512.create(),i=new R(e);n.update(i.getBytes(r),"binary");var a=n.digest().getBytes();if(void 0!==t)return new t(a,"binary");for(var o=new N(L.constants.HASH_BYTE_LENGTH),s=0;s<64;++s)o[s]=a.charCodeAt(s);return o}function o(e,t){var r,n=[T(),T(),T(),T()],i=a(t,32);for(i[0]&=248,i[31]&=127,i[31]|=64,b(n,i),h(e,n),r=0;r<32;++r)t[r+32]=e[r];return 0}function s(e,t,r,n){var i,o,s=new Float64Array(64),u=[T(),T(),T(),T()],f=a(n,32);f[0]&=248,f[31]&=127,f[31]|=64;var p=r+64;for(i=0;i<r;++i)e[64+i]=t[i];for(i=0;i<32;++i)e[32+i]=f[32+i];var d=a(e.subarray(32),r+32);for(l(d),b(u,d),h(e,u),i=32;i<64;++i)e[i]=n[i];var y=a(e,r+64);for(l(y),i=32;i<64;++i)s[i]=0;for(i=0;i<32;++i)s[i]=d[i];for(i=0;i<32;++i)for(o=0;o<32;o++)s[i+o]+=y[i]*f[o];return c(e.subarray(32),s),p}function u(e,t,r,n){var i,o=new N(32),s=[T(),T(),T(),T()],u=[T(),T(),T(),T()];if(r<64)return-1;if(function(e,t){var r=T(),n=T(),i=T(),a=T(),o=T(),s=T(),u=T();return C(e[2],O),function(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(e[1],t),w(i,e[1]),I(a,i,U),B(i,i,e[2]),A(a,e[2],a),w(o,a),w(s,o),I(u,s,o),I(r,u,i),I(r,r,a),function(e,t){var r,n=T();for(r=0;r<16;++r)n[r]=t[r];for(r=250;r>=0;--r)w(n,n),1!==r&&I(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(r,r),I(r,r,i),I(r,r,a),I(r,r,a),I(e[0],r,a),w(n,e[0]),I(n,n,a),y(n,i)&&I(e[0],e[0],M),w(n,e[0]),I(n,n,a),y(n,i)?-1:(v(e[0])===t[31]>>7&&B(e[0],D,e[0]),I(e[3],e[0],e[1]),0)}(u,n))return-1;for(i=0;i<r;++i)e[i]=t[i];for(i=0;i<32;++i)e[i+32]=n[i];var c=a(e,r);if(l(c),m(s,u,c),b(u,t.subarray(32)),f(s,u),h(o,s),r-=64,g(t,0,o,0)){for(i=0;i<r;++i)e[i]=0;return-1}for(i=0;i<r;++i)e[i]=t[i+64];return r}function c(e,t){var r,n,i,a;for(n=63;n>=32;--n){for(r=0,i=n-32,a=n-12;i<a;++i)t[i]+=r-16*t[n]*V[i-(n-32)],r=t[i]+128>>8,t[i]-=256*r;t[i]+=r,t[n]=0}for(r=0,i=0;i<32;++i)t[i]+=r-(t[31]>>4)*V[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;++i)t[i]-=r*V[i];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function l(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;c(e,t)}function f(e,t){var r=T(),n=T(),i=T(),a=T(),o=T(),s=T(),u=T(),c=T(),l=T();B(r,e[1],e[0]),B(l,t[1],t[0]),I(r,r,l),A(n,e[0],e[1]),A(l,t[0],t[1]),I(n,n,l),I(i,e[3],t[3]),I(i,i,P),I(a,e[2],t[2]),A(a,a,a),B(o,n,r),B(s,a,i),A(u,a,i),A(c,n,r),I(e[0],o,s),I(e[1],c,u),I(e[2],u,s),I(e[3],o,c)}function p(e,t,r){for(var n=0;n<4;++n)S(e[n],t[n],r)}function h(e,t){var r=T(),n=T(),i=T();(function(e,t){var r,n=T();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)w(n,n),2!==r&&4!==r&&I(n,n,t);for(r=0;r<16;++r)e[r]=n[r]})(i,t[2]),I(r,t[0],i),I(n,t[1],i),d(e,n),e[31]^=v(r)<<7}function d(e,t){var r,n,i,a=T(),o=T();for(r=0;r<16;++r)o[r]=t[r];for(E(o),E(o),E(o),n=0;n<2;++n){for(a[0]=o[0]-65517,r=1;r<15;++r)a[r]=o[r]-65535-(a[r-1]>>16&1),a[r-1]&=65535;a[15]=o[15]-32767-(a[14]>>16&1),i=a[15]>>16&1,a[14]&=65535,S(o,a,1-i)}for(r=0;r<16;r++)e[2*r]=255&o[r],e[2*r+1]=o[r]>>8}function y(e,t){var r=new N(32),n=new N(32);return d(r,e),d(n,t),g(r,0,n,0)}function g(e,t,r,n){return function(e,t,r,n,i){var a,o=0;for(a=0;a<i;++a)o|=e[t+a]^r[n+a];return(1&o-1>>>8)-1}(e,t,r,n,32)}function v(e){var t=new N(32);return d(t,e),1&t[0]}function m(e,t,r){var n,i;for(C(e[0],D),C(e[1],O),C(e[2],O),C(e[3],D),i=255;i>=0;--i)n=r[i/8|0]>>(7&i)&1,p(e,t,n),f(t,e),f(e,e),p(e,t,n)}function b(e,t){var r=[T(),T(),T(),T()];C(r[0],x),C(r[1],F),C(r[2],O),I(r[3],x,F),m(e,r,t)}function C(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function E(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function S(e,t,r){for(var n,i=~(r-1),a=0;a<16;++a)n=i&(e[a]^t[a]),e[a]^=n,t[a]^=n}function T(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;++t)r[t]=e[t];return r}function A(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]+r[n]}function B(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]-r[n]}function w(e,t){I(e,t,t)}function I(e,t,r){var n,i,a=0,o=0,s=0,u=0,c=0,l=0,f=0,p=0,h=0,d=0,y=0,g=0,v=0,m=0,b=0,C=0,E=0,S=0,T=0,A=0,B=0,w=0,I=0,_=0,k=0,R=0,N=0,L=0,D=0,O=0,U=0,P=r[0],x=r[1],F=r[2],V=r[3],M=r[4],j=r[5],K=r[6],H=r[7],z=r[8],G=r[9],q=r[10],Y=r[11],Q=r[12],W=r[13],X=r[14],Z=r[15];n=t[0],a+=n*P,o+=n*x,s+=n*F,u+=n*V,c+=n*M,l+=n*j,f+=n*K,p+=n*H,h+=n*z,d+=n*G,y+=n*q,g+=n*Y,v+=n*Q,m+=n*W,b+=n*X,C+=n*Z,n=t[1],o+=n*P,s+=n*x,u+=n*F,c+=n*V,l+=n*M,f+=n*j,p+=n*K,h+=n*H,d+=n*z,y+=n*G,g+=n*q,v+=n*Y,m+=n*Q,b+=n*W,C+=n*X,E+=n*Z,n=t[2],s+=n*P,u+=n*x,c+=n*F,l+=n*V,f+=n*M,p+=n*j,h+=n*K,d+=n*H,y+=n*z,g+=n*G,v+=n*q,m+=n*Y,b+=n*Q,C+=n*W,E+=n*X,S+=n*Z,n=t[3],u+=n*P,c+=n*x,l+=n*F,f+=n*V,p+=n*M,h+=n*j,d+=n*K,y+=n*H,g+=n*z,v+=n*G,m+=n*q,b+=n*Y,C+=n*Q,E+=n*W,S+=n*X,T+=n*Z,n=t[4],c+=n*P,l+=n*x,f+=n*F,p+=n*V,h+=n*M,d+=n*j,y+=n*K,g+=n*H,v+=n*z,m+=n*G,b+=n*q,C+=n*Y,E+=n*Q,S+=n*W,T+=n*X,A+=n*Z,n=t[5],l+=n*P,f+=n*x,p+=n*F,h+=n*V,d+=n*M,y+=n*j,g+=n*K,v+=n*H,m+=n*z,b+=n*G,C+=n*q,E+=n*Y,S+=n*Q,T+=n*W,A+=n*X,B+=n*Z,n=t[6],f+=n*P,p+=n*x,h+=n*F,d+=n*V,y+=n*M,g+=n*j,v+=n*K,m+=n*H,b+=n*z,C+=n*G,E+=n*q,S+=n*Y,T+=n*Q,A+=n*W,B+=n*X,w+=n*Z,n=t[7],p+=n*P,h+=n*x,d+=n*F,y+=n*V,g+=n*M,v+=n*j,m+=n*K,b+=n*H,C+=n*z,E+=n*G,S+=n*q,T+=n*Y,A+=n*Q,B+=n*W,w+=n*X,I+=n*Z,n=t[8],h+=n*P,d+=n*x,y+=n*F,g+=n*V,v+=n*M,m+=n*j,b+=n*K,C+=n*H,E+=n*z,S+=n*G,T+=n*q,A+=n*Y,B+=n*Q,w+=n*W,I+=n*X,_+=n*Z,n=t[9],d+=n*P,y+=n*x,g+=n*F,v+=n*V,m+=n*M,b+=n*j,C+=n*K,E+=n*H,S+=n*z,T+=n*G,A+=n*q,B+=n*Y,w+=n*Q,I+=n*W,_+=n*X,k+=n*Z,n=t[10],y+=n*P,g+=n*x,v+=n*F,m+=n*V,b+=n*M,C+=n*j,E+=n*K,S+=n*H,T+=n*z,A+=n*G,B+=n*q,w+=n*Y,I+=n*Q,_+=n*W,k+=n*X,R+=n*Z,n=t[11],g+=n*P,v+=n*x,m+=n*F,b+=n*V,C+=n*M,E+=n*j,S+=n*K,T+=n*H,A+=n*z,B+=n*G,w+=n*q,I+=n*Y,_+=n*Q,k+=n*W,R+=n*X,N+=n*Z,n=t[12],v+=n*P,m+=n*x,b+=n*F,C+=n*V,E+=n*M,S+=n*j,T+=n*K,A+=n*H,B+=n*z,w+=n*G,I+=n*q,_+=n*Y,k+=n*Q,R+=n*W,N+=n*X,L+=n*Z,n=t[13],m+=n*P,b+=n*x,C+=n*F,E+=n*V,S+=n*M,T+=n*j,A+=n*K,B+=n*H,w+=n*z,I+=n*G,_+=n*q,k+=n*Y,R+=n*Q,N+=n*W,L+=n*X,D+=n*Z,n=t[14],b+=n*P,C+=n*x,E+=n*F,S+=n*V,T+=n*M,A+=n*j,B+=n*K,w+=n*H,I+=n*z,_+=n*G,k+=n*q,R+=n*Y,N+=n*Q,L+=n*W,D+=n*X,O+=n*Z,n=t[15],C+=n*P,o+=38*(S+=n*F),s+=38*(T+=n*V),u+=38*(A+=n*M),c+=38*(B+=n*j),l+=38*(w+=n*K),f+=38*(I+=n*H),p+=38*(_+=n*z),h+=38*(k+=n*G),d+=38*(R+=n*q),y+=38*(N+=n*Y),g+=38*(L+=n*Q),v+=38*(D+=n*W),m+=38*(O+=n*X),b+=38*(U+=n*Z),n=(a+=38*(E+=n*x))+(i=1)+65535,i=Math.floor(n/65536),a=n-65536*i,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=C+i+65535,i=Math.floor(n/65536),C=n-65536*i,n=(a+=i-1+37*(i-1))+(i=1)+65535,i=Math.floor(n/65536),a=n-65536*i,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=C+i+65535,i=Math.floor(n/65536),C=n-65536*i,a+=i-1+37*(i-1),e[0]=a,e[1]=o,e[2]=s,e[3]=u,e[4]=c,e[5]=l,e[6]=f,e[7]=p,e[8]=h,e[9]=d,e[10]=y,e[11]=g,e[12]=v,e[13]=m,e[14]=b,e[15]=C}var _=n(0);if(n(12),n(2),n(32),n(1),void 0===k)var k=_.jsbn.BigInteger;var R=_.util.ByteBuffer,N=void 0===t?Uint8Array:t;_.pki=_.pki||{},e.exports=_.pki.ed25519=_.ed25519=_.ed25519||{};var L=_.ed25519;L.constants={},L.constants.PUBLIC_KEY_BYTE_LENGTH=32,L.constants.PRIVATE_KEY_BYTE_LENGTH=64,L.constants.SEED_BYTE_LENGTH=32,L.constants.SIGN_BYTE_LENGTH=64,L.constants.HASH_BYTE_LENGTH=64,L.generateKeyPair=function(e){var t=(e=e||{}).seed;if(void 0===t)t=_.random.getBytesSync(L.constants.SEED_BYTE_LENGTH);else if("string"==typeof t){if(t.length!==L.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+L.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');t=i({message:t,encoding:"binary"});for(var r=new N(L.constants.PUBLIC_KEY_BYTE_LENGTH),n=new N(L.constants.PRIVATE_KEY_BYTE_LENGTH),a=0;a<32;++a)n[a]=t[a];return o(r,n),{publicKey:r,privateKey:n}},L.publicKeyFromPrivateKey=function(e){var t=i({message:(e=e||{}).privateKey,encoding:"binary"});if(t.length!==L.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+L.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new N(L.constants.PUBLIC_KEY_BYTE_LENGTH),n=0;n<r.length;++n)r[n]=t[32+n];return r},L.sign=function(e){var t=i(e=e||{}),r=i({message:e.privateKey,encoding:"binary"});if(r.length!==L.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+L.constants.PRIVATE_KEY_BYTE_LENGTH);var n=new N(L.constants.SIGN_BYTE_LENGTH+t.length);s(n,t,t.length,r);for(var a=new N(L.constants.SIGN_BYTE_LENGTH),o=0;o<a.length;++o)a[o]=n[o];return a},L.verify=function(e){var t=i(e=e||{});if(void 0===e.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var r=i({message:e.signature,encoding:"binary"});if(r.length!==L.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+L.constants.SIGN_BYTE_LENGTH);var n=i({message:e.publicKey,encoding:"binary"});if(n.length!==L.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+L.constants.PUBLIC_KEY_BYTE_LENGTH);var a,o=new N(L.constants.SIGN_BYTE_LENGTH+t.length),s=new N(L.constants.SIGN_BYTE_LENGTH+t.length);for(a=0;a<L.constants.SIGN_BYTE_LENGTH;++a)o[a]=r[a];for(a=0;a<t.length;++a)o[a+L.constants.SIGN_BYTE_LENGTH]=t[a];return u(s,o,o.length,n)>=0};var D=T(),O=T([1]),U=T([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),P=T([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),x=T([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),F=T([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),V=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),M=T([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139])},function(e,t,r){function n(e,t,r,n){e.generate=function(e,a){for(var o=new i.util.ByteBuffer,s=Math.ceil(a/n)+r,u=new i.util.ByteBuffer,c=r;c<s;++c){u.putInt32(c),t.start(),t.update(e+u.getBytes());var l=t.digest();o.putBytes(l.getBytes(n))}return o.truncate(o.length()-a),o.getBytes()}}var i=r(0);r(1),r(2),r(12),e.exports=i.kem=i.kem||{};var a=i.jsbn.BigInteger;i.kem.rsa={},i.kem.rsa.create=function(e,t){var r=(t=t||{}).prng||i.random,n={encrypt:function(t,n){var o,s=Math.ceil(t.n.bitLength()/8);do{o=new a(i.util.bytesToHex(r.getBytesSync(s)),16).mod(t.n)}while(o.equals(a.ZERO));o=i.util.hexToBytes(o.toString(16));var u=s-o.length;return u>0&&(o=i.util.fillString(String.fromCharCode(0),u)+o),{encapsulation:t.encrypt(o,"NONE"),key:e.generate(o,n)}},decrypt:function(t,r,n){var i=t.decrypt(r,"NONE");return e.generate(i,n)}};return n},i.kem.kdf1=function(e,t){n(this,e,0,t||e.digestLength)},i.kem.kdf2=function(e,t){n(this,e,1,t||e.digestLength)}},function(e,t,r){e.exports=r(4),r(14),r(9),r(23),r(32)},function(e,t,r){function n(e){var t={},r=[];if(!h.validate(e,d.asn1.recipientInfoValidator,t,r)){var n=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw n.errors=r,n}return{version:t.version.charCodeAt(0),issuer:p.pki.RDNAttributesAsArray(t.issuer),serialNumber:p.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:h.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function i(e){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.version).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[p.pki.distinguishedNameToAsn1({attributes:e.issuer}),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,p.util.hexToBytes(e.serialNumber))]),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.encryptedContent.algorithm).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")]),h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function a(e){for(var t=[],r=0;r<e.length;++r)t.push(i(e[r]));return t}function o(e){var t=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.version).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[p.pki.distinguishedNameToAsn1({attributes:e.issuer}),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,p.util.hexToBytes(e.serialNumber))]),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.digestAlgorithm).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&t.value.push(e.authenticatedAttributesAsn1),t.value.push(h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.signatureAlgorithm).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")])),t.value.push(h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var r=h.create(h.Class.CONTEXT_SPECIFIC,1,!0,[]),n=0;n<e.unauthenticatedAttributes.length;++n){var i=e.unauthenticatedAttributes[n];r.values.push(u(i))}t.value.push(r)}return t}function s(e){for(var t=[],r=0;r<e.length;++r)t.push(o(e[r]));return t}function u(e){var t;if(e.type===p.pki.oids.contentType)t=h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.value).getBytes());else if(e.type===p.pki.oids.messageDigest)t=h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===p.pki.oids.signingTime){var r=new Date("1950-01-01T00:00:00Z"),n=new Date("2050-01-01T00:00:00Z"),i=e.value;if("string"==typeof i){var a=Date.parse(i);i=isNaN(a)?13===i.length?h.utcTimeToDate(i):h.generalizedTimeToDate(i):new Date(a)}t=i>=r&&i<n?h.create(h.Class.UNIVERSAL,h.Type.UTCTIME,!1,h.dateToUtcTime(i)):h.create(h.Class.UNIVERSAL,h.Type.GENERALIZEDTIME,!1,h.dateToGeneralizedTime(i))}return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.type).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[t])])}function c(e){return[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(p.pki.oids.data).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.algorithm).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,e.parameter.getBytes())]),h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,e.content.getBytes())])]}function l(e,t,r){var n={};if(!h.validate(t,r,n,[])){var i=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw i.errors=i,i}if(h.derToOid(n.contentType)!==p.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(n.encryptedContent){var a="";if(p.util.isArray(n.encryptedContent))for(var o=0;o<n.encryptedContent.length;++o){if(n.encryptedContent[o].type!==h.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");a+=n.encryptedContent[o].value}else a=n.encryptedContent;e.encryptedContent={algorithm:h.derToOid(n.encAlgorithm),parameter:p.util.createBuffer(n.encParameter.value),content:p.util.createBuffer(a)}}if(n.content){var a="";if(p.util.isArray(n.content))for(var o=0;o<n.content.length;++o){if(n.content[o].type!==h.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");a+=n.content[o].value}else a=n.content;e.content=p.util.createBuffer(a)}return e.version=n.version.charCodeAt(0),e.rawCapture=n,n}function f(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 p.pki.oids["aes128-CBC"]:case p.pki.oids["aes192-CBC"]:case p.pki.oids["aes256-CBC"]:t=p.aes.createDecryptionCipher(e.encryptedContent.key);break;case p.pki.oids.desCBC:case p.pki.oids["des-EDE3-CBC"]:t=p.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}}var p=r(0);r(5),r(3),r(10),r(6),r(7),r(29),r(2),r(1),r(16);var h=p.asn1,d=e.exports=p.pkcs7=p.pkcs7||{};d.messageFromPem=function(e){var t=p.pem.decode(e)[0];if("PKCS7"!==t.type){var r=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var n=h.fromDer(t.body);return d.messageFromAsn1(n)},d.messageToPem=function(e,t){var r={type:"PKCS7",body:h.toDer(e.toAsn1()).getBytes()};return p.pem.encode(r,{maxline:t})},d.messageFromAsn1=function(e){var t={},r=[];if(!h.validate(e,d.asn1.contentInfoValidator,t,r)){var n=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw n.errors=r,n}var i,a=h.derToOid(t.contentType);switch(a){case p.pki.oids.envelopedData:i=d.createEnvelopedData();break;case p.pki.oids.encryptedData:i=d.createEncryptedData();break;case p.pki.oids.signedData:i=d.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+a+" is not (yet) supported.")}return i.fromAsn1(t.content.value[0]),i},d.createSignedData=function(){var e=null;return e={type:p.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(t){if(l(e,t,d.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var r=e.rawCapture.certificates.value,n=0;n<r.length;++n)e.certificates.push(p.pki.certificateFromAsn1(r[n]))},toAsn1:function(){e.contentInfo||e.sign();for(var t=[],r=0;r<e.certificates.length;++r)t.push(p.pki.certificateToAsn1(e.certificates[r]));var n=[],i=h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.version).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return t.length>0&&i.value[0].value.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!0,t)),n.length>0&&i.value[0].value.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,n)),i.value[0].value.push(h.create(h.Class.UNIVERSAL,h.Type.SET,!0,e.signerInfos)),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.type).getBytes()),i])},addSigner:function(t){var r=t.issuer,n=t.serialNumber;if(t.certificate){var i=t.certificate;"string"==typeof i&&(i=p.pki.certificateFromPem(i)),r=i.issuer.attributes,n=i.serialNumber}var a=t.key;if(!a)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof a&&(a=p.pki.privateKeyFromPem(a));var o=t.digestAlgorithm||p.pki.oids.sha1;switch(o){case p.pki.oids.sha1:case p.pki.oids.sha256:case p.pki.oids.sha384:case p.pki.oids.sha512:case p.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+o)}var s=t.authenticatedAttributes||[];if(s.length>0){for(var u=!1,c=!1,l=0;l<s.length;++l){var f=s[l];if(u||f.type!==p.pki.oids.contentType){if(c||f.type!==p.pki.oids.messageDigest);else if(c=!0,u)break}else if(u=!0,c)break}if(!u||!c)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}e.signers.push({key:a,version:1,issuer:r,serialNumber:n,digestAlgorithm:o,signatureAlgorithm:p.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:s,unauthenticatedAttributes:[]})},sign:function(t){var r;t=t||{},("object"!=typeof e.content||null===e.contentInfo)&&(e.contentInfo=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(p.pki.oids.data).getBytes())]),"content"in e)&&(e.content instanceof p.util.ByteBuffer?r=e.content.bytes():"string"==typeof e.content&&(r=p.util.encodeUtf8(e.content)),t.detached?e.detachedContent=h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,r):e.contentInfo.value.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,r)]))),0!==e.signers.length&&function(t){var r;if(!(r=e.detachedContent?e.detachedContent:(r=e.contentInfo.value[1]).value[0]))throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var n=h.derToOid(e.contentInfo.value[0].value),i=h.toDer(r);for(var a in i.getByte(),h.getBerValueLength(i),i=i.getBytes(),t)t[a].start().update(i);for(var o=new Date,c=0;c<e.signers.length;++c){var l=e.signers[c];if(0===l.authenticatedAttributes.length){if(n!==p.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{l.authenticatedAttributesAsn1=h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var f=h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[]),d=0;d<l.authenticatedAttributes.length;++d){var y=l.authenticatedAttributes[d];y.type===p.pki.oids.messageDigest?y.value=t[l.digestAlgorithm].digest():y.type===p.pki.oids.signingTime&&(y.value||(y.value=o)),f.value.push(u(y)),l.authenticatedAttributesAsn1.value.push(u(y))}i=h.toDer(f).getBytes(),l.md.start().update(i)}l.signature=l.key.sign(l.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=s(e.signers)}(function(){for(var t={},r=0;r<e.signers.length;++r){var n=e.signers[r],i=n.digestAlgorithm;i in t||(t[i]=p.md[p.pki.oids[i]].create()),0===n.authenticatedAttributes.length?n.md=t[i]:n.md=p.md[p.pki.oids[i]].create()}for(var i in e.digestAlgorithmIdentifiers=[],t)e.digestAlgorithmIdentifiers.push(h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(i).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")]));return t}())},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(t){"string"==typeof t&&(t=p.pki.certificateFromPem(t)),e.certificates.push(t)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},d.createEncryptedData=function(){var e=null;return e={type:p.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:p.pki.oids["aes256-CBC"]},fromAsn1:function(t){l(e,t,d.asn1.encryptedDataValidator)},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),f(e)}}},d.createEnvelopedData=function(){var e=null;return e={type:p.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:p.pki.oids["aes256-CBC"]},fromAsn1:function(t){var r=l(e,t,d.asn1.envelopedDataValidator);e.recipients=function(e){for(var t=[],r=0;r<e.length;++r)t.push(n(e[r]));return t}(r.recipientInfos.value)},toAsn1:function(){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.type).getBytes()),h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.version).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,a(e.recipients)),h.create(h.Class.UNIVERSAL,h.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;if(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,r){if(void 0===e.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case p.pki.oids.rsaEncryption:case p.pki.oids.desCBC:var n=r.decrypt(t.encryptedContent.content);e.encryptedContent.key=p.util.createBuffer(n);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:p.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(void 0===e.encryptedContent.content){var n,i,a;switch(r=r||e.encryptedContent.algorithm,t=t||e.encryptedContent.key,r){case p.pki.oids["aes128-CBC"]:n=16,i=16,a=p.aes.createEncryptionCipher;break;case p.pki.oids["aes192-CBC"]:n=24,i=16,a=p.aes.createEncryptionCipher;break;case p.pki.oids["aes256-CBC"]:n=32,i=16,a=p.aes.createEncryptionCipher;break;case p.pki.oids["des-EDE3-CBC"]:n=24,i=8,a=p.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===t)t=p.util.createBuffer(p.random.getBytes(n));else if(t.length()!=n)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+n+".");e.encryptedContent.algorithm=r,e.encryptedContent.key=t,e.encryptedContent.parameter=p.util.createBuffer(p.random.getBytes(i));var o=a(t);if(o.start(e.encryptedContent.parameter.copy()),o.update(e.content),!o.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=o.output}for(var s=0;s<e.recipients.length;++s){var u=e.recipients[s];if(void 0===u.encryptedContent.content)switch(u.encryptedContent.algorithm){case p.pki.oids.rsaEncryption:u.encryptedContent.content=u.encryptedContent.key.encrypt(e.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+u.encryptedContent.algorithm)}}}}}},function(e,t,r){function n(e,t){var r=t.toString(16);r[0]>="8"&&(r="00"+r);var n=o.util.hexToBytes(r);e.putInt32(n.length),e.putBytes(n)}function i(e,t){e.putInt32(t.length),e.putString(t)}function a(){for(var e=o.md.sha1.create(),t=arguments.length,r=0;r<t;++r)e.update(arguments[r]);return e.digest()}var o=r(0);r(5),r(8),r(14),r(9),r(1);var s=e.exports=o.ssh=o.ssh||{};s.privateKeyToPutty=function(e,t,r){var s=""===(t=t||"")?"none":"aes256-cbc",u="PuTTY-User-Key-File-2: ssh-rsa\r\n";u+="Encryption: "+s+"\r\n",u+="Comment: "+(r=r||"")+"\r\n";var c=o.util.createBuffer();i(c,"ssh-rsa"),n(c,e.e),n(c,e.n);var l=o.util.encode64(c.bytes(),64),f=Math.floor(l.length/66)+1;u+="Public-Lines: "+f+"\r\n",u+=l;var p,h=o.util.createBuffer();if(n(h,e.d),n(h,e.p),n(h,e.q),n(h,e.qInv),t){var d=h.length()+16-1;d-=d%16;var y=a(h.bytes());y.truncate(y.length()-d+h.length()),h.putBuffer(y);var g=o.util.createBuffer();g.putBuffer(a("\0\0\0\0",t)),g.putBuffer(a("\0\0\0",t));var v=o.aes.createEncryptionCipher(g.truncate(8),"CBC");v.start(o.util.createBuffer().fillWithByte(0,16)),v.update(h.copy()),v.finish();var m=v.output;m.truncate(16),p=o.util.encode64(m.bytes(),64)}else p=o.util.encode64(h.bytes(),64);f=Math.floor(p.length/66)+1,u+="\r\nPrivate-Lines: "+f+"\r\n",u+=p;var b=a("putty-private-key-file-mac-key",t),C=o.util.createBuffer();i(C,"ssh-rsa"),i(C,s),i(C,r),C.putInt32(c.length()),C.putBuffer(c),C.putInt32(h.length()),C.putBuffer(h);var E=o.hmac.create();return E.start("sha1",b),E.update(C.bytes()),u+="\r\nPrivate-MAC: "+E.digest().toHex()+"\r\n"},s.publicKeyToOpenSSH=function(e,t){t=t||"";var r=o.util.createBuffer();return i(r,"ssh-rsa"),n(r,e.e),n(r,e.n),"ssh-rsa "+o.util.encode64(r.bytes())+" "+t},s.privateKeyToOpenSSH=function(e,t){return t?o.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:"aes128"}):o.pki.privateKeyToPem(e)},s.getPublicKeyFingerprint=function(e,t){var r=(t=t||{}).md||o.md.md5.create(),a=o.util.createBuffer();i(a,"ssh-rsa"),n(a,e.e),n(a,e.n),r.start(),r.update(a.getBytes());var s=r.digest();if("hex"===t.encoding){var u=s.toHex();return t.delimiter?u.match(/.{2}/g).join(t.delimiter):u}if("binary"===t.encoding)return s.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return s}},function(e,t,r){var n=r(0);r(31),r(33),r(1);var i="forge.task",a={},o=0;n.debug.set(i,"tasks",a);var s={};n.debug.set(i,"queues",s);var u="ready",c="running",l="blocked",f="sleeping",p="done",h="error",d="stop",y="start",g={ready:{}};g[u][d]=u,g[u][y]=c,g[u].cancel=p,g[u].fail=h,g[c]={},g[c][d]=u,g[c][y]=c,g[c].block=l,g[c].unblock=c,g[c].sleep=f,g[c].wakeup=c,g[c].cancel=p,g[c].fail=h,g[l]={},g[l][d]=l,g[l][y]=l,g[l].block=l,g[l].unblock=l,g[l].sleep=l,g[l].wakeup=l,g[l].cancel=p,g[l].fail=h,g[f]={},g[f][d]=f,g[f][y]=f,g[f].block=f,g[f].unblock=f,g[f].sleep=f,g[f].wakeup=f,g[f].cancel=p,g[f].fail=h,g[p]={},g[p][d]=p,g[p][y]=p,g[p].block=p,g[p].unblock=p,g[p].sleep=p,g[p].wakeup=p,g[p].cancel=p,g[p].fail=h,g[h]={},g[h][d]=h,g[h][y]=h,g[h].block=h,g[h].unblock=h,g[h].sleep=h,g[h].wakeup=h,g[h].cancel=h,g[h].fail=h;var v=function(e){this.id=-1,this.name=e.name||"?",this.parent=e.parent||null,this.run=e.run,this.subtasks=[],this.error=!1,this.state=u,this.blocks=0,this.timeoutId=null,this.swapTime=null,this.userData=null,this.id=o++,a[this.id]=this};v.prototype.debug=function(e){e=e||"",n.log.debug(i,e,"[%s][%s] task:",this.id,this.name,this,"subtasks:",this.subtasks.length,"queue:",s)},v.prototype.next=function(e,t){"function"==typeof e&&(t=e,e=this.name);var r=new v({run:t,name:e,parent:this});return r.state=c,r.type=this.type,r.successCallback=this.successCallback||null,r.failureCallback=this.failureCallback||null,this.subtasks.push(r),this},v.prototype.parallel=function(e,t){return n.util.isArray(e)&&(t=e,e=this.name),this.next(e,function(r){var i=r;i.block(t.length);for(var a=0;a<t.length;a++){var o=e+"__parallel-"+r.id+"-"+a,s=a;!function(e,r){n.task.start({type:e,run:function(e){t[r](e)},success:function(e){i.unblock()},failure:function(e){i.unblock()}})}(o,s)}})},v.prototype.stop=function(){this.state=g[this.state][d]},v.prototype.start=function(){this.error=!1,this.state=g[this.state][y],this.state===c&&(this.start=new Date,this.run(this),m(this,0))},v.prototype.block=function(e){e=void 0===e?1:e,this.blocks+=e,this.blocks>0&&(this.state=g[this.state].block)},v.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==p&&(this.state=c,m(this,0)),this.blocks},v.prototype.sleep=function(e){e=void 0===e?0:e,this.state=g[this.state].sleep;var t=this;this.timeoutId=setTimeout(function(){t.timeoutId=null,t.state=c,m(t,0)},e)},v.prototype.wait=function(e){e.wait(this)},v.prototype.wakeup=function(){this.state===f&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=c,m(this,0))},v.prototype.cancel=function(){this.state=g[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},v.prototype.fail=function(e){if(this.error=!0,b(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,m(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;b(t,!0)}this.failureCallback&&this.failureCallback(this)}};var m=function(e,t){var r=t>30||+new Date-e.swapTime>20,n=function(t){if(t++,e.state===c)if(r&&(e.swapTime=+new Date),e.subtasks.length>0){var n=e.subtasks.shift();n.error=e.error,n.swapTime=e.swapTime,n.userData=e.userData,n.run(n),n.error||m(n,t)}else b(e),e.error||null!==e.parent&&(e.parent.error=e.error,e.parent.swapTime=e.swapTime,e.parent.userData=e.userData,m(e.parent,t))};r?setTimeout(n,0):n(t)},b=function(e,t){e.state=p,delete a[e.id],null===e.parent&&(e.type in s?0===s[e.type].length?n.log.error(i,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):s[e.type][0]!==e?n.log.error(i,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(s[e.type].shift(),0===s[e.type].length?delete s[e.type]:s[e.type][0].start()):n.log.error(i,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};e.exports=n.task=n.task||{},n.task.start=function(e){var t=new v({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in s?s[e.type].push(t):(s[t.type]=[t],function(e){e.error=!1,e.state=g[e.state][y],setTimeout(function(){e.state===c&&(e.swapTime=+new Date,e.run(e),m(e,0))},0)}(t))},n.task.cancel=function(e){e in s&&(s[e]=[s[e][0]])},n.task.createCondition=function(){var e={tasks:{},wait:function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},notify:function(){var t=e.tasks;for(var r in e.tasks={},t)t[r].unblock()}};return e}}])}).call(this,r(5).Buffer,r(21),r(449).setImmediate)},4:function(e,t,r){var n;!function(i){"use strict";var a,o=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,s=Math.ceil,u=Math.floor,c="[BigNumber Error] ",l=c+"Number primitive has more than 15 significant digits: ",f=1e14,p=14,h=9007199254740991,d=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,g=1e9;function v(e){var t=0|e;return e>0||e===t?t:t-1}function m(e){for(var t,r,n=1,i=e.length,a=e[0]+"";n<i;){for(t=e[n++]+"",r=p-t.length;r--;t="0"+t);a+=t}for(i=a.length;48===a.charCodeAt(--i););return a.slice(0,i+1||1)}function b(e,t){var r,n,i=e.c,a=t.c,o=e.s,s=t.s,u=e.e,c=t.e;if(!o||!s)return null;if(r=i&&!i[0],n=a&&!a[0],r||n)return r?n?0:-s:o;if(o!=s)return o;if(r=o<0,n=u==c,!i||!a)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(s=(u=i.length)<(c=a.length)?u:c,o=0;o<s;o++)if(i[o]!=a[o])return i[o]>a[o]^r?1:-1;return u==c?0:u>c^r?1:-1}function C(e,t,r,n){if(e<t||e>r||e!==(e<0?s(e):u(e)))throw Error(c+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function E(e){var t=e.c.length-1;return v(e.e/p)==t&&e.c[t]%2!=0}function S(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function T(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}(a=function e(t){var r,n,i,a,A,B,w,I,_,k=K.prototype={constructor:K,toString:null,valueOf:null},R=new K(1),N=20,L=4,D=-7,O=21,U=-1e7,P=1e7,x=!1,F=1,V=0,M={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},j="0123456789abcdefghijklmnopqrstuvwxyz";function K(e,t){var r,a,s,c,f,d,y,g,v=this;if(!(v instanceof K))return new K(e,t);if(null==t){if(e instanceof K)return v.s=e.s,v.e=e.e,void(v.c=(e=e.c)?e.slice():e);if((d="number"==typeof e)&&0*e==0){if(v.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,f=e;f>=10;f/=10,c++);return v.e=c,void(v.c=[e])}g=String(e)}else{if(g=String(e),!o.test(g))return i(v,g,d);v.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(c=g.indexOf("."))>-1&&(g=g.replace(".","")),(f=g.search(/e/i))>0?(c<0&&(c=f),c+=+g.slice(f+1),g=g.substring(0,f)):c<0&&(c=g.length)}else{if(C(t,2,j.length,"Base"),g=String(e),10==t)return q(v=new K(e instanceof K?e:g),N+v.e+1,L);if(d="number"==typeof e){if(0*e!=0)return i(v,g,d,t);if(v.s=1/e<0?(g=g.slice(1),-1):1,K.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(l+e);d=!1}else v.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(r=j.slice(0,t),c=f=0,y=g.length;f<y;f++)if(r.indexOf(a=g.charAt(f))<0){if("."==a){if(f>c){c=y;continue}}else if(!s&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){s=!0,f=-1,c=0;continue}return i(v,String(e),d,t)}(c=(g=n(g,t,10,v.s)).indexOf("."))>-1?g=g.replace(".",""):c=g.length}for(f=0;48===g.charCodeAt(f);f++);for(y=g.length;48===g.charCodeAt(--y););if(g=g.slice(f,++y)){if(y-=f,d&&K.DEBUG&&y>15&&(e>h||e!==u(e)))throw Error(l+v.s*e);if((c=c-f-1)>P)v.c=v.e=null;else if(c<U)v.c=[v.e=0];else{if(v.e=c,v.c=[],f=(c+1)%p,c<0&&(f+=p),f<y){for(f&&v.c.push(+g.slice(0,f)),y-=p;f<y;)v.c.push(+g.slice(f,f+=p));g=g.slice(f),f=p-g.length}else f-=y;for(;f--;g+="0");v.c.push(+g)}}else v.c=[v.e=0]}function H(e,t,r,n){var i,a,o,s,u;if(null==r?r=L:C(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)u=m(e.c),u=1==n||2==n&&(o<=D||o>=O)?S(u,o):T(u,o,"0");else if(a=(e=q(new K(e),t,r)).e,s=(u=m(e.c)).length,1==n||2==n&&(t<=a||a<=D)){for(;s<t;u+="0",s++);u=S(u,a)}else if(t-=o,u=T(u,a,"0"),a+1>s){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=a-s)>0)for(a+1==s&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function z(e,t){for(var r,n=1,i=new K(e[0]);n<e.length;n++){if(!(r=new K(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function G(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*p-1)>P?e.c=e.e=null:r<U?e.c=[e.e=0]:(e.e=r,e.c=t),e}function q(e,t,r,n){var i,a,o,c,l,h,y,g=e.c,v=d;if(g){e:{for(i=1,c=g[0];c>=10;c/=10,i++);if((a=t-i)<0)a+=p,o=t,y=(l=g[h=0])/v[i-o-1]%10|0;else if((h=s((a+1)/p))>=g.length){if(!n)break e;for(;g.length<=h;g.push(0));l=y=0,i=1,o=(a%=p)-p+1}else{for(l=c=g[h],i=1;c>=10;c/=10,i++);y=(o=(a%=p)-p+i)<0?0:l/v[i-o-1]%10|0}if(n=n||t<0||null!=g[h+1]||(o<0?l:l%v[i-o-1]),n=r<4?(y||n)&&(0==r||r==(e.s<0?3:2)):y>5||5==y&&(4==r||n||6==r&&(a>0?o>0?l/v[i-o]:0:g[h-1])%10&1||r==(e.s<0?8:7)),t<1||!g[0])return g.length=0,n?(t-=e.e+1,g[0]=v[(p-t%p)%p],e.e=-t||0):g[0]=e.e=0,e;if(0==a?(g.length=h,c=1,h--):(g.length=h+1,c=v[p-a],g[h]=o>0?u(l/v[i-o]%v[o])*c:0),n)for(;;){if(0==h){for(a=1,o=g[0];o>=10;o/=10,a++);for(o=g[0]+=c,c=1;o>=10;o/=10,c++);a!=c&&(e.e++,g[0]==f&&(g[0]=1));break}if(g[h]+=c,g[h]!=f)break;g[h--]=0,c=1}for(a=g.length;0===g[--a];g.pop());}e.e>P?e.c=e.e=null:e.e<U&&(e.c=[e.e=0])}return e}function Y(e){var t,r=e.e;return null===r?e.toString():(t=m(e.c),t=r<=D||r>=O?S(t,r):T(t,r,"0"),e.s<0?"-"+t:t)}return K.clone=e,K.ROUND_UP=0,K.ROUND_DOWN=1,K.ROUND_CEIL=2,K.ROUND_FLOOR=3,K.ROUND_HALF_UP=4,K.ROUND_HALF_DOWN=5,K.ROUND_HALF_EVEN=6,K.ROUND_HALF_CEIL=7,K.ROUND_HALF_FLOOR=8,K.EUCLID=9,K.config=K.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(c+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(C(r=e[t],0,g,t),N=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(C(r=e[t],0,8,t),L=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(C(r[0],-g,0,t),C(r[1],0,g,t),D=r[0],O=r[1]):(C(r,-g,g,t),D=-(O=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)C(r[0],-g,-1,t),C(r[1],1,g,t),U=r[0],P=r[1];else{if(C(r,-g,g,t),!r)throw Error(c+t+" cannot be zero: "+r);U=-(P=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(c+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw x=!r,Error(c+"crypto unavailable");x=r}else x=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(C(r=e[t],0,9,t),F=r),e.hasOwnProperty(t="POW_PRECISION")&&(C(r=e[t],0,g,t),V=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(c+t+" not an object: "+r);M=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(c+t+" invalid: "+r);j=r}}return{DECIMAL_PLACES:N,ROUNDING_MODE:L,EXPONENTIAL_AT:[D,O],RANGE:[U,P],CRYPTO:x,MODULO_MODE:F,POW_PRECISION:V,FORMAT:M,ALPHABET:j}},K.isBigNumber=function(e){return e instanceof K||e&&!0===e._isBigNumber||!1},K.maximum=K.max=function(){return z(arguments,k.lt)},K.minimum=K.min=function(){return z(arguments,k.gt)},K.random=(a=9007199254740992*Math.random()&2097151?function(){return u(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,l=0,f=[],h=new K(R);if(null==e?e=N:C(e,0,g),i=s(e/p),x)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));l<i;)(o=131072*t[l]+(t[l+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[l]=r[0],t[l+1]=r[1]):(f.push(o%1e14),l+=2);l=i/2}else{if(!crypto.randomBytes)throw x=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);l<i;)(o=281474976710656*(31&t[l])+1099511627776*t[l+1]+4294967296*t[l+2]+16777216*t[l+3]+(t[l+4]<<16)+(t[l+5]<<8)+t[l+6])>=9e15?crypto.randomBytes(7).copy(t,l):(f.push(o%1e14),l+=7);l=i/7}if(!x)for(;l<i;)(o=a())<9e15&&(f[l++]=o%1e14);for(i=f[--l],e%=p,i&&e&&(o=d[p-e],f[l]=u(i/o)*o);0===f[l];f.pop(),l--);if(l<0)f=[n=0];else{for(n=-1;0===f[0];f.splice(0,1),n-=p);for(l=1,o=f[0];o>=10;o/=10,l++);l<p&&(n-=p-l)}return h.e=n,h.c=f,h}),K.sum=function(){for(var e=1,t=arguments,r=new K(t[0]);e<t.length;)r=r.plus(t[e++]);return r},n=function(){function e(e,t,r,n){for(var i,a,o=[0],s=0,u=e.length;s<u;){for(a=o.length;a--;o[a]*=t);for(o[0]+=n.indexOf(e.charAt(s++)),i=0;i<o.length;i++)o[i]>r-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/r|0,o[i]%=r)}return o.reverse()}return function(t,n,i,a,o){var s,u,c,l,f,p,h,d,y=t.indexOf("."),g=N,v=L;for(y>=0&&(l=V,V=0,t=t.replace(".",""),p=(d=new K(n)).pow(t.length-y),V=l,d.c=e(T(m(p.c),p.e,"0"),10,i,"0123456789"),d.e=d.c.length),c=l=(h=e(t,n,i,o?(s=j,"0123456789"):(s="0123456789",j))).length;0==h[--l];h.pop());if(!h[0])return s.charAt(0);if(y<0?--c:(p.c=h,p.e=c,p.s=a,h=(p=r(p,d,g,v,i)).c,f=p.r,c=p.e),y=h[u=c+g+1],l=i/2,f=f||u<0||null!=h[u+1],f=v<4?(null!=y||f)&&(0==v||v==(p.s<0?3:2)):y>l||y==l&&(4==v||f||6==v&&1&h[u-1]||v==(p.s<0?8:7)),u<1||!h[0])t=f?T(s.charAt(1),-g,s.charAt(0)):s.charAt(0);else{if(h.length=u,f)for(--i;++h[--u]>i;)h[u]=0,u||(++c,h=[1].concat(h));for(l=h.length;!h[--l];);for(y=0,t="";y<=l;t+=s.charAt(h[y++]));t=T(t,c,s.charAt(0))}return t}}(),r=function(){function e(e,t,r){var n,i,a,o,s=0,u=e.length,c=t%y,l=t/y|0;for(e=e.slice();u--;)s=((i=c*(a=e[u]%y)+(n=l*a+(o=e[u]/y|0)*c)%y*y+s)/r|0)+(n/y|0)+l*o,e[u]=i%r;return s&&(e=[s].concat(e)),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,a,o,s){var c,l,h,d,y,g,m,b,C,E,S,T,A,B,w,I,_,k=n.s==i.s?1:-1,R=n.c,N=i.c;if(!(R&&R[0]&&N&&N[0]))return new K(n.s&&i.s&&(R?!N||R[0]!=N[0]:N)?R&&0==R[0]||!N?0*k:k/0:NaN);for(C=(b=new K(k)).c=[],k=a+(l=n.e-i.e)+1,s||(s=f,l=v(n.e/p)-v(i.e/p),k=k/p|0),h=0;N[h]==(R[h]||0);h++);if(N[h]>(R[h]||0)&&l--,k<0)C.push(1),d=!0;else{for(B=R.length,I=N.length,h=0,k+=2,(y=u(s/(N[0]+1)))>1&&(N=e(N,y,s),R=e(R,y,s),I=N.length,B=R.length),A=I,S=(E=R.slice(0,I)).length;S<I;E[S++]=0);_=N.slice(),_=[0].concat(_),w=N[0],N[1]>=s/2&&w++;do{if(y=0,(c=t(N,E,I,S))<0){if(T=E[0],I!=S&&(T=T*s+(E[1]||0)),(y=u(T/w))>1)for(y>=s&&(y=s-1),m=(g=e(N,y,s)).length,S=E.length;1==t(g,E,m,S);)y--,r(g,I<m?_:N,m,s),m=g.length,c=1;else 0==y&&(c=y=1),m=(g=N.slice()).length;if(m<S&&(g=[0].concat(g)),r(E,g,S,s),S=E.length,-1==c)for(;t(N,E,I,S)<1;)y++,r(E,I<S?_:N,S,s),S=E.length}else 0===c&&(y++,E=[0]);C[h++]=y,E[0]?E[S++]=R[A]||0:(E=[R[A]],S=1)}while((A++<B||null!=E[0])&&k--);d=null!=E[0],C[0]||C.splice(0,1)}if(s==f){for(h=1,k=C[0];k>=10;k/=10,h++);q(b,a+(b.e=h+l*p-1)+1,o,d)}else b.e=l,b.r=+d;return b}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,B=/^([^.]+)\.$/,w=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,_=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,a=r?t:t.replace(_,"");if(I.test(a))e.s=isNaN(a)?null:a<0?-1:1,e.c=e.e=null;else{if(!r&&(a=a.replace(A,function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t}),n&&(i=n,a=a.replace(B,"$1").replace(w,"0.$1")),t!=a))return new K(a,i);if(K.DEBUG)throw Error(c+"Not a"+(n?" base "+n:"")+" number: "+t);e.c=e.e=e.s=null}},k.absoluteValue=k.abs=function(){var e=new K(this);return e.s<0&&(e.s=1),e},k.comparedTo=function(e,t){return b(this,new K(e,t))},k.decimalPlaces=k.dp=function(e,t){var r,n,i,a=this;if(null!=e)return C(e,0,g),null==t?t=L:C(t,0,8),q(new K(a),e+a.e+1,t);if(!(r=a.c))return null;if(n=((i=r.length-1)-v(this.e/p))*p,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},k.dividedBy=k.div=function(e,t){return r(this,new K(e,t),N,L)},k.dividedToIntegerBy=k.idiv=function(e,t){return r(this,new K(e,t),0,1)},k.exponentiatedBy=k.pow=function(e,t){var r,n,i,a,o,l,f,h,d=this;if((e=new K(e)).c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new K(t)),o=e.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!e.c||!e.c[0])return h=new K(Math.pow(+Y(d),o?2-E(e):+Y(e))),t?h.mod(t):h;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new K(NaN);(n=!l&&d.isInteger()&&t.isInteger())&&(d=d.mod(t))}else{if(e.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||o&&d.c[1]>=24e7:d.c[0]<8e13||o&&d.c[0]<=9999975e7)))return a=d.s<0&&E(e)?-0:0,d.e>-1&&(a=1/a),new K(l?1/a:a);V&&(a=s(V/p+2))}for(o?(r=new K(.5),l&&(e.s=1),f=E(e)):f=(i=Math.abs(+Y(e)))%2,h=new K(R);;){if(f){if(!(h=h.times(d)).c)break;a?h.c.length>a&&(h.c.length=a):n&&(h=h.mod(t))}if(i){if(0===(i=u(i/2)))break;f=i%2}else if(q(e=e.times(r),e.e+1,1),e.e>14)f=E(e);else{if(0==(i=+Y(e)))break;f=i%2}d=d.times(d),a?d.c&&d.c.length>a&&(d.c.length=a):n&&(d=d.mod(t))}return n?h:(l&&(h=R.div(h)),t?h.mod(t):a?q(h,V,L,void 0):h)},k.integerValue=function(e){var t=new K(this);return null==e?e=L:C(e,0,8),q(t,t.e+1,e)},k.isEqualTo=k.eq=function(e,t){return 0===b(this,new K(e,t))},k.isFinite=function(){return!!this.c},k.isGreaterThan=k.gt=function(e,t){return b(this,new K(e,t))>0},k.isGreaterThanOrEqualTo=k.gte=function(e,t){return 1===(t=b(this,new K(e,t)))||0===t},k.isInteger=function(){return!!this.c&&v(this.e/p)>this.c.length-2},k.isLessThan=k.lt=function(e,t){return b(this,new K(e,t))<0},k.isLessThanOrEqualTo=k.lte=function(e,t){return-1===(t=b(this,new K(e,t)))||0===t},k.isNaN=function(){return!this.s},k.isNegative=function(){return this.s<0},k.isPositive=function(){return this.s>0},k.isZero=function(){return!!this.c&&0==this.c[0]},k.minus=function(e,t){var r,n,i,a,o=this,s=o.s;if(t=(e=new K(e,t)).s,!s||!t)return new K(NaN);if(s!=t)return e.s=-t,o.plus(e);var u=o.e/p,c=e.e/p,l=o.c,h=e.c;if(!u||!c){if(!l||!h)return l?(e.s=-t,e):new K(h?o:NaN);if(!l[0]||!h[0])return h[0]?(e.s=-t,e):new K(l[0]?o:3==L?-0:0)}if(u=v(u),c=v(c),l=l.slice(),s=u-c){for((a=s<0)?(s=-s,i=l):(c=u,i=h),i.reverse(),t=s;t--;i.push(0));i.reverse()}else for(n=(a=(s=l.length)<(t=h.length))?s:t,s=t=0;t<n;t++)if(l[t]!=h[t]){a=l[t]<h[t];break}if(a&&(i=l,l=h,h=i,e.s=-e.s),(t=(n=h.length)-(r=l.length))>0)for(;t--;l[r++]=0);for(t=f-1;n>s;){if(l[--n]<h[n]){for(r=n;r&&!l[--r];l[r]=t);--l[r],l[n]+=f}l[n]-=h[n]}for(;0==l[0];l.splice(0,1),--c);return l[0]?G(e,l,c):(e.s=3==L?-1:1,e.c=[e.e=0],e)},k.modulo=k.mod=function(e,t){var n,i,a=this;return e=new K(e,t),!a.c||!e.s||e.c&&!e.c[0]?new K(NaN):!e.c||a.c&&!a.c[0]?new K(a):(9==F?(i=e.s,e.s=1,n=r(a,e,0,3),e.s=i,n.s*=i):n=r(a,e,0,F),(e=a.minus(n.times(e))).c[0]||1!=F||(e.s=a.s),e)},k.multipliedBy=k.times=function(e,t){var r,n,i,a,o,s,u,c,l,h,d,g,m,b,C,E=this,S=E.c,T=(e=new K(e,t)).c;if(!(S&&T&&S[0]&&T[0]))return!E.s||!e.s||S&&!S[0]&&!T||T&&!T[0]&&!S?e.c=e.e=e.s=null:(e.s*=E.s,S&&T?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=v(E.e/p)+v(e.e/p),e.s*=E.s,(u=S.length)<(h=T.length)&&(m=S,S=T,T=m,i=u,u=h,h=i),i=u+h,m=[];i--;m.push(0));for(b=f,C=y,i=h;--i>=0;){for(r=0,d=T[i]%C,g=T[i]/C|0,a=i+(o=u);a>i;)r=((c=d*(c=S[--o]%C)+(s=g*c+(l=S[o]/C|0)*d)%C*C+m[a]+r)/b|0)+(s/C|0)+g*l,m[a--]=c%b;m[a]=r}return r?++n:m.splice(0,1),G(e,m,n)},k.negated=function(){var e=new K(this);return e.s=-e.s||null,e},k.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new K(e,t)).s,!i||!t)return new K(NaN);if(i!=t)return e.s=-t,n.minus(e);var a=n.e/p,o=e.e/p,s=n.c,u=e.c;if(!a||!o){if(!s||!u)return new K(i/0);if(!s[0]||!u[0])return u[0]?e:new K(s[0]?n:0*i)}if(a=v(a),o=v(o),s=s.slice(),i=a-o){for(i>0?(o=a,r=u):(i=-i,r=s),r.reverse();i--;r.push(0));r.reverse()}for((i=s.length)-(t=u.length)<0&&(r=u,u=s,s=r,t=i),i=0;t;)i=(s[--t]=s[t]+u[t]+i)/f|0,s[t]=f===s[t]?0:s[t]%f;return i&&(s=[i].concat(s),++o),G(e,s,o)},k.precision=k.sd=function(e,t){var r,n,i,a=this;if(null!=e&&e!==!!e)return C(e,1,g),null==t?t=L:C(t,0,8),q(new K(a),e,t);if(!(r=a.c))return null;if(n=(i=r.length-1)*p+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&a.e+1>n&&(n=a.e+1),n},k.shiftedBy=function(e){return C(e,-h,h),this.times("1e"+e)},k.squareRoot=k.sqrt=function(){var e,t,n,i,a,o=this,s=o.c,u=o.s,c=o.e,l=N+4,f=new K("0.5");if(1!==u||!s||!s[0])return new K(!u||u<0&&(!s||s[0])?NaN:s?o:1/0);if(0==(u=Math.sqrt(+Y(o)))||u==1/0?(((t=m(s)).length+c)%2==0&&(t+="0"),u=Math.sqrt(+t),c=v((c+1)/2)-(c<0||c%2),n=new K(t=u==1/0?"1e"+c:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new K(u+""),n.c[0])for((u=(c=n.e)+l)<3&&(u=0);;)if(a=n,n=f.times(a.plus(r(o,a,l,1))),m(a.c).slice(0,u)===(t=m(n.c)).slice(0,u)){if(n.e<c&&--u,"9999"!=(t=t.slice(u-3,u+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(q(n,n.e+N+2,1),e=!n.times(n).eq(o));break}if(!i&&(q(a,a.e+N+2,0),a.times(a).eq(o))){n=a;break}l+=4,u+=4,i=1}return q(n,n.e+N+1,L,e)},k.toExponential=function(e,t){return null!=e&&(C(e,0,g),e++),H(this,e,t,1)},k.toFixed=function(e,t){return null!=e&&(C(e,0,g),e=e+this.e+1),H(this,e,t)},k.toFormat=function(e,t,r){var n,i=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=M;else if("object"!=typeof r)throw Error(c+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var a,o=n.split("."),s=+r.groupSize,u=+r.secondaryGroupSize,l=r.groupSeparator||"",f=o[0],p=o[1],h=i.s<0,d=h?f.slice(1):f,y=d.length;if(u&&(a=s,s=u,u=a,y-=a),s>0&&y>0){for(a=y%s||s,f=d.substr(0,a);a<y;a+=s)f+=l+d.substr(a,s);u>0&&(f+=l+d.slice(a)),h&&(f="-"+f)}n=p?f+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?p.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):p):f}return(r.prefix||"")+n+(r.suffix||"")},k.toFraction=function(e){var t,n,i,a,o,s,u,l,f,h,y,g,v=this,b=v.c;if(null!=e&&(!(u=new K(e)).isInteger()&&(u.c||1!==u.s)||u.lt(R)))throw Error(c+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+Y(u));if(!b)return new K(v);for(t=new K(R),f=n=new K(R),i=l=new K(R),g=m(b),o=t.e=g.length-v.e-1,t.c[0]=d[(s=o%p)<0?p+s:s],e=!e||u.comparedTo(t)>0?o>0?t:f:u,s=P,P=1/0,u=new K(g),l.c[0]=0;h=r(u,t,0,1),1!=(a=n.plus(h.times(i))).comparedTo(e);)n=i,i=a,f=l.plus(h.times(a=f)),l=a,t=u.minus(h.times(a=t)),u=a;return a=r(e.minus(n),i,0,1),l=l.plus(a.times(f)),n=n.plus(a.times(i)),l.s=f.s=v.s,y=r(f,i,o*=2,L).minus(v).abs().comparedTo(r(l,n,o,L).minus(v).abs())<1?[f,i]:[l,n],P=s,y},k.toNumber=function(){return+Y(this)},k.toPrecision=function(e,t){return null!=e&&C(e,1,g),H(this,e,t,2)},k.toString=function(e){var t,r=this,i=r.s,a=r.e;return null===a?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=a<=D||a>=O?S(m(r.c),a):T(m(r.c),a,"0"):10===e?t=T(m((r=q(new K(r),N+a+1,L)).c),r.e,"0"):(C(e,2,j.length,"Base"),t=n(T(m(r.c),a,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},k.valueOf=k.toJSON=function(){return Y(this)},k._isBigNumber=!0,"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator&&(k[Symbol.toStringTag]="BigNumber",k[Symbol.for("nodejs.util.inspect.custom")]=k.valueOf),null!=t&&K.set(t),K}()).default=a.BigNumber=a,void 0===(n=function(){return a}.call(t,r,t,e))||(e.exports=n)}()},419:function(e,t,r){var n,i,a;e.exports=(n=r(34),a=(i=n).lib.WordArray,i.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],a=0;a<r;a+=3)for(var o=(t[a>>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s<r;s++)i.push(n.charAt(o>>>6*(3-s)&63));var u=n.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var i=0;i<r.length;i++)n[r.charCodeAt(i)]=i}var o=r.charAt(64);if(o){var s=e.indexOf(o);-1!==s&&(t=s)}return function(e,t,r){for(var n=[],i=0,o=0;o<t;o++)if(o%4){var s=r[e.charCodeAt(o-1)]<<o%4*2,u=r[e.charCodeAt(o)]>>>6-o%4*2;n[i>>>2]|=(s|u)<<24-i%4*8,i++}return a.create(n,i)}(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},n.enc.Base64)},420:function(e,t,r){var n;e.exports=(n=r(34),function(e){var t=n,r=t.lib,i=r.WordArray,a=r.Hasher,o=t.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var u=o.MD5=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var a=this._hash.words,o=e[t+0],u=e[t+1],h=e[t+2],d=e[t+3],y=e[t+4],g=e[t+5],v=e[t+6],m=e[t+7],b=e[t+8],C=e[t+9],E=e[t+10],S=e[t+11],T=e[t+12],A=e[t+13],B=e[t+14],w=e[t+15],I=a[0],_=a[1],k=a[2],R=a[3];I=c(I,_,k,R,o,7,s[0]),R=c(R,I,_,k,u,12,s[1]),k=c(k,R,I,_,h,17,s[2]),_=c(_,k,R,I,d,22,s[3]),I=c(I,_,k,R,y,7,s[4]),R=c(R,I,_,k,g,12,s[5]),k=c(k,R,I,_,v,17,s[6]),_=c(_,k,R,I,m,22,s[7]),I=c(I,_,k,R,b,7,s[8]),R=c(R,I,_,k,C,12,s[9]),k=c(k,R,I,_,E,17,s[10]),_=c(_,k,R,I,S,22,s[11]),I=c(I,_,k,R,T,7,s[12]),R=c(R,I,_,k,A,12,s[13]),k=c(k,R,I,_,B,17,s[14]),I=l(I,_=c(_,k,R,I,w,22,s[15]),k,R,u,5,s[16]),R=l(R,I,_,k,v,9,s[17]),k=l(k,R,I,_,S,14,s[18]),_=l(_,k,R,I,o,20,s[19]),I=l(I,_,k,R,g,5,s[20]),R=l(R,I,_,k,E,9,s[21]),k=l(k,R,I,_,w,14,s[22]),_=l(_,k,R,I,y,20,s[23]),I=l(I,_,k,R,C,5,s[24]),R=l(R,I,_,k,B,9,s[25]),k=l(k,R,I,_,d,14,s[26]),_=l(_,k,R,I,b,20,s[27]),I=l(I,_,k,R,A,5,s[28]),R=l(R,I,_,k,h,9,s[29]),k=l(k,R,I,_,m,14,s[30]),I=f(I,_=l(_,k,R,I,T,20,s[31]),k,R,g,4,s[32]),R=f(R,I,_,k,b,11,s[33]),k=f(k,R,I,_,S,16,s[34]),_=f(_,k,R,I,B,23,s[35]),I=f(I,_,k,R,u,4,s[36]),R=f(R,I,_,k,y,11,s[37]),k=f(k,R,I,_,m,16,s[38]),_=f(_,k,R,I,E,23,s[39]),I=f(I,_,k,R,A,4,s[40]),R=f(R,I,_,k,o,11,s[41]),k=f(k,R,I,_,d,16,s[42]),_=f(_,k,R,I,v,23,s[43]),I=f(I,_,k,R,C,4,s[44]),R=f(R,I,_,k,T,11,s[45]),k=f(k,R,I,_,w,16,s[46]),I=p(I,_=f(_,k,R,I,h,23,s[47]),k,R,o,6,s[48]),R=p(R,I,_,k,m,10,s[49]),k=p(k,R,I,_,B,15,s[50]),_=p(_,k,R,I,g,21,s[51]),I=p(I,_,k,R,T,6,s[52]),R=p(R,I,_,k,d,10,s[53]),k=p(k,R,I,_,E,15,s[54]),_=p(_,k,R,I,u,21,s[55]),I=p(I,_,k,R,b,6,s[56]),R=p(R,I,_,k,w,10,s[57]),k=p(k,R,I,_,v,15,s[58]),_=p(_,k,R,I,A,21,s[59]),I=p(I,_,k,R,y,6,s[60]),R=p(R,I,_,k,S,10,s[61]),k=p(k,R,I,_,h,15,s[62]),_=p(_,k,R,I,C,21,s[63]),a[0]=a[0]+I|0,a[1]=a[1]+_|0,a[2]=a[2]+k|0,a[3]=a[3]+R|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;r[i>>>5]|=128<<24-i%32;var a=e.floor(n/4294967296),o=n;r[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),r[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,u=s.words,c=0;c<4;c++){var l=u[c];u[c]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return s},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,r,n,i,a,o){var s=e+(t&r|~t&n)+i+o;return(s<<a|s>>>32-a)+t}function l(e,t,r,n,i,a,o){var s=e+(t&n|r&~n)+i+o;return(s<<a|s>>>32-a)+t}function f(e,t,r,n,i,a,o){var s=e+(t^r^n)+i+o;return(s<<a|s>>>32-a)+t}function p(e,t,r,n,i,a,o){var s=e+(r^(t|~n))+i+o;return(s<<a|s>>>32-a)+t}t.MD5=a._createHelper(u),t.HmacMD5=a._createHmacHelper(u)}(Math),n.MD5)},449:function(e,t,r){(function(e){var n=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function a(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new a(i.call(setTimeout,n,arguments),clearTimeout)},t.setInterval=function(){return new a(i.call(setInterval,n,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(n,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},r(450),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(17))},450:function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var n,i,a,o,s,u=1,c={},l=!1,f=e.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(e);p=p&&p.setTimeout?p:e,"[object process]"==={}.toString.call(e.process)?n=function(e){t.nextTick(function(){d(e)})}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?e.MessageChannel?((a=new MessageChannel).port1.onmessage=function(e){d(e.data)},n=function(e){a.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(i=f.documentElement,n=function(e){var t=f.createElement("script");t.onreadystatechange=function(){d(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):n=function(e){setTimeout(d,0,e)}:(o="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&d(+t.data.slice(o.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),n=function(t){e.postMessage(o+t,"*")}),p.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r<t.length;r++)t[r]=arguments[r+1];var i={callback:e,args:t};return c[u]=i,n(u),u++},p.clearImmediate=h}function h(e){delete c[e]}function d(e){if(l)setTimeout(d,0,e);else{var t=c[e];if(t){l=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(r,n)}}(t)}finally{h(e),l=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,r(17),r(21))},498:function(e,t,r){var n,i,a,o,s,u;e.exports=(n=r(34),a=(i=n).lib,o=a.Base,s=a.WordArray,(u=i.x64={}).Word=o.extend({init:function(e,t){this.high=e,this.low=t}}),u.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var i=e[n];r.push(i.high),r.push(i.low)}return s.create(r,this.sigBytes)},clone:function(){for(var e=o.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}}),n)},5:function(e,t,r){"use strict";(function(e){
|
||
/*!
|
||
* The buffer module from node.js, for the browser.
|
||
*
|
||
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
||
* @license MIT
|
||
*/
|
||
var n=r(58),i=r(59),a=r(60);function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(o()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(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 f(this,e)}return c(this,e,t,r)}function c(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?function(e,t,r,n){if(t.byteLength,r<0||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");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=p(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(t,r),i=(e=s(e,n)).write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|h(t.length);return 0===(e=s(e,r)).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||(n=t.length)!=n?s(e,0):p(e,t);if("Buffer"===t.type&&a(t.data))return p(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(l(t),e=s(e,t<0?0:0|h(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function p(e,t){var r=t.length<0?0:0|h(t.length);e=s(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function h(e){if(e>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function d(e,t){if(u.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"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return M(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(n)return M(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){var a,o=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var l=-1;for(a=r;a<s;a++)if(c(e,a)===c(t,-1===l?0:a-l)){if(-1===l&&(l=a),a-l+1===u)return l*o}else-1!==l&&(a-=a-l),l=-1}else for(r+u>s&&(r=s-u),a=r;a>=0;a--){for(var f=!0,p=0;p<u;p++)if(c(e,a+p)!==c(t,p)){f=!1;break}if(f)return a}return-1}function m(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[r+o]=s}return o}function b(e,t,r,n){return K(M(t,e.length-r),e,r,n)}function C(e,t,r,n){return K(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function E(e,t,r,n){return C(e,t,r,n)}function S(e,t,r,n){return K(j(t),e,r,n)}function T(e,t,r,n){return K(function(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}(t,e.length-r),e,r,n)}function A(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function B(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,o,s,u,c=e[i],l=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&c)<<6|63&a)>127&&(l=u);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(u=(15&c)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&c)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(e){var t=e.length;if(t<=w)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=w));return r}(n)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=o(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return c(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return function(e,t,r,n){return l(t),t<=0?s(e,t):void 0!==r?"string"==typeof n?s(e,t).fill(r,n):s(e,t).fill(r):s(e,t)}(null,e,t,r)},u.allocUnsafe=function(e){return f(null,e)},u.allocUnsafeSlow=function(e){return f(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.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);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!a(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=u.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(!u.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},u.byteLength=d,u.prototype._isBuffer=!0,u.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;t<e;t+=2)y(this,t,t+1);return this},u.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;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?B(this,0,e):function(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,r);case"utf8":case"utf-8":return B(this,t,r);case"ascii":return I(this,t,r);case"latin1":case"binary":return _(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,r,n,i){if(!u.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),t<0||r>e.length||n<0||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(this===e)return 0;for(var a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),s=Math.min(a,o),c=this.slice(n,i),l=e.slice(t,r),f=0;f<s;++f)if(c[f]!==l[f]){a=c[f],o=l[f];break}return a<o?-1:o<a?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)},u.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,isFinite(r)?(r|=0,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&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return m(this,e,t,r);case"utf8":case"utf-8":return b(this,e,t,r);case"ascii":return C(this,e,t,r);case"latin1":case"binary":return E(this,e,t,r);case"base64":return S(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}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var w=4096;function I(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function _(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function k(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=V(e[a]);return i}function R(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 N(e,t,r){if(e%1!=0||e<0)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(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function D(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);i<a;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function O(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);i<a;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function U(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function P(e,t,r,n,a){return a||U(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function x(e,t,r,n,a){return a||U(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=u.prototype;else{var i=t-e;r=new u(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r},u.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||N(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},u.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||N(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return t||N(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||N(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||N(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||N(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||N(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},u.prototype.readInt8=function(e,t){return t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||N(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||N(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||N(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||N(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||N(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||N(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||L(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},u.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||L(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||L(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||L(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||L(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||L(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):O(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||L(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):O(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!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);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!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);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||L(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||L(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||L(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||L(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):O(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):O(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return P(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return P(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return x(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return x(this,e,t,!1,r)},u.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&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)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&&r<t&&t<n)for(i=a-1;i>=0;--i)e[i+t]=this[i+r];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+a),t);return a},u.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);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var a;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a<r;++a)this[a]=e;else{var o=u.isBuffer(e)?e:M(new u(e,n).toString()),s=o.length;for(a=0;a<r-t;++a)this[a+t]=o[a%s]}return this};var F=/[^+\/0-9A-Za-z-_]/g;function V(e){return e<16?"0"+e.toString(16):e.toString(16)}function M(e,t){var r;t=t||1/0;for(var n=e.length,i=null,a=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){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(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))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 j(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function K(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(17))},54:function(e,t,r){var n;e.exports=(n=r(34),r(498),r(1071),r(1072),r(419),r(420),r(581),r(700),r(1073),r(701),r(1074),r(1075),r(1076),r(582),r(1077),r(329),r(77),r(1078),r(1079),r(1080),r(1081),r(1082),r(1083),r(1084),r(1085),r(1086),r(1087),r(1088),r(1089),r(1090),r(1091),r(1092),r(1093),n)},58:function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){for(var t,r=c(e),n=r[0],o=r[1],s=new a(function(e,t,r){return 3*(t+r)/4-r}(0,n,o)),u=0,l=o>0?n-4:n,f=0;f<l;f+=4)t=i[e.charCodeAt(f)]<<18|i[e.charCodeAt(f+1)]<<12|i[e.charCodeAt(f+2)]<<6|i[e.charCodeAt(f+3)],s[u++]=t>>16&255,s[u++]=t>>8&255,s[u++]=255&t;2===o&&(t=i[e.charCodeAt(f)]<<2|i[e.charCodeAt(f+1)]>>4,s[u++]=255&t);1===o&&(t=i[e.charCodeAt(f)]<<10|i[e.charCodeAt(f+1)]<<4|i[e.charCodeAt(f+2)]>>2,s[u++]=t>>8&255,s[u++]=255&t);return s},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,a=[],o=0,s=r-i;o<s;o+=16383)a.push(l(e,o,o+16383>s?s:o+16383));1===i?(t=e[r-1],a.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],a.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return a.join("")};for(var n=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=o.length;s<u;++s)n[s]=o[s],i[o.charCodeAt(s)]=s;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var i,a,o=[],s=t;s<r;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(n[(a=i)>>18&63]+n[a>>12&63]+n[a>>6&63]+n[63&a]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},581:function(e,t,r){var n,i,a,o,s,u,c,l;e.exports=(n=r(34),a=(i=n).lib,o=a.WordArray,s=a.Hasher,u=i.algo,c=[],l=u.SHA1=s.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],u=0;u<80;u++){if(u<16)c[u]=0|e[t+u];else{var l=c[u-3]^c[u-8]^c[u-14]^c[u-16];c[u]=l<<1|l>>>31}var f=(n<<5|n>>>27)+s+c[u];f+=u<20?1518500249+(i&a|~i&o):u<40?1859775393+(i^a^o):u<60?(i&a|i&o|a&o)-1894007588:(i^a^o)-899497514,s=o,o=a,a=i<<30|i>>>2,i=n,n=f}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+s|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}}),i.SHA1=s._createHelper(l),i.HmacSHA1=s._createHmacHelper(l),n.SHA1)},582:function(e,t,r){var n,i,a,o,s,u,c;e.exports=(n=r(34),a=(i=n).lib,o=a.Base,s=i.enc,u=s.Utf8,c=i.algo,void(c.HMAC=o.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=u.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),a=this._iKey=t.clone(),o=i.words,s=a.words,c=0;c<r;c++)o[c]^=1549556828,s[c]^=909522486;i.sigBytes=a.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);t.reset();var n=t.finalize(this._oKey.clone().concat(r));return n}})))},59:function(e,t){t.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,p=r?-1:1,h=e[t+f];for(f+=p,a=h&(1<<-l)-1,h>>=-l,l+=s;l>0;a=256*a+e[t+f],f+=p,l-=8);for(o=a&(1<<-l)-1,a>>=-l,l+=n;l>0;o=256*o+e[t+f],f+=p,l-=8);if(0===a)a=1-c;else{if(a===u)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),a-=c}return(h?-1:1)*o*Math.pow(2,a-n)},t.write=function(e,t,r,n,i,a){var o,s,u,c=8*a-i-1,l=(1<<c)-1,f=l>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,d=n?1:-1,y=t<0||0===t&&1/t<0?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?p/u:p*Math.pow(2,1-f))*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+h]=255&s,h+=d,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;e[r+h]=255&o,h+=d,o/=256,c-=8);e[r+h-d]|=128*y}},60:function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},7:function(e,t,r){"use strict";r.d(t,"d",function(){return i}),r.d(t,"e",function(){return a}),r.d(t,"c",function(){return o}),r.d(t,"b",function(){return s}),r.d(t,"a",function(){return u});var n=r(0);
|
||
/**
|
||
* Hexadecimal functions.
|
||
*
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if(!e)return"";for(var n="",i=0;i<e.length;i++)n+=e[i].toString(16).padStart(r,"0")+t;return"0x"===t&&(n="0x"+n),"\\x"===t&&(n="\\x"+n),t.length?n.slice(0,-t.length):n}function a(e){if(!e)return"";for(var t=[],r=0;r<e.length;r++)t.push((e[r]>>>4).toString(16)),t.push((15&e[r]).toString(16));return t.join("")}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if("None"!==t){var i="Auto"===t?/[^a-f\d]/gi:n.a.regexRep(t);e=e.replace(i,"")}for(var a=[],o=0;o<e.length;o+=r)a.push(parseInt(e.substr(o,r),16));return a}var s=["Space","Comma","Semi-colon","Colon","Line feed","CRLF","0x","\\x","None"],u=["Auto"].concat(s)},700:function(e,t,r){var n;e.exports=(n=r(34),function(e){var t=n,r=t.lib,i=r.WordArray,a=r.Hasher,o=t.algo,s=[],u=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)t(n)&&(i<8&&(s[i]=r(e.pow(n,.5))),u[i]=r(e.pow(n,1/3)),i++),n++}();var c=[],l=o.SHA256=a.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],l=r[5],f=r[6],p=r[7],h=0;h<64;h++){if(h<16)c[h]=0|e[t+h];else{var d=c[h-15],y=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,g=c[h-2],v=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;c[h]=y+c[h-7]+v+c[h-16]}var m=n&i^n&a^i&a,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),C=p+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&l^~s&f)+u[h]+c[h];p=f,f=l,l=s,s=o+C|0,o=a,a=i,i=n,n=C+(b+m)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+s|0,r[5]=r[5]+l|0,r[6]=r[6]+f|0,r[7]=r[7]+p|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=a._createHelper(l),t.HmacSHA256=a._createHmacHelper(l)}(Math),n.SHA256)},701:function(e,t,r){var n;e.exports=(n=r(34),r(498),function(){var e=n,t=e.lib.Hasher,r=e.x64,i=r.Word,a=r.WordArray,o=e.algo;function s(){return i.create.apply(i,arguments)}var u=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],c=[];!function(){for(var e=0;e<80;e++)c[e]=s()}();var l=o.SHA512=t.extend({_doReset:function(){this._hash=new a.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],l=r[5],f=r[6],p=r[7],h=n.high,d=n.low,y=i.high,g=i.low,v=a.high,m=a.low,b=o.high,C=o.low,E=s.high,S=s.low,T=l.high,A=l.low,B=f.high,w=f.low,I=p.high,_=p.low,k=h,R=d,N=y,L=g,D=v,O=m,U=b,P=C,x=E,F=S,V=T,M=A,j=B,K=w,H=I,z=_,G=0;G<80;G++){var q=c[G];if(G<16)var Y=q.high=0|e[t+2*G],Q=q.low=0|e[t+2*G+1];else{var W=c[G-15],X=W.high,Z=W.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,$=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=c[G-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ie=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),ae=c[G-7],oe=ae.high,se=ae.low,ue=c[G-16],ce=ue.high,le=ue.low;Y=(Y=(Y=J+oe+((Q=$+se)>>>0<$>>>0?1:0))+ne+((Q+=ie)>>>0<ie>>>0?1:0))+ce+((Q+=le)>>>0<le>>>0?1:0),q.high=Y,q.low=Q}var fe,pe=x&V^~x&j,he=F&M^~F&K,de=k&N^k&D^N&D,ye=R&L^R&O^L&O,ge=(k>>>28|R<<4)^(k<<30|R>>>2)^(k<<25|R>>>7),ve=(R>>>28|k<<4)^(R<<30|k>>>2)^(R<<25|k>>>7),me=(x>>>14|F<<18)^(x>>>18|F<<14)^(x<<23|F>>>9),be=(F>>>14|x<<18)^(F>>>18|x<<14)^(F<<23|x>>>9),Ce=u[G],Ee=Ce.high,Se=Ce.low,Te=H+me+((fe=z+be)>>>0<z>>>0?1:0),Ae=ve+ye;H=j,z=K,j=V,K=M,V=x,M=F,x=U+(Te=(Te=(Te=Te+pe+((fe+=he)>>>0<he>>>0?1:0))+Ee+((fe+=Se)>>>0<Se>>>0?1:0))+Y+((fe+=Q)>>>0<Q>>>0?1:0))+((F=P+fe|0)>>>0<P>>>0?1:0)|0,U=D,P=O,D=N,O=L,N=k,L=R,k=Te+(ge+de+(Ae>>>0<ve>>>0?1:0))+((R=fe+Ae|0)>>>0<fe>>>0?1:0)|0}d=n.low=d+R,n.high=h+k+(d>>>0<R>>>0?1:0),g=i.low=g+L,i.high=y+N+(g>>>0<L>>>0?1:0),m=a.low=m+O,a.high=v+D+(m>>>0<O>>>0?1:0),C=o.low=C+P,o.high=b+U+(C>>>0<P>>>0?1:0),S=s.low=S+F,s.high=E+x+(S>>>0<F>>>0?1:0),A=l.low=A+M,l.high=T+V+(A>>>0<M>>>0?1:0),w=f.low=w+K,f.high=B+j+(w>>>0<K>>>0?1:0),_=p.low=_+z,p.high=I+H+(_>>>0<z>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(l),e.HmacSHA512=t._createHmacHelper(l)}(),n.SHA512)},77:function(e,t,r){var n;e.exports=(n=r(34),r(329),void(n.lib.Cipher||function(e){var t=n,r=t.lib,i=r.Base,a=r.WordArray,o=r.BufferedBlockAlgorithm,s=t.enc,u=(s.Utf8,s.Base64),c=t.algo,l=c.EvpKDF,f=r.Cipher=o.extend({cfg:i.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){e&&this._append(e);var t=this._doFinalize();return t},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?T:C}return function(t){return{encrypt:function(r,n,i){return e(n).encrypt(t,r,n,i)},decrypt:function(r,n,i){return e(n).decrypt(t,r,n,i)}}}}()}),p=(r.StreamCipher=f.extend({_doFinalize:function(){var e=this._process(!0);return e},blockSize:1}),t.mode={}),h=r.BlockCipherMode=i.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),d=p.CBC=function(){var t=h.extend();function r(t,r,n){var i=this._iv;if(i){var a=i;this._iv=e}else var a=this._prevBlock;for(var o=0;o<n;o++)t[r+o]^=a[o]}return t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;r.call(this,e,t,i),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+i)}}),t.Decryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,a=e.slice(t,t+i);n.decryptBlock(e,t),r.call(this,e,t,i),this._prevBlock=a}}),t}(),y=t.pad={},g=y.Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,i=n<<24|n<<16|n<<8|n,o=[],s=0;s<n;s+=4)o.push(i);var u=a.create(o,n);e.concat(u)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},v=(r.BlockCipher=f.extend({cfg:f.cfg.extend({mode:d,padding:g}),reset:function(){f.reset.call(this);var e=this.cfg,t=e.iv,r=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=r.createEncryptor;else{var n=r.createDecryptor;this._minBufferSize=1}this._mode&&this._mode.__creator==n?this._mode.init(this,t&&t.words):(this._mode=n.call(r,this,t&&t.words),this._mode.__creator=n)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else{var t=this._process(!0);e.unpad(t)}return t},blockSize:4}),r.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}})),m=t.format={},b=m.OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;if(r)var n=a.create([1398893684,1701076831]).concat(r).concat(t);else var n=t;return n.toString(u)},parse:function(e){var t=u.parse(e),r=t.words;if(1398893684==r[0]&&1701076831==r[1]){var n=a.create(r.slice(2,4));r.splice(0,4),t.sigBytes-=16}return v.create({ciphertext:t,salt:n})}},C=r.SerializableCipher=i.extend({cfg:i.extend({format:b}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),a=i.finalize(t),o=i.cfg;return v.create({ciphertext:a,key:r,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=e.createDecryptor(r,n).finalize(t.ciphertext);return i},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),E=t.kdf={},S=E.OpenSSL={execute:function(e,t,r,n){n||(n=a.random(8));var i=l.create({keySize:t+r}).compute(e,n),o=a.create(i.words.slice(t),4*r);return i.sigBytes=4*t,v.create({key:i,iv:o,salt:n})}},T=r.PasswordBasedCipher=C.extend({cfg:C.cfg.extend({kdf:S}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize);n.iv=i.iv;var a=C.encrypt.call(this,e,t,i.key,n);return a.mixIn(i),a},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt);n.iv=i.iv;var a=C.decrypt.call(this,e,t,i.key,n);return a}})}()))},9:function(e,t,r){"use strict";var n=r(0),i=r(12),a=r(4),o=r.n(a),s=r(14),u=r.n(s);function c(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function l(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function o(e){c(a,n,i,o,s,"next",e)}function s(e){c(a,n,i,o,s,"throw",e)}o(void 0)})}}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @author Matt C [matt@artemisbot.uk]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/
|
||
var p=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.value=[],this.type=e.BYTE_ARRAY,t&&t.hasOwnProperty("value")&&t.hasOwnProperty("type")&&this.set(t.value,t.type)}var t,r,a;return t=e,r=[{key:"set",value:function(t,r){if("string"==typeof r&&(r=e.typeEnum(r)),u.a.debug("Dish type: "+e.enumLookup(r)),this.value=t,this.type=r,!this.valid()){var a=n.a.truncate(JSON.stringify(this.value),13);throw new i.a("Data is not a valid ".concat(e.enumLookup(r),": ").concat(a))}}},{key:"get",value:function(){var t=l(regeneratorRuntime.mark(function t(r){var n,i=arguments;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=i.length>1&&void 0!==i[1]&&i[1],"string"==typeof r&&(r=e.typeEnum(r)),this.type===r){t.next=5;break}return t.next=5,this._translate(r,n);case 5:return t.abrupt("return",this.value);case 6:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"_translate",value:function(){var t=l(regeneratorRuntime.mark(function t(r){var a,s,c=arguments;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:a=c.length>1&&void 0!==c[1]&&c[1],u.a.debug("Translating Dish from ".concat(e.enumLookup(this.type)," to ").concat(e.enumLookup(r))),s=a?n.a.byteArrayToChars:n.a.byteArrayToUtf8,t.prev=3,t.t0=this.type,t.next=t.t0===e.STRING?7:t.t0===e.NUMBER?9:t.t0===e.HTML?11:t.t0===e.ARRAY_BUFFER?13:t.t0===e.BIG_NUMBER?15:t.t0===e.JSON?17:t.t0===e.FILE?19:t.t0===e.LIST_FILE?24:30;break;case 7:return this.value=this.value?n.a.strToByteArray(this.value):[],t.abrupt("break",31);case 9:return this.value="number"==typeof this.value?n.a.strToByteArray(this.value.toString()):[],t.abrupt("break",31);case 11:return this.value=this.value?n.a.strToByteArray(n.a.unescapeHtml(n.a.stripHtmlTags(this.value,!0))):[],t.abrupt("break",31);case 13:return this.value=Array.prototype.slice.call(new Uint8Array(this.value)),t.abrupt("break",31);case 15:return this.value=o.a.isBigNumber(this.value)?n.a.strToByteArray(this.value.toFixed()):[],t.abrupt("break",31);case 17:return this.value=this.value?n.a.strToByteArray(JSON.stringify(this.value,null,4)):[],t.abrupt("break",31);case 19:return t.next=21,n.a.readFile(this.value);case 21:return this.value=t.sent,this.value=Array.prototype.slice.call(this.value),t.abrupt("break",31);case 24:return t.next=26,Promise.all(this.value.map(function(){var e=l(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.a.readFile(t));case 1:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()));case 26:return this.value=t.sent,this.value=this.value.map(function(e){return Array.prototype.slice.call(e)}),this.value=[].concat.apply([],this.value),t.abrupt("break",31);case 30:return t.abrupt("break",31);case 31:t.next=36;break;case 33:throw t.prev=33,t.t1=t.catch(3),new i.a("Error translating from ".concat(e.enumLookup(this.type)," to byteArray: ").concat(t.t1));case 36:this.type=e.BYTE_ARRAY,t.prev=37,t.t2=r,t.next=t.t2===e.STRING?41:t.t2===e.HTML?41:t.t2===e.NUMBER?44:t.t2===e.ARRAY_BUFFER?47:t.t2===e.BIG_NUMBER?50:t.t2===e.JSON?53:t.t2===e.FILE?56:t.t2===e.LIST_FILE?58:61;break;case 41:return this.value=this.value?s(this.value):"",this.type=e.STRING,t.abrupt("break",62);case 44:return this.value=this.value?parseFloat(s(this.value)):0,this.type=e.NUMBER,t.abrupt("break",62);case 47:return this.value=new Uint8Array(this.value).buffer,this.type=e.ARRAY_BUFFER,t.abrupt("break",62);case 50:try{this.value=new o.a(s(this.value))}catch(e){this.value=new o.a(NaN)}return this.type=e.BIG_NUMBER,t.abrupt("break",62);case 53:return this.value=JSON.parse(s(this.value)),this.type=e.JSON,t.abrupt("break",62);case 56:return this.value=new File(this.value,"unknown"),t.abrupt("break",62);case 58:return this.value=[new File(this.value,"unknown")],this.type=e.LIST_FILE,t.abrupt("break",62);case 61:return t.abrupt("break",62);case 62:t.next=67;break;case 64:throw t.prev=64,t.t3=t.catch(37),new i.a("Error translating from byteArray to ".concat(e.enumLookup(r),": ").concat(t.t3));case 67:case"end":return t.stop()}},t,this,[[3,33],[37,64]])}));return function(e){return t.apply(this,arguments)}}()},{key:"valid",value:function(){switch(this.type){case e.BYTE_ARRAY:if(!(this.value instanceof Array))return!1;for(var t=0;t<this.value.length;t++)if("number"!=typeof this.value[t]||this.value[t]<0||this.value[t]>255)return!1;return!0;case e.STRING:case e.HTML:return"string"==typeof this.value;case e.NUMBER:return"number"==typeof this.value;case e.ARRAY_BUFFER:return this.value instanceof ArrayBuffer;case e.BIG_NUMBER:return o.a.isBigNumber(this.value);case e.JSON:return!0;case e.FILE:return this.value instanceof File;case e.LIST_FILE:return this.value instanceof Array&&this.value.reduce(function(e,t){return e&&t instanceof File},!0);default:return!1}}},{key:"clone",value:function(){var t=new e;switch(this.type){case e.STRING:case e.HTML:case e.NUMBER:case e.BIG_NUMBER:t.set(this.value,this.type);break;case e.BYTE_ARRAY:case e.JSON:t.set(JSON.parse(JSON.stringify(this.value)),this.type);break;case e.ARRAY_BUFFER:t.set(this.value.slice(0),this.type);break;case e.FILE:t.set(new File([this.value],this.value.name,{type:this.value.type,lastModified:this.value.lastModified}),this.type);break;case e.LIST_FILE:t.set(this.value.map(function(e){return new File([e],e.name,{type:e.type,lastModified:e.lastModified})}),this.type);break;default:throw new i.a("Cannot clone Dish, unknown type")}return t}},{key:"size",get:function(){switch(this.type){case e.BYTE_ARRAY:case e.STRING:case e.HTML:return this.value.length;case e.NUMBER:case e.BIG_NUMBER:return this.value.toString().length;case e.ARRAY_BUFFER:return this.value.byteLength;case e.JSON:return JSON.stringify(this.value).length;case e.FILE:return this.value.size;case e.LIST_FILE:return this.value.reduce(function(e,t){return e+t.size},0);default:return-1}}}],a=[{key:"typeEnum",value:function(t){switch(t.toLowerCase()){case"bytearray":case"byte array":return e.BYTE_ARRAY;case"string":return e.STRING;case"number":return e.NUMBER;case"html":return e.HTML;case"arraybuffer":case"array buffer":return e.ARRAY_BUFFER;case"bignumber":case"big number":return e.BIG_NUMBER;case"json":return e.JSON;case"file":return e.FILE;case"list<file>":return e.LIST_FILE;default:throw new i.a("Invalid data type string. No matching enum.")}}},{key:"enumLookup",value:function(t){switch(t){case e.BYTE_ARRAY:return"byteArray";case e.STRING:return"string";case e.NUMBER:return"number";case e.HTML:return"html";case e.ARRAY_BUFFER:return"ArrayBuffer";case e.BIG_NUMBER:return"BigNumber";case e.JSON:return"JSON";case e.FILE:return"File";case e.LIST_FILE:return"List<File>";default:throw new i.a("Invalid data type enum. No matching type.")}}}],r&&f(t.prototype,r),a&&f(t,a),e}();p.BYTE_ARRAY=0,p.STRING=1,p.NUMBER=2,p.HTML=3,p.ARRAY_BUFFER=4,p.BIG_NUMBER=5,p.JSON=6,p.FILE=7,p.LIST_FILE=8,t.a=p}}); |