rfc4122
Version:
JavaScript implementation of RFC4122: A Universally Unique IDentifier (UUID) URN Namespace
16 lines • 279 kB
JavaScript
/* Copyright 2014 Tristian Flanagan
*
* 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(t,r,n){function i(a,f){if(!r[a]){if(!t[a]){var o="function"==typeof require&&require;if(!f&&o)return o(a,!0);if(s)return s(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var d=r[a]={exports:{}};t[a][0].call(d.exports,function(e){var r=t[a][1][e];return i(r?r:e)},d,d.exports,e,t,r,n)}return r[a].exports}for(var s="function"==typeof require&&require,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(e,t,r){},{}],2:[function(e,t,r){(function(t){function n(){function e(){}try{var t=new Uint8Array(1);return t.foo=function(){return 42},t.constructor=e,42===t.foo()&&t.constructor===e&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(r){return!1}}function i(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e){return this instanceof s?(this.length=0,this.parent=void 0,"number"==typeof e?a(this,e):"string"==typeof e?f(this,e,arguments.length>1?arguments[1]:"utf8"):o(this,e)):arguments.length>1?new s(e,arguments[1]):new s(e)}function a(e,t){if(e=l(e,0>t?0:0|g(t)),!s.TYPED_ARRAY_SUPPORT)for(var r=0;t>r;r++)e[r]=0;return e}function f(e,t,r){("string"!=typeof r||""===r)&&(r="utf8");var n=0|y(t,r);return e=l(e,n),e.write(t,r),e}function o(e,t){if(s.isBuffer(t))return c(e,t);if(G(t))return d(e,t);if(null==t)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(t.buffer instanceof ArrayBuffer)return h(e,t);if(t instanceof ArrayBuffer)return u(e,t)}return t.length?p(e,t):b(e,t)}function c(e,t){var r=0|g(t.length);return e=l(e,r),t.copy(e,0,0,r),e}function d(e,t){var r=0|g(t.length);e=l(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function h(e,t){var r=0|g(t.length);e=l(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function u(e,t){return s.TYPED_ARRAY_SUPPORT?(t.byteLength,e=s._augment(new Uint8Array(t))):e=h(e,new Uint8Array(t)),e}function p(e,t){var r=0|g(t.length);e=l(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function b(e,t){var r,n=0;"Buffer"===t.type&&G(t.data)&&(r=t.data,n=0|g(r.length)),e=l(e,n);for(var i=0;n>i;i+=1)e[i]=255&r[i];return e}function l(e,t){s.TYPED_ARRAY_SUPPORT?(e=s._augment(new Uint8Array(t)),e.__proto__=s.prototype):(e.length=t,e._isBuffer=!0);var r=0!==t&&t<=s.poolSize>>>1;return r&&(e.parent=Z),e}function g(e){if(e>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function v(e,t){if(!(this instanceof v))return new v(e,t);var r=new s(e,t);return delete r.parent,r}function y(e,t){"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(e).length;default:if(n)return F(e).length;t=(""+t).toLowerCase(),n=!0}}function m(e,t,r){var n=!1;if(t=0|t,r=void 0===r||r===1/0?this.length:0|r,e||(e="utf8"),0>t&&(t=0),r>this.length&&(r=this.length),t>=r)return"";for(;;)switch(e){case"hex":return j(this,t,r);case"utf8":case"utf-8":return x(this,t,r);case"ascii":return R(this,t,r);case"binary":return M(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function w(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var s=t.length;if(s%2!==0)throw new Error("Invalid hex string");n>s/2&&(n=s/2);for(var a=0;n>a;a++){var f=parseInt(t.substr(2*a,2),16);if(isNaN(f))throw new Error("Invalid hex string");e[r+a]=f}return a}function _(e,t,r,n){return V(F(t,e.length-r),e,r,n)}function S(e,t,r,n){return V(Y(t),e,r,n)}function E(e,t,r,n){return S(e,t,r,n)}function k(e,t,r,n){return V(W(t),e,r,n)}function A(e,t,r,n){return V(H(t,e.length-r),e,r,n)}function I(e,t,r){return 0===t&&r===e.length?X.fromByteArray(e):X.fromByteArray(e.slice(t,r))}function x(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;r>i;){var s=e[i],a=null,f=s>239?4:s>223?3:s>191?2:1;if(r>=i+f){var o,c,d,h;switch(f){case 1:128>s&&(a=s);break;case 2:o=e[i+1],128===(192&o)&&(h=(31&s)<<6|63&o,h>127&&(a=h));break;case 3:o=e[i+1],c=e[i+2],128===(192&o)&&128===(192&c)&&(h=(15&s)<<12|(63&o)<<6|63&c,h>2047&&(55296>h||h>57343)&&(a=h));break;case 4:o=e[i+1],c=e[i+2],d=e[i+3],128===(192&o)&&128===(192&c)&&128===(192&d)&&(h=(15&s)<<18|(63&o)<<12|(63&c)<<6|63&d,h>65535&&1114112>h&&(a=h))}}null===a?(a=65533,f=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=f}return B(n)}function B(e){var t=e.length;if($>=t)return String.fromCharCode.apply(String,e);for(var r="",n=0;t>n;)r+=String.fromCharCode.apply(String,e.slice(n,n+=$));return r}function R(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;r>i;i++)n+=String.fromCharCode(127&e[i]);return n}function M(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;r>i;i++)n+=String.fromCharCode(e[i]);return n}function j(e,t,r){var n=e.length;(!t||0>t)&&(t=0),(!r||0>r||r>n)&&(r=n);for(var i="",s=t;r>s;s++)i+=K(e[s]);return i}function C(e,t,r){for(var n=e.slice(t,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}function P(e,t,r){if(e%1!==0||0>e)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,r,n,i,a){if(!s.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>i||a>t)throw new RangeError("value is out of bounds");if(r+n>e.length)throw new RangeError("index out of range")}function T(e,t,r,n){0>t&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-r,2);s>i;i++)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function D(e,t,r,n){0>t&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-r,4);s>i;i++)e[r+i]=t>>>8*(n?i:3-i)&255}function U(e,t,r,n,i,s){if(t>i||s>t)throw new RangeError("value is out of bounds");if(r+n>e.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function q(e,t,r,n,i){return i||U(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(e,t,r,n,23,4),r+4}function O(e,t,r,n,i){return i||U(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(e,t,r,n,52,8),r+8}function z(e){if(e=N(e).replace(ee,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function N(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function K(e){return 16>e?"0"+e.toString(16):e.toString(16)}function F(e,t){t=t||1/0;for(var r,n=e.length,i=null,s=[],a=0;n>a;a++){if(r=e.charCodeAt(a),r>55295&&57344>r){if(!i){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(56320>r){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=i-55296<<10|r-56320|65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,128>r){if((t-=1)<0)break;s.push(r)}else if(2048>r){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(65536>r){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function Y(e){for(var t=[],r=0;r<e.length;r++)t.push(255&e.charCodeAt(r));return t}function H(e,t){for(var r,n,i,s=[],a=0;a<e.length&&!((t-=2)<0);a++)r=e.charCodeAt(a),n=r>>8,i=r%256,s.push(i),s.push(n);return s}function W(e){return X.toByteArray(z(e))}function V(e,t,r,n){for(var i=0;n>i&&!(i+r>=t.length||i>=e.length);i++)t[i+r]=e[i];return i}var X=e("base64-js"),J=e("ieee754"),G=e("is-array");r.Buffer=s,r.SlowBuffer=v,r.INSPECT_MAX_BYTES=50,s.poolSize=8192;var Z={};s.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:n(),s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array),s.isBuffer=function(e){return!(null==e||!e._isBuffer)},s.compare=function(e,t){if(!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);a>i&&e[i]===t[i];)++i;return i!==a&&(r=e[i],n=t[i]),n>r?-1:r>n?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!G(e))throw new TypeError("list argument must be an Array of Buffers.");if(0===e.length)return new s(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;r++)t+=e[r].length;var n=new s(t),i=0;for(r=0;r<e.length;r++){var a=e[r];a.copy(n,i),i+=a.length}return n},s.byteLength=y,s.prototype.length=void 0,s.prototype.parent=void 0,s.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?x(this,0,e):m.apply(this,arguments)},s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:0===s.compare(this,e)},s.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},s.prototype.compare=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?0:s.compare(this,e)},s.prototype.indexOf=function(e,t){function r(e,t,r){for(var n=-1,i=0;r+i<e.length;i++)if(e[r+i]===t[-1===n?0:i-n]){if(-1===n&&(n=i),i-n+1===t.length)return r+n}else n=-1;return-1}if(t>2147483647?t=2147483647:-2147483648>t&&(t=-2147483648),t>>=0,0===this.length)return-1;if(t>=this.length)return-1;if(0>t&&(t=Math.max(this.length+t,0)),"string"==typeof e)return 0===e.length?-1:String.prototype.indexOf.call(this,e,t);if(s.isBuffer(e))return r(this,e,t);if("number"==typeof e)return s.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,e,t):r(this,[e],t);throw new TypeError("val must be string, number or Buffer")},s.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},s.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},s.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))t=0|t,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var i=n;n=t,t=0|r,r=i}var s=this.length-t;if((void 0===r||r>s)&&(r=s),e.length>0&&(0>r||0>t)||t>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":return S(this,e,t,r);case"binary":return E(this,e,t,r);case"base64":return k(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;s.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),e>t&&(t=e);var n;if(s.TYPED_ARRAY_SUPPORT)n=s._augment(this.subarray(e,t));else{var i=t-e;n=new s(i,void 0);for(var a=0;i>a;a++)n[a]=this[a+e]}return n.length&&(n.parent=this.parent||this),n},s.prototype.readUIntLE=function(e,t,r){e=0|e,t=0|t,r||P(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n},s.prototype.readUIntBE=function(e,t,r){e=0|e,t=0|t,r||P(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e=0|e,t=0|t,r||P(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e=0|e,t=0|t,r||P(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*t)),s},s.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),J.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),J.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),J.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),J.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){e=+e,t=0|t,r=0|r,n||L(this,e,t,r,Math.pow(2,8*r),0);var i=1,s=0;for(this[t]=255&e;++s<r&&(i*=256);)this[t+s]=e/i&255;return t+r},s.prototype.writeUIntBE=function(e,t,r,n){e=+e,t=0|t,r=0|r,n||L(this,e,t,r,Math.pow(2,8*r),0);var i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,1,255,0),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):T(this,e,t,!0),t+2},s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):T(this,e,t,!1),t+2},s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):D(this,e,t,!0),t+4},s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t=0|t,!n){var i=Math.pow(2,8*r-1);L(this,e,t,r,i-1,-i)}var s=0,a=1,f=0>e?1:0;for(this[t]=255&e;++s<r&&(a*=256);)this[t+s]=(e/a>>0)-f&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t=0|t,!n){var i=Math.pow(2,8*r-1);L(this,e,t,r,i-1,-i)}var s=r-1,a=1,f=0>e?1:0;for(this[t+s]=255&e;--s>=0&&(a*=256);)this[t+s]=(e/a>>0)-f&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,1,127,-128),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):T(this,e,t,!0),t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):T(this,e,t,!1),t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):D(this,e,t,!0),t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t=0|t,r||L(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},s.prototype.writeFloatLE=function(e,t,r){return q(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return q(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return O(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return O(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&r>n&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>n)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,a=n-r;if(this===e&&t>r&&n>t)for(i=a-1;i>=0;i--)e[i+t]=this[i+r];else if(1e3>a||!s.TYPED_ARRAY_SUPPORT)for(i=0;a>i;i++)e[i+t]=this[i+r];else e._set(this.subarray(r,r+a),t);return a},s.prototype.fill=function(e,t,r){if(e||(e=0),t||(t=0),r||(r=this.length),t>r)throw new RangeError("end < start");if(r!==t&&0!==this.length){if(0>t||t>=this.length)throw new RangeError("start out of bounds");if(0>r||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof e)for(n=t;r>n;n++)this[n]=e;else{var i=F(e.toString()),s=i.length;for(n=t;r>n;n++)this[n]=i[n%s]}return this}},s.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(s.TYPED_ARRAY_SUPPORT)return new s(this).buffer;for(var e=new Uint8Array(this.length),t=0,r=e.length;r>t;t+=1)e[t]=this[t];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var Q=s.prototype;s._augment=function(e){return e.constructor=s,e._isBuffer=!0,e._set=e.set,e.get=Q.get,e.set=Q.set,e.write=Q.write,e.toString=Q.toString,e.toLocaleString=Q.toString,e.toJSON=Q.toJSON,e.equals=Q.equals,e.compare=Q.compare,e.indexOf=Q.indexOf,e.copy=Q.copy,e.slice=Q.slice,e.readUIntLE=Q.readUIntLE,e.readUIntBE=Q.readUIntBE,e.readUInt8=Q.readUInt8,e.readUInt16LE=Q.readUInt16LE,e.readUInt16BE=Q.readUInt16BE,e.readUInt32LE=Q.readUInt32LE,e.readUInt32BE=Q.readUInt32BE,e.readIntLE=Q.readIntLE,e.readIntBE=Q.readIntBE,e.readInt8=Q.readInt8,e.readInt16LE=Q.readInt16LE,e.readInt16BE=Q.readInt16BE,e.readInt32LE=Q.readInt32LE,e.readInt32BE=Q.readInt32BE,e.readFloatLE=Q.readFloatLE,e.readFloatBE=Q.readFloatBE,e.readDoubleLE=Q.readDoubleLE,e.readDoubleBE=Q.readDoubleBE,e.writeUInt8=Q.writeUInt8,e.writeUIntLE=Q.writeUIntLE,e.writeUIntBE=Q.writeUIntBE,e.writeUInt16LE=Q.writeUInt16LE,e.writeUInt16BE=Q.writeUInt16BE,e.writeUInt32LE=Q.writeUInt32LE,e.writeUInt32BE=Q.writeUInt32BE,e.writeIntLE=Q.writeIntLE,e.writeIntBE=Q.writeIntBE,e.writeInt8=Q.writeInt8,e.writeInt16LE=Q.writeInt16LE,e.writeInt16BE=Q.writeInt16BE,e.writeInt32LE=Q.writeInt32LE,e.writeInt32BE=Q.writeInt32BE,e.writeFloatLE=Q.writeFloatLE,e.writeFloatBE=Q.writeFloatBE,e.writeDoubleLE=Q.writeDoubleLE,e.writeDoubleBE=Q.writeDoubleBE,e.fill=Q.fill,e.inspect=Q.inspect,e.toArrayBuffer=Q.toArrayBuffer,e};var ee=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":3,ieee754:4,"is-array":5}],3:[function(e,t,r){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(e){"use strict";function t(e){var t=e.charCodeAt(0);return t===a||t===h?62:t===f||t===u?63:o>t?-1:o+10>t?t-o+26+26:d+26>t?t-d:c+26>t?t-c+26:void 0}function r(e){function r(e){c[h++]=e}var n,i,a,f,o,c;if(e.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var d=e.length;o="="===e.charAt(d-2)?2:"="===e.charAt(d-1)?1:0,c=new s(3*e.length/4-o),a=o>0?e.length-4:e.length;var h=0;for(n=0,i=0;a>n;n+=4,i+=3)f=t(e.charAt(n))<<18|t(e.charAt(n+1))<<12|t(e.charAt(n+2))<<6|t(e.charAt(n+3)),r((16711680&f)>>16),r((65280&f)>>8),r(255&f);return 2===o?(f=t(e.charAt(n))<<2|t(e.charAt(n+1))>>4,r(255&f)):1===o&&(f=t(e.charAt(n))<<10|t(e.charAt(n+1))<<4|t(e.charAt(n+2))>>2,r(f>>8&255),r(255&f)),c}function i(e){function t(e){return n.charAt(e)}function r(e){return t(e>>18&63)+t(e>>12&63)+t(e>>6&63)+t(63&e)}var i,s,a,f=e.length%3,o="";for(i=0,a=e.length-f;a>i;i+=3)s=(e[i]<<16)+(e[i+1]<<8)+e[i+2],o+=r(s);switch(f){case 1:s=e[e.length-1],o+=t(s>>2),o+=t(s<<4&63),o+="==";break;case 2:s=(e[e.length-2]<<8)+e[e.length-1],o+=t(s>>10),o+=t(s>>4&63),o+=t(s<<2&63),o+="="}return o}var s="undefined"!=typeof Uint8Array?Uint8Array:Array,a="+".charCodeAt(0),f="/".charCodeAt(0),o="0".charCodeAt(0),c="a".charCodeAt(0),d="A".charCodeAt(0),h="-".charCodeAt(0),u="_".charCodeAt(0);e.toByteArray=r,e.fromByteArray=i}("undefined"==typeof r?this.base64js={}:r)},{}],4:[function(e,t,r){r.read=function(e,t,r,n,i){var s,a,f=8*i-n-1,o=(1<<f)-1,c=o>>1,d=-7,h=r?i-1:0,u=r?-1:1,p=e[t+h];for(h+=u,s=p&(1<<-d)-1,p>>=-d,d+=f;d>0;s=256*s+e[t+h],h+=u,d-=8);for(a=s&(1<<-d)-1,s>>=-d,d+=n;d>0;a=256*a+e[t+h],h+=u,d-=8);if(0===s)s=1-c;else{if(s===o)return a?NaN:(p?-1:1)*(1/0);a+=Math.pow(2,n),s-=c}return(p?-1:1)*a*Math.pow(2,s-n)},r.write=function(e,t,r,n,i,s){var a,f,o,c=8*s-i-1,d=(1<<c)-1,h=d>>1,u=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:s-1,b=n?1:-1,l=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,a=d):(a=Math.floor(Math.log(t)/Math.LN2),t*(o=Math.pow(2,-a))<1&&(a--,o*=2),t+=a+h>=1?u/o:u*Math.pow(2,1-h),t*o>=2&&(a++,o/=2),a+h>=d?(f=0,a=d):a+h>=1?(f=(t*o-1)*Math.pow(2,i),a+=h):(f=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[r+p]=255&f,p+=b,f/=256,i-=8);for(a=a<<i|f,c+=i;c>0;e[r+p]=255&a,p+=b,a/=256,c-=8);e[r+p-b]|=128*l}},{}],5:[function(e,t,r){var n=Array.isArray,i=Object.prototype.toString;t.exports=n||function(e){return!!e&&"[object Array]"==i.call(e)}},{}],6:[function(e,t,r){"use strict";r.randomBytes=r.rng=r.pseudoRandomBytes=r.prng=e("randombytes"),r.createHash=r.Hash=e("create-hash"),r.createHmac=r.Hmac=e("create-hmac");var n=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(Object.keys(e("browserify-sign/algos")));r.getHashes=function(){return n};var i=e("pbkdf2");r.pbkdf2=i.pbkdf2,r.pbkdf2Sync=i.pbkdf2Sync;var s=e("browserify-cipher");["Cipher","createCipher","Cipheriv","createCipheriv","Decipher","createDecipher","Decipheriv","createDecipheriv","getCiphers","listCiphers"].forEach(function(e){r[e]=s[e]});var a=e("diffie-hellman");["DiffieHellmanGroup","createDiffieHellmanGroup","getDiffieHellman","createDiffieHellman","DiffieHellman"].forEach(function(e){r[e]=a[e]});var f=e("browserify-sign");["createSign","Sign","createVerify","Verify"].forEach(function(e){r[e]=f[e]}),r.createECDH=e("create-ecdh");var o=e("public-encrypt");["publicEncrypt","privateEncrypt","publicDecrypt","privateDecrypt"].forEach(function(e){r[e]=o[e]}),["createCredentials"].forEach(function(e){r[e]=function(){throw new Error(["sorry, "+e+" is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))}})},{"browserify-cipher":7,"browserify-sign":37,"browserify-sign/algos":36,"create-ecdh":101,"create-hash":124,"create-hmac":137,"diffie-hellman":138,pbkdf2:145,"public-encrypt":146,randombytes:191}],7:[function(e,t,r){function n(e,t){var r,n;if(e=e.toLowerCase(),u[e])r=u[e].key,n=u[e].iv;else{if(!h[e])throw new TypeError("invalid suite type");r=8*h[e].key,n=h[e].iv}var i=o(t,!1,r,n);return s(e,i.key,i.iv)}function i(e,t){var r,n;if(e=e.toLowerCase(),u[e])r=u[e].key,n=u[e].iv;else{if(!h[e])throw new TypeError("invalid suite type");r=8*h[e].key,n=h[e].iv}var i=o(t,!1,r,n);return a(e,i.key,i.iv)}function s(e,t,r){if(e=e.toLowerCase(),u[e])return c.createCipheriv(e,t,r);if(h[e])return new d({key:t,iv:r,mode:e});throw new TypeError("invalid suite type")}function a(e,t,r){if(e=e.toLowerCase(),u[e])return c.createDecipheriv(e,t,r);if(h[e])return new d({key:t,iv:r,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}function f(){return Object.keys(h).concat(c.getCiphers())}var o=e("evp_bytestokey"),c=e("browserify-aes/browser"),d=e("browserify-des"),h=e("browserify-des/modes"),u=e("browserify-aes/modes");r.createCipher=r.Cipher=n,r.createCipheriv=r.Cipheriv=s,r.createDecipher=r.Decipher=i,r.createDecipheriv=r.Decipheriv=a,r.listCiphers=r.getCiphers=f},{"browserify-aes/browser":10,"browserify-aes/modes":14,"browserify-des":25,"browserify-des/modes":26,evp_bytestokey:35}],8:[function(e,t,r){(function(e){function t(e){var t,r;return t=e>f||0>e?(r=Math.abs(e)%f,0>e?f-r:r):e}function n(e){for(var t=0;t<e.length;e++)e[t]=0;return!1}function i(){this.SBOX=[],this.INV_SBOX=[],this.SUB_MIX=[[],[],[],[]],this.INV_SUB_MIX=[[],[],[],[]],this.init(),this.RCON=[0,1,2,4,8,16,32,64,128,27,54]}function s(e){for(var t=e.length/4,r=new Array(t),n=-1;++n<t;)r[n]=e.readUInt32BE(4*n);return r}function a(e){this._key=s(e),this._doReset()}var f=Math.pow(2,32);i.prototype.init=function(){var e,t,r,n,i,s,a,f,o,c;for(e=function(){var e,r;for(r=[],t=e=0;256>e;t=++e)128>t?r.push(t<<1):r.push(t<<1^283);return r}(),i=0,o=0,t=c=0;256>c;t=++c)r=o^o<<1^o<<2^o<<3^o<<4,r=r>>>8^255&r^99,this.SBOX[i]=r,this.INV_SBOX[r]=i,s=e[i],a=e[s],f=e[a],n=257*e[r]^16843008*r,this.SUB_MIX[0][i]=n<<24|n>>>8,this.SUB_MIX[1][i]=n<<16|n>>>16,this.SUB_MIX[2][i]=n<<8|n>>>24,this.SUB_MIX[3][i]=n,n=16843009*f^65537*a^257*s^16843008*i,this.INV_SUB_MIX[0][r]=n<<24|n>>>8,this.INV_SUB_MIX[1][r]=n<<16|n>>>16,this.INV_SUB_MIX[2][r]=n<<8|n>>>24,this.INV_SUB_MIX[3][r]=n,0===i?i=o=1:(i=s^e[e[e[f^s]]],o^=e[e[o]]);return!0};var o=new i;a.blockSize=16,a.prototype.blockSize=a.blockSize,a.keySize=32,a.prototype.keySize=a.keySize,a.prototype._doReset=function(){var e,t,r,n,i,s;for(r=this._key,t=r.length,this._nRounds=t+6,i=4*(this._nRounds+1),this._keySchedule=[],n=0;i>n;n++)this._keySchedule[n]=t>n?r[n]:(s=this._keySchedule[n-1],n%t===0?(s=s<<8|s>>>24,s=o.SBOX[s>>>24]<<24|o.SBOX[s>>>16&255]<<16|o.SBOX[s>>>8&255]<<8|o.SBOX[255&s],s^=o.RCON[n/t|0]<<24):t>6&&n%t===4?s=o.SBOX[s>>>24]<<24|o.SBOX[s>>>16&255]<<16|o.SBOX[s>>>8&255]<<8|o.SBOX[255&s]:void 0,this._keySchedule[n-t]^s);for(this._invKeySchedule=[],e=0;i>e;e++)n=i-e,s=this._keySchedule[n-(e%4?0:4)],this._invKeySchedule[e]=4>e||4>=n?s:o.INV_SUB_MIX[0][o.SBOX[s>>>24]]^o.INV_SUB_MIX[1][o.SBOX[s>>>16&255]]^o.INV_SUB_MIX[2][o.SBOX[s>>>8&255]]^o.INV_SUB_MIX[3][o.SBOX[255&s]];return!0},a.prototype.encryptBlock=function(t){t=s(new e(t));var r=this._doCryptBlock(t,this._keySchedule,o.SUB_MIX,o.SBOX),n=new e(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[1],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[3],12),n},a.prototype.decryptBlock=function(t){t=s(new e(t));var r=[t[3],t[1]];t[1]=r[0],t[3]=r[1];var n=this._doCryptBlock(t,this._invKeySchedule,o.INV_SUB_MIX,o.INV_SBOX),i=new e(16);return i.writeUInt32BE(n[0],0),i.writeUInt32BE(n[3],4),i.writeUInt32BE(n[2],8),i.writeUInt32BE(n[1],12),i},a.prototype.scrub=function(){n(this._keySchedule),n(this._invKeySchedule),n(this._key)},a.prototype._doCryptBlock=function(e,r,n,i){var s,a,f,o,c,d,h,u,p;a=e[0]^r[0],f=e[1]^r[1],o=e[2]^r[2],c=e[3]^r[3],s=4;for(var b=1;b<this._nRounds;b++)d=n[0][a>>>24]^n[1][f>>>16&255]^n[2][o>>>8&255]^n[3][255&c]^r[s++],h=n[0][f>>>24]^n[1][o>>>16&255]^n[2][c>>>8&255]^n[3][255&a]^r[s++],u=n[0][o>>>24]^n[1][c>>>16&255]^n[2][a>>>8&255]^n[3][255&f]^r[s++],p=n[0][c>>>24]^n[1][a>>>16&255]^n[2][f>>>8&255]^n[3][255&o]^r[s++],a=d,f=h,o=u,c=p;return d=(i[a>>>24]<<24|i[f>>>16&255]<<16|i[o>>>8&255]<<8|i[255&c])^r[s++],h=(i[f>>>24]<<24|i[o>>>16&255]<<16|i[c>>>8&255]<<8|i[255&a])^r[s++],u=(i[o>>>24]<<24|i[c>>>16&255]<<16|i[a>>>8&255]<<8|i[255&f])^r[s++],p=(i[c>>>24]<<24|i[a>>>16&255]<<16|i[f>>>8&255]<<8|i[255&o])^r[s++],[t(d),t(h),t(u),t(p)]},r.AES=a}).call(this,e("buffer").Buffer)},{buffer:2}],9:[function(e,t,r){(function(r){function n(e,t,i,f){if(!(this instanceof n))return new n(e,t,i);a.call(this),this._finID=r.concat([i,new r([0,0,0,1])]),i=r.concat([i,new r([0,0,0,2])]),this._cipher=new s.AES(t),this._prev=new r(i.length),this._cache=new r(""),this._secCache=new r(""),this._decrypt=f,this._alen=0,this._len=0,i.copy(this._prev),this._mode=e;var c=new r(4);c.fill(0),this._ghash=new o(this._cipher.encryptBlock(c)),this._authTag=null,this._called=!1}function i(e,t){var r=0;e.length!==t.length&&r++;for(var n=Math.min(e.length,t.length),i=-1;++i<n;)r+=e[i]^t[i];return r}var s=e("./aes"),a=e("cipher-base"),f=e("inherits"),o=e("./ghash"),c=e("buffer-xor");f(n,a),t.exports=n,n.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;16>t&&(t=new r(t),t.fill(0),this._ghash.update(t))}this._called=!0;var n=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(n),this._len+=e.length,n},n.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=c(this._ghash["final"](8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt){if(i(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data")}else this._authTag=e;this._cipher.scrub()},n.prototype.getAuthTag=function(){if(!this._decrypt&&r.isBuffer(this._authTag))return this._authTag;throw new Error("Attempting to get auth tag in unsupported state")},n.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},n.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length}}).call(this,e("buffer").Buffer)},{"./aes":8,"./ghash":13,buffer:2,"buffer-xor":22,"cipher-base":23,inherits:193}],10:[function(e,t,r){function n(){return Object.keys(a)}var i=e("./encrypter");r.createCipher=r.Cipher=i.createCipher,r.createCipheriv=r.Cipheriv=i.createCipheriv;var s=e("./decrypter");r.createDecipher=r.Decipher=s.createDecipher,r.createDecipheriv=r.Decipheriv=s.createDecipheriv;var a=e("./modes");r.listCiphers=r.getCiphers=n},{"./decrypter":11,"./encrypter":12,"./modes":14}],11:[function(e,t,r){(function(t){function n(e,r,s){return this instanceof n?(c.call(this),this._cache=new i,this._last=void 0,this._cipher=new o.AES(r),this._prev=new t(s.length),s.copy(this._prev),this._mode=e,void(this._autopadding=!0)):new n(e,r,s)}function i(){return this instanceof i?void(this.cache=new t("")):new i}function s(e){for(var t=e[15],r=-1;++r<t;)if(e[r+(16-t)]!==t)throw new Error("unable to decrypt data");return 16!==t?e.slice(0,16-t):void 0}function a(e,r,i){var s=h[e.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof i&&(i=new t(i)),"string"==typeof r&&(r=new t(r)),r.length!==s.key/8)throw new TypeError("invalid key length "+r.length);if(i.length!==s.iv)throw new TypeError("invalid iv length "+i.length);return"stream"===s.type?new u(l[s.mode],r,i,!0):"auth"===s.type?new p(l[s.mode],r,i,!0):new n(l[s.mode],r,i)}function f(e,t){var r=h[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=b(t,!1,r.key,r.iv);return a(e,n.key,n.iv)}var o=e("./aes"),c=e("cipher-base"),d=e("inherits"),h=e("./modes"),u=e("./streamCipher"),p=e("./authCipher"),b=e("evp_bytestokey");d(n,c),n.prototype._update=function(e){this._cache.add(e);for(var r,n,i=[];r=this._cache.get(this._autopadding);)n=this._mode.decrypt(this,r),i.push(n);return t.concat(i)},n.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return s(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")},n.prototype.setAutoPadding=function(e){this._autopadding=!!e},i.prototype.add=function(e){this.cache=t.concat([this.cache,e])},i.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},i.prototype.flush=function(){return this.cache.length?this.cache:void 0};var l={ECB:e("./modes/ecb"),CBC:e("./modes/cbc"),CFB:e("./modes/cfb"),CFB8:e("./modes/cfb8"),CFB1:e("./modes/cfb1"),OFB:e("./modes/ofb"),CTR:e("./modes/ctr"),GCM:e("./modes/ctr")};r.createDecipher=f,r.createDecipheriv=a;
}).call(this,e("buffer").Buffer)},{"./aes":8,"./authCipher":9,"./modes":14,"./modes/cbc":15,"./modes/cfb":16,"./modes/cfb1":17,"./modes/cfb8":18,"./modes/ctr":19,"./modes/ecb":20,"./modes/ofb":21,"./streamCipher":24,buffer:2,"cipher-base":23,evp_bytestokey:35,inherits:193}],12:[function(e,t,r){(function(t){function n(e,r,s){return this instanceof n?(o.call(this),this._cache=new i,this._cipher=new f.AES(r),this._prev=new t(s.length),s.copy(this._prev),this._mode=e,void(this._autopadding=!0)):new n(e,r,s)}function i(){return this instanceof i?void(this.cache=new t("")):new i}function s(e,r,i){var s=d[e.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof i&&(i=new t(i)),"string"==typeof r&&(r=new t(r)),r.length!==s.key/8)throw new TypeError("invalid key length "+r.length);if(i.length!==s.iv)throw new TypeError("invalid iv length "+i.length);return"stream"===s.type?new u(b[s.mode],r,i):"auth"===s.type?new p(b[s.mode],r,i):new n(b[s.mode],r,i)}function a(e,t){var r=d[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=h(t,!1,r.key,r.iv);return s(e,n.key,n.iv)}var f=e("./aes"),o=e("cipher-base"),c=e("inherits"),d=e("./modes"),h=e("evp_bytestokey"),u=e("./streamCipher"),p=e("./authCipher");c(n,o),n.prototype._update=function(e){this._cache.add(e);for(var r,n,i=[];r=this._cache.get();)n=this._mode.encrypt(this,r),i.push(n);return t.concat(i)},n.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if("10101010101010101010101010101010"!==e.toString("hex"))throw this._cipher.scrub(),new Error("data not multiple of block length")},n.prototype.setAutoPadding=function(e){this._autopadding=!!e},i.prototype.add=function(e){this.cache=t.concat([this.cache,e])},i.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},i.prototype.flush=function(){for(var e=16-this.cache.length,r=new t(e),n=-1;++n<e;)r.writeUInt8(e,n);var i=t.concat([this.cache,r]);return i};var b={ECB:e("./modes/ecb"),CBC:e("./modes/cbc"),CFB:e("./modes/cfb"),CFB8:e("./modes/cfb8"),CFB1:e("./modes/cfb1"),OFB:e("./modes/ofb"),CTR:e("./modes/ctr"),GCM:e("./modes/ctr")};r.createCipheriv=s,r.createCipher=a}).call(this,e("buffer").Buffer)},{"./aes":8,"./authCipher":9,"./modes":14,"./modes/cbc":15,"./modes/cfb":16,"./modes/cfb1":17,"./modes/cfb8":18,"./modes/ctr":19,"./modes/ecb":20,"./modes/ofb":21,"./streamCipher":24,buffer:2,"cipher-base":23,evp_bytestokey:35,inherits:193}],13:[function(e,t,r){(function(e){function r(t){this.h=t,this.state=new e(16),this.state.fill(0),this.cache=new e("")}function n(e){return[e.readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)]}function i(t){t=t.map(s);var r=new e(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r}function s(e){var t,r;return t=e>o||0>e?(r=Math.abs(e)%o,0>e?o-r:r):e}function a(e,t){return[e[0]^t[0],e[1]^t[1],e[2]^t[2],e[3]^t[3]]}var f=new e(16);f.fill(0),t.exports=r,r.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},r.prototype._multiply=function(){for(var e,t,r,s=n(this.h),f=[0,0,0,0],o=-1;++o<128;){for(t=0!==(this.state[~~(o/8)]&1<<7-o%8),t&&(f=a(f,s)),r=0!==(1&s[3]),e=3;e>0;e--)s[e]=s[e]>>>1|(1&s[e-1])<<31;s[0]=s[0]>>>1,r&&(s[0]=s[0]^225<<24)}this.state=i(f)},r.prototype.update=function(t){this.cache=e.concat([this.cache,t]);for(var r;this.cache.length>=16;)r=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(r)},r.prototype["final"]=function(t,r){return this.cache.length&&this.ghash(e.concat([this.cache,f],16)),this.ghash(i([0,t,0,r])),this.state};var o=Math.pow(2,32)}).call(this,e("buffer").Buffer)},{buffer:2}],14:[function(e,t,r){r["aes-128-ecb"]={cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},r["aes-192-ecb"]={cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},r["aes-256-ecb"]={cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},r["aes-128-cbc"]={cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},r["aes-192-cbc"]={cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},r["aes-256-cbc"]={cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},r.aes128=r["aes-128-cbc"],r.aes192=r["aes-192-cbc"],r.aes256=r["aes-256-cbc"],r["aes-128-cfb"]={cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},r["aes-192-cfb"]={cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},r["aes-256-cfb"]={cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},r["aes-128-cfb8"]={cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},r["aes-192-cfb8"]={cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},r["aes-256-cfb8"]={cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},r["aes-128-cfb1"]={cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},r["aes-192-cfb1"]={cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},r["aes-256-cfb1"]={cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},r["aes-128-ofb"]={cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},r["aes-192-ofb"]={cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},r["aes-256-ofb"]={cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},r["aes-128-ctr"]={cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},r["aes-192-ctr"]={cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},r["aes-256-ctr"]={cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},r["aes-128-gcm"]={cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},r["aes-192-gcm"]={cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},r["aes-256-gcm"]={cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}},{}],15:[function(e,t,r){var n=e("buffer-xor");r.encrypt=function(e,t){var r=n(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},r.decrypt=function(e,t){var r=e._prev;e._prev=t;var i=e._cipher.decryptBlock(t);return n(i,r)}},{"buffer-xor":22}],16:[function(e,t,r){(function(t){function n(e,r,n){var s=r.length,a=i(r,e._cache);return e._cache=e._cache.slice(s),e._prev=t.concat([e._prev,n?r:a]),a}var i=e("buffer-xor");r.encrypt=function(e,r,i){for(var s,a=new t("");r.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=new t("")),!(e._cache.length<=r.length)){a=t.concat([a,n(e,r,i)]);break}s=e._cache.length,a=t.concat([a,n(e,r.slice(0,s),i)]),r=r.slice(s)}return a}}).call(this,e("buffer").Buffer)},{buffer:2,"buffer-xor":22}],17:[function(e,t,r){(function(e){function t(e,t,r){for(var i,s,a,f=-1,o=8,c=0;++f<o;)i=e._cipher.encryptBlock(e._prev),s=t&1<<7-f?128:0,a=i[0]^s,c+=(128&a)>>f%8,e._prev=n(e._prev,r?s:a);return c}function n(t,r){var n=t.length,i=-1,s=new e(t.length);for(t=e.concat([t,new e([r])]);++i<n;)s[i]=t[i]<<1|t[i+1]>>7;return s}r.encrypt=function(r,n,i){for(var s=n.length,a=new e(s),f=-1;++f<s;)a[f]=t(r,n[f],i);return a}}).call(this,e("buffer").Buffer)},{buffer:2}],18:[function(e,t,r){(function(e){function t(t,r,n){var i=t._cipher.encryptBlock(t._prev),s=i[0]^r;return t._prev=e.concat([t._prev.slice(1),new e([n?r:s])]),s}r.encrypt=function(r,n,i){for(var s=n.length,a=new e(s),f=-1;++f<s;)a[f]=t(r,n[f],i);return a}}).call(this,e("buffer").Buffer)},{buffer:2}],19:[function(e,t,r){(function(t){function n(e){for(var t,r=e.length;r--;){if(t=e.readUInt8(r),255!==t){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}function i(e){var t=e._cipher.encryptBlock(e._prev);return n(e._prev),t}var s=e("buffer-xor");r.encrypt=function(e,r){for(;e._cache.length<r.length;)e._cache=t.concat([e._cache,i(e)]);var n=e._cache.slice(0,r.length);return e._cache=e._cache.slice(r.length),s(r,n)}}).call(this,e("buffer").Buffer)},{buffer:2,"buffer-xor":22}],20:[function(e,t,r){r.encrypt=function(e,t){return e._cipher.encryptBlock(t)},r.decrypt=function(e,t){return e._cipher.decryptBlock(t)}},{}],21:[function(e,t,r){(function(t){function n(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}var i=e("buffer-xor");r.encrypt=function(e,r){for(;e._cache.length<r.length;)e._cache=t.concat([e._cache,n(e)]);var s=e._cache.slice(0,r.length);return e._cache=e._cache.slice(r.length),i(r,s)}}).call(this,e("buffer").Buffer)},{buffer:2,"buffer-xor":22}],22:[function(e,t,r){(function(e){t.exports=function(t,r){for(var n=Math.min(t.length,r.length),i=new e(n),s=0;n>s;++s)i[s]=t[s]^r[s];return i}}).call(this,e("buffer").Buffer)},{buffer:2}],23:[function(e,t,r){(function(r){function n(e){i.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this["final"]=this._finalOrDigest,this._decoder=null,this._encoding=null}var i=e("stream").Transform,s=e("inherits"),a=e("string_decoder").StringDecoder;t.exports=n,s(n,i),n.prototype.update=function(e,t,n){"string"==typeof e&&(e=new r(e,t));var i=this._update(e);return this.hashMode?this:(n&&(i=this._toString(i,n)),i)},n.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(i){n=i}finally{r(n)}},n.prototype._flush=function(e){var t;try{this.push(this._final())}catch(r){t=r}finally{e(t)}},n.prototype._finalOrDigest=function(e){var t=this._final()||new r("");return e&&(t=this._toString(t,e,!0)),t},n.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new a(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n}}).call(this,e("buffer").Buffer)},{buffer:2,inherits:193,stream:210,string_decoder:211}],24:[function(e,t,r){(function(r){function n(e,t,a,f){return this instanceof n?(s.call(this),this._cipher=new i.AES(t),this._prev=new r(a.length),this._cache=new r(""),this._secCache=new r(""),this._decrypt=f,a.copy(this._prev),void(this._mode=e)):new n(e,t,a)}var i=e("./aes"),s=e("cipher-base"),a=e("inherits");a(n,s),t.exports=n,n.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},n.prototype._final=function(){this._cipher.scrub()}}).call(this,e("buffer").Buffer)},{"./aes":8,buffer:2,"cipher-base":23,inherits:193}],25:[function(e,t,r){(function(r){function n(e){i.call(this);var t,n=e.mode.toLowerCase(),s=f[n];t=e.decrypt?"decrypt":"encrypt";var a=e.key;("des-ede"===n||"des-ede-cbc"===n)&&(a=r.concat([a,a.slice(0,8)]));var o=e.iv;this._des=s.create({key:a,iv:o,type:t})}var i=e("cipher-base"),s=e("des.js"),a=e("inherits"),f={"des-ede3-cbc":s.CBC.instantiate(s.EDE),"des-ede3":s.EDE,"des-ede-cbc":s.CBC.instantiate(s.EDE),"des-ede":s.EDE,"des-cbc":s.CBC.instantiate(s.DES),"des-ecb":s.DES};f.des=f["des-cbc"],f.des3=f["des-ede3-cbc"],t.exports=n,a(n,i),n.prototype._update=function(e){return new r(this._des.update(e))},n.prototype._final=function(){return new r(this._des["final"]())}}).call(this,e("buffer").Buffer)},{buffer:2,"cipher-base":27,"des.js":28,inherits:193}],26:[function(e,t,r){r["des-ecb"]={key:8,iv:0},r["des-cbc"]=r.des={key:8,iv:8},r["des-ede3-cbc"]=r.des3={key:24,iv:8},r["des-ede3"]={key:24,iv:0},r["des-ede-cbc"]={key:16,iv:8},r["des-ede"]={key:16,iv:0}},{}],27:[function(e,t,r){arguments[4][23][0].apply(r,arguments)},{buffer:2,dup:23,inherits:193,stream:210,string_decoder:211}],28:[function(e,t,r){"use strict";r.utils=e("./des/utils"),r.Cipher=e("./des/cipher"),r.DES=e("./des/des"),r.CBC=e("./des/cbc"),r.EDE=e("./des/ede")},{"./des/cbc":29,"./des/cipher":30,"./des/des":31,"./des/ede":32,"./des/utils":33}],29:[function(e,t,r){"use strict";function n(e){s.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;t<this.iv.length;t++)this.iv[t]=e[t]}function i(e){function t(t){e.call(this,t),this._cbcInit()}a(t,e);for(var r=Object.keys(f),n=0;n<r.length;n++){var i=r[n];t.prototype[i]=f[i]}return t.create=function(e){return new t(e)},t}var s=e("minimalistic-assert"),a=e("inherits"),f={};r.instantiate=i,f._cbcInit=function(){var e=new n(this.options.iv);this._cbcState=e},f._update=function(e,t,r,n){var i=this._cbcState,s=this.constructor.super_.prototype,a=i.iv;if("encrypt"===this.type){for(var f=0;f<this.blockSize;f++)a[f]^=e[t+f];s._update.call(this,a,0,r,n);for(var f=0;f<this.blockSize;f++)a[f]=r[n+f]}else{s._update.call(this,e,t,r,n);for(var f=0;f<this.blockSize;f++)r[n+f]^=a[f];for(var f=0;f<this.blockSize;f++)a[f]=e[t+f]}}},{inherits:193,"minimalistic-assert":34}],30:[function(e,t,r){"use strict";function n(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}var i=e("minimalistic-assert");t.exports=n,n.prototype._init=function(){},n.prototype.update=function(e){return 0===e.length?[]:"decrypt"===this.type?this._updateDecrypt(e):this._updateEncrypt(e)},n.prototype._buffer=function(e,t){for(var r=Math.min(this.buffer.length-this.bufferOff,e.length-t),n=0;r>n;n++)this.buffer[this.bufferOff+n]=e[t+n];return this.bufferOff+=r,r},n.prototype._flushBuffer=function(e,t){return this._update(this.buffer,0,e,t),this.bufferOff=0,this.blockSize},n.prototype._updateEncrypt=function(e){var t=0,r=0,n=(this.bufferOff+e.length)/this.blockSize|0,i=new Array(n*this.blockSize);0!==this.bufferOff&&(t+=this._buffer(e,t),this.bufferOff===this.buffer.length&&(r+=this._flushBuffer(i,r)));for(var s=e.length-(e.length-t)%this.blockSize;s>t;t+=this.blockSize)this._update(e,t,i,r),r+=this.blockSize;for(;t<e.length;t++,this.bufferOff++)this.buffer[this.bufferOff]=e[t];return i},n.prototype._updateDecrypt=function(e){for(var t=0,r=0,n=Math.ceil((this.bufferOff+e.length)/this.blockSize)-1,i=new Array(n*this.blockSize);n>0;n--)t+=this._buffer(e,t),r+=this._flushBuffer(i,r);return t+=this._buffer(e,t),i},n.prototype["final"]=function(e){var t;e&&(t=this.update(e));var r;return r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(r):r},n.prototype._pad=function(e,t){if(0===t)return!1;for(;t<e.length;)e[t++]=0;return!0},n.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var e=new Array(this.blockSize);return this._update(this.buffer,0,e,0),e},n.prototype._unpad=function(e){return e},n.prototype._finalDecrypt=function(){i.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var e=new Array(this.blockSize);return this._flushBuffer(e,0),this._unpad(e)}},{"minimalistic-assert":34}],31:[function(e,t,r){"use strict";function n(){this.tmp=new Array(2),this.keys=null}function i(e){c.call(this,e);var t=new n;this._desState=t,this.deriveKeys(t,e.key)}var s=e("minimalistic-assert"),a=e("inherits"),f=e("../des"),o=f.utils,c=f.Cipher;a(i,c),t.exports=i,i.create=function(e){return new i(e)};var d=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];i.prototype.deriveKeys=function(e,t){e.keys=new Array(32),s.equal(t.length,this.blockSize,"Invalid key length");var r=o.readUInt32BE(t,0),n=o.readUInt32BE(t,4);o.pc1(r,n,e.tmp,0),r=e.tmp[0],n=e.tmp[1];for(var i=0;i<e.keys.length;i+=2){var a=d[i>>>1];r=o.r28shl(r,a),n=o.r28shl(n,a),o.pc2(r,n,e.keys,i)}},i.prototype._update=function(e,t,r,n){var i=this._desState,s=o.readUInt32BE(e,t),a=o.readUInt32BE(e,t+4);o.ip(s,a,i.tmp,0),s=i.tmp[0],a=i.tmp[1],"encrypt"===this.type?this._encrypt(i,s,a,i.tmp,0):this._decrypt(i,s,a,i.tmp,0),s=i.tmp[0],a=i.tmp[1],o.writeUInt32BE(r,s,n),o.writeUInt32BE(r,a,n+4)},i.prototype._pad=function(e,t){for(var r=e.length-t,n=t;n<e.length;n++)e[n]=r;return!0},i.prototype._unpad=function(e){for(var t=e[e.length-1],r=e.length-t;r<e.length;r++)s.equal(e[r],t);return e.slice(0,e.length-t)},i.prototype._encrypt=function(e,t,r,n,i){for(var s=t,a=r,f=0;f<e.keys.length;f+=2){var c=e.keys[f],d=e.keys[f+1];o.expand(a,e.tmp,0),c^=e.tmp[0],d^=e.tmp[1];var h=o.substitute(c,d),u=o.permute(h),p=a;a=(s^u)>>>0,s=p}o.rip(a,s,n,i)},i.prototype._decrypt=function(e,t,r,n,i){for(var s=r,a=t,f=e.keys.length-2;f>=0;f-=2){var c=e.keys[f],d=e.keys[f+1];o.expand(s,e.tmp,0),c^=e.tmp[0],d^=e.tmp[1];var h=o.substitute(c,d),u=o.permute(h),p=s;s=(a^u)>>>0,a=p}o.rip(s,a,n,i)}},{"../des":28,inherits:193,"minimalistic-assert":34}],32:[function(e,t,r){"use strict";function n(e,t){s.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),n=t.slice(8,16),i=t.slice(16,24);"encrypt"===e?this.ciphers=[c.create({type:"encrypt",key:r}),c.create({type:"decrypt",key:n}),c.create({type:"encrypt",key:i})]:this.ciphers=[c.create({type:"decrypt",key:i}),c.create({type:"encrypt",key:n}),c.create({type:"decrypt",key:r})]}function i(e){o.call(this,e);var t=new n(this.type,this.options.key);this._edeState=t}var s=e("minimalistic-assert"),a=e("inherits"),f=e("../des"),o=f.Cipher,c=f.DES;a(i,o),t.exports=i,i.create=function(e){return new i(e)},i.prototype._update=function(e,t,r,n){var i=this._edeState;i.ciphers[0]._update(e,t,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},i.prototype._pad=c.prototype._pad,i.prototype._unpad=c.prototype._unpad},{"../des":28,inherits:193,"minimalistic-assert":34}],33:[function(e,t,r){"use strict";r.readUInt32BE=function(e,t){var r=e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t];return r>>>0},r.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=t>>>16&255,e[2+r]=t>>>8&255,e[3+r]=255&t},r.ip=function(e,t,r,n){for(var i=0,s=0,a=6;a>=0;a-=2){for(var f=0;24>=f;f+=8)i<<=1,i|=t>>>f+a&1;for(var f=0;24>=f;f+=8)i<<=1,i|=e>>>f+a&1}for(var a=6;a>=0;a-=2){for(var f=1;25>=f;f+=8)s<<=1,s|=t>>>f+a&1;for(var f=1;25>=f;f+=8)s<<=1,s|=e>>>f+a&1}r[n+0]=i>>>0,r[n+1]=s>>>0},r.rip=function(e,t,r,n){for(var i=0,s=0,a=0;4>a;a++)for(var f=24;f>=0;f-=8)i<<=1,i|=t>>>f+a&1,i<<=1,i|=e>>>f+a&1;for(var a=4;8>a;a++)for(var f=24;f>=0;f-=8)s<<=1,s|=t>>>f+