arnaucube
arnaucube/websnarkPublic Self-hosted repository
websnark/build/websnark.js
build/websnark.jsRaw
   1(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
   2(function (Buffer){
   3
   4            exports.code = new Buffer("AGFzbQEAAAABPApgAn9/AGABfwBgAX8Bf2ACf38Bf2ADf39/AX9gA39/fwBgA39+fwBgAn9+AGAEf39/fwBgBX9/f39/AAIQAQNlbnYGbWVtb3J5AgDoBwNgXwABAgEDAwQEBQYHCAUFBQAABQAAAAEFBQAABQAAAAEFAAIBAAAFAAUAAAAIAQIAAgUICQMABQUFBQACBQUIAAgCAQEABQUFAAAAAwACAQAABQAFAAAACAECAAIFCAkFB+4IXAhpbnRfY29weQAACGludF96ZXJvAAEHaW50X29uZQADCmludF9pc1plcm8AAgZpbnRfZXEABAdpbnRfZ3RlAAUHaW50X2FkZAAGB2ludF9zdWIABwdpbnRfbXVsAAgHaW50X2RpdgALDmludF9pbnZlcnNlTW9kAAwHZjFtX2FkZAANB2YxbV9zdWIADgdmMW1fbmVnAA8LZjFtX21SZWR1Y3QAEAdmMW1fbXVsABESZjFtX2Zyb21Nb250Z29tZXJ5ABMQZjFtX3RvTW9udGdvbWVyeQASC2YxbV9pbnZlcnNlABQIZjFtX2NvcHkAAAhmMW1femVybwABCmYxbV9pc1plcm8AAgZmMW1fZXEABAdmMW1fb25lABUHZnJtX2FkZAAWB2ZybV9zdWIAFwdmcm1fbmVnABgLZnJtX21SZWR1Y3QAGQdmcm1fbXVsABoSZnJtX2Zyb21Nb250Z29tZXJ5ABwQZnJtX3RvTW9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ACAAQgA3AwAgAEIANwMIIABCADcDECAAQgA3AxgLMwAgACkDGFAEQCAAKQMQUARAIAApAwhQBEAgACkDAFAPBUEADwsFQQAPCwVBAA8LQQAPCx4AIABCATcDACAAQgA3AwggAEIANwMQIABCADcDGAtHACAAKQMYIAEpAxhRBEAgACkDECABKQMQUQRAIAApAwggASkDCFEEQCAAKQMAIAEpAwBRDwVBAA8LBUEADwsFQQAPC0EADwt9ACAAKQMYIAEpAxhUBEBBAA8FIAApAxggASkDGFYEQEEBDwUgACkDECABKQMQVARAQQAPBSAAKQMQIAEpAxBWBEBBAQ8FIAApAwggASkDCFQEQEEADwUgACkDCCABKQMIVgRAQQEPBSAAKQMAIAEpAwBaDwsLCwsLC0EADwvUAQEBfiAANQIAIAE1AgB8IQMgAiADPgIAIAA1AgQgATUCBHwgA0IgiHwhAyACIAM+AgQgADUCCCABNQIIfCADQiCIfCEDIAIgAz4CCCAANQIMIAE1Agx8IANCIIh8IQMgAiADPgIMIAA1AhAgATUCEHwgA0IgiHwhAyACIAM+AhAgADUCFCABNQIUfCADQiCIfCEDIAIgAz4CFCAANQIYIAE1Ahh8IANCIIh8IQMgAiADPgIYIAA1AhwgATUCHHwgA0IgiHwhAyACIAM+AhwgA0IgiKcLjAIBAX4gADUCACABNQIAfSEDIAIgA0L/////D4M+AgAgADUCBCABNQIEfSADQiCHfCEDIAIgA0L/////D4M+AgQgADUCCCABNQIIfSADQiCHfCEDIAIgA0L/////D4M+AgggADUCDCABNQIMfSADQiCHfCEDIAIgA0L/////D4M+AgwgADUCECABNQIQfSADQiCHfCEDIAIgA0L/////D4M+AhAgADUCFCABNQIUfSADQiCHfCEDIAIgA0L/////D4M+AhQgADUCGCABNQIYfSADQiCHfCEDIAIgA0L/////D4M+AhggADUCHCABNQIcfSADQiCHfCEDIAIgA0L/////D4M+AhwgA0Igh6cL9BABAX5BKCAANQIAIAE1AgB+NwMAQSggADUCACABNQIEfjcDCEEoIAA1AgAgATUCCH43AxBBKCAANQIAIAE1Agx+NwMYQSggADUCACABNQIQfjcDIEEoIAA1AgAgATUCFH43AyhBKCAANQIAIAE1Ahh+NwMwQSggADUCACABNQIcfjcDOEEoIAA1AgQgATUCAH43A0BBKCAANQIEIAE1AgR+NwNIQSggADUCBCABNQIIfjcDUEEoIAA1AgQgATUCDH43A1hBKCAANQIEIAE1AhB+NwNgQSggADUCBCABNQIUfjcDaEEoIAA1AgQgATUCGH43A3BBKCAANQIEIAE1Ahx+NwN4QSggADUCCCABNQIAfjcDgAFBKCAANQIIIAE1AgR+NwOIAUEoIAA1AgggATUCCH43A5ABQSggADUCCCABNQIMfjcDmAFBKCAANQIIIAE1AhB+NwOgAUEoIAA1AgggATUCFH43A6gBQSggADUCCCABNQIYfjcDsAFBKCAANQIIIAE1Ahx+NwO4AUEoIAA1AgwgATUCAH43A8ABQSggADUCDCABNQIEfjcDyAFBKCAANQIMIAE1Agh+NwPQAUEoIAA1AgwgATUCDH43A9gBQSggADUCDCABNQIQfjcD4AFBKCAANQIMIAE1AhR+NwPoAUEoIAA1AgwgATUCGH43A/ABQSggADUCDCABNQIcfjcD+AFBKCAANQIQIAE1AgB+NwOAAkEoIAA1AhAgATUCBH43A4gCQSggADUCECABNQIIfjcDkAJBKCAANQIQIAE1Agx+NwOYAkEoIAA1AhAgATUCEH43A6ACQSggADUCECABNQIUfjcDqAJBKCAANQIQIAE1Ahh+NwOwAkEoIAA1AhAgATUCHH43A7gCQSggADUCFCABNQIAfjcDwAJBKCAANQIUIAE1AgR+NwPIAkEoIAA1AhQgATUCCH43A9ACQSggADUCFCABNQIMfjcD2AJBKCAANQIUIAE1AhB+NwPgAkEoIAA1AhQgATUCFH43A+gCQSggADUCFCABNQIYfjcD8AJBKCAANQIUIAE1Ahx+NwP4AkEoIAA1AhggATUCAH43A4ADQSggADUCGCABNQIEfjcDiANBKCAANQIYIAE1Agh+NwOQA0EoIAA1AhggATUCDH43A5gDQSggADUCGCABNQIQfjcDoANBKCAANQIYIAE1AhR+NwOoA0E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gA0IgiHxB6A01AgAgBH58IQMgACADPgIEIAA1AgggA0IgiHxB6A01AgQgBH58IQMgACADPgIIIAA1AgwgA0IgiHxB6A01AgggBH58IQMgACADPgIMIAA1AhAgA0IgiHxB6A01AgwgBH58IQMgACADPgIQIAA1AhQgA0IgiHxB6A01AhAgBH58IQMgACADPgIUIAA1AhggA0IgiHxB6A01AhQgBH58IQMgACADPgIYIAA1AhwgA0IgiHxB6A01AhggBH58IQMgACADPgIcIAA1AiAgA0IgiHxB6A01AhwgBH58IQMgACADPgIgQegOIANCIIg+AgRCACEDIAA1AgggAn5C/////w+DIQQgADUCCCADQiCIfEHoDTUCACAEfnwhAyAAIAM+AgggADUCDCADQiCIfEHoDTUCBCAEfnwhAyAAIAM+AgwgADUCECADQiCIfEHoDTUCCCAEfnwhAyAAIAM+AhAgADUCFCADQiCIfEHoDTUCDCAEfnwhAyAAIAM+AhQgADUCGCADQiCIfEHoDTUCECAEfnwhAyAAIAM+AhggADUCHCADQiCIfEHoDTUCFCAEfnwhAyAAIAM+AhwgADUCICADQiCIfEHoDTUCGCAEfnwhAyAAIAM+AiAgADUCJCADQiCIfEHoDTUCHCAEfnwhAyAAIAM+AiRB6A4gA0IgiD4CCEIAIQMgADUCDCACfkL/////D4MhBCAANQIMIANCIIh8QegNNQIAIAR+fCEDIAAgAz4CDCAANQIQIANCIIh8QegNNQIEIAR+fCEDIAAgAz4CECAANQIUIANCIIh8QegNNQIIIAR+fCEDIAAgAz4CFCAANQIYIANCIIh8QegNNQIMIAR+fCEDIAAgAz4CGCAANQIcIANCIIh8QegNNQIQIAR+fCEDIAAgAz4CHCAANQIgIANCIIh8QegNNQIUIAR+fCEDIAAgAz4CICAANQIkIANCIIh8QegNNQIYIAR+fCEDIAAgAz4CJCAANQIoIANCIIh8QegNNQIcIAR+fCEDIAAgAz4CKEHoDiADQiCIPgIMQgAhAyAANQIQIAJ+Qv////8PgyEEIAA1AhAgA0IgiHxB6A01AgAgBH58IQMgACADPgIQIAA1Ah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A1AiQgA0IgiHxB6A01AgggBH58IQMgACADPgIkIAA1AiggA0IgiHxB6A01AgwgBH58IQMgACADPgIoIAA1AiwgA0IgiHxB6A01AhAgBH58IQMgACADPgIsIAA1AjAgA0IgiHxB6A01AhQgBH58IQMgACADPgIwIAA1AjQgA0IgiHxB6A01AhggBH58IQMgACADPgI0IAA1AjggA0IgiHxB6A01AhwgBH58IQMgACADPgI4QegOIANCIIg+AhxB6A4gAEEgaiABEBYLEgAgACABQegSEAhB6BIgAhAZCwsAIABBiA4gARAaCxUAIABBqBMQAEHIExABQagTIAEQGQsXACAAIAEQHCABQegNIAEQDCABIAEQGwsJAEGoDiAAEAALFQAgACABQegTEBpB6BNBiA4gAhAaCwsAIABB6A0gARAMCwoAIABBwABqEAILFQAgABABIABBIGoQFSAAQcAAahABCyIAIAAgARAAIABBIGogAUEgahAAIABBwABqIAFBwABqEAALhgIAIAAQIQRAIAAgARAjDwsgACAAQYgUEBEgAEEgaiAAQSBqQagUEBFBqBRBqBRByBQQESAAQagUQegUEA1B6BRB6BRB6BQQEUHoFEGIFEHoFBAOQegUQcgUQegUEA5B6BRB6BRB6BQQDUGIFEGIFEGIFRANQYgVQYgUQYgVEA1BiBVBiBVBqBUQESAAQSBqIABBwABqQcgVEBFB6BRB6BQgARANQagVIAEgARAOQcgUQcgUQegVEA1B6BVB6BVB6BUQDUHoFUHoFUHoFRANQegUIAEgAUEgahAOIAFBIGpBiBUgAUEgahARIAFBIGpB6BUgAUEgahAOQcgVQcgVIAFBwABqEA0LrAMCAX8BfyAAQcAAaiEDIAFBwABqIQQgABAhBEAgASACECMPCyABECEEQCAAIAIQIw8LIAMgA0GIFhARIAQgBEGoFhARIABBqBZByBYQESABQYgWQegWEBEgA0GIFkGIFxARIARBqBZBqBcQESAAQSBqQagXQcgXEBEgAUEgakGIF0HoFxARQcgWQegWEAQEQEHIF0HoFxAEBEAgACACECQPCwtB6BZByBZBiBgQDkHoF0HIF0GoGBAOQYgYQYgYQcgYEA1ByBhByBhByBgQEUGIGEHIGEHoGBARQagYQagYQYgZEA1ByBZByBhByBkQEUGIGUGIGUGoGRARQcgZQcgZQegZEA1BqBlB6BggAhAOIAJB6BkgAhAOQcgXQegYQYgaEBFBiBpBiBpBiBoQDUHIGSACIAJBIGoQDiACQSBqQYgZIAJBIGoQESACQSBqQYgaIAJBIGoQDiADIAQgAkHAAGoQDSACQcAAaiACQcAAaiACQcAAahARIAJBwABqQYgWIAJBwABqEA4gAkHAAGpBqBYgAkHAAGoQDiACQcAAakGIGCACQcAAahARCyIAIAAgARAAIABBIGogAUEgahAPIABBwABqIAFBwABqEAALEAAgASACECYgACACIAIQJQsiACAAIAEQEyAAQSBqIAFBIGoQEyAAQcAAaiABQcAAahATCyIAIAAgARASIABBIGogAUEgahASIABBwABqIAFBwABqEBILTwAgABAhBEAgARAiBSAAQcAAakGoGhAUQagaQagaQcgaEBFBqBpByBpB6BoQESAAQcgaIAEQESAAQSBqQegaIAFBIGoQESABQcAAahAVCwunAgIBfwF/IABBiBsQIyADECIgAiEEAkADQCAEQQFrIQQgASAEai0AACEFIAMgAxAkIAVBgAFPBEAgBUGAAWshBUGIGyADIAMQJQsgAyADECQgBUHAAE8EQCAFQcAAayEFQYgbIAMgAxAlCyADIAMQJCAFQSBPBEAgBUEgayEFQYgbIAMgAxAlCyADIAMQJCAFQRBPBEAgBUEQayEFQYgbIAMgAxAlCyADIAMQJCAFQQhPBEAgBUEIayEFQYgbIAMgAxAlCyADIAMQJCAFQQRPBEAgBUEEayEFQYgbIAMgAxAlCyADIAMQJCAFQQJPBEAgBUECayEFQYgbIAMgAxAlCyADIAMQJCAFQQFPBEAgBUEBayEFQYgbIAMgAxAlCyAERQ0BDAALCwsrAgF/AX8gAEEFdkECdCEBQQEgAEEfcXQhAiABIAEoAujbASACcjYC6NsBCyQCAX8BfyAAQQV2QQJ0IQFBASAAQR9xdCECIAEoAujbASACcQugAQQBfwF/AX8BfyAAIQJB6BsQIkEAIQQCQANAIAQgAUYNAUH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CAwMDAAQEBIQFBQUEBgYGBgYGBwAICAiICQkJCAoKCgoKCgsIDAwMDAwMDQwMDA4MDg4OABAQEJAREREQEhISEhISExAUFBQUFBQVFBQUFhQWFhYQGBgYGBgYGRgYGBoYGhoaGBgYHBgcHBwYHBwcHBwcHgAgICCgISEhICIiIiIiIiMgJCQkJCQkJSQkJCYkJiYmICgoKCgoKCkoKCgqKCoqKigoKCwoLCwsKCwsLCwsLC4gMDAwMDAwMTAwMDIwMjIyMDAwNDA0NDQwNDQ0NDQ0NjAwMDgwODg4MDg4ODg4ODowODg4ODg4PDg4ODw4PDw8ABB6IgFC4ACAAAAAQABAgEAAQIBBAECAwABAgEEAQIDCAECAwQFBgMAAQIBBAECAwgBAgMEBQYDEAECAwQFBgMICQoDDAUGBwABAgEEAQIDCAECAwQFBgMQAQIDBAUGAwgJCgMMBQYHIAECAwQFBgMICQoDDAUGBxAREgMUBQYHGAkKCwwNDgcAAQIBBAECAwgBAgMEBQYDEAECAwQFBgMICQoDDAUGByABAgMEBQYDCAkKAwwFBgcQERIDFAUGBxgJCgsMDQ4HQAECAwQFBgMICQoDDAUGBxAREgMUBQYHGAkKCwwNDgcgISIDJAUGBygJCgsMDQ4HMBESExQVFgcYGRoLHA0ODw==", "base64");
   5            exports.pq = 1000;
   6            exports.pr = 1768;
   7        
   8}).call(this,require("buffer").Buffer)
   9},{"buffer":10}],2:[function(require,module,exports){
  10/*
  11    Copyright 2019 0KIMS association.
  12
  13    This file is part of websnark (Web Assembly zkSnark Prover).
  14
  15    websnark is a free software: you can redistribute it and/or modify it
  16    under the terms of the GNU General Public License as published by
  17    the Free Software Foundation, either version 3 of the License, or
  18    (at your option) any later version.
  19
  20    websnark is distributed in the hope that it will be useful, but WITHOUT
  21    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  22    or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  23    License for more details.
  24
  25    You should have received a copy of the GNU General Public License
  26    along with websnark. If not, see <https://www.gnu.org/licenses/>.
  27*/
  28
  29/* globals window */
  30
  31const buildGroth16 = require("./src/groth16.js");
  32
  33buildGroth16().then( (groth16) => {
  34    window.genZKSnarkProof = function(witness, provingKey, cb) {
  35
  36        const p = groth16.proof(witness, provingKey);
  37
  38        if (cb) {
  39            p.then( (proof) => {
  40                cb(null, proof);
  41            }, (err) => {
  42                cb(err);
  43            });
  44        } else {
  45            return p;
  46        }
  47    };
  48});
  49
  50
  51
  52},{"./src/groth16.js":4}],3:[function(require,module,exports){
  53var bigInt = (function (undefined) {
  54    "use strict";
  55
  56    var BASE = 1e7,
  57        LOG_BASE = 7,
  58        MAX_INT = 9007199254740992,
  59        MAX_INT_ARR = smallToArray(MAX_INT),
  60        DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz";
  61
  62    var supportsNativeBigInt = typeof BigInt === "function";
  63
  64    function Integer(v, radix, alphabet, caseSensitive) {
  65        if (typeof v === "undefined") return Integer[0];
  66        if (typeof radix !== "undefined") return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive);
  67        return parseValue(v);
  68    }
  69
  70    function BigInteger(value, sign) {
  71        this.value = value;
  72        this.sign = sign;
  73        this.isSmall = false;
  74    }
  75    BigInteger.prototype = Object.create(Integer.prototype);
  76
  77    function SmallInteger(value) {
  78        this.value = value;
  79        this.sign = value < 0;
  80        this.isSmall = true;
  81    }
  82    SmallInteger.prototype = Object.create(Integer.prototype);
  83
  84    function NativeBigInt(value) {
  85        this.value = value;
  86    }
  87    NativeBigInt.prototype = Object.create(Integer.prototype);
  88
  89    function isPrecise(n) {
  90        return -MAX_INT < n && n < MAX_INT;
  91    }
  92
  93    function smallToArray(n) { // For performance reasons doesn't reference BASE, need to change this function if BASE changes
  94        if (n < 1e7)
  95            return [n];
  96        if (n < 1e14)
  97            return [n % 1e7, Math.floor(n / 1e7)];
  98        return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];
  99    }
 100
 101    function arrayToSmall(arr) { // If BASE changes this function may need to change
 102        trim(arr);
 103        var length = arr.length;
 104        if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {
 105            switch (length) {
 106                case 0: return 0;
 107                case 1: return arr[0];
 108                case 2: return arr[0] + arr[1] * BASE;
 109                default: return arr[0] + (arr[1] + arr[2] * BASE) * BASE;
 110            }
 111        }
 112        return arr;
 113    }
 114
 115    function trim(v) {
 116        var i = v.length;
 117        while (v[--i] === 0);
 118        v.length = i + 1;
 119    }
 120
 121    function createArray(length) { // function shamelessly stolen from Yaffle's library https://github.com/Yaffle/BigInteger
 122        var x = new Array(length);
 123        var i = -1;
 124        while (++i < length) {
 125            x[i] = 0;
 126        }
 127        return x;
 128    }
 129
 130    function truncate(n) {
 131        if (n > 0) return Math.floor(n);
 132        return Math.ceil(n);
 133    }
 134
 135    function add(a, b) { // assumes a and b are arrays with a.length >= b.length
 136        var l_a = a.length,
 137            l_b = b.length,
 138            r = new Array(l_a),
 139            carry = 0,
 140            base = BASE,
 141            sum, i;
 142        for (i = 0; i < l_b; i++) {
 143            sum = a[i] + b[i] + carry;
 144            carry = sum >= base ? 1 : 0;
 145            r[i] = sum - carry * base;
 146        }
 147        while (i < l_a) {
 148            sum = a[i] + carry;
 149            carry = sum === base ? 1 : 0;
 150            r[i++] = sum - carry * base;
 151        }
 152        if (carry > 0) r.push(carry);
 153        return r;
 154    }
 155
 156    function addAny(a, b) {
 157        if (a.length >= b.length) return add(a, b);
 158        return add(b, a);
 159    }
 160
 161    function addSmall(a, carry) { // assumes a is array, carry is number with 0 <= carry < MAX_INT
 162        var l = a.length,
 163            r = new Array(l),
 164            base = BASE,
 165            sum, i;
 166        for (i = 0; i < l; i++) {
 167            sum = a[i] - base + carry;
 168            carry = Math.floor(sum / base);
 169            r[i] = sum - carry * base;
 170            carry += 1;
 171        }
 172        while (carry > 0) {
 173            r[i++] = carry % base;
 174            carry = Math.floor(carry / base);
 175        }
 176        return r;
 177    }
 178
 179    BigInteger.prototype.add = function (v) {
 180        var n = parseValue(v);
 181        if (this.sign !== n.sign) {
 182            return this.subtract(n.negate());
 183        }
 184        var a = this.value, b = n.value;
 185        if (n.isSmall) {
 186            return new BigInteger(addSmall(a, Math.abs(b)), this.sign);
 187        }
 188        return new BigInteger(addAny(a, b), this.sign);
 189    };
 190    BigInteger.prototype.plus = BigInteger.prototype.add;
 191
 192    SmallInteger.prototype.add = function (v) {
 193        var n = parseValue(v);
 194        var a = this.value;
 195        if (a < 0 !== n.sign) {
 196            return this.subtract(n.negate());
 197        }
 198        var b = n.value;
 199        if (n.isSmall) {
 200            if (isPrecise(a + b)) return new SmallInteger(a + b);
 201            b = smallToArray(Math.abs(b));
 202        }
 203        return new BigInteger(addSmall(b, Math.abs(a)), a < 0);
 204    };
 205    SmallInteger.prototype.plus = SmallInteger.prototype.add;
 206
 207    NativeBigInt.prototype.add = function (v) {
 208        return new NativeBigInt(this.value + parseValue(v).value);
 209    }
 210    NativeBigInt.prototype.plus = NativeBigInt.prototype.add;
 211
 212    function subtract(a, b) { // assumes a and b are arrays with a >= b
 213        var a_l = a.length,
 214            b_l = b.length,
 215            r = new Array(a_l),
 216            borrow = 0,
 217            base = BASE,
 218            i, difference;
 219        for (i = 0; i < b_l; i++) {
 220            difference = a[i] - borrow - b[i];
 221            if (difference < 0) {
 222                difference += base;
 223                borrow = 1;
 224            } else borrow = 0;
 225            r[i] = difference;
 226        }
 227        for (i = b_l; i < a_l; i++) {
 228            difference = a[i] - borrow;
 229            if (difference < 0) difference += base;
 230            else {
 231                r[i++] = difference;
 232                break;
 233            }
 234            r[i] = difference;
 235        }
 236        for (; i < a_l; i++) {
 237            r[i] = a[i];
 238        }
 239        trim(r);
 240        return r;
 241    }
 242
 243    function subtractAny(a, b, sign) {
 244        var value;
 245        if (compareAbs(a, b) >= 0) {
 246            value = subtract(a, b);
 247        } else {
 248            value = subtract(b, a);
 249            sign = !sign;
 250        }
 251        value = arrayToSmall(value);
 252        if (typeof value === "number") {
 253            if (sign) value = -value;
 254            return new SmallInteger(value);
 255        }
 256        return new BigInteger(value, sign);
 257    }
 258
 259    function subtractSmall(a, b, sign) { // assumes a is array, b is number with 0 <= b < MAX_INT
 260        var l = a.length,
 261            r = new Array(l),
 262            carry = -b,
 263            base = BASE,
 264            i, difference;
 265        for (i = 0; i < l; i++) {
 266            difference = a[i] + carry;
 267            carry = Math.floor(difference / base);
 268            difference %= base;
 269            r[i] = difference < 0 ? difference + base : difference;
 270        }
 271        r = arrayToSmall(r);
 272        if (typeof r === "number") {
 273            if (sign) r = -r;
 274            return new SmallInteger(r);
 275        } return new BigInteger(r, sign);
 276    }
 277
 278    BigInteger.prototype.subtract = function (v) {
 279        var n = parseValue(v);
 280        if (this.sign !== n.sign) {
 281            return this.add(n.negate());
 282        }
 283        var a = this.value, b = n.value;
 284        if (n.isSmall)
 285            return subtractSmall(a, Math.abs(b), this.sign);
 286        return subtractAny(a, b, this.sign);
 287    };
 288    BigInteger.prototype.minus = BigInteger.prototype.subtract;
 289
 290    SmallInteger.prototype.subtract = function (v) {
 291        var n = parseValue(v);
 292        var a = this.value;
 293        if (a < 0 !== n.sign) {
 294            return this.add(n.negate());
 295        }
 296        var b = n.value;
 297        if (n.isSmall) {
 298            return new SmallInteger(a - b);
 299        }
 300        return subtractSmall(b, Math.abs(a), a >= 0);
 301    };
 302    SmallInteger.prototype.minus = SmallInteger.prototype.subtract;
 303
 304    NativeBigInt.prototype.subtract = function (v) {
 305        return new NativeBigInt(this.value - parseValue(v).value);
 306    }
 307    NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract;
 308
 309    BigInteger.prototype.negate = function () {
 310        return new BigInteger(this.value, !this.sign);
 311    };
 312    SmallInteger.prototype.negate = function () {
 313        var sign = this.sign;
 314        var small = new SmallInteger(-this.value);
 315        small.sign = !sign;
 316        return small;
 317    };
 318    NativeBigInt.prototype.negate = function () {
 319        return new NativeBigInt(-this.value);
 320    }
 321
 322    BigInteger.prototype.abs = function () {
 323        return new BigInteger(this.value, false);
 324    };
 325    SmallInteger.prototype.abs = function () {
 326        return new SmallInteger(Math.abs(this.value));
 327    };
 328    NativeBigInt.prototype.abs = function () {
 329        return new NativeBigInt(this.value >= 0 ? this.value : -this.value);
 330    }
 331
 332
 333    function multiplyLong(a, b) {
 334        var a_l = a.length,
 335            b_l = b.length,
 336            l = a_l + b_l,
 337            r = createArray(l),
 338            base = BASE,
 339            product, carry, i, a_i, b_j;
 340        for (i = 0; i < a_l; ++i) {
 341            a_i = a[i];
 342            for (var j = 0; j < b_l; ++j) {
 343                b_j = b[j];
 344                product = a_i * b_j + r[i + j];
 345                carry = Math.floor(product / base);
 346                r[i + j] = product - carry * base;
 347                r[i + j + 1] += carry;
 348            }
 349        }
 350        trim(r);
 351        return r;
 352    }
 353
 354    function multiplySmall(a, b) { // assumes a is array, b is number with |b| < BASE
 355        var l = a.length,
 356            r = new Array(l),
 357            base = BASE,
 358            carry = 0,
 359            product, i;
 360        for (i = 0; i < l; i++) {
 361            product = a[i] * b + carry;
 362            carry = Math.floor(product / base);
 363            r[i] = product - carry * base;
 364        }
 365        while (carry > 0) {
 366            r[i++] = carry % base;
 367            carry = Math.floor(carry / base);
 368        }
 369        return r;
 370    }
 371
 372    function shiftLeft(x, n) {
 373        var r = [];
 374        while (n-- > 0) r.push(0);
 375        return r.concat(x);
 376    }
 377
 378    function multiplyKaratsuba(x, y) {
 379        var n = Math.max(x.length, y.length);
 380
 381        if (n <= 30) return multiplyLong(x, y);
 382        n = Math.ceil(n / 2);
 383
 384        var b = x.slice(n),
 385            a = x.slice(0, n),
 386            d = y.slice(n),
 387            c = y.slice(0, n);
 388
 389        var ac = multiplyKaratsuba(a, c),
 390            bd = multiplyKaratsuba(b, d),
 391            abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));
 392
 393        var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n));
 394        trim(product);
 395        return product;
 396    }
 397
 398    // The following function is derived from a surface fit of a graph plotting the performance difference
 399    // between long multiplication and karatsuba multiplication versus the lengths of the two arrays.
 400    function useKaratsuba(l1, l2) {
 401        return -0.012 * l1 - 0.012 * l2 + 0.000015 * l1 * l2 > 0;
 402    }
 403
 404    BigInteger.prototype.multiply = function (v) {
 405        var n = parseValue(v),
 406            a = this.value, b = n.value,
 407            sign = this.sign !== n.sign,
 408            abs;
 409        if (n.isSmall) {
 410            if (b === 0) return Integer[0];
 411            if (b === 1) return this;
 412            if (b === -1) return this.negate();
 413            abs = Math.abs(b);
 414            if (abs < BASE) {
 415                return new BigInteger(multiplySmall(a, abs), sign);
 416            }
 417            b = smallToArray(abs);
 418        }
 419        if (useKaratsuba(a.length, b.length)) // Karatsuba is only faster for certain array sizes
 420            return new BigInteger(multiplyKaratsuba(a, b), sign);
 421        return new BigInteger(multiplyLong(a, b), sign);
 422    };
 423
 424    BigInteger.prototype.times = BigInteger.prototype.multiply;
 425
 426    function multiplySmallAndArray(a, b, sign) { // a >= 0
 427        if (a < BASE) {
 428            return new BigInteger(multiplySmall(b, a), sign);
 429        }
 430        return new BigInteger(multiplyLong(b, smallToArray(a)), sign);
 431    }
 432    SmallInteger.prototype._multiplyBySmall = function (a) {
 433        if (isPrecise(a.value * this.value)) {
 434            return new SmallInteger(a.value * this.value);
 435        }
 436        return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign);
 437    };
 438    BigInteger.prototype._multiplyBySmall = function (a) {
 439        if (a.value === 0) return Integer[0];
 440        if (a.value === 1) return this;
 441        if (a.value === -1) return this.negate();
 442        return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign);
 443    };
 444    SmallInteger.prototype.multiply = function (v) {
 445        return parseValue(v)._multiplyBySmall(this);
 446    };
 447    SmallInteger.prototype.times = SmallInteger.prototype.multiply;
 448
 449    NativeBigInt.prototype.multiply = function (v) {
 450        return new NativeBigInt(this.value * parseValue(v).value);
 451    }
 452    NativeBigInt.prototype.times = NativeBigInt.prototype.multiply;
 453
 454    function square(a) {
 455        //console.assert(2 * BASE * BASE < MAX_INT);
 456        var l = a.length,
 457            r = createArray(l + l),
 458            base = BASE,
 459            product, carry, i, a_i, a_j;
 460        for (i = 0; i < l; i++) {
 461            a_i = a[i];
 462            carry = 0 - a_i * a_i;
 463            for (var j = i; j < l; j++) {
 464                a_j = a[j];
 465                product = 2 * (a_i * a_j) + r[i + j] + carry;
 466                carry = Math.floor(product / base);
 467                r[i + j] = product - carry * base;
 468            }
 469            r[i + l] = carry;
 470        }
 471        trim(r);
 472        return r;
 473    }
 474
 475    BigInteger.prototype.square = function () {
 476        return new BigInteger(square(this.value), false);
 477    };
 478
 479    SmallInteger.prototype.square = function () {
 480        var value = this.value * this.value;
 481        if (isPrecise(value)) return new SmallInteger(value);
 482        return new BigInteger(square(smallToArray(Math.abs(this.value))), false);
 483    };
 484
 485    NativeBigInt.prototype.square = function (v) {
 486        return new NativeBigInt(this.value * this.value);
 487    }
 488
 489    function divMod1(a, b) { // Left over from previous version. Performs faster than divMod2 on smaller input sizes.
 490        var a_l = a.length,
 491            b_l = b.length,
 492            base = BASE,
 493            result = createArray(b.length),
 494            divisorMostSignificantDigit = b[b_l - 1],
 495            // normalization
 496            lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)),
 497            remainder = multiplySmall(a, lambda),
 498            divisor = multiplySmall(b, lambda),
 499            quotientDigit, shift, carry, borrow, i, l, q;
 500        if (remainder.length <= a_l) remainder.push(0);
 501        divisor.push(0);
 502        divisorMostSignificantDigit = divisor[b_l - 1];
 503        for (shift = a_l - b_l; shift >= 0; shift--) {
 504            quotientDigit = base - 1;
 505            if (remainder[shift + b_l] !== divisorMostSignificantDigit) {
 506                quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit);
 507            }
 508            // quotientDigit <= base - 1
 509            carry = 0;
 510            borrow = 0;
 511            l = divisor.length;
 512            for (i = 0; i < l; i++) {
 513                carry += quotientDigit * divisor[i];
 514                q = Math.floor(carry / base);
 515                borrow += remainder[shift + i] - (carry - q * base);
 516                carry = q;
 517                if (borrow < 0) {
 518                    remainder[shift + i] = borrow + base;
 519                    borrow = -1;
 520                } else {
 521                    remainder[shift + i] = borrow;
 522                    borrow = 0;
 523                }
 524            }
 525            while (borrow !== 0) {
 526                quotientDigit -= 1;
 527                carry = 0;
 528                for (i = 0; i < l; i++) {
 529                    carry += remainder[shift + i] - base + divisor[i];
 530                    if (carry < 0) {
 531                        remainder[shift + i] = carry + base;
 532                        carry = 0;
 533                    } else {
 534                        remainder[shift + i] = carry;
 535                        carry = 1;
 536                    }
 537                }
 538                borrow += carry;
 539            }
 540            result[shift] = quotientDigit;
 541        }
 542        // denormalization
 543        remainder = divModSmall(remainder, lambda)[0];
 544        return [arrayToSmall(result), arrayToSmall(remainder)];
 545    }
 546
 547    function divMod2(a, b) { // Implementation idea shamelessly stolen from Silent Matt's library http://silentmatt.com/biginteger/
 548        // Performs faster than divMod1 on larger input sizes.
 549        var a_l = a.length,
 550            b_l = b.length,
 551            result = [],
 552            part = [],
 553            base = BASE,
 554            guess, xlen, highx, highy, check;
 555        while (a_l) {
 556            part.unshift(a[--a_l]);
 557            trim(part);
 558            if (compareAbs(part, b) < 0) {
 559                result.push(0);
 560                continue;
 561            }
 562            xlen = part.length;
 563            highx = part[xlen - 1] * base + part[xlen - 2];
 564            highy = b[b_l - 1] * base + b[b_l - 2];
 565            if (xlen > b_l) {
 566                highx = (highx + 1) * base;
 567            }
 568            guess = Math.ceil(highx / highy);
 569            do {
 570                check = multiplySmall(b, guess);
 571                if (compareAbs(check, part) <= 0) break;
 572                guess--;
 573            } while (guess);
 574            result.push(guess);
 575            part = subtract(part, check);
 576        }
 577        result.reverse();
 578        return [arrayToSmall(result), arrayToSmall(part)];
 579    }
 580
 581    function divModSmall(value, lambda) {
 582        var length = value.length,
 583            quotient = createArray(length),
 584            base = BASE,
 585            i, q, remainder, divisor;
 586        remainder = 0;
 587        for (i = length - 1; i >= 0; --i) {
 588            divisor = remainder * base + value[i];
 589            q = truncate(divisor / lambda);
 590            remainder = divisor - q * lambda;
 591            quotient[i] = q | 0;
 592        }
 593        return [quotient, remainder | 0];
 594    }
 595
 596    function divModAny(self, v) {
 597        var value, n = parseValue(v);
 598        if (supportsNativeBigInt) {
 599            return [new NativeBigInt(self.value / n.value), new NativeBigInt(self.value % n.value)];
 600        }
 601        var a = self.value, b = n.value;
 602        var quotient;
 603        if (b === 0) throw new Error("Cannot divide by zero");
 604        if (self.isSmall) {
 605            if (n.isSmall) {
 606                return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];
 607            }
 608            return [Integer[0], self];
 609        }
 610        if (n.isSmall) {
 611            if (b === 1) return [self, Integer[0]];
 612            if (b == -1) return [self.negate(), Integer[0]];
 613            var abs = Math.abs(b);
 614            if (abs < BASE) {
 615                value = divModSmall(a, abs);
 616                quotient = arrayToSmall(value[0]);
 617                var remainder = value[1];
 618                if (self.sign) remainder = -remainder;
 619                if (typeof quotient === "number") {
 620                    if (self.sign !== n.sign) quotient = -quotient;
 621                    return [new SmallInteger(quotient), new SmallInteger(remainder)];
 622                }
 623                return [new BigInteger(quotient, self.sign !== n.sign), new SmallInteger(remainder)];
 624            }
 625            b = smallToArray(abs);
 626        }
 627        var comparison = compareAbs(a, b);
 628        if (comparison === -1) return [Integer[0], self];
 629        if (comparison === 0) return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]];
 630
 631        // divMod1 is faster on smaller input sizes
 632        if (a.length + b.length <= 200)
 633            value = divMod1(a, b);
 634        else value = divMod2(a, b);
 635
 636        quotient = value[0];
 637        var qSign = self.sign !== n.sign,
 638            mod = value[1],
 639            mSign = self.sign;
 640        if (typeof quotient === "number") {
 641            if (qSign) quotient = -quotient;
 642            quotient = new SmallInteger(quotient);
 643        } else quotient = new BigInteger(quotient, qSign);
 644        if (typeof mod === "number") {
 645            if (mSign) mod = -mod;
 646            mod = new SmallInteger(mod);
 647        } else mod = new BigInteger(mod, mSign);
 648        return [quotient, mod];
 649    }
 650
 651    BigInteger.prototype.divmod = function (v) {
 652        var result = divModAny(this, v);
 653        return {
 654            quotient: result[0],
 655            remainder: result[1]
 656        };
 657    };
 658    NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod;
 659
 660
 661    BigInteger.prototype.divide = function (v) {
 662        return divModAny(this, v)[0];
 663    };
 664    NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function (v) {
 665        return new NativeBigInt(this.value / parseValue(v).value);
 666    };
 667    SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide;
 668
 669    BigInteger.prototype.mod = function (v) {
 670        return divModAny(this, v)[1];
 671    };
 672    NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function (v) {
 673        return new NativeBigInt(this.value % parseValue(v).value);
 674    };
 675    SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod;
 676
 677    BigInteger.prototype.pow = function (v) {
 678        var n = parseValue(v),
 679            a = this.value,
 680            b = n.value,
 681            value, x, y;
 682        if (b === 0) return Integer[1];
 683        if (a === 0) return Integer[0];
 684        if (a === 1) return Integer[1];
 685        if (a === -1) return n.isEven() ? Integer[1] : Integer[-1];
 686        if (n.sign) {
 687            return Integer[0];
 688        }
 689        if (!n.isSmall) throw new Error("The exponent " + n.toString() + " is too large.");
 690        if (this.isSmall) {
 691            if (isPrecise(value = Math.pow(a, b)))
 692                return new SmallInteger(truncate(value));
 693        }
 694        x = this;
 695        y = Integer[1];
 696        while (true) {
 697            if (b & 1 === 1) {
 698                y = y.times(x);
 699                --b;
 700            }
 701            if (b === 0) break;
 702            b /= 2;
 703            x = x.square();
 704        }
 705        return y;
 706    };
 707    SmallInteger.prototype.pow = BigInteger.prototype.pow;
 708
 709    NativeBigInt.prototype.pow = function (v) {
 710        var n = parseValue(v);
 711        var a = this.value, b = n.value;
 712        var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2);
 713        if (b === _0) return Integer[1];
 714        if (a === _0) return Integer[0];
 715        if (a === _1) return Integer[1];
 716        if (a === BigInt(-1)) return n.isEven() ? Integer[1] : Integer[-1];
 717        if (n.isNegative()) return new NativeBigInt(_0);
 718        var x = this;
 719        var y = Integer[1];
 720        while (true) {
 721            if ((b & _1) === _1) {
 722                y = y.times(x);
 723                --b;
 724            }
 725            if (b === _0) break;
 726            b /= _2;
 727            x = x.square();
 728        }
 729        return y;
 730    }
 731
 732    BigInteger.prototype.modPow = function (exp, mod) {
 733        exp = parseValue(exp);
 734        mod = parseValue(mod);
 735        if (mod.isZero()) throw new Error("Cannot take modPow with modulus 0");
 736        var r = Integer[1],
 737            base = this.mod(mod);
 738        while (exp.isPositive()) {
 739            if (base.isZero()) return Integer[0];
 740            if (exp.isOdd()) r = r.multiply(base).mod(mod);
 741            exp = exp.divide(2);
 742            base = base.square().mod(mod);
 743        }
 744        return r;
 745    };
 746    NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow;
 747
 748    function compareAbs(a, b) {
 749        if (a.length !== b.length) {
 750            return a.length > b.length ? 1 : -1;
 751        }
 752        for (var i = a.length - 1; i >= 0; i--) {
 753            if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1;
 754        }
 755        return 0;
 756    }
 757
 758    BigInteger.prototype.compareAbs = function (v) {
 759        var n = parseValue(v),
 760            a = this.value,
 761            b = n.value;
 762        if (n.isSmall) return 1;
 763        return compareAbs(a, b);
 764    };
 765    SmallInteger.prototype.compareAbs = function (v) {
 766        var n = parseValue(v),
 767            a = Math.abs(this.value),
 768            b = n.value;
 769        if (n.isSmall) {
 770            b = Math.abs(b);
 771            return a === b ? 0 : a > b ? 1 : -1;
 772        }
 773        return -1;
 774    };
 775    NativeBigInt.prototype.compareAbs = function (v) {
 776        var a = this.value;
 777        var b = parseValue(v).value;
 778        a = a >= 0 ? a : -a;
 779        b = b >= 0 ? b : -b;
 780        return a === b ? 0 : a > b ? 1 : -1;
 781    }
 782
 783    BigInteger.prototype.compare = function (v) {
 784        // See discussion about comparison with Infinity:
 785        // https://github.com/peterolson/BigInteger.js/issues/61
 786        if (v === Infinity) {
 787            return -1;
 788        }
 789        if (v === -Infinity) {
 790            return 1;
 791        }
 792
 793        var n = parseValue(v),
 794            a = this.value,
 795            b = n.value;
 796        if (this.sign !== n.sign) {
 797            return n.sign ? 1 : -1;
 798        }
 799        if (n.isSmall) {
 800            return this.sign ? -1 : 1;
 801        }
 802        return compareAbs(a, b) * (this.sign ? -1 : 1);
 803    };
 804    BigInteger.prototype.compareTo = BigInteger.prototype.compare;
 805
 806    SmallInteger.prototype.compare = function (v) {
 807        if (v === Infinity) {
 808            return -1;
 809        }
 810        if (v === -Infinity) {
 811            return 1;
 812        }
 813
 814        var n = parseValue(v),
 815            a = this.value,
 816            b = n.value;
 817        if (n.isSmall) {
 818            return a == b ? 0 : a > b ? 1 : -1;
 819        }
 820        if (a < 0 !== n.sign) {
 821            return a < 0 ? -1 : 1;
 822        }
 823        return a < 0 ? 1 : -1;
 824    };
 825    SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;
 826
 827    NativeBigInt.prototype.compare = function (v) {
 828        if (v === Infinity) {
 829            return -1;
 830        }
 831        if (v === -Infinity) {
 832            return 1;
 833        }
 834        var a = this.value;
 835        var b = parseValue(v).value;
 836        return a === b ? 0 : a > b ? 1 : -1;
 837    }
 838    NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare;
 839
 840    BigInteger.prototype.equals = function (v) {
 841        return this.compare(v) === 0;
 842    };
 843    NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals;
 844
 845    BigInteger.prototype.notEquals = function (v) {
 846        return this.compare(v) !== 0;
 847    };
 848    NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals;
 849
 850    BigInteger.prototype.greater = function (v) {
 851        return this.compare(v) > 0;
 852    };
 853    NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater;
 854
 855    BigInteger.prototype.lesser = function (v) {
 856        return this.compare(v) < 0;
 857    };
 858    NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser;
 859
 860    BigInteger.prototype.greaterOrEquals = function (v) {
 861        return this.compare(v) >= 0;
 862    };
 863    NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals;
 864
 865    BigInteger.prototype.lesserOrEquals = function (v) {
 866        return this.compare(v) <= 0;
 867    };
 868    NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals;
 869
 870    BigInteger.prototype.isEven = function () {
 871        return (this.value[0] & 1) === 0;
 872    };
 873    SmallInteger.prototype.isEven = function () {
 874        return (this.value & 1) === 0;
 875    };
 876    NativeBigInt.prototype.isEven = function () {
 877        return (this.value & BigInt(1)) === BigInt(0);
 878    }
 879
 880    BigInteger.prototype.isOdd = function () {
 881        return (this.value[0] & 1) === 1;
 882    };
 883    SmallInteger.prototype.isOdd = function () {
 884        return (this.value & 1) === 1;
 885    };
 886    NativeBigInt.prototype.isOdd = function () {
 887        return (this.value & BigInt(1)) === BigInt(1);
 888    }
 889
 890    BigInteger.prototype.isPositive = function () {
 891        return !this.sign;
 892    };
 893    SmallInteger.prototype.isPositive = function () {
 894        return this.value > 0;
 895    };
 896    NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive;
 897
 898    BigInteger.prototype.isNegative = function () {
 899        return this.sign;
 900    };
 901    SmallInteger.prototype.isNegative = function () {
 902        return this.value < 0;
 903    };
 904    NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative;
 905
 906    BigInteger.prototype.isUnit = function () {
 907        return false;
 908    };
 909    SmallInteger.prototype.isUnit = function () {
 910        return Math.abs(this.value) === 1;
 911    };
 912    NativeBigInt.prototype.isUnit = function () {
 913        return this.abs().value === BigInt(1);
 914    }
 915
 916    BigInteger.prototype.isZero = function () {
 917        return false;
 918    };
 919    SmallInteger.prototype.isZero = function () {
 920        return this.value === 0;
 921    };
 922    NativeBigInt.prototype.isZero = function () {
 923        return this.value === BigInt(0);
 924    }
 925
 926    BigInteger.prototype.isDivisibleBy = function (v) {
 927        var n = parseValue(v);
 928        if (n.isZero()) return false;
 929        if (n.isUnit()) return true;
 930        if (n.compareAbs(2) === 0) return this.isEven();
 931        return this.mod(n).isZero();
 932    };
 933    NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;
 934
 935    function isBasicPrime(v) {
 936        var n = v.abs();
 937        if (n.isUnit()) return false;
 938        if (n.equals(2) || n.equals(3) || n.equals(5)) return true;
 939        if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;
 940        if (n.lesser(49)) return true;
 941        // we don't know if it's prime: let the other functions figure it out
 942    }
 943
 944    function millerRabinTest(n, a) {
 945        var nPrev = n.prev(),
 946            b = nPrev,
 947            r = 0,
 948            d, t, i, x;
 949        while (b.isEven()) b = b.divide(2), r++;
 950        next: for (i = 0; i < a.length; i++) {
 951            if (n.lesser(a[i])) continue;
 952            x = bigInt(a[i]).modPow(b, n);
 953            if (x.isUnit() || x.equals(nPrev)) continue;
 954            for (d = r - 1; d != 0; d--) {
 955                x = x.square().mod(n);
 956                if (x.isUnit()) return false;
 957                if (x.equals(nPrev)) continue next;
 958            }
 959            return false;
 960        }
 961        return true;
 962    }
 963
 964    // Set "strict" to true to force GRH-supported lower bound of 2*log(N)^2
 965    BigInteger.prototype.isPrime = function (strict) {
 966        var isPrime = isBasicPrime(this);
 967        if (isPrime !== undefined) return isPrime;
 968        var n = this.abs();
 969        var bits = n.bitLength();
 970        if (bits <= 64)
 971            return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]);
 972        var logN = Math.log(2) * bits.toJSNumber();
 973        var t = Math.ceil((strict === true) ? (2 * Math.pow(logN, 2)) : logN);
 974        for (var a = [], i = 0; i < t; i++) {
 975            a.push(bigInt(i + 2));
 976        }
 977        return millerRabinTest(n, a);
 978    };
 979    NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;
 980
 981    BigInteger.prototype.isProbablePrime = function (iterations) {
 982        var isPrime = isBasicPrime(this);
 983        if (isPrime !== undefined) return isPrime;
 984        var n = this.abs();
 985        var t = iterations === undefined ? 5 : iterations;
 986        for (var a = [], i = 0; i < t; i++) {
 987            a.push(bigInt.randBetween(2, n.minus(2)));
 988        }
 989        return millerRabinTest(n, a);
 990    };
 991    NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;
 992
 993    BigInteger.prototype.modInv = function (n) {
 994        var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR;
 995        while (!newR.isZero()) {
 996            q = r.divide(newR);
 997            lastT = t;
 998            lastR = r;
 999            t = newT;
1000            r = newR;
1001            newT = lastT.subtract(q.multiply(newT));
1002            newR = lastR.subtract(q.multiply(newR));
1003        }
1004        if (!r.isUnit()) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime");
1005        if (t.compare(0) === -1) {
1006            t = t.add(n);
1007        }
1008        if (this.isNegative()) {
1009            return t.negate();
1010        }
1011        return t;
1012    };
1013
1014    NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv;
1015
1016    BigInteger.prototype.next = function () {
1017        var value = this.value;
1018        if (this.sign) {
1019            return subtractSmall(value, 1, this.sign);
1020        }
1021        return new BigInteger(addSmall(value, 1), this.sign);
1022    };
1023    SmallInteger.prototype.next = function () {
1024        var value = this.value;
1025        if (value + 1 < MAX_INT) return new SmallInteger(value + 1);
1026        return new BigInteger(MAX_INT_ARR, false);
1027    };
1028    NativeBigInt.prototype.next = function () {
1029        return new NativeBigInt(this.value + BigInt(1));
1030    }
1031
1032    BigInteger.prototype.prev = function () {
1033        var value = this.value;
1034        if (this.sign) {
1035            return new BigInteger(addSmall(value, 1), true);
1036        }
1037        return subtractSmall(value, 1, this.sign);
1038    };
1039    SmallInteger.prototype.prev = function () {
1040        var value = this.value;
1041        if (value - 1 > -MAX_INT) return new SmallInteger(value - 1);
1042        return new BigInteger(MAX_INT_ARR, true);
1043    };
1044    NativeBigInt.prototype.prev = function () {
1045        return new NativeBigInt(this.value - BigInt(1));
1046    }
1047
1048    var powersOfTwo = [1];
1049    while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);
1050    var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1];
1051
1052    function shift_isSmall(n) {
1053        return Math.abs(n) <= BASE;
1054    }
1055
1056    BigInteger.prototype.shiftLeft = function (v) {
1057        var n = parseValue(v).toJSNumber();
1058        if (!shift_isSmall(n)) {
1059            throw new Error(String(n) + " is too large for shifting.");
1060        }
1061        if (n < 0) return this.shiftRight(-n);
1062        var result = this;
1063        if (result.isZero()) return result;
1064        while (n >= powers2Length) {
1065            result = result.multiply(highestPower2);
1066            n -= powers2Length - 1;
1067        }
1068        return result.multiply(powersOfTwo[n]);
1069    };
1070    NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;
1071
1072    BigInteger.prototype.shiftRight = function (v) {
1073        var remQuo;
1074        var n = parseValue(v).toJSNumber();
1075        if (!shift_isSmall(n)) {
1076            throw new Error(String(n) + " is too large for shifting.");
1077        }
1078        if (n < 0) return this.shiftLeft(-n);
1079        var result = this;
1080        while (n >= powers2Length) {
1081            if (result.isZero() || (result.isNegative() && result.isUnit())) return result;
1082            remQuo = divModAny(result, highestPower2);
1083            result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
1084            n -= powers2Length - 1;
1085        }
1086        remQuo = divModAny(result, powersOfTwo[n]);
1087        return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
1088    };
1089    NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;
1090
1091    function bitwise(x, y, fn) {
1092        y = parseValue(y);
1093        var xSign = x.isNegative(), ySign = y.isNegative();
1094        var xRem = xSign ? x.not() : x,
1095            yRem = ySign ? y.not() : y;
1096        var xDigit = 0, yDigit = 0;
1097        var xDivMod = null, yDivMod = null;
1098        var result = [];
1099        while (!xRem.isZero() || !yRem.isZero()) {
1100            xDivMod = divModAny(xRem, highestPower2);
1101            xDigit = xDivMod[1].toJSNumber();
1102            if (xSign) {
1103                xDigit = highestPower2 - 1 - xDigit; // two's complement for negative numbers
1104            }
1105
1106            yDivMod = divModAny(yRem, highestPower2);
1107            yDigit = yDivMod[1].toJSNumber();
1108            if (ySign) {
1109                yDigit = highestPower2 - 1 - yDigit; // two's complement for negative numbers
1110            }
1111
1112            xRem = xDivMod[0];
1113            yRem = yDivMod[0];
1114            result.push(fn(xDigit, yDigit));
1115        }
1116        var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);
1117        for (var i = result.length - 1; i >= 0; i -= 1) {
1118            sum = sum.multiply(highestPower2).add(bigInt(result[i]));
1119        }
1120        return sum;
1121    }
1122
1123    BigInteger.prototype.not = function () {
1124        return this.negate().prev();
1125    };
1126    NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not;
1127
1128    BigInteger.prototype.and = function (n) {
1129        return bitwise(this, n, function (a, b) { return a & b; });
1130    };
1131    NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and;
1132
1133    BigInteger.prototype.or = function (n) {
1134        return bitwise(this, n, function (a, b) { return a | b; });
1135    };
1136    NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or;
1137
1138    BigInteger.prototype.xor = function (n) {
1139        return bitwise(this, n, function (a, b) { return a ^ b; });
1140    };
1141    NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor;
1142
1143    var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I;
1144    function roughLOB(n) { // get lowestOneBit (rough)
1145        // SmallInteger: return Min(lowestOneBit(n), 1 << 30)
1146        // BigInteger: return Min(lowestOneBit(n), 1 << 14) [BASE=1e7]
1147        var v = n.value,
1148            x = typeof v === "number" ? v | LOBMASK_I :
1149                typeof v === "bigint" ? v | BigInt(LOBMASK_I) :
1150                    v[0] + v[1] * BASE | LOBMASK_BI;
1151        return x & -x;
1152    }
1153
1154    function integerLogarithm(value, base) {
1155        if (base.compareTo(value) <= 0) {
1156            var tmp = integerLogarithm(value, base.square(base));
1157            var p = tmp.p;
1158            var e = tmp.e;
1159            var t = p.multiply(base);
1160            return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p: p, e: e * 2 };
1161        }
1162        return { p: bigInt(1), e: 0 };
1163    }
1164
1165    BigInteger.prototype.bitLength = function () {
1166        var n = this;
1167        if (n.compareTo(bigInt(0)) < 0) {
1168            n = n.negate().subtract(bigInt(1));
1169        }
1170        if (n.compareTo(bigInt(0)) === 0) {
1171            return bigInt(0);
1172        }
1173        return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1));
1174    }
1175    NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;
1176
1177    function max(a, b) {
1178        a = parseValue(a);
1179        b = parseValue(b);
1180        return a.greater(b) ? a : b;
1181    }
1182    function min(a, b) {
1183        a = parseValue(a);
1184        b = parseValue(b);
1185        return a.lesser(b) ? a : b;
1186    }
1187    function gcd(a, b) {
1188        a = parseValue(a).abs();
1189        b = parseValue(b).abs();
1190        if (a.equals(b)) return a;
1191        if (a.isZero()) return b;
1192        if (b.isZero()) return a;
1193        var c = Integer[1], d, t;
1194        while (a.isEven() && b.isEven()) {
1195            d = min(roughLOB(a), roughLOB(b));
1196            a = a.divide(d);
1197            b = b.divide(d);
1198            c = c.multiply(d);
1199        }
1200        while (a.isEven()) {
1201            a = a.divide(roughLOB(a));
1202        }
1203        do {
1204            while (b.isEven()) {
1205                b = b.divide(roughLOB(b));
1206            }
1207            if (a.greater(b)) {
1208                t = b; b = a; a = t;
1209            }
1210            b = b.subtract(a);
1211        } while (!b.isZero());
1212        return c.isUnit() ? a : a.multiply(c);
1213    }
1214    function lcm(a, b) {
1215        a = parseValue(a).abs();
1216        b = parseValue(b).abs();
1217        return a.divide(gcd(a, b)).multiply(b);
1218    }
1219    function randBetween(a, b) {
1220        a = parseValue(a);
1221        b = parseValue(b);
1222        var low = min(a, b), high = max(a, b);
1223        var range = high.subtract(low).add(1);
1224        if (range.isSmall) return low.add(Math.floor(Math.random() * range));
1225        var digits = toBase(range, BASE).value;
1226        var result = [], restricted = true;
1227        for (var i = 0; i < digits.length; i++) {
1228            var top = restricted ? digits[i] : BASE;
1229            var digit = truncate(Math.random() * top);
1230            result.push(digit);
1231            if (digit < top) restricted = false;
1232        }
1233        return low.add(Integer.fromArray(result, BASE, false));
1234    }
1235
1236    var parseBase = function (text, base, alphabet, caseSensitive) {
1237        alphabet = alphabet || DEFAULT_ALPHABET;
1238        text = String(text);
1239        if (!caseSensitive) {
1240            text = text.toLowerCase();
1241            alphabet = alphabet.toLowerCase();
1242        }
1243        var length = text.length;
1244        var i;
1245        var absBase = Math.abs(base);
1246        var alphabetValues = {};
1247        for (i = 0; i < alphabet.length; i++) {
1248            alphabetValues[alphabet[i]] = i;
1249        }
1250        for (i = 0; i < length; i++) {
1251            var c = text[i];
1252            if (c === "-") continue;
1253            if (c in alphabetValues) {
1254                if (alphabetValues[c] >= absBase) {
1255                    if (c === "1" && absBase === 1) continue;
1256                    throw new Error(c + " is not a valid digit in base " + base + ".");
1257                }
1258            }
1259        }
1260        base = parseValue(base);
1261        var digits = [];
1262        var isNegative = text[0] === "-";
1263        for (i = isNegative ? 1 : 0; i < text.length; i++) {
1264            var c = text[i];
1265            if (c in alphabetValues) digits.push(parseValue(alphabetValues[c]));
1266            else if (c === "<") {
1267                var start = i;
1268                do { i++; } while (text[i] !== ">" && i < text.length);
1269                digits.push(parseValue(text.slice(start + 1, i)));
1270            }
1271            else throw new Error(c + " is not a valid character");
1272        }
1273        return parseBaseFromArray(digits, base, isNegative);
1274    };
1275
1276    function parseBaseFromArray(digits, base, isNegative) {
1277        var val = Integer[0], pow = Integer[1], i;
1278        for (i = digits.length - 1; i >= 0; i--) {
1279            val = val.add(digits[i].times(pow));
1280            pow = pow.times(base);
1281        }
1282        return isNegative ? val.negate() : val;
1283    }
1284
1285    function stringify(digit, alphabet) {
1286        alphabet = alphabet || DEFAULT_ALPHABET;
1287        if (digit < alphabet.length) {
1288            return alphabet[digit];
1289        }
1290        return "<" + digit + ">";
1291    }
1292
1293    function toBase(n, base) {
1294        base = bigInt(base);
1295        if (base.isZero()) {
1296            if (n.isZero()) return { value: [0], isNegative: false };
1297            throw new Error("Cannot convert nonzero numbers to base 0.");
1298        }
1299        if (base.equals(-1)) {
1300            if (n.isZero()) return { value: [0], isNegative: false };
1301            if (n.isNegative())
1302                return {
1303                    value: [].concat.apply([], Array.apply(null, Array(-n.toJSNumber()))
1304                        .map(Array.prototype.valueOf, [1, 0])
1305                    ),
1306                    isNegative: false
1307                };
1308
1309            var arr = Array.apply(null, Array(n.toJSNumber() - 1))
1310                .map(Array.prototype.valueOf, [0, 1]);
1311            arr.unshift([1]);
1312            return {
1313                value: [].concat.apply([], arr),
1314                isNegative: false
1315            };
1316        }
1317
1318        var neg = false;
1319        if (n.isNegative() && base.isPositive()) {
1320            neg = true;
1321            n = n.abs();
1322        }
1323        if (base.isUnit()) {
1324            if (n.isZero()) return { value: [0], isNegative: false };
1325
1326            return {
1327                value: Array.apply(null, Array(n.toJSNumber()))
1328                    .map(Number.prototype.valueOf, 1),
1329                isNegative: neg
1330            };
1331        }
1332        var out = [];
1333        var left = n, divmod;
1334        while (left.isNegative() || left.compareAbs(base) >= 0) {
1335            divmod = left.divmod(base);
1336            left = divmod.quotient;
1337            var digit = divmod.remainder;
1338            if (digit.isNegative()) {
1339                digit = base.minus(digit).abs();
1340                left = left.next();
1341            }
1342            out.push(digit.toJSNumber());
1343        }
1344        out.push(left.toJSNumber());
1345        return { value: out.reverse(), isNegative: neg };
1346    }
1347
1348    function toBaseString(n, base, alphabet) {
1349        var arr = toBase(n, base);
1350        return (arr.isNegative ? "-" : "") + arr.value.map(function (x) {
1351            return stringify(x, alphabet);
1352        }).join('');
1353    }
1354
1355    BigInteger.prototype.toArray = function (radix) {
1356        return toBase(this, radix);
1357    };
1358
1359    SmallInteger.prototype.toArray = function (radix) {
1360        return toBase(this, radix);
1361    };
1362
1363    NativeBigInt.prototype.toArray = function (radix) {
1364        return toBase(this, radix);
1365    };
1366
1367    BigInteger.prototype.toString = function (radix, alphabet) {
1368        if (radix === undefined) radix = 10;
1369        if (radix !== 10) return toBaseString(this, radix, alphabet);
1370        var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit;
1371        while (--l >= 0) {
1372            digit = String(v[l]);
1373            str += zeros.slice(digit.length) + digit;
1374        }
1375        var sign = this.sign ? "-" : "";
1376        return sign + str;
1377    };
1378
1379    SmallInteger.prototype.toString = function (radix, alphabet) {
1380        if (radix === undefined) radix = 10;
1381        if (radix != 10) return toBaseString(this, radix, alphabet);
1382        return String(this.value);
1383    };
1384
1385    NativeBigInt.prototype.toString = SmallInteger.prototype.toString;
1386
1387    NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function () { return this.toString(); }
1388
1389    BigInteger.prototype.valueOf = function () {
1390        return parseInt(this.toString(), 10);
1391    };
1392    BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;
1393
1394    SmallInteger.prototype.valueOf = function () {
1395        return this.value;
1396    };
1397    SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;
1398    NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function () {
1399        return parseInt(this.toString(), 10);
1400    }
1401
1402    function parseStringValue(v) {
1403        if (isPrecise(+v)) {
1404            var x = +v;
1405            if (x === truncate(x))
1406                return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x);
1407            throw new Error("Invalid integer: " + v);
1408        }
1409        var sign = v[0] === "-";
1410        if (sign) v = v.slice(1);
1411        var split = v.split(/e/i);
1412        if (split.length > 2) throw new Error("Invalid integer: " + split.join("e"));
1413        if (split.length === 2) {
1414            var exp = split[1];
1415            if (exp[0] === "+") exp = exp.slice(1);
1416            exp = +exp;
1417            if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error("Invalid integer: " + exp + " is not a valid exponent.");
1418            var text = split[0];
1419            var decimalPlace = text.indexOf(".");
1420            if (decimalPlace >= 0) {
1421                exp -= text.length - decimalPlace - 1;
1422                text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);
1423            }
1424            if (exp < 0) throw new Error("Cannot include negative exponent part for integers");
1425            text += (new Array(exp + 1)).join("0");
1426            v = text;
1427        }
1428        var isValid = /^([0-9][0-9]*)$/.test(v);
1429        if (!isValid) throw new Error("Invalid integer: " + v);
1430        if (supportsNativeBigInt) {
1431            return new NativeBigInt(BigInt(sign ? "-" + v : v));
1432        }
1433        var r = [], max = v.length, l = LOG_BASE, min = max - l;
1434        while (max > 0) {
1435            r.push(+v.slice(min, max));
1436            min -= l;
1437            if (min < 0) min = 0;
1438            max -= l;
1439        }
1440        trim(r);
1441        return new BigInteger(r, sign);
1442    }
1443
1444    function parseNumberValue(v) {
1445        if (supportsNativeBigInt) {
1446            return new NativeBigInt(BigInt(v));
1447        }
1448        if (isPrecise(v)) {
1449            if (v !== truncate(v)) throw new Error(v + " is not an integer.");
1450            return new SmallInteger(v);
1451        }
1452        return parseStringValue(v.toString());
1453    }
1454
1455    function parseValue(v) {
1456        if (typeof v === "number") {
1457            return parseNumberValue(v);
1458        }
1459        if (typeof v === "string") {
1460            return parseStringValue(v);
1461        }
1462        if (typeof v === "bigint") {
1463            return new NativeBigInt(v);
1464        }
1465        return v;
1466    }
1467    // Pre-define numbers in range [-999,999]
1468    for (var i = 0; i < 1000; i++) {
1469        Integer[i] = parseValue(i);
1470        if (i > 0) Integer[-i] = parseValue(-i);
1471    }
1472    // Backwards compatibility
1473    Integer.one = Integer[1];
1474    Integer.zero = Integer[0];
1475    Integer.minusOne = Integer[-1];
1476    Integer.max = max;
1477    Integer.min = min;
1478    Integer.gcd = gcd;
1479    Integer.lcm = lcm;
1480    Integer.isInstance = function (x) { return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt; };
1481    Integer.randBetween = randBetween;
1482
1483    Integer.fromArray = function (digits, base, isNegative) {
1484        return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative);
1485    };
1486
1487    return Integer;
1488})();
1489
1490// Node.js check
1491if (typeof module !== "undefined" && module.hasOwnProperty("exports")) {
1492    module.exports = bigInt;
1493}
1494
1495//amd check
1496if (typeof define === "function" && define.amd) {
1497    define("big-integer", [], function () {
1498        return bigInt;
1499    });
1500}
1501
1502},{}],4:[function(require,module,exports){
1503(function (process){
1504/*
1505    Copyright 2019 0KIMS association.
1506
1507    This file is part of websnark (Web Assembly zkSnark Prover).
1508
1509    websnark is a free software: you can redistribute it and/or modify it
1510    under the terms of the GNU General Public License as published by
1511    the Free Software Foundation, either version 3 of the License, or
1512    (at your option) any later version.
1513
1514    websnark is distributed in the hope that it will be useful, but WITHOUT
1515    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1516    or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
1517    License for more details.
1518
1519    You should have received a copy of the GNU General Public License
1520    along with websnark. If not, see <https://www.gnu.org/licenses/>.
1521*/
1522
1523/* globals WebAssembly, Blob, Worker, navigator, Promise, window */
1524const bigInt = require("big-integer");
1525const groth16_wasm = require("../build/groth16_wasm.js");
1526const assert = require("assert");
1527
1528const inBrowser = (typeof window !== "undefined");
1529let NodeWorker;
1530let NodeCrypto;
1531if (!inBrowser) {
1532    NodeWorker = require("worker_threads").Worker;
1533    NodeCrypto = require("crypto");
1534}
1535
1536
1537class Deferred {
1538    constructor() {
1539        this.promise = new Promise((resolve, reject)=> {
1540            this.reject = reject;
1541            this.resolve = resolve;
1542        });
1543    }
1544}
1545
1546/*
1547function delay(ms) {
1548    return new Promise(resolve => setTimeout(resolve, ms));
1549}
1550*/
1551
1552function thread(self) {
1553    let instance;
1554    let memory;
1555    let i32;
1556
1557    async function init(data) {
1558        const code = new Uint8Array(data.code);
1559        const wasmModule = await WebAssembly.compile(code);
1560        memory = new WebAssembly.Memory({initial:data.init});
1561        i32 = new Uint32Array(memory.buffer);
1562
1563        instance = await WebAssembly.instantiate(wasmModule, {
1564            env: {
1565                "memory": memory
1566            }
1567        });
1568    }
1569
1570    function alloc(length) {
1571        while (i32[0] & 3) i32[0]++;  // Return always aligned pointers
1572        const res = i32[0];
1573        i32[0] += length;
1574        return res;
1575    }
1576
1577    function putBin(b) {
1578        const p = alloc(b.byteLength);
1579        const s32 = new Uint32Array(b);
1580        i32.set(s32, p/4);
1581        return p;
1582    }
1583
1584    function getBin(p, l) {
1585        return memory.buffer.slice(p, p+l);
1586    }
1587
1588    self.onmessage = function(e) {
1589        let data;
1590        if (e.data) {
1591            data = e.data;
1592        } else {
1593            data = e;
1594        }
1595
1596        if (data.command == "INIT") {
1597            init(data).then(function() {
1598                self.postMessage(data.result);
1599            });
1600        } else if (data.command == "G1_MULTIEXP") {
1601
1602            const oldAlloc = i32[0];
1603            const pScalars = putBin(data.scalars);
1604            const pPoints = putBin(data.points);
1605            const pRes = alloc(96);
1606            instance.exports.g1_zero(pRes);
1607            instance.exports.g1_multiexp(pScalars, pPoints, data.n, 5, pRes);
1608
1609            data.result = getBin(pRes, 96);
1610            i32[0] = oldAlloc;
1611            self.postMessage(data.result, [data.result]);
1612        } else if (data.command == "G2_MULTIEXP") {
1613
1614            const oldAlloc = i32[0];
1615            const pScalars = putBin(data.scalars);
1616            const pPoints = putBin(data.points);
1617            const pRes = alloc(192);
1618            instance.exports.g2_zero(pRes);
1619            instance.exports.g2_multiexp(pScalars, pPoints, data.n, 5, pRes);
1620
1621            data.result = getBin(pRes, 192);
1622            i32[0] = oldAlloc;
1623            self.postMessage(data.result, [data.result]);
1624        } else if (data.command == "CALC_H") {
1625            const oldAlloc = i32[0];
1626            const pSignals = putBin(data.signals);
1627            const pPolsA = putBin(data.polsA);
1628            const pPolsB = putBin(data.polsB);
1629            const nSignals = data.nSignals;
1630            const domainSize = data.domainSize;
1631            const pSignalsM = alloc(nSignals*32);
1632            const pPolA = alloc(domainSize*32);
1633            const pPolB = alloc(domainSize*32);
1634            const pPolA2 = alloc(domainSize*32*2);
1635            const pPolB2 = alloc(domainSize*32*2);
1636
1637            instance.exports.fft_toMontgomeryN(pSignals, pSignalsM, nSignals);
1638
1639            instance.exports.pol_zero(pPolA, domainSize);
1640            instance.exports.pol_zero(pPolB, domainSize);
1641
1642            instance.exports.pol_constructLC(pPolsA, pSignalsM, nSignals, pPolA);
1643            instance.exports.pol_constructLC(pPolsB, pSignalsM, nSignals, pPolB);
1644
1645            instance.exports.fft_copyNInterleaved(pPolA, pPolA2, domainSize);
1646            instance.exports.fft_copyNInterleaved(pPolB, pPolB2, domainSize);
1647
1648            instance.exports.fft_ifft(pPolA, domainSize, 0);
1649            instance.exports.fft_ifft(pPolB, domainSize, 0);
1650            instance.exports.fft_fft(pPolA, domainSize, 1);
1651            instance.exports.fft_fft(pPolB, domainSize, 1);
1652
1653            instance.exports.fft_copyNInterleaved(pPolA, pPolA2+32, domainSize);
1654            instance.exports.fft_copyNInterleaved(pPolB, pPolB2+32, domainSize);
1655
1656            instance.exports.fft_mulN(pPolA2, pPolB2, domainSize*2, pPolA2);
1657
1658            instance.exports.fft_ifft(pPolA2, domainSize*2, 0);
1659
1660            instance.exports.fft_fromMontgomeryN(pPolA2+domainSize*32, pPolA2+domainSize*32, domainSize);
1661
1662            data.result = getBin(pPolA2+domainSize*32, domainSize*32);
1663            i32[0] = oldAlloc;
1664            self.postMessage(data.result, [data.result]);
1665        } else if (data.command == "TERMINATE") {
1666            process.exit();
1667        }
1668    };
1669}
1670
1671async function build() {
1672
1673    const groth16 = new Groth16();
1674
1675    groth16.q = bigInt("21888242871839275222246405745257275088696311157297823662689037894645226208583");
1676    groth16.r = bigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617");
1677    groth16.n64 = Math.floor((groth16.q.minus(1).bitLength() - 1)/64) +1;
1678    groth16.n32 = groth16.n64*2;
1679    groth16.n8 = groth16.n64*8;
1680
1681    groth16.memory = new WebAssembly.Memory({initial:1000});
1682    groth16.i32 = new Uint32Array(groth16.memory.buffer);
1683
1684    const wasmModule = await WebAssembly.compile(groth16_wasm.code);
1685
1686    groth16.instance = await WebAssembly.instantiate(wasmModule, {
1687        env: {
1688            "memory": groth16.memory
1689        }
1690    });
1691
1692    groth16.pq = groth16_wasm.pq;
1693    groth16.pr = groth16_wasm.pr;
1694
1695    groth16.pr0 = groth16.alloc(192);
1696    groth16.pr1 = groth16.alloc(192);
1697
1698    groth16.workers = [];
1699    groth16.pendingDeferreds = [];
1700    groth16.working = [];
1701
1702    let concurrency;
1703
1704    if ((typeof(navigator) === "object") && navigator.hardwareConcurrency) {
1705        concurrency = navigator.hardwareConcurrency;
1706    } else {
1707        concurrency = 8;
1708    }
1709
1710    function getOnMsg(i) {
1711        return function(e) {
1712            let data;
1713            if ((e)&&(e.data)) {
1714                data = e.data;
1715            } else {
1716                data = e;
1717            }
1718
1719            groth16.working[i]=false;
1720            groth16.pendingDeferreds[i].resolve(data);
1721            groth16.processWorks();
1722        };
1723    }
1724
1725    for (let i = 0; i<concurrency; i++) {
1726
1727        if (inBrowser) {
1728            const blob = new Blob(["(", thread.toString(), ")(self);"], { type: "text/javascript" });
1729            const url = URL.createObjectURL(blob);
1730
1731            groth16.workers[i] = new Worker(url);
1732
1733            groth16.workers[i].onmessage = getOnMsg(i);
1734
1735        } else {
1736            groth16.workers[i] = new NodeWorker("(" + thread.toString()+ ")(require('worker_threads').parentPort);", {eval: true});
1737
1738            groth16.workers[i].on("message", getOnMsg(i));
1739        }
1740
1741        groth16.working[i]=false;
1742    }
1743
1744    const initPromises = [];
1745    for (let i=0; i<groth16.workers.length;i++) {
1746        const copyCode = groth16_wasm.code.buffer.slice(0);
1747        initPromises.push(groth16.postAction(i, {
1748            command: "INIT",
1749            init: 1000,
1750            code: copyCode
1751
1752        }, [copyCode]));
1753    }
1754
1755    await Promise.all(initPromises);
1756
1757    return groth16;
1758}
1759
1760class Groth16 {
1761    constructor() {
1762        this.actionQueue = [];
1763    }
1764
1765    postAction(workerId, e, transfers, _deferred) {
1766        assert(this.working[workerId] == false);
1767        this.working[workerId] = true;
1768
1769        this.pendingDeferreds[workerId] = _deferred ? _deferred : new Deferred();
1770        this.workers[workerId].postMessage(e, transfers);
1771
1772        return this.pendingDeferreds[workerId].promise;
1773    }
1774
1775    processWorks() {
1776        for (let i=0; (i<this.workers.length)&&(this.actionQueue.length > 0); i++) {
1777            if (this.working[i] == false) {
1778                const work = this.actionQueue.shift();
1779                this.postAction(i, work.data, work.transfers, work.deferred);
1780            }
1781        }
1782    }
1783
1784    queueAction(actionData, transfers) {
1785        const d = new Deferred();
1786        this.actionQueue.push({
1787            data: actionData,
1788            transfers: transfers,
1789            deferred: d
1790        });
1791        this.processWorks();
1792        return d.promise;
1793    }
1794
1795    alloc(length) {
1796        while (this.i32[0] & 3) this.i32[0]++;  // Return always aligned pointers
1797        const res = this.i32[0];
1798        this.i32[0] += length;
1799        return res;
1800    }
1801
1802
1803    putBin(p, b) {
1804        const s32 = new Uint32Array(b);
1805        this.i32.set(s32, p/4);
1806    }
1807
1808    getBin(p, l) {
1809        return this.memory.buffer.slice(p, p+l);
1810    }
1811
1812    bin2int(b) {
1813        const i32 = new Uint32Array(b);
1814        let acc = bigInt(i32[7]);
1815        for (let i=6; i>=0; i--) {
1816            acc = acc.shiftLeft(32);
1817            acc = acc.add(i32[i]);
1818        }
1819        return acc.toString();
1820    }
1821
1822    bin2g1(b) {
1823        return [
1824            this.bin2int(b.slice(0,32)),
1825            this.bin2int(b.slice(32,64)),
1826            this.bin2int(b.slice(64,96)),
1827        ];
1828    }
1829    bin2g2(b) {
1830        return [
1831            [
1832                this.bin2int(b.slice(0,32)),
1833                this.bin2int(b.slice(32,64))
1834            ],
1835            [
1836                this.bin2int(b.slice(64,96)),
1837                this.bin2int(b.slice(96,128))
1838            ],
1839            [
1840                this.bin2int(b.slice(128,160)),
1841                this.bin2int(b.slice(160,192))
1842            ],
1843        ];
1844    }
1845
1846    async g1_multiexp(scalars, points) {
1847        const nPoints = scalars.byteLength /32;
1848        const nPointsPerThread = Math.floor(nPoints / this.workers.length);
1849        const opPromises = [];
1850        for (let i=0; i<this.workers.length; i++) {
1851            const th_nPoints =
1852                i < this.workers.length -1 ?
1853                    nPointsPerThread :
1854                    nPoints - (nPointsPerThread * (this.workers.length -1));
1855            const scalars_th = scalars.slice(i*nPointsPerThread*32, i*nPointsPerThread*32 + th_nPoints*32);
1856            const points_th = points.slice(i*nPointsPerThread*64, i*nPointsPerThread*64 + th_nPoints*64);
1857            opPromises.push(
1858                this.queueAction({
1859                    command: "G1_MULTIEXP",
1860                    scalars: scalars_th,
1861                    points: points_th,
1862                    n: th_nPoints
1863                }, [scalars_th, points_th])
1864            );
1865        }
1866
1867        const results = await Promise.all(opPromises);
1868
1869        this.instance.exports.g1_zero(this.pr0);
1870        for (let i=0; i<results.length; i++) {
1871            this.putBin(this.pr1, results[i]);
1872            this.instance.exports.g1_add(this.pr0, this.pr1, this.pr0);
1873        }
1874
1875        return this.getBin(this.pr0, 96);
1876    }
1877
1878    async g2_multiexp(scalars, points) {
1879        const nPoints = scalars.byteLength /32;
1880        const nPointsPerThread = Math.floor(nPoints / this.workers.length);
1881        const opPromises = [];
1882        for (let i=0; i<this.workers.length; i++) {
1883            const th_nPoints =
1884                i < this.workers.length -1 ?
1885                    nPointsPerThread :
1886                    nPoints - (nPointsPerThread * (this.workers.length -1));
1887            const scalars_th = scalars.slice(i*nPointsPerThread*32, i*nPointsPerThread*32 + th_nPoints*32);
1888            const points_th = points.slice(i*nPointsPerThread*128, i*nPointsPerThread*128 + th_nPoints*128);
1889            opPromises.push(
1890                this.queueAction({
1891                    command: "G2_MULTIEXP",
1892                    scalars: scalars_th,
1893                    points: points_th,
1894                    n: th_nPoints
1895                }, [scalars_th, points_th])
1896            );
1897        }
1898
1899        const results = await Promise.all(opPromises);
1900
1901        this.instance.exports.g2_zero(this.pr0);
1902        for (let i=0; i<results.length; i++) {
1903            this.putBin(this.pr1, results[i]);
1904            this.instance.exports.g2_add(this.pr0, this.pr1, this.pr0);
1905        }
1906
1907        return this.getBin(this.pr0, 192);
1908    }
1909
1910    g1_affine(p) {
1911        this.putBin(this.pr0, p);
1912        this.instance.exports.g1_affine(this.pr0, this.pr0);
1913        return this.getBin(this.pr0, 96);
1914    }
1915
1916    g2_affine(p) {
1917        this.putBin(this.pr0, p);
1918        this.instance.exports.g2_affine(this.pr0, this.pr0);
1919        return this.getBin(this.pr0, 192);
1920    }
1921
1922    g1_fromMontgomery(p) {
1923        this.putBin(this.pr0, p);
1924        this.instance.exports.g1_fromMontgomery(this.pr0, this.pr0);
1925        return this.getBin(this.pr0, 96);
1926    }
1927
1928    g2_fromMontgomery(p) {
1929        this.putBin(this.pr0, p);
1930        this.instance.exports.g2_fromMontgomery(this.pr0, this.pr0);
1931        return this.getBin(this.pr0, 192);
1932    }
1933
1934    loadPoint1(b) {
1935        const p = this.alloc(96);
1936        this.putBin(p, b);
1937        this.instance.exports.f1m_one(p+64);
1938        return p;
1939    }
1940
1941    loadPoint2(b) {
1942        const p = this.alloc(192);
1943        this.putBin(p, b);
1944        this.instance.exports.f2m_one(p+128);
1945        return p;
1946    }
1947
1948    terminate() {
1949        for (let i=0; i<this.workers.length; i++) {
1950            this.workers[i].postMessage({command: "TERMINATE"});
1951        }
1952    }
1953
1954
1955    async calcH(signals, polsA, polsB, nSignals, domainSize) {
1956        return this.queueAction({
1957            command: "CALC_H",
1958            signals: signals,
1959            polsA: polsA,
1960            polsB: polsB,
1961            nSignals: nSignals,
1962            domainSize: domainSize
1963        }, [signals, polsA, polsB]);
1964    }
1965
1966    async proof(signals, pkey) {
1967        const pkey32 = new Uint32Array(pkey);
1968        const nSignals = pkey32[0];
1969        const nPublic = pkey32[1];
1970        const domainSize = pkey32[2];
1971        const pPolsA = pkey32[3];
1972        const pPolsB = pkey32[4];
1973        const pPointsA = pkey32[5];
1974        const pPointsB1 = pkey32[6];
1975        const pPointsB2 = pkey32[7];
1976        const pPointsC = pkey32[8];
1977        const pHExps = pkey32[9];
1978        const polsA = pkey.slice(pPolsA, pPolsA + pPolsB);
1979        const polsB = pkey.slice(pPolsB, pPolsB + pPointsA);
1980        const pointsA = pkey.slice(pPointsA, pPointsA + nSignals*64);
1981        const pointsB1 = pkey.slice(pPointsB1, pPointsB1 + nSignals*64);
1982        const pointsB2 = pkey.slice(pPointsB2, pPointsB2 + nSignals*128);
1983        const pointsC = pkey.slice(pPointsC, pPointsC + (nSignals-nPublic-1)*64);
1984        const pointsHExps = pkey.slice(pHExps, pHExps + domainSize*64);
1985
1986        const alfa1 = pkey.slice(10*4, 10*4 + 64);
1987        const beta1 = pkey.slice(10*4 + 64, 10*4 + 128);
1988        const delta1 = pkey.slice(10*4 + 128, 10*4 + 192);
1989        const beta2 = pkey.slice(10*4 + 192, 10*4 + 320);
1990        const delta2 = pkey.slice(10*4 + 320, 10*4 + 448);
1991
1992
1993        const pH = this.calcH(signals.slice(0), polsA, polsB, nSignals, domainSize).then( (h) => {
1994/* Debug code to print the result of h
1995            for (let i=0; i<domainSize; i++) {
1996                const a = this.bin2int(h.slice(i*32, i*32+32));
1997                console.log(i + " -> " + a.toString());
1998            }
1999*/
2000            return this.g1_multiexp(h, pointsHExps);
2001        });
2002
2003        const pA = this.g1_multiexp(signals.slice(0), pointsA);
2004        const pB1 = this.g1_multiexp(signals.slice(0), pointsB1);
2005        const pB2 = this.g2_multiexp(signals.slice(0), pointsB2);
2006        const pC = this.g1_multiexp(signals.slice((nPublic+1)*32), pointsC);
2007
2008        const res = await Promise.all([pA, pB1, pB2, pC, pH]);
2009
2010        const pi_a = this.alloc(96);
2011        const pi_b = this.alloc(192);
2012        const pi_c = this.alloc(96);
2013        const pib1 = this.alloc(96);
2014
2015
2016        this.putBin(pi_a, res[0]);
2017        this.putBin(pib1, res[1]);
2018        this.putBin(pi_b, res[2]);
2019        this.putBin(pi_c, res[3]);
2020
2021        const pAlfa1 = this.loadPoint1(alfa1);
2022        const pBeta1 = this.loadPoint1(beta1);
2023        const pDelta1 = this.loadPoint1(delta1);
2024        const pBeta2 = this.loadPoint2(beta2);
2025        const pDelta2 = this.loadPoint2(delta2);
2026
2027
2028        let rnd = new Uint32Array(8);
2029
2030        const aux1 = this.alloc(96);
2031        const aux2 = this.alloc(192);
2032
2033        const pr = this.alloc(32);
2034        const ps = this.alloc(32);
2035
2036        if (inBrowser) {
2037            window.crypto.getRandomValues(rnd);
2038            this.putBin(pr, rnd);
2039
2040            window.crypto.getRandomValues(rnd);
2041            this.putBin(ps, rnd);
2042        } else {
2043            const br = NodeCrypto.randomBytes(32);
2044            this.putBin(pr, br);
2045            const bs = NodeCrypto.randomBytes(32);
2046            this.putBin(ps, bs);
2047        }
2048
2049/// Uncoment it to debug and check it works
2050//        this.instance.exports.f1m_zero(pr);
2051//        this.instance.exports.f1m_zero(ps);
2052
2053        // pi_a = pi_a + Alfa1 + r*Delta1
2054        this.instance.exports.g1_add(pAlfa1, pi_a, pi_a);
2055        this.instance.exports.g1_timesScalar(pDelta1, pr, 32, aux1);
2056        this.instance.exports.g1_add(aux1, pi_a, pi_a);
2057
2058        // pi_b = pi_b + Beta2 + s*Delta2
2059        this.instance.exports.g2_add(pBeta2, pi_b, pi_b);
2060        this.instance.exports.g2_timesScalar(pDelta2, ps, 32, aux2);
2061        this.instance.exports.g2_add(aux2, pi_b, pi_b);
2062
2063        // pib1 = pib1 + Beta1 + s*Delta1
2064        this.instance.exports.g1_add(pBeta1, pib1, pib1);
2065        this.instance.exports.g1_timesScalar(pDelta1, ps, 32, aux1);
2066        this.instance.exports.g1_add(aux1, pib1, pib1);
2067
2068
2069        // pi_c = pi_c + pH
2070        this.putBin(aux1, res[4]);
2071        this.instance.exports.g1_add(aux1, pi_c, pi_c);
2072
2073
2074        // pi_c = pi_c + s*pi_a
2075        this.instance.exports.g1_timesScalar(pi_a, ps, 32, aux1);
2076        this.instance.exports.g1_add(aux1, pi_c, pi_c);
2077
2078        // pi_c = pi_c + r*pib1
2079        this.instance.exports.g1_timesScalar(pib1, pr, 32, aux1);
2080        this.instance.exports.g1_add(aux1, pi_c, pi_c);
2081
2082        // pi_c = pi_c - r*s*delta1
2083        const prs = this.alloc(64);
2084        this.instance.exports.int_mul(pr, ps, prs);
2085        this.instance.exports.g1_timesScalar(pDelta1, prs, 64, aux1);
2086        this.instance.exports.g1_neg(aux1, aux1);
2087        this.instance.exports.g1_add(aux1, pi_c, pi_c);
2088
2089        this.instance.exports.g1_affine(pi_a, pi_a);
2090        this.instance.exports.g2_affine(pi_b, pi_b);
2091        this.instance.exports.g1_affine(pi_c, pi_c);
2092
2093        this.instance.exports.g1_fromMontgomery(pi_a, pi_a);
2094        this.instance.exports.g2_fromMontgomery(pi_b, pi_b);
2095        this.instance.exports.g1_fromMontgomery(pi_c, pi_c);
2096
2097        return {
2098            pi_a: this.bin2g1(this.getBin(pi_a, 96)),
2099            pi_b: this.bin2g2(this.getBin(pi_b, 192)),
2100            pi_c: this.bin2g1(this.getBin(pi_c, 96)),
2101        };
2102
2103    }
2104
2105}
2106
2107module.exports = build;
2108
2109}).call(this,require('_process'))
2110},{"../build/groth16_wasm.js":1,"_process":12,"assert":5,"big-integer":3,"crypto":undefined,"worker_threads":undefined}],5:[function(require,module,exports){
2111(function (global){
2112'use strict';
2113
2114// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
2115// original notice:
2116
2117/*!
2118 * The buffer module from node.js, for the browser.
2119 *
2120 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
2121 * @license  MIT
2122 */
2123function compare(a, b) {
2124  if (a === b) {
2125    return 0;
2126  }
2127
2128  var x = a.length;
2129  var y = b.length;
2130
2131  for (var i = 0, len = Math.min(x, y); i < len; ++i) {
2132    if (a[i] !== b[i]) {
2133      x = a[i];
2134      y = b[i];
2135      break;
2136    }
2137  }
2138
2139  if (x < y) {
2140    return -1;
2141  }
2142  if (y < x) {
2143    return 1;
2144  }
2145  return 0;
2146}
2147function isBuffer(b) {
2148  if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {
2149    return global.Buffer.isBuffer(b);
2150  }
2151  return !!(b != null && b._isBuffer);
2152}
2153
2154// based on node assert, original notice:
2155
2156// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
2157//
2158// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
2159//
2160// Originally from narwhal.js (http://narwhaljs.org)
2161// Copyright (c) 2009 Thomas Robinson <280north.com>
2162//
2163// Permission is hereby granted, free of charge, to any person obtaining a copy
2164// of this software and associated documentation files (the 'Software'), to
2165// deal in the Software without restriction, including without limitation the
2166// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
2167// sell copies of the Software, and to permit persons to whom the Software is
2168// furnished to do so, subject to the following conditions:
2169//
2170// The above copyright notice and this permission notice shall be included in
2171// all copies or substantial portions of the Software.
2172//
2173// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2174// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2175// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2176// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
2177// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2178// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2179
2180var util = require('util/');
2181var hasOwn = Object.prototype.hasOwnProperty;
2182var pSlice = Array.prototype.slice;
2183var functionsHaveNames = (function () {
2184  return function foo() {}.name === 'foo';
2185}());
2186function pToString (obj) {
2187  return Object.prototype.toString.call(obj);
2188}
2189function isView(arrbuf) {
2190  if (isBuffer(arrbuf)) {
2191    return false;
2192  }
2193  if (typeof global.ArrayBuffer !== 'function') {
2194    return false;
2195  }
2196  if (typeof ArrayBuffer.isView === 'function') {
2197    return ArrayBuffer.isView(arrbuf);
2198  }
2199  if (!arrbuf) {
2200    return false;
2201  }
2202  if (arrbuf instanceof DataView) {
2203    return true;
2204  }
2205  if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
2206    return true;
2207  }
2208  return false;
2209}
2210// 1. The assert module provides functions that throw
2211// AssertionError's when particular conditions are not met. The
2212// assert module must conform to the following interface.
2213
2214var assert = module.exports = ok;
2215
2216// 2. The AssertionError is defined in assert.
2217// new assert.AssertionError({ message: message,
2218//                             actual: actual,
2219//                             expected: expected })
2220
2221var regex = /\s*function\s+([^\(\s]*)\s*/;
2222// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
2223function getName(func) {
2224  if (!util.isFunction(func)) {
2225    return;
2226  }
2227  if (functionsHaveNames) {
2228    return func.name;
2229  }
2230  var str = func.toString();
2231  var match = str.match(regex);
2232  return match && match[1];
2233}
2234assert.AssertionError = function AssertionError(options) {
2235  this.name = 'AssertionError';
2236  this.actual = options.actual;
2237  this.expected = options.expected;
2238  this.operator = options.operator;
2239  if (options.message) {
2240    this.message = options.message;
2241    this.generatedMessage = false;
2242  } else {
2243    this.message = getMessage(this);
2244    this.generatedMessage = true;
2245  }
2246  var stackStartFunction = options.stackStartFunction || fail;
2247  if (Error.captureStackTrace) {
2248    Error.captureStackTrace(this, stackStartFunction);
2249  } else {
2250    // non v8 browsers so we can have a stacktrace
2251    var err = new Error();
2252    if (err.stack) {
2253      var out = err.stack;
2254
2255      // try to strip useless frames
2256      var fn_name = getName(stackStartFunction);
2257      var idx = out.indexOf('\n' + fn_name);
2258      if (idx >= 0) {
2259        // once we have located the function frame
2260        // we need to strip out everything before it (and its line)
2261        var next_line = out.indexOf('\n', idx + 1);
2262        out = out.substring(next_line + 1);
2263      }
2264
2265      this.stack = out;
2266    }
2267  }
2268};
2269
2270// assert.AssertionError instanceof Error
2271util.inherits(assert.AssertionError, Error);
2272
2273function truncate(s, n) {
2274  if (typeof s === 'string') {
2275    return s.length < n ? s : s.slice(0, n);
2276  } else {
2277    return s;
2278  }
2279}
2280function inspect(something) {
2281  if (functionsHaveNames || !util.isFunction(something)) {
2282    return util.inspect(something);
2283  }
2284  var rawname = getName(something);
2285  var name = rawname ? ': ' + rawname : '';
2286  return '[Function' +  name + ']';
2287}
2288function getMessage(self) {
2289  return truncate(inspect(self.actual), 128) + ' ' +
2290         self.operator + ' ' +
2291         truncate(inspect(self.expected), 128);
2292}
2293
2294// At present only the three keys mentioned above are used and
2295// understood by the spec. Implementations or sub modules can pass
2296// other keys to the AssertionError's constructor - they will be
2297// ignored.
2298
2299// 3. All of the following functions must throw an AssertionError
2300// when a corresponding condition is not met, with a message that
2301// may be undefined if not provided.  All assertion methods provide
2302// both the actual and expected values to the assertion error for
2303// display purposes.
2304
2305function fail(actual, expected, message, operator, stackStartFunction) {
2306  throw new assert.AssertionError({
2307    message: message,
2308    actual: actual,
2309    expected: expected,
2310    operator: operator,
2311    stackStartFunction: stackStartFunction
2312  });
2313}
2314
2315// EXTENSION! allows for well behaved errors defined elsewhere.
2316assert.fail = fail;
2317
2318// 4. Pure assertion tests whether a value is truthy, as determined
2319// by !!guard.
2320// assert.ok(guard, message_opt);
2321// This statement is equivalent to assert.equal(true, !!guard,
2322// message_opt);. To test strictly for the value true, use
2323// assert.strictEqual(true, guard, message_opt);.
2324
2325function ok(value, message) {
2326  if (!value) fail(value, true, message, '==', assert.ok);
2327}
2328assert.ok = ok;
2329
2330// 5. The equality assertion tests shallow, coercive equality with
2331// ==.
2332// assert.equal(actual, expected, message_opt);
2333
2334assert.equal = function equal(actual, expected, message) {
2335  if (actual != expected) fail(actual, expected, message, '==', assert.equal);
2336};
2337
2338// 6. The non-equality assertion tests for whether two objects are not equal
2339// with != assert.notEqual(actual, expected, message_opt);
2340
2341assert.notEqual = function notEqual(actual, expected, message) {
2342  if (actual == expected) {
2343    fail(actual, expected, message, '!=', assert.notEqual);
2344  }
2345};
2346
2347// 7. The equivalence assertion tests a deep equality relation.
2348// assert.deepEqual(actual, expected, message_opt);
2349
2350assert.deepEqual = function deepEqual(actual, expected, message) {
2351  if (!_deepEqual(actual, expected, false)) {
2352    fail(actual, expected, message, 'deepEqual', assert.deepEqual);
2353  }
2354};
2355
2356assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
2357  if (!_deepEqual(actual, expected, true)) {
2358    fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);
2359  }
2360};
2361
2362function _deepEqual(actual, expected, strict, memos) {
2363  // 7.1. All identical values are equivalent, as determined by ===.
2364  if (actual === expected) {
2365    return true;
2366  } else if (isBuffer(actual) && isBuffer(expected)) {
2367    return compare(actual, expected) === 0;
2368
2369  // 7.2. If the expected value is a Date object, the actual value is
2370  // equivalent if it is also a Date object that refers to the same time.
2371  } else if (util.isDate(actual) && util.isDate(expected)) {
2372    return actual.getTime() === expected.getTime();
2373
2374  // 7.3 If the expected value is a RegExp object, the actual value is
2375  // equivalent if it is also a RegExp object with the same source and
2376  // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
2377  } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
2378    return actual.source === expected.source &&
2379           actual.global === expected.global &&
2380           actual.multiline === expected.multiline &&
2381           actual.lastIndex === expected.lastIndex &&
2382           actual.ignoreCase === expected.ignoreCase;
2383
2384  // 7.4. Other pairs that do not both pass typeof value == 'object',
2385  // equivalence is determined by ==.
2386  } else if ((actual === null || typeof actual !== 'object') &&
2387             (expected === null || typeof expected !== 'object')) {
2388    return strict ? actual === expected : actual == expected;
2389
2390  // If both values are instances of typed arrays, wrap their underlying
2391  // ArrayBuffers in a Buffer each to increase performance
2392  // This optimization requires the arrays to have the same type as checked by
2393  // Object.prototype.toString (aka pToString). Never perform binary
2394  // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
2395  // bit patterns are not identical.
2396  } else if (isView(actual) && isView(expected) &&
2397             pToString(actual) === pToString(expected) &&
2398             !(actual instanceof Float32Array ||
2399               actual instanceof Float64Array)) {
2400    return compare(new Uint8Array(actual.buffer),
2401                   new Uint8Array(expected.buffer)) === 0;
2402
2403  // 7.5 For all other Object pairs, including Array objects, equivalence is
2404  // determined by having the same number of owned properties (as verified
2405  // with Object.prototype.hasOwnProperty.call), the same set of keys
2406  // (although not necessarily the same order), equivalent values for every
2407  // corresponding key, and an identical 'prototype' property. Note: this
2408  // accounts for both named and indexed properties on Arrays.
2409  } else if (isBuffer(actual) !== isBuffer(expected)) {
2410    return false;
2411  } else {
2412    memos = memos || {actual: [], expected: []};
2413
2414    var actualIndex = memos.actual.indexOf(actual);
2415    if (actualIndex !== -1) {
2416      if (actualIndex === memos.expected.indexOf(expected)) {
2417        return true;
2418      }
2419    }
2420
2421    memos.actual.push(actual);
2422    memos.expected.push(expected);
2423
2424    return objEquiv(actual, expected, strict, memos);
2425  }
2426}
2427
2428function isArguments(object) {
2429  return Object.prototype.toString.call(object) == '[object Arguments]';
2430}
2431
2432function objEquiv(a, b, strict, actualVisitedObjects) {
2433  if (a === null || a === undefined || b === null || b === undefined)
2434    return false;
2435  // if one is a primitive, the other must be same
2436  if (util.isPrimitive(a) || util.isPrimitive(b))
2437    return a === b;
2438  if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
2439    return false;
2440  var aIsArgs = isArguments(a);
2441  var bIsArgs = isArguments(b);
2442  if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
2443    return false;
2444  if (aIsArgs) {
2445    a = pSlice.call(a);
2446    b = pSlice.call(b);
2447    return _deepEqual(a, b, strict);
2448  }
2449  var ka = objectKeys(a);
2450  var kb = objectKeys(b);
2451  var key, i;
2452  // having the same number of owned properties (keys incorporates
2453  // hasOwnProperty)
2454  if (ka.length !== kb.length)
2455    return false;
2456  //the same set of keys (although not necessarily the same order),
2457  ka.sort();
2458  kb.sort();
2459  //~~~cheap key test
2460  for (i = ka.length - 1; i >= 0; i--) {
2461    if (ka[i] !== kb[i])
2462      return false;
2463  }
2464  //equivalent values for every corresponding key, and
2465  //~~~possibly expensive deep test
2466  for (i = ka.length - 1; i >= 0; i--) {
2467    key = ka[i];
2468    if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
2469      return false;
2470  }
2471  return true;
2472}
2473
2474// 8. The non-equivalence assertion tests for any deep inequality.
2475// assert.notDeepEqual(actual, expected, message_opt);
2476
2477assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
2478  if (_deepEqual(actual, expected, false)) {
2479    fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
2480  }
2481};
2482
2483assert.notDeepStrictEqual = notDeepStrictEqual;
2484function notDeepStrictEqual(actual, expected, message) {
2485  if (_deepEqual(actual, expected, true)) {
2486    fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
2487  }
2488}
2489
2490
2491// 9. The strict equality assertion tests strict equality, as determined by ===.
2492// assert.strictEqual(actual, expected, message_opt);
2493
2494assert.strictEqual = function strictEqual(actual, expected, message) {
2495  if (actual !== expected) {
2496    fail(actual, expected, message, '===', assert.strictEqual);
2497  }
2498};
2499
2500// 10. The strict non-equality assertion tests for strict inequality, as
2501// determined by !==.  assert.notStrictEqual(actual, expected, message_opt);
2502
2503assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
2504  if (actual === expected) {
2505    fail(actual, expected, message, '!==', assert.notStrictEqual);
2506  }
2507};
2508
2509function expectedException(actual, expected) {
2510  if (!actual || !expected) {
2511    return false;
2512  }
2513
2514  if (Object.prototype.toString.call(expected) == '[object RegExp]') {
2515    return expected.test(actual);
2516  }
2517
2518  try {
2519    if (actual instanceof expected) {
2520      return true;
2521    }
2522  } catch (e) {
2523    // Ignore.  The instanceof check doesn't work for arrow functions.
2524  }
2525
2526  if (Error.isPrototypeOf(expected)) {
2527    return false;
2528  }
2529
2530  return expected.call({}, actual) === true;
2531}
2532
2533function _tryBlock(block) {
2534  var error;
2535  try {
2536    block();
2537  } catch (e) {
2538    error = e;
2539  }
2540  return error;
2541}
2542
2543function _throws(shouldThrow, block, expected, message) {
2544  var actual;
2545
2546  if (typeof block !== 'function') {
2547    throw new TypeError('"block" argument must be a function');
2548  }
2549
2550  if (typeof expected === 'string') {
2551    message = expected;
2552    expected = null;
2553  }
2554
2555  actual = _tryBlock(block);
2556
2557  message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
2558            (message ? ' ' + message : '.');
2559
2560  if (shouldThrow && !actual) {
2561    fail(actual, expected, 'Missing expected exception' + message);
2562  }
2563
2564  var userProvidedMessage = typeof message === 'string';
2565  var isUnwantedException = !shouldThrow && util.isError(actual);
2566  var isUnexpectedException = !shouldThrow && actual && !expected;
2567
2568  if ((isUnwantedException &&
2569      userProvidedMessage &&
2570      expectedException(actual, expected)) ||
2571      isUnexpectedException) {
2572    fail(actual, expected, 'Got unwanted exception' + message);
2573  }
2574
2575  if ((shouldThrow && actual && expected &&
2576      !expectedException(actual, expected)) || (!shouldThrow && actual)) {
2577    throw actual;
2578  }
2579}
2580
2581// 11. Expected to throw an error:
2582// assert.throws(block, Error_opt, message_opt);
2583
2584assert.throws = function(block, /*optional*/error, /*optional*/message) {
2585  _throws(true, block, error, message);
2586};
2587
2588// EXTENSION! This is annoying to write outside this module.
2589assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
2590  _throws(false, block, error, message);
2591};
2592
2593assert.ifError = function(err) { if (err) throw err; };
2594
2595var objectKeys = Object.keys || function (obj) {
2596  var keys = [];
2597  for (var key in obj) {
2598    if (hasOwn.call(obj, key)) keys.push(key);
2599  }
2600  return keys;
2601};
2602
2603}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
2604},{"util/":8}],6:[function(require,module,exports){
2605if (typeof Object.create === 'function') {
2606  // implementation from standard node.js 'util' module
2607  module.exports = function inherits(ctor, superCtor) {
2608    ctor.super_ = superCtor
2609    ctor.prototype = Object.create(superCtor.prototype, {
2610      constructor: {
2611        value: ctor,
2612        enumerable: false,
2613        writable: true,
2614        configurable: true
2615      }
2616    });
2617  };
2618} else {
2619  // old school shim for old browsers
2620  module.exports = function inherits(ctor, superCtor) {
2621    ctor.super_ = superCtor
2622    var TempCtor = function () {}
2623    TempCtor.prototype = superCtor.prototype
2624    ctor.prototype = new TempCtor()
2625    ctor.prototype.constructor = ctor
2626  }
2627}
2628
2629},{}],7:[function(require,module,exports){
2630module.exports = function isBuffer(arg) {
2631  return arg && typeof arg === 'object'
2632    && typeof arg.copy === 'function'
2633    && typeof arg.fill === 'function'
2634    && typeof arg.readUInt8 === 'function';
2635}
2636},{}],8:[function(require,module,exports){
2637(function (process,global){
2638// Copyright Joyent, Inc. and other Node contributors.
2639//
2640// Permission is hereby granted, free of charge, to any person obtaining a
2641// copy of this software and associated documentation files (the
2642// "Software"), to deal in the Software without restriction, including
2643// without limitation the rights to use, copy, modify, merge, publish,
2644// distribute, sublicense, and/or sell copies of the Software, and to permit
2645// persons to whom the Software is furnished to do so, subject to the
2646// following conditions:
2647//
2648// The above copyright notice and this permission notice shall be included
2649// in all copies or substantial portions of the Software.
2650//
2651// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2652// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2653// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
2654// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
2655// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2656// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2657// USE OR OTHER DEALINGS IN THE SOFTWARE.
2658
2659var formatRegExp = /%[sdj%]/g;
2660exports.format = function(f) {
2661  if (!isString(f)) {
2662    var objects = [];
2663    for (var i = 0; i < arguments.length; i++) {
2664      objects.push(inspect(arguments[i]));
2665    }
2666    return objects.join(' ');
2667  }
2668
2669  var i = 1;
2670  var args = arguments;
2671  var len = args.length;
2672  var str = String(f).replace(formatRegExp, function(x) {
2673    if (x === '%%') return '%';
2674    if (i >= len) return x;
2675    switch (x) {
2676      case '%s': return String(args[i++]);
2677      case '%d': return Number(args[i++]);
2678      case '%j':
2679        try {
2680          return JSON.stringify(args[i++]);
2681        } catch (_) {
2682          return '[Circular]';
2683        }
2684      default:
2685        return x;
2686    }
2687  });
2688  for (var x = args[i]; i < len; x = args[++i]) {
2689    if (isNull(x) || !isObject(x)) {
2690      str += ' ' + x;
2691    } else {
2692      str += ' ' + inspect(x);
2693    }
2694  }
2695  return str;
2696};
2697
2698
2699// Mark that a method should not be used.
2700// Returns a modified function which warns once by default.
2701// If --no-deprecation is set, then it is a no-op.
2702exports.deprecate = function(fn, msg) {
2703  // Allow for deprecating things in the process of starting up.
2704  if (isUndefined(global.process)) {
2705    return function() {
2706      return exports.deprecate(fn, msg).apply(this, arguments);
2707    };
2708  }
2709
2710  if (process.noDeprecation === true) {
2711    return fn;
2712  }
2713
2714  var warned = false;
2715  function deprecated() {
2716    if (!warned) {
2717      if (process.throwDeprecation) {
2718        throw new Error(msg);
2719      } else if (process.traceDeprecation) {
2720        console.trace(msg);
2721      } else {
2722        console.error(msg);
2723      }
2724      warned = true;
2725    }
2726    return fn.apply(this, arguments);
2727  }
2728
2729  return deprecated;
2730};
2731
2732
2733var debugs = {};
2734var debugEnviron;
2735exports.debuglog = function(set) {
2736  if (isUndefined(debugEnviron))
2737    debugEnviron = process.env.NODE_DEBUG || '';
2738  set = set.toUpperCase();
2739  if (!debugs[set]) {
2740    if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
2741      var pid = process.pid;
2742      debugs[set] = function() {
2743        var msg = exports.format.apply(exports, arguments);
2744        console.error('%s %d: %s', set, pid, msg);
2745      };
2746    } else {
2747      debugs[set] = function() {};
2748    }
2749  }
2750  return debugs[set];
2751};
2752
2753
2754/**
2755 * Echos the value of a value. Trys to print the value out
2756 * in the best way possible given the different types.
2757 *
2758 * @param {Object} obj The object to print out.
2759 * @param {Object} opts Optional options object that alters the output.
2760 */
2761/* legacy: obj, showHidden, depth, colors*/
2762function inspect(obj, opts) {
2763  // default options
2764  var ctx = {
2765    seen: [],
2766    stylize: stylizeNoColor
2767  };
2768  // legacy...
2769  if (arguments.length >= 3) ctx.depth = arguments[2];
2770  if (arguments.length >= 4) ctx.colors = arguments[3];
2771  if (isBoolean(opts)) {
2772    // legacy...
2773    ctx.showHidden = opts;
2774  } else if (opts) {
2775    // got an "options" object
2776    exports._extend(ctx, opts);
2777  }
2778  // set default options
2779  if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
2780  if (isUndefined(ctx.depth)) ctx.depth = 2;
2781  if (isUndefined(ctx.colors)) ctx.colors = false;
2782  if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
2783  if (ctx.colors) ctx.stylize = stylizeWithColor;
2784  return formatValue(ctx, obj, ctx.depth);
2785}
2786exports.inspect = inspect;
2787
2788
2789// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
2790inspect.colors = {
2791  'bold' : [1, 22],
2792  'italic' : [3, 23],
2793  'underline' : [4, 24],
2794  'inverse' : [7, 27],
2795  'white' : [37, 39],
2796  'grey' : [90, 39],
2797  'black' : [30, 39],
2798  'blue' : [34, 39],
2799  'cyan' : [36, 39],
2800  'green' : [32, 39],
2801  'magenta' : [35, 39],
2802  'red' : [31, 39],
2803  'yellow' : [33, 39]
2804};
2805
2806// Don't use 'blue' not visible on cmd.exe
2807inspect.styles = {
2808  'special': 'cyan',
2809  'number': 'yellow',
2810  'boolean': 'yellow',
2811  'undefined': 'grey',
2812  'null': 'bold',
2813  'string': 'green',
2814  'date': 'magenta',
2815  // "name": intentionally not styling
2816  'regexp': 'red'
2817};
2818
2819
2820function stylizeWithColor(str, styleType) {
2821  var style = inspect.styles[styleType];
2822
2823  if (style) {
2824    return '\u001b[' + inspect.colors[style][0] + 'm' + str +
2825           '\u001b[' + inspect.colors[style][1] + 'm';
2826  } else {
2827    return str;
2828  }
2829}
2830
2831
2832function stylizeNoColor(str, styleType) {
2833  return str;
2834}
2835
2836
2837function arrayToHash(array) {
2838  var hash = {};
2839
2840  array.forEach(function(val, idx) {
2841    hash[val] = true;
2842  });
2843
2844  return hash;
2845}
2846
2847
2848function formatValue(ctx, value, recurseTimes) {
2849  // Provide a hook for user-specified inspect functions.
2850  // Check that value is an object with an inspect function on it
2851  if (ctx.customInspect &&
2852      value &&
2853      isFunction(value.inspect) &&
2854      // Filter out the util module, it's inspect function is special
2855      value.inspect !== exports.inspect &&
2856      // Also filter out any prototype objects using the circular check.
2857      !(value.constructor && value.constructor.prototype === value)) {
2858    var ret = value.inspect(recurseTimes, ctx);
2859    if (!isString(ret)) {
2860      ret = formatValue(ctx, ret, recurseTimes);
2861    }
2862    return ret;
2863  }
2864
2865  // Primitive types cannot have properties
2866  var primitive = formatPrimitive(ctx, value);
2867  if (primitive) {
2868    return primitive;
2869  }
2870
2871  // Look up the keys of the object.
2872  var keys = Object.keys(value);
2873  var visibleKeys = arrayToHash(keys);
2874
2875  if (ctx.showHidden) {
2876    keys = Object.getOwnPropertyNames(value);
2877  }
2878
2879  // IE doesn't make error fields non-enumerable
2880  // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
2881  if (isError(value)
2882      && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
2883    return formatError(value);
2884  }
2885
2886  // Some type of object without properties can be shortcutted.
2887  if (keys.length === 0) {
2888    if (isFunction(value)) {
2889      var name = value.name ? ': ' + value.name : '';
2890      return ctx.stylize('[Function' + name + ']', 'special');
2891    }
2892    if (isRegExp(value)) {
2893      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
2894    }
2895    if (isDate(value)) {
2896      return ctx.stylize(Date.prototype.toString.call(value), 'date');
2897    }
2898    if (isError(value)) {
2899      return formatError(value);
2900    }
2901  }
2902
2903  var base = '', array = false, braces = ['{', '}'];
2904
2905  // Make Array say that they are Array
2906  if (isArray(value)) {
2907    array = true;
2908    braces = ['[', ']'];
2909  }
2910
2911  // Make functions say that they are functions
2912  if (isFunction(value)) {
2913    var n = value.name ? ': ' + value.name : '';
2914    base = ' [Function' + n + ']';
2915  }
2916
2917  // Make RegExps say that they are RegExps
2918  if (isRegExp(value)) {
2919    base = ' ' + RegExp.prototype.toString.call(value);
2920  }
2921
2922  // Make dates with properties first say the date
2923  if (isDate(value)) {
2924    base = ' ' + Date.prototype.toUTCString.call(value);
2925  }
2926
2927  // Make error with message first say the error
2928  if (isError(value)) {
2929    base = ' ' + formatError(value);
2930  }
2931
2932  if (keys.length === 0 && (!array || value.length == 0)) {
2933    return braces[0] + base + braces[1];
2934  }
2935
2936  if (recurseTimes < 0) {
2937    if (isRegExp(value)) {
2938      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
2939    } else {
2940      return ctx.stylize('[Object]', 'special');
2941    }
2942  }
2943
2944  ctx.seen.push(value);
2945
2946  var output;
2947  if (array) {
2948    output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
2949  } else {
2950    output = keys.map(function(key) {
2951      return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
2952    });
2953  }
2954
2955  ctx.seen.pop();
2956
2957  return reduceToSingleString(output, base, braces);
2958}
2959
2960
2961function formatPrimitive(ctx, value) {
2962  if (isUndefined(value))
2963    return ctx.stylize('undefined', 'undefined');
2964  if (isString(value)) {
2965    var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
2966                                             .replace(/'/g, "\\'")
2967                                             .replace(/\\"/g, '"') + '\'';
2968    return ctx.stylize(simple, 'string');
2969  }
2970  if (isNumber(value))
2971    return ctx.stylize('' + value, 'number');
2972  if (isBoolean(value))
2973    return ctx.stylize('' + value, 'boolean');
2974  // For some reason typeof null is "object", so special case here.
2975  if (isNull(value))
2976    return ctx.stylize('null', 'null');
2977}
2978
2979
2980function formatError(value) {
2981  return '[' + Error.prototype.toString.call(value) + ']';
2982}
2983
2984
2985function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
2986  var output = [];
2987  for (var i = 0, l = value.length; i < l; ++i) {
2988    if (hasOwnProperty(value, String(i))) {
2989      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
2990          String(i), true));
2991    } else {
2992      output.push('');
2993    }
2994  }
2995  keys.forEach(function(key) {
2996    if (!key.match(/^\d+$/)) {
2997      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
2998          key, true));
2999    }
3000  });
3001  return output;
3002}
3003
3004
3005function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
3006  var name, str, desc;
3007  desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
3008  if (desc.get) {
3009    if (desc.set) {
3010      str = ctx.stylize('[Getter/Setter]', 'special');
3011    } else {
3012      str = ctx.stylize('[Getter]', 'special');
3013    }
3014  } else {
3015    if (desc.set) {
3016      str = ctx.stylize('[Setter]', 'special');
3017    }
3018  }
3019  if (!hasOwnProperty(visibleKeys, key)) {
3020    name = '[' + key + ']';
3021  }
3022  if (!str) {
3023    if (ctx.seen.indexOf(desc.value) < 0) {
3024      if (isNull(recurseTimes)) {
3025        str = formatValue(ctx, desc.value, null);
3026      } else {
3027        str = formatValue(ctx, desc.value, recurseTimes - 1);
3028      }
3029      if (str.indexOf('\n') > -1) {
3030        if (array) {
3031          str = str.split('\n').map(function(line) {
3032            return '  ' + line;
3033          }).join('\n').substr(2);
3034        } else {
3035          str = '\n' + str.split('\n').map(function(line) {
3036            return '   ' + line;
3037          }).join('\n');
3038        }
3039      }
3040    } else {
3041      str = ctx.stylize('[Circular]', 'special');
3042    }
3043  }
3044  if (isUndefined(name)) {
3045    if (array && key.match(/^\d+$/)) {
3046      return str;
3047    }
3048    name = JSON.stringify('' + key);
3049    if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
3050      name = name.substr(1, name.length - 2);
3051      name = ctx.stylize(name, 'name');
3052    } else {
3053      name = name.replace(/'/g, "\\'")
3054                 .replace(/\\"/g, '"')
3055                 .replace(/(^"|"$)/g, "'");
3056      name = ctx.stylize(name, 'string');
3057    }
3058  }
3059
3060  return name + ': ' + str;
3061}
3062
3063
3064function reduceToSingleString(output, base, braces) {
3065  var numLinesEst = 0;
3066  var length = output.reduce(function(prev, cur) {
3067    numLinesEst++;
3068    if (cur.indexOf('\n') >= 0) numLinesEst++;
3069    return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
3070  }, 0);
3071
3072  if (length > 60) {
3073    return braces[0] +
3074           (base === '' ? '' : base + '\n ') +
3075           ' ' +
3076           output.join(',\n  ') +
3077           ' ' +
3078           braces[1];
3079  }
3080
3081  return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
3082}
3083
3084
3085// NOTE: These type checking functions intentionally don't use `instanceof`
3086// because it is fragile and can be easily faked with `Object.create()`.
3087function isArray(ar) {
3088  return Array.isArray(ar);
3089}
3090exports.isArray = isArray;
3091
3092function isBoolean(arg) {
3093  return typeof arg === 'boolean';
3094}
3095exports.isBoolean = isBoolean;
3096
3097function isNull(arg) {
3098  return arg === null;
3099}
3100exports.isNull = isNull;
3101
3102function isNullOrUndefined(arg) {
3103  return arg == null;
3104}
3105exports.isNullOrUndefined = isNullOrUndefined;
3106
3107function isNumber(arg) {
3108  return typeof arg === 'number';
3109}
3110exports.isNumber = isNumber;
3111
3112function isString(arg) {
3113  return typeof arg === 'string';
3114}
3115exports.isString = isString;
3116
3117function isSymbol(arg) {
3118  return typeof arg === 'symbol';
3119}
3120exports.isSymbol = isSymbol;
3121
3122function isUndefined(arg) {
3123  return arg === void 0;
3124}
3125exports.isUndefined = isUndefined;
3126
3127function isRegExp(re) {
3128  return isObject(re) && objectToString(re) === '[object RegExp]';
3129}
3130exports.isRegExp = isRegExp;
3131
3132function isObject(arg) {
3133  return typeof arg === 'object' && arg !== null;
3134}
3135exports.isObject = isObject;
3136
3137function isDate(d) {
3138  return isObject(d) && objectToString(d) === '[object Date]';
3139}
3140exports.isDate = isDate;
3141
3142function isError(e) {
3143  return isObject(e) &&
3144      (objectToString(e) === '[object Error]' || e instanceof Error);
3145}
3146exports.isError = isError;
3147
3148function isFunction(arg) {
3149  return typeof arg === 'function';
3150}
3151exports.isFunction = isFunction;
3152
3153function isPrimitive(arg) {
3154  return arg === null ||
3155         typeof arg === 'boolean' ||
3156         typeof arg === 'number' ||
3157         typeof arg === 'string' ||
3158         typeof arg === 'symbol' ||  // ES6 symbol
3159         typeof arg === 'undefined';
3160}
3161exports.isPrimitive = isPrimitive;
3162
3163exports.isBuffer = require('./support/isBuffer');
3164
3165function objectToString(o) {
3166  return Object.prototype.toString.call(o);
3167}
3168
3169
3170function pad(n) {
3171  return n < 10 ? '0' + n.toString(10) : n.toString(10);
3172}
3173
3174
3175var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
3176              'Oct', 'Nov', 'Dec'];
3177
3178// 26 Feb 16:19:34
3179function timestamp() {
3180  var d = new Date();
3181  var time = [pad(d.getHours()),
3182              pad(d.getMinutes()),
3183              pad(d.getSeconds())].join(':');
3184  return [d.getDate(), months[d.getMonth()], time].join(' ');
3185}
3186
3187
3188// log is just a thin wrapper to console.log that prepends a timestamp
3189exports.log = function() {
3190  console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
3191};
3192
3193
3194/**
3195 * Inherit the prototype methods from one constructor into another.
3196 *
3197 * The Function.prototype.inherits from lang.js rewritten as a standalone
3198 * function (not on Function.prototype). NOTE: If this file is to be loaded
3199 * during bootstrapping this function needs to be rewritten using some native
3200 * functions as prototype setup using normal JavaScript does not work as
3201 * expected during bootstrapping (see mirror.js in r114903).
3202 *
3203 * @param {function} ctor Constructor function which needs to inherit the
3204 *     prototype.
3205 * @param {function} superCtor Constructor function to inherit prototype from.
3206 */
3207exports.inherits = require('inherits');
3208
3209exports._extend = function(origin, add) {
3210  // Don't do anything if add isn't an object
3211  if (!add || !isObject(add)) return origin;
3212
3213  var keys = Object.keys(add);
3214  var i = keys.length;
3215  while (i--) {
3216    origin[keys[i]] = add[keys[i]];
3217  }
3218  return origin;
3219};
3220
3221function hasOwnProperty(obj, prop) {
3222  return Object.prototype.hasOwnProperty.call(obj, prop);
3223}
3224
3225}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
3226},{"./support/isBuffer":7,"_process":12,"inherits":6}],9:[function(require,module,exports){
3227'use strict'
3228
3229exports.byteLength = byteLength
3230exports.toByteArray = toByteArray
3231exports.fromByteArray = fromByteArray
3232
3233var lookup = []
3234var revLookup = []
3235var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
3236
3237var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
3238for (var i = 0, len = code.length; i < len; ++i) {
3239  lookup[i] = code[i]
3240  revLookup[code.charCodeAt(i)] = i
3241}
3242
3243// Support decoding URL-safe base64 strings, as Node.js does.
3244// See: https://en.wikipedia.org/wiki/Base64#URL_applications
3245revLookup['-'.charCodeAt(0)] = 62
3246revLookup['_'.charCodeAt(0)] = 63
3247
3248function getLens (b64) {
3249  var len = b64.length
3250
3251  if (len % 4 > 0) {
3252    throw new Error('Invalid string. Length must be a multiple of 4')
3253  }
3254
3255  // Trim off extra bytes after placeholder bytes are found
3256  // See: https://github.com/beatgammit/base64-js/issues/42
3257  var validLen = b64.indexOf('=')
3258  if (validLen === -1) validLen = len
3259
3260  var placeHoldersLen = validLen === len
3261    ? 0
3262    : 4 - (validLen % 4)
3263
3264  return [validLen, placeHoldersLen]
3265}
3266
3267// base64 is 4/3 + up to two characters of the original data
3268function byteLength (b64) {
3269  var lens = getLens(b64)
3270  var validLen = lens[0]
3271  var placeHoldersLen = lens[1]
3272  return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
3273}
3274
3275function _byteLength (b64, validLen, placeHoldersLen) {
3276  return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
3277}
3278
3279function toByteArray (b64) {
3280  var tmp
3281  var lens = getLens(b64)
3282  var validLen = lens[0]
3283  var placeHoldersLen = lens[1]
3284
3285  var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
3286
3287  var curByte = 0
3288
3289  // if there are placeholders, only get up to the last complete 4 chars
3290  var len = placeHoldersLen > 0
3291    ? validLen - 4
3292    : validLen
3293
3294  for (var i = 0; i < len; i += 4) {
3295    tmp =
3296      (revLookup[b64.charCodeAt(i)] << 18) |
3297      (revLookup[b64.charCodeAt(i + 1)] << 12) |
3298      (revLookup[b64.charCodeAt(i + 2)] << 6) |
3299      revLookup[b64.charCodeAt(i + 3)]
3300    arr[curByte++] = (tmp >> 16) & 0xFF
3301    arr[curByte++] = (tmp >> 8) & 0xFF
3302    arr[curByte++] = tmp & 0xFF
3303  }
3304
3305  if (placeHoldersLen === 2) {
3306    tmp =
3307      (revLookup[b64.charCodeAt(i)] << 2) |
3308      (revLookup[b64.charCodeAt(i + 1)] >> 4)
3309    arr[curByte++] = tmp & 0xFF
3310  }
3311
3312  if (placeHoldersLen === 1) {
3313    tmp =
3314      (revLookup[b64.charCodeAt(i)] << 10) |
3315      (revLookup[b64.charCodeAt(i + 1)] << 4) |
3316      (revLookup[b64.charCodeAt(i + 2)] >> 2)
3317    arr[curByte++] = (tmp >> 8) & 0xFF
3318    arr[curByte++] = tmp & 0xFF
3319  }
3320
3321  return arr
3322}
3323
3324function tripletToBase64 (num) {
3325  return lookup[num >> 18 & 0x3F] +
3326    lookup[num >> 12 & 0x3F] +
3327    lookup[num >> 6 & 0x3F] +
3328    lookup[num & 0x3F]
3329}
3330
3331function encodeChunk (uint8, start, end) {
3332  var tmp
3333  var output = []
3334  for (var i = start; i < end; i += 3) {
3335    tmp =
3336      ((uint8[i] << 16) & 0xFF0000) +
3337      ((uint8[i + 1] << 8) & 0xFF00) +
3338      (uint8[i + 2] & 0xFF)
3339    output.push(tripletToBase64(tmp))
3340  }
3341  return output.join('')
3342}
3343
3344function fromByteArray (uint8) {
3345  var tmp
3346  var len = uint8.length
3347  var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
3348  var parts = []
3349  var maxChunkLength = 16383 // must be multiple of 3
3350
3351  // go through the array every three bytes, we'll deal with trailing stuff later
3352  for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
3353    parts.push(encodeChunk(
3354      uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
3355    ))
3356  }
3357
3358  // pad the end with zeros, but make sure to not forget the extra bytes
3359  if (extraBytes === 1) {
3360    tmp = uint8[len - 1]
3361    parts.push(
3362      lookup[tmp >> 2] +
3363      lookup[(tmp << 4) & 0x3F] +
3364      '=='
3365    )
3366  } else if (extraBytes === 2) {
3367    tmp = (uint8[len - 2] << 8) + uint8[len - 1]
3368    parts.push(
3369      lookup[tmp >> 10] +
3370      lookup[(tmp >> 4) & 0x3F] +
3371      lookup[(tmp << 2) & 0x3F] +
3372      '='
3373    )
3374  }
3375
3376  return parts.join('')
3377}
3378
3379},{}],10:[function(require,module,exports){
3380(function (Buffer){
3381/*!
3382 * The buffer module from node.js, for the browser.
3383 *
3384 * @author   Feross Aboukhadijeh <https://feross.org>
3385 * @license  MIT
3386 */
3387/* eslint-disable no-proto */
3388
3389'use strict'
3390
3391var base64 = require('base64-js')
3392var ieee754 = require('ieee754')
3393
3394exports.Buffer = Buffer
3395exports.SlowBuffer = SlowBuffer
3396exports.INSPECT_MAX_BYTES = 50
3397
3398var K_MAX_LENGTH = 0x7fffffff
3399exports.kMaxLength = K_MAX_LENGTH
3400
3401/**
3402 * If `Buffer.TYPED_ARRAY_SUPPORT`:
3403 *   === true    Use Uint8Array implementation (fastest)
3404 *   === false   Print warning and recommend using `buffer` v4.x which has an Object
3405 *               implementation (most compatible, even IE6)
3406 *
3407 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
3408 * Opera 11.6+, iOS 4.2+.
3409 *
3410 * We report that the browser does not support typed arrays if the are not subclassable
3411 * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
3412 * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
3413 * for __proto__ and has a buggy typed array implementation.
3414 */
3415Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
3416
3417if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
3418    typeof console.error === 'function') {
3419  console.error(
3420    'This browser lacks typed array (Uint8Array) support which is required by ' +
3421    '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
3422  )
3423}
3424
3425function typedArraySupport () {
3426  // Can typed array instances can be augmented?
3427  try {
3428    var arr = new Uint8Array(1)
3429    arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } }
3430    return arr.foo() === 42
3431  } catch (e) {
3432    return false
3433  }
3434}
3435
3436Object.defineProperty(Buffer.prototype, 'parent', {
3437  enumerable: true,
3438  get: function () {
3439    if (!Buffer.isBuffer(this)) return undefined
3440    return this.buffer
3441  }
3442})
3443
3444Object.defineProperty(Buffer.prototype, 'offset', {
3445  enumerable: true,
3446  get: function () {
3447    if (!Buffer.isBuffer(this)) return undefined
3448    return this.byteOffset
3449  }
3450})
3451
3452function createBuffer (length) {
3453  if (length > K_MAX_LENGTH) {
3454    throw new RangeError('The value "' + length + '" is invalid for option "size"')
3455  }
3456  // Return an augmented `Uint8Array` instance
3457  var buf = new Uint8Array(length)
3458  buf.__proto__ = Buffer.prototype
3459  return buf
3460}
3461
3462/**
3463 * The Buffer constructor returns instances of `Uint8Array` that have their
3464 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
3465 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
3466 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
3467 * returns a single octet.
3468 *
3469 * The `Uint8Array` prototype remains unmodified.
3470 */
3471
3472function Buffer (arg, encodingOrOffset, length) {
3473  // Common case.
3474  if (typeof arg === 'number') {
3475    if (typeof encodingOrOffset === 'string') {
3476      throw new TypeError(
3477        'The "string" argument must be of type string. Received type number'
3478      )
3479    }
3480    return allocUnsafe(arg)
3481  }
3482  return from(arg, encodingOrOffset, length)
3483}
3484
3485// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
3486if (typeof Symbol !== 'undefined' && Symbol.species != null &&
3487    Buffer[Symbol.species] === Buffer) {
3488  Object.defineProperty(Buffer, Symbol.species, {
3489    value: null,
3490    configurable: true,
3491    enumerable: false,
3492    writable: false
3493  })
3494}
3495
3496Buffer.poolSize = 8192 // not used by this implementation
3497
3498function from (value, encodingOrOffset, length) {
3499  if (typeof value === 'string') {
3500    return fromString(value, encodingOrOffset)
3501  }
3502
3503  if (ArrayBuffer.isView(value)) {
3504    return fromArrayLike(value)
3505  }
3506
3507  if (value == null) {
3508    throw TypeError(
3509      'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
3510      'or Array-like Object. Received type ' + (typeof value)
3511    )
3512  }
3513
3514  if (isInstance(value, ArrayBuffer) ||
3515      (value && isInstance(value.buffer, ArrayBuffer))) {
3516    return fromArrayBuffer(value, encodingOrOffset, length)
3517  }
3518
3519  if (typeof value === 'number') {
3520    throw new TypeError(
3521      'The "value" argument must not be of type number. Received type number'
3522    )
3523  }
3524
3525  var valueOf = value.valueOf && value.valueOf()
3526  if (valueOf != null && valueOf !== value) {
3527    return Buffer.from(valueOf, encodingOrOffset, length)
3528  }
3529
3530  var b = fromObject(value)
3531  if (b) return b
3532
3533  if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
3534      typeof value[Symbol.toPrimitive] === 'function') {
3535    return Buffer.from(
3536      value[Symbol.toPrimitive]('string'), encodingOrOffset, length
3537    )
3538  }
3539
3540  throw new TypeError(
3541    'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
3542    'or Array-like Object. Received type ' + (typeof value)
3543  )
3544}
3545
3546/**
3547 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
3548 * if value is a number.
3549 * Buffer.from(str[, encoding])
3550 * Buffer.from(array)
3551 * Buffer.from(buffer)
3552 * Buffer.from(arrayBuffer[, byteOffset[, length]])
3553 **/
3554Buffer.from = function (value, encodingOrOffset, length) {
3555  return from(value, encodingOrOffset, length)
3556}
3557
3558// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
3559// https://github.com/feross/buffer/pull/148
3560Buffer.prototype.__proto__ = Uint8Array.prototype
3561Buffer.__proto__ = Uint8Array
3562
3563function assertSize (size) {
3564  if (typeof size !== 'number') {
3565    throw new TypeError('"size" argument must be of type number')
3566  } else if (size < 0) {
3567    throw new RangeError('The value "' + size + '" is invalid for option "size"')
3568  }
3569}
3570
3571function alloc (size, fill, encoding) {
3572  assertSize(size)
3573  if (size <= 0) {
3574    return createBuffer(size)
3575  }
3576  if (fill !== undefined) {
3577    // Only pay attention to encoding if it's a string. This
3578    // prevents accidentally sending in a number that would
3579    // be interpretted as a start offset.
3580    return typeof encoding === 'string'
3581      ? createBuffer(size).fill(fill, encoding)
3582      : createBuffer(size).fill(fill)
3583  }
3584  return createBuffer(size)
3585}
3586
3587/**
3588 * Creates a new filled Buffer instance.
3589 * alloc(size[, fill[, encoding]])
3590 **/
3591Buffer.alloc = function (size, fill, encoding) {
3592  return alloc(size, fill, encoding)
3593}
3594
3595function allocUnsafe (size) {
3596  assertSize(size)
3597  return createBuffer(size < 0 ? 0 : checked(size) | 0)
3598}
3599
3600/**
3601 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
3602 * */
3603Buffer.allocUnsafe = function (size) {
3604  return allocUnsafe(size)
3605}
3606/**
3607 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
3608 */
3609Buffer.allocUnsafeSlow = function (size) {
3610  return allocUnsafe(size)
3611}
3612
3613function fromString (string, encoding) {
3614  if (typeof encoding !== 'string' || encoding === '') {
3615    encoding = 'utf8'
3616  }
3617
3618  if (!Buffer.isEncoding(encoding)) {
3619    throw new TypeError('Unknown encoding: ' + encoding)
3620  }
3621
3622  var length = byteLength(string, encoding) | 0
3623  var buf = createBuffer(length)
3624
3625  var actual = buf.write(string, encoding)
3626
3627  if (actual !== length) {
3628    // Writing a hex string, for example, that contains invalid characters will
3629    // cause everything after the first invalid character to be ignored. (e.g.
3630    // 'abxxcd' will be treated as 'ab')
3631    buf = buf.slice(0, actual)
3632  }
3633
3634  return buf
3635}
3636
3637function fromArrayLike (array) {
3638  var length = array.length < 0 ? 0 : checked(array.length) | 0
3639  var buf = createBuffer(length)
3640  for (var i = 0; i < length; i += 1) {
3641    buf[i] = array[i] & 255
3642  }
3643  return buf
3644}
3645
3646function fromArrayBuffer (array, byteOffset, length) {
3647  if (byteOffset < 0 || array.byteLength < byteOffset) {
3648    throw new RangeError('"offset" is outside of buffer bounds')
3649  }
3650
3651  if (array.byteLength < byteOffset + (length || 0)) {
3652    throw new RangeError('"length" is outside of buffer bounds')
3653  }
3654
3655  var buf
3656  if (byteOffset === undefined && length === undefined) {
3657    buf = new Uint8Array(array)
3658  } else if (length === undefined) {
3659    buf = new Uint8Array(array, byteOffset)
3660  } else {
3661    buf = new Uint8Array(array, byteOffset, length)
3662  }
3663
3664  // Return an augmented `Uint8Array` instance
3665  buf.__proto__ = Buffer.prototype
3666  return buf
3667}
3668
3669function fromObject (obj) {
3670  if (Buffer.isBuffer(obj)) {
3671    var len = checked(obj.length) | 0
3672    var buf = createBuffer(len)
3673
3674    if (buf.length === 0) {
3675      return buf
3676    }
3677
3678    obj.copy(buf, 0, 0, len)
3679    return buf
3680  }
3681
3682  if (obj.length !== undefined) {
3683    if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
3684      return createBuffer(0)
3685    }
3686    return fromArrayLike(obj)
3687  }
3688
3689  if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
3690    return fromArrayLike(obj.data)
3691  }
3692}
3693
3694function checked (length) {
3695  // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
3696  // length is NaN (which is otherwise coerced to zero.)
3697  if (length >= K_MAX_LENGTH) {
3698    throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
3699                         'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
3700  }
3701  return length | 0
3702}
3703
3704function SlowBuffer (length) {
3705  if (+length != length) { // eslint-disable-line eqeqeq
3706    length = 0
3707  }
3708  return Buffer.alloc(+length)
3709}
3710
3711Buffer.isBuffer = function isBuffer (b) {
3712  return b != null && b._isBuffer === true &&
3713    b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
3714}
3715
3716Buffer.compare = function compare (a, b) {
3717  if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
3718  if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
3719  if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
3720    throw new TypeError(
3721      'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
3722    )
3723  }
3724
3725  if (a === b) return 0
3726
3727  var x = a.length
3728  var y = b.length
3729
3730  for (var i = 0, len = Math.min(x, y); i < len; ++i) {
3731    if (a[i] !== b[i]) {
3732      x = a[i]
3733      y = b[i]
3734      break
3735    }
3736  }
3737
3738  if (x < y) return -1
3739  if (y < x) return 1
3740  return 0
3741}
3742
3743Buffer.isEncoding = function isEncoding (encoding) {
3744  switch (String(encoding).toLowerCase()) {
3745    case 'hex':
3746    case 'utf8':
3747    case 'utf-8':
3748    case 'ascii':
3749    case 'latin1':
3750    case 'binary':
3751    case 'base64':
3752    case 'ucs2':
3753    case 'ucs-2':
3754    case 'utf16le':
3755    case 'utf-16le':
3756      return true
3757    default:
3758      return false
3759  }
3760}
3761
3762Buffer.concat = function concat (list, length) {
3763  if (!Array.isArray(list)) {
3764    throw new TypeError('"list" argument must be an Array of Buffers')
3765  }
3766
3767  if (list.length === 0) {
3768    return Buffer.alloc(0)
3769  }
3770
3771  var i
3772  if (length === undefined) {
3773    length = 0
3774    for (i = 0; i < list.length; ++i) {
3775      length += list[i].length
3776    }
3777  }
3778
3779  var buffer = Buffer.allocUnsafe(length)
3780  var pos = 0
3781  for (i = 0; i < list.length; ++i) {
3782    var buf = list[i]
3783    if (isInstance(buf, Uint8Array)) {
3784      buf = Buffer.from(buf)
3785    }
3786    if (!Buffer.isBuffer(buf)) {
3787      throw new TypeError('"list" argument must be an Array of Buffers')
3788    }
3789    buf.copy(buffer, pos)
3790    pos += buf.length
3791  }
3792  return buffer
3793}
3794
3795function byteLength (string, encoding) {
3796  if (Buffer.isBuffer(string)) {
3797    return string.length
3798  }
3799  if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
3800    return string.byteLength
3801  }
3802  if (typeof string !== 'string') {
3803    throw new TypeError(
3804      'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
3805      'Received type ' + typeof string
3806    )
3807  }
3808
3809  var len = string.length
3810  var mustMatch = (arguments.length > 2 && arguments[2] === true)
3811  if (!mustMatch && len === 0) return 0
3812
3813  // Use a for loop to avoid recursion
3814  var loweredCase = false
3815  for (;;) {
3816    switch (encoding) {
3817      case 'ascii':
3818      case 'latin1':
3819      case 'binary':
3820        return len
3821      case 'utf8':
3822      case 'utf-8':
3823        return utf8ToBytes(string).length
3824      case 'ucs2':
3825      case 'ucs-2':
3826      case 'utf16le':
3827      case 'utf-16le':
3828        return len * 2
3829      case 'hex':
3830        return len >>> 1
3831      case 'base64':
3832        return base64ToBytes(string).length
3833      default:
3834        if (loweredCase) {
3835          return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
3836        }
3837        encoding = ('' + encoding).toLowerCase()
3838        loweredCase = true
3839    }
3840  }
3841}
3842Buffer.byteLength = byteLength
3843
3844function slowToString (encoding, start, end) {
3845  var loweredCase = false
3846
3847  // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
3848  // property of a typed array.
3849
3850  // This behaves neither like String nor Uint8Array in that we set start/end
3851  // to their upper/lower bounds if the value passed is out of range.
3852  // undefined is handled specially as per ECMA-262 6th Edition,
3853  // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
3854  if (start === undefined || start < 0) {
3855    start = 0
3856  }
3857  // Return early if start > this.length. Done here to prevent potential uint32
3858  // coercion fail below.
3859  if (start > this.length) {
3860    return ''
3861  }
3862
3863  if (end === undefined || end > this.length) {
3864    end = this.length
3865  }
3866
3867  if (end <= 0) {
3868    return ''
3869  }
3870
3871  // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
3872  end >>>= 0
3873  start >>>= 0
3874
3875  if (end <= start) {
3876    return ''
3877  }
3878
3879  if (!encoding) encoding = 'utf8'
3880
3881  while (true) {
3882    switch (encoding) {
3883      case 'hex':
3884        return hexSlice(this, start, end)
3885
3886      case 'utf8':
3887      case 'utf-8':
3888        return utf8Slice(this, start, end)
3889
3890      case 'ascii':
3891        return asciiSlice(this, start, end)
3892
3893      case 'latin1':
3894      case 'binary':
3895        return latin1Slice(this, start, end)
3896
3897      case 'base64':
3898        return base64Slice(this, start, end)
3899
3900      case 'ucs2':
3901      case 'ucs-2':
3902      case 'utf16le':
3903      case 'utf-16le':
3904        return utf16leSlice(this, start, end)
3905
3906      default:
3907        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
3908        encoding = (encoding + '').toLowerCase()
3909        loweredCase = true
3910    }
3911  }
3912}
3913
3914// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
3915// to detect a Buffer instance. It's not possible to use `instanceof Buffer`
3916// reliably in a browserify context because there could be multiple different
3917// copies of the 'buffer' package in use. This method works even for Buffer
3918// instances that were created from another copy of the `buffer` package.
3919// See: https://github.com/feross/buffer/issues/154
3920Buffer.prototype._isBuffer = true
3921
3922function swap (b, n, m) {
3923  var i = b[n]
3924  b[n] = b[m]
3925  b[m] = i
3926}
3927
3928Buffer.prototype.swap16 = function swap16 () {
3929  var len = this.length
3930  if (len % 2 !== 0) {
3931    throw new RangeError('Buffer size must be a multiple of 16-bits')
3932  }
3933  for (var i = 0; i < len; i += 2) {
3934    swap(this, i, i + 1)
3935  }
3936  return this
3937}
3938
3939Buffer.prototype.swap32 = function swap32 () {
3940  var len = this.length
3941  if (len % 4 !== 0) {
3942    throw new RangeError('Buffer size must be a multiple of 32-bits')
3943  }
3944  for (var i = 0; i < len; i += 4) {
3945    swap(this, i, i + 3)
3946    swap(this, i + 1, i + 2)
3947  }
3948  return this
3949}
3950
3951Buffer.prototype.swap64 = function swap64 () {
3952  var len = this.length
3953  if (len % 8 !== 0) {
3954    throw new RangeError('Buffer size must be a multiple of 64-bits')
3955  }
3956  for (var i = 0; i < len; i += 8) {
3957    swap(this, i, i + 7)
3958    swap(this, i + 1, i + 6)
3959    swap(this, i + 2, i + 5)
3960    swap(this, i + 3, i + 4)
3961  }
3962  return this
3963}
3964
3965Buffer.prototype.toString = function toString () {
3966  var length = this.length
3967  if (length === 0) return ''
3968  if (arguments.length === 0) return utf8Slice(this, 0, length)
3969  return slowToString.apply(this, arguments)
3970}
3971
3972Buffer.prototype.toLocaleString = Buffer.prototype.toString
3973
3974Buffer.prototype.equals = function equals (b) {
3975  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
3976  if (this === b) return true
3977  return Buffer.compare(this, b) === 0
3978}
3979
3980Buffer.prototype.inspect = function inspect () {
3981  var str = ''
3982  var max = exports.INSPECT_MAX_BYTES
3983  str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
3984  if (this.length > max) str += ' ... '
3985  return '<Buffer ' + str + '>'
3986}
3987
3988Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
3989  if (isInstance(target, Uint8Array)) {
3990    target = Buffer.from(target, target.offset, target.byteLength)
3991  }
3992  if (!Buffer.isBuffer(target)) {
3993    throw new TypeError(
3994      'The "target" argument must be one of type Buffer or Uint8Array. ' +
3995      'Received type ' + (typeof target)
3996    )
3997  }
3998
3999  if (start === undefined) {
4000    start = 0
4001  }
4002  if (end === undefined) {
4003    end = target ? target.length : 0
4004  }
4005  if (thisStart === undefined) {
4006    thisStart = 0
4007  }
4008  if (thisEnd === undefined) {
4009    thisEnd = this.length
4010  }
4011
4012  if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
4013    throw new RangeError('out of range index')
4014  }
4015
4016  if (thisStart >= thisEnd && start >= end) {
4017    return 0
4018  }
4019  if (thisStart >= thisEnd) {
4020    return -1
4021  }
4022  if (start >= end) {
4023    return 1
4024  }
4025
4026  start >>>= 0
4027  end >>>= 0
4028  thisStart >>>= 0
4029  thisEnd >>>= 0
4030
4031  if (this === target) return 0
4032
4033  var x = thisEnd - thisStart
4034  var y = end - start
4035  var len = Math.min(x, y)
4036
4037  var thisCopy = this.slice(thisStart, thisEnd)
4038  var targetCopy = target.slice(start, end)
4039
4040  for (var i = 0; i < len; ++i) {
4041    if (thisCopy[i] !== targetCopy[i]) {
4042      x = thisCopy[i]
4043      y = targetCopy[i]
4044      break
4045    }
4046  }
4047
4048  if (x < y) return -1
4049  if (y < x) return 1
4050  return 0
4051}
4052
4053// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
4054// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
4055//
4056// Arguments:
4057// - buffer - a Buffer to search
4058// - val - a string, Buffer, or number
4059// - byteOffset - an index into `buffer`; will be clamped to an int32
4060// - encoding - an optional encoding, relevant is val is a string
4061// - dir - true for indexOf, false for lastIndexOf
4062function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
4063  // Empty buffer means no match
4064  if (buffer.length === 0) return -1
4065
4066  // Normalize byteOffset
4067  if (typeof byteOffset === 'string') {
4068    encoding = byteOffset
4069    byteOffset = 0
4070  } else if (byteOffset > 0x7fffffff) {
4071    byteOffset = 0x7fffffff
4072  } else if (byteOffset < -0x80000000) {
4073    byteOffset = -0x80000000
4074  }
4075  byteOffset = +byteOffset // Coerce to Number.
4076  if (numberIsNaN(byteOffset)) {
4077    // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
4078    byteOffset = dir ? 0 : (buffer.length - 1)
4079  }
4080
4081  // Normalize byteOffset: negative offsets start from the end of the buffer
4082  if (byteOffset < 0) byteOffset = buffer.length + byteOffset
4083  if (byteOffset >= buffer.length) {
4084    if (dir) return -1
4085    else byteOffset = buffer.length - 1
4086  } else if (byteOffset < 0) {
4087    if (dir) byteOffset = 0
4088    else return -1
4089  }
4090
4091  // Normalize val
4092  if (typeof val === 'string') {
4093    val = Buffer.from(val, encoding)
4094  }
4095
4096  // Finally, search either indexOf (if dir is true) or lastIndexOf
4097  if (Buffer.isBuffer(val)) {
4098    // Special case: looking for empty string/buffer always fails
4099    if (val.length === 0) {
4100      return -1
4101    }
4102    return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
4103  } else if (typeof val === 'number') {
4104    val = val & 0xFF // Search for a byte value [0-255]
4105    if (typeof Uint8Array.prototype.indexOf === 'function') {
4106      if (dir) {
4107        return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
4108      } else {
4109        return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
4110      }
4111    }
4112    return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
4113  }
4114
4115  throw new TypeError('val must be string, number or Buffer')
4116}
4117
4118function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
4119  var indexSize = 1
4120  var arrLength = arr.length
4121  var valLength = val.length
4122
4123  if (encoding !== undefined) {
4124    encoding = String(encoding).toLowerCase()
4125    if (encoding === 'ucs2' || encoding === 'ucs-2' ||
4126        encoding === 'utf16le' || encoding === 'utf-16le') {
4127      if (arr.length < 2 || val.length < 2) {
4128        return -1
4129      }
4130      indexSize = 2
4131      arrLength /= 2
4132      valLength /= 2
4133      byteOffset /= 2
4134    }
4135  }
4136
4137  function read (buf, i) {
4138    if (indexSize === 1) {
4139      return buf[i]
4140    } else {
4141      return buf.readUInt16BE(i * indexSize)
4142    }
4143  }
4144
4145  var i
4146  if (dir) {
4147    var foundIndex = -1
4148    for (i = byteOffset; i < arrLength; i++) {
4149      if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
4150        if (foundIndex === -1) foundIndex = i
4151        if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
4152      } else {
4153        if (foundIndex !== -1) i -= i - foundIndex
4154        foundIndex = -1
4155      }
4156    }
4157  } else {
4158    if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
4159    for (i = byteOffset; i >= 0; i--) {
4160      var found = true
4161      for (var j = 0; j < valLength; j++) {
4162        if (read(arr, i + j) !== read(val, j)) {
4163          found = false
4164          break
4165        }
4166      }
4167      if (found) return i
4168    }
4169  }
4170
4171  return -1
4172}
4173
4174Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
4175  return this.indexOf(val, byteOffset, encoding) !== -1
4176}
4177
4178Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
4179  return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
4180}
4181
4182Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
4183  return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
4184}
4185
4186function hexWrite (buf, string, offset, length) {
4187  offset = Number(offset) || 0
4188  var remaining = buf.length - offset
4189  if (!length) {
4190    length = remaining
4191  } else {
4192    length = Number(length)
4193    if (length > remaining) {
4194      length = remaining
4195    }
4196  }
4197
4198  var strLen = string.length
4199
4200  if (length > strLen / 2) {
4201    length = strLen / 2
4202  }
4203  for (var i = 0; i < length; ++i) {
4204    var parsed = parseInt(string.substr(i * 2, 2), 16)
4205    if (numberIsNaN(parsed)) return i
4206    buf[offset + i] = parsed
4207  }
4208  return i
4209}
4210
4211function utf8Write (buf, string, offset, length) {
4212  return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
4213}
4214
4215function asciiWrite (buf, string, offset, length) {
4216  return blitBuffer(asciiToBytes(string), buf, offset, length)
4217}
4218
4219function latin1Write (buf, string, offset, length) {
4220  return asciiWrite(buf, string, offset, length)
4221}
4222
4223function base64Write (buf, string, offset, length) {
4224  return blitBuffer(base64ToBytes(string), buf, offset, length)
4225}
4226
4227function ucs2Write (buf, string, offset, length) {
4228  return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
4229}
4230
4231Buffer.prototype.write = function write (string, offset, length, encoding) {
4232  // Buffer#write(string)
4233  if (offset === undefined) {
4234    encoding = 'utf8'
4235    length = this.length
4236    offset = 0
4237  // Buffer#write(string, encoding)
4238  } else if (length === undefined && typeof offset === 'string') {
4239    encoding = offset
4240    length = this.length
4241    offset = 0
4242  // Buffer#write(string, offset[, length][, encoding])
4243  } else if (isFinite(offset)) {
4244    offset = offset >>> 0
4245    if (isFinite(length)) {
4246      length = length >>> 0
4247      if (encoding === undefined) encoding = 'utf8'
4248    } else {
4249      encoding = length
4250      length = undefined
4251    }
4252  } else {
4253    throw new Error(
4254      'Buffer.write(string, encoding, offset[, length]) is no longer supported'
4255    )
4256  }
4257
4258  var remaining = this.length - offset
4259  if (length === undefined || length > remaining) length = remaining
4260
4261  if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
4262    throw new RangeError('Attempt to write outside buffer bounds')
4263  }
4264
4265  if (!encoding) encoding = 'utf8'
4266
4267  var loweredCase = false
4268  for (;;) {
4269    switch (encoding) {
4270      case 'hex':
4271        return hexWrite(this, string, offset, length)
4272
4273      case 'utf8':
4274      case 'utf-8':
4275        return utf8Write(this, string, offset, length)
4276
4277      case 'ascii':
4278        return asciiWrite(this, string, offset, length)
4279
4280      case 'latin1':
4281      case 'binary':
4282        return latin1Write(this, string, offset, length)
4283
4284      case 'base64':
4285        // Warning: maxLength not taken into account in base64Write
4286        return base64Write(this, string, offset, length)
4287
4288      case 'ucs2':
4289      case 'ucs-2':
4290      case 'utf16le':
4291      case 'utf-16le':
4292        return ucs2Write(this, string, offset, length)
4293
4294      default:
4295        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
4296        encoding = ('' + encoding).toLowerCase()
4297        loweredCase = true
4298    }
4299  }
4300}
4301
4302Buffer.prototype.toJSON = function toJSON () {
4303  return {
4304    type: 'Buffer',
4305    data: Array.prototype.slice.call(this._arr || this, 0)
4306  }
4307}
4308
4309function base64Slice (buf, start, end) {
4310  if (start === 0 && end === buf.length) {
4311    return base64.fromByteArray(buf)
4312  } else {
4313    return base64.fromByteArray(buf.slice(start, end))
4314  }
4315}
4316
4317function utf8Slice (buf, start, end) {
4318  end = Math.min(buf.length, end)
4319  var res = []
4320
4321  var i = start
4322  while (i < end) {
4323    var firstByte = buf[i]
4324    var codePoint = null
4325    var bytesPerSequence = (firstByte > 0xEF) ? 4
4326      : (firstByte > 0xDF) ? 3
4327        : (firstByte > 0xBF) ? 2
4328          : 1
4329
4330    if (i + bytesPerSequence <= end) {
4331      var secondByte, thirdByte, fourthByte, tempCodePoint
4332
4333      switch (bytesPerSequence) {
4334        case 1:
4335          if (firstByte < 0x80) {
4336            codePoint = firstByte
4337          }
4338          break
4339        case 2:
4340          secondByte = buf[i + 1]
4341          if ((secondByte & 0xC0) === 0x80) {
4342            tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
4343            if (tempCodePoint > 0x7F) {
4344              codePoint = tempCodePoint
4345            }
4346          }
4347          break
4348        case 3:
4349          secondByte = buf[i + 1]
4350          thirdByte = buf[i + 2]
4351          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
4352            tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
4353            if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
4354              codePoint = tempCodePoint
4355            }
4356          }
4357          break
4358        case 4:
4359          secondByte = buf[i + 1]
4360          thirdByte = buf[i + 2]
4361          fourthByte = buf[i + 3]
4362          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
4363            tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
4364            if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
4365              codePoint = tempCodePoint
4366            }
4367          }
4368      }
4369    }
4370
4371    if (codePoint === null) {
4372      // we did not generate a valid codePoint so insert a
4373      // replacement char (U+FFFD) and advance only 1 byte
4374      codePoint = 0xFFFD
4375      bytesPerSequence = 1
4376    } else if (codePoint > 0xFFFF) {
4377      // encode to utf16 (surrogate pair dance)
4378      codePoint -= 0x10000
4379      res.push(codePoint >>> 10 & 0x3FF | 0xD800)
4380      codePoint = 0xDC00 | codePoint & 0x3FF
4381    }
4382
4383    res.push(codePoint)
4384    i += bytesPerSequence
4385  }
4386
4387  return decodeCodePointsArray(res)
4388}
4389
4390// Based on http://stackoverflow.com/a/22747272/680742, the browser with
4391// the lowest limit is Chrome, with 0x10000 args.
4392// We go 1 magnitude less, for safety
4393var MAX_ARGUMENTS_LENGTH = 0x1000
4394
4395function decodeCodePointsArray (codePoints) {
4396  var len = codePoints.length
4397  if (len <= MAX_ARGUMENTS_LENGTH) {
4398    return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
4399  }
4400
4401  // Decode in chunks to avoid "call stack size exceeded".
4402  var res = ''
4403  var i = 0
4404  while (i < len) {
4405    res += String.fromCharCode.apply(
4406      String,
4407      codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
4408    )
4409  }
4410  return res
4411}
4412
4413function asciiSlice (buf, start, end) {
4414  var ret = ''
4415  end = Math.min(buf.length, end)
4416
4417  for (var i = start; i < end; ++i) {
4418    ret += String.fromCharCode(buf[i] & 0x7F)
4419  }
4420  return ret
4421}
4422
4423function latin1Slice (buf, start, end) {
4424  var ret = ''
4425  end = Math.min(buf.length, end)
4426
4427  for (var i = start; i < end; ++i) {
4428    ret += String.fromCharCode(buf[i])
4429  }
4430  return ret
4431}
4432
4433function hexSlice (buf, start, end) {
4434  var len = buf.length
4435
4436  if (!start || start < 0) start = 0
4437  if (!end || end < 0 || end > len) end = len
4438
4439  var out = ''
4440  for (var i = start; i < end; ++i) {
4441    out += toHex(buf[i])
4442  }
4443  return out
4444}
4445
4446function utf16leSlice (buf, start, end) {
4447  var bytes = buf.slice(start, end)
4448  var res = ''
4449  for (var i = 0; i < bytes.length; i += 2) {
4450    res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
4451  }
4452  return res
4453}
4454
4455Buffer.prototype.slice = function slice (start, end) {
4456  var len = this.length
4457  start = ~~start
4458  end = end === undefined ? len : ~~end
4459
4460  if (start < 0) {
4461    start += len
4462    if (start < 0) start = 0
4463  } else if (start > len) {
4464    start = len
4465  }
4466
4467  if (end < 0) {
4468    end += len
4469    if (end < 0) end = 0
4470  } else if (end > len) {
4471    end = len
4472  }
4473
4474  if (end < start) end = start
4475
4476  var newBuf = this.subarray(start, end)
4477  // Return an augmented `Uint8Array` instance
4478  newBuf.__proto__ = Buffer.prototype
4479  return newBuf
4480}
4481
4482/*
4483 * Need to make sure that buffer isn't trying to write out of bounds.
4484 */
4485function checkOffset (offset, ext, length) {
4486  if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
4487  if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
4488}
4489
4490Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
4491  offset = offset >>> 0
4492  byteLength = byteLength >>> 0
4493  if (!noAssert) checkOffset(offset, byteLength, this.length)
4494
4495  var val = this[offset]
4496  var mul = 1
4497  var i = 0
4498  while (++i < byteLength && (mul *= 0x100)) {
4499    val += this[offset + i] * mul
4500  }
4501
4502  return val
4503}
4504
4505Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
4506  offset = offset >>> 0
4507  byteLength = byteLength >>> 0
4508  if (!noAssert) {
4509    checkOffset(offset, byteLength, this.length)
4510  }
4511
4512  var val = this[offset + --byteLength]
4513  var mul = 1
4514  while (byteLength > 0 && (mul *= 0x100)) {
4515    val += this[offset + --byteLength] * mul
4516  }
4517
4518  return val
4519}
4520
4521Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
4522  offset = offset >>> 0
4523  if (!noAssert) checkOffset(offset, 1, this.length)
4524  return this[offset]
4525}
4526
4527Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
4528  offset = offset >>> 0
4529  if (!noAssert) checkOffset(offset, 2, this.length)
4530  return this[offset] | (this[offset + 1] << 8)
4531}
4532
4533Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
4534  offset = offset >>> 0
4535  if (!noAssert) checkOffset(offset, 2, this.length)
4536  return (this[offset] << 8) | this[offset + 1]
4537}
4538
4539Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
4540  offset = offset >>> 0
4541  if (!noAssert) checkOffset(offset, 4, this.length)
4542
4543  return ((this[offset]) |
4544      (this[offset + 1] << 8) |
4545      (this[offset + 2] << 16)) +
4546      (this[offset + 3] * 0x1000000)
4547}
4548
4549Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
4550  offset = offset >>> 0
4551  if (!noAssert) checkOffset(offset, 4, this.length)
4552
4553  return (this[offset] * 0x1000000) +
4554    ((this[offset + 1] << 16) |
4555    (this[offset + 2] << 8) |
4556    this[offset + 3])
4557}
4558
4559Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
4560  offset = offset >>> 0
4561  byteLength = byteLength >>> 0
4562  if (!noAssert) checkOffset(offset, byteLength, this.length)
4563
4564  var val = this[offset]
4565  var mul = 1
4566  var i = 0
4567  while (++i < byteLength && (mul *= 0x100)) {
4568    val += this[offset + i] * mul
4569  }
4570  mul *= 0x80
4571
4572  if (val >= mul) val -= Math.pow(2, 8 * byteLength)
4573
4574  return val
4575}
4576
4577Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
4578  offset = offset >>> 0
4579  byteLength = byteLength >>> 0
4580  if (!noAssert) checkOffset(offset, byteLength, this.length)
4581
4582  var i = byteLength
4583  var mul = 1
4584  var val = this[offset + --i]
4585  while (i > 0 && (mul *= 0x100)) {
4586    val += this[offset + --i] * mul
4587  }
4588  mul *= 0x80
4589
4590  if (val >= mul) val -= Math.pow(2, 8 * byteLength)
4591
4592  return val
4593}
4594
4595Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
4596  offset = offset >>> 0
4597  if (!noAssert) checkOffset(offset, 1, this.length)
4598  if (!(this[offset] & 0x80)) return (this[offset])
4599  return ((0xff - this[offset] + 1) * -1)
4600}
4601
4602Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
4603  offset = offset >>> 0
4604  if (!noAssert) checkOffset(offset, 2, this.length)
4605  var val = this[offset] | (this[offset + 1] << 8)
4606  return (val & 0x8000) ? val | 0xFFFF0000 : val
4607}
4608
4609Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
4610  offset = offset >>> 0
4611  if (!noAssert) checkOffset(offset, 2, this.length)
4612  var val = this[offset + 1] | (this[offset] << 8)
4613  return (val & 0x8000) ? val | 0xFFFF0000 : val
4614}
4615
4616Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
4617  offset = offset >>> 0
4618  if (!noAssert) checkOffset(offset, 4, this.length)
4619
4620  return (this[offset]) |
4621    (this[offset + 1] << 8) |
4622    (this[offset + 2] << 16) |
4623    (this[offset + 3] << 24)
4624}
4625
4626Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
4627  offset = offset >>> 0
4628  if (!noAssert) checkOffset(offset, 4, this.length)
4629
4630  return (this[offset] << 24) |
4631    (this[offset + 1] << 16) |
4632    (this[offset + 2] << 8) |
4633    (this[offset + 3])
4634}
4635
4636Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
4637  offset = offset >>> 0
4638  if (!noAssert) checkOffset(offset, 4, this.length)
4639  return ieee754.read(this, offset, true, 23, 4)
4640}
4641
4642Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
4643  offset = offset >>> 0
4644  if (!noAssert) checkOffset(offset, 4, this.length)
4645  return ieee754.read(this, offset, false, 23, 4)
4646}
4647
4648Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
4649  offset = offset >>> 0
4650  if (!noAssert) checkOffset(offset, 8, this.length)
4651  return ieee754.read(this, offset, true, 52, 8)
4652}
4653
4654Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
4655  offset = offset >>> 0
4656  if (!noAssert) checkOffset(offset, 8, this.length)
4657  return ieee754.read(this, offset, false, 52, 8)
4658}
4659
4660function checkInt (buf, value, offset, ext, max, min) {
4661  if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
4662  if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
4663  if (offset + ext > buf.length) throw new RangeError('Index out of range')
4664}
4665
4666Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
4667  value = +value
4668  offset = offset >>> 0
4669  byteLength = byteLength >>> 0
4670  if (!noAssert) {
4671    var maxBytes = Math.pow(2, 8 * byteLength) - 1
4672    checkInt(this, value, offset, byteLength, maxBytes, 0)
4673  }
4674
4675  var mul = 1
4676  var i = 0
4677  this[offset] = value & 0xFF
4678  while (++i < byteLength && (mul *= 0x100)) {
4679    this[offset + i] = (value / mul) & 0xFF
4680  }
4681
4682  return offset + byteLength
4683}
4684
4685Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
4686  value = +value
4687  offset = offset >>> 0
4688  byteLength = byteLength >>> 0
4689  if (!noAssert) {
4690    var maxBytes = Math.pow(2, 8 * byteLength) - 1
4691    checkInt(this, value, offset, byteLength, maxBytes, 0)
4692  }
4693
4694  var i = byteLength - 1
4695  var mul = 1
4696  this[offset + i] = value & 0xFF
4697  while (--i >= 0 && (mul *= 0x100)) {
4698    this[offset + i] = (value / mul) & 0xFF
4699  }
4700
4701  return offset + byteLength
4702}
4703
4704Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
4705  value = +value
4706  offset = offset >>> 0
4707  if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
4708  this[offset] = (value & 0xff)
4709  return offset + 1
4710}
4711
4712Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
4713  value = +value
4714  offset = offset >>> 0
4715  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
4716  this[offset] = (value & 0xff)
4717  this[offset + 1] = (value >>> 8)
4718  return offset + 2
4719}
4720
4721Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
4722  value = +value
4723  offset = offset >>> 0
4724  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
4725  this[offset] = (value >>> 8)
4726  this[offset + 1] = (value & 0xff)
4727  return offset + 2
4728}
4729
4730Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
4731  value = +value
4732  offset = offset >>> 0
4733  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
4734  this[offset + 3] = (value >>> 24)
4735  this[offset + 2] = (value >>> 16)
4736  this[offset + 1] = (value >>> 8)
4737  this[offset] = (value & 0xff)
4738  return offset + 4
4739}
4740
4741Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
4742  value = +value
4743  offset = offset >>> 0
4744  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
4745  this[offset] = (value >>> 24)
4746  this[offset + 1] = (value >>> 16)
4747  this[offset + 2] = (value >>> 8)
4748  this[offset + 3] = (value & 0xff)
4749  return offset + 4
4750}
4751
4752Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
4753  value = +value
4754  offset = offset >>> 0
4755  if (!noAssert) {
4756    var limit = Math.pow(2, (8 * byteLength) - 1)
4757
4758    checkInt(this, value, offset, byteLength, limit - 1, -limit)
4759  }
4760
4761  var i = 0
4762  var mul = 1
4763  var sub = 0
4764  this[offset] = value & 0xFF
4765  while (++i < byteLength && (mul *= 0x100)) {
4766    if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
4767      sub = 1
4768    }
4769    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
4770  }
4771
4772  return offset + byteLength
4773}
4774
4775Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
4776  value = +value
4777  offset = offset >>> 0
4778  if (!noAssert) {
4779    var limit = Math.pow(2, (8 * byteLength) - 1)
4780
4781    checkInt(this, value, offset, byteLength, limit - 1, -limit)
4782  }
4783
4784  var i = byteLength - 1
4785  var mul = 1
4786  var sub = 0
4787  this[offset + i] = value & 0xFF
4788  while (--i >= 0 && (mul *= 0x100)) {
4789    if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
4790      sub = 1
4791    }
4792    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
4793  }
4794
4795  return offset + byteLength
4796}
4797
4798Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
4799  value = +value
4800  offset = offset >>> 0
4801  if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
4802  if (value < 0) value = 0xff + value + 1
4803  this[offset] = (value & 0xff)
4804  return offset + 1
4805}
4806
4807Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
4808  value = +value
4809  offset = offset >>> 0
4810  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
4811  this[offset] = (value & 0xff)
4812  this[offset + 1] = (value >>> 8)
4813  return offset + 2
4814}
4815
4816Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
4817  value = +value
4818  offset = offset >>> 0
4819  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
4820  this[offset] = (value >>> 8)
4821  this[offset + 1] = (value & 0xff)
4822  return offset + 2
4823}
4824
4825Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
4826  value = +value
4827  offset = offset >>> 0
4828  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
4829  this[offset] = (value & 0xff)
4830  this[offset + 1] = (value >>> 8)
4831  this[offset + 2] = (value >>> 16)
4832  this[offset + 3] = (value >>> 24)
4833  return offset + 4
4834}
4835
4836Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
4837  value = +value
4838  offset = offset >>> 0
4839  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
4840  if (value < 0) value = 0xffffffff + value + 1
4841  this[offset] = (value >>> 24)
4842  this[offset + 1] = (value >>> 16)
4843  this[offset + 2] = (value >>> 8)
4844  this[offset + 3] = (value & 0xff)
4845  return offset + 4
4846}
4847
4848function checkIEEE754 (buf, value, offset, ext, max, min) {
4849  if (offset + ext > buf.length) throw new RangeError('Index out of range')
4850  if (offset < 0) throw new RangeError('Index out of range')
4851}
4852
4853function writeFloat (buf, value, offset, littleEndian, noAssert) {
4854  value = +value
4855  offset = offset >>> 0
4856  if (!noAssert) {
4857    checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
4858  }
4859  ieee754.write(buf, value, offset, littleEndian, 23, 4)
4860  return offset + 4
4861}
4862
4863Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
4864  return writeFloat(this, value, offset, true, noAssert)
4865}
4866
4867Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
4868  return writeFloat(this, value, offset, false, noAssert)
4869}
4870
4871function writeDouble (buf, value, offset, littleEndian, noAssert) {
4872  value = +value
4873  offset = offset >>> 0
4874  if (!noAssert) {
4875    checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
4876  }
4877  ieee754.write(buf, value, offset, littleEndian, 52, 8)
4878  return offset + 8
4879}
4880
4881Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
4882  return writeDouble(this, value, offset, true, noAssert)
4883}
4884
4885Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
4886  return writeDouble(this, value, offset, false, noAssert)
4887}
4888
4889// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
4890Buffer.prototype.copy = function copy (target, targetStart, start, end) {
4891  if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
4892  if (!start) start = 0
4893  if (!end && end !== 0) end = this.length
4894  if (targetStart >= target.length) targetStart = target.length
4895  if (!targetStart) targetStart = 0
4896  if (end > 0 && end < start) end = start
4897
4898  // Copy 0 bytes; we're done
4899  if (end === start) return 0
4900  if (target.length === 0 || this.length === 0) return 0
4901
4902  // Fatal error conditions
4903  if (targetStart < 0) {
4904    throw new RangeError('targetStart out of bounds')
4905  }
4906  if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
4907  if (end < 0) throw new RangeError('sourceEnd out of bounds')
4908
4909  // Are we oob?
4910  if (end > this.length) end = this.length
4911  if (target.length - targetStart < end - start) {
4912    end = target.length - targetStart + start
4913  }
4914
4915  var len = end - start
4916
4917  if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
4918    // Use built-in when available, missing from IE11
4919    this.copyWithin(targetStart, start, end)
4920  } else if (this === target && start < targetStart && targetStart < end) {
4921    // descending copy from end
4922    for (var i = len - 1; i >= 0; --i) {
4923      target[i + targetStart] = this[i + start]
4924    }
4925  } else {
4926    Uint8Array.prototype.set.call(
4927      target,
4928      this.subarray(start, end),
4929      targetStart
4930    )
4931  }
4932
4933  return len
4934}
4935
4936// Usage:
4937//    buffer.fill(number[, offset[, end]])
4938//    buffer.fill(buffer[, offset[, end]])
4939//    buffer.fill(string[, offset[, end]][, encoding])
4940Buffer.prototype.fill = function fill (val, start, end, encoding) {
4941  // Handle string cases:
4942  if (typeof val === 'string') {
4943    if (typeof start === 'string') {
4944      encoding = start
4945      start = 0
4946      end = this.length
4947    } else if (typeof end === 'string') {
4948      encoding = end
4949      end = this.length
4950    }
4951    if (encoding !== undefined && typeof encoding !== 'string') {
4952      throw new TypeError('encoding must be a string')
4953    }
4954    if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
4955      throw new TypeError('Unknown encoding: ' + encoding)
4956    }
4957    if (val.length === 1) {
4958      var code = val.charCodeAt(0)
4959      if ((encoding === 'utf8' && code < 128) ||
4960          encoding === 'latin1') {
4961        // Fast path: If `val` fits into a single byte, use that numeric value.
4962        val = code
4963      }
4964    }
4965  } else if (typeof val === 'number') {
4966    val = val & 255
4967  }
4968
4969  // Invalid ranges are not set to a default, so can range check early.
4970  if (start < 0 || this.length < start || this.length < end) {
4971    throw new RangeError('Out of range index')
4972  }
4973
4974  if (end <= start) {
4975    return this
4976  }
4977
4978  start = start >>> 0
4979  end = end === undefined ? this.length : end >>> 0
4980
4981  if (!val) val = 0
4982
4983  var i
4984  if (typeof val === 'number') {
4985    for (i = start; i < end; ++i) {
4986      this[i] = val
4987    }
4988  } else {
4989    var bytes = Buffer.isBuffer(val)
4990      ? val
4991      : Buffer.from(val, encoding)
4992    var len = bytes.length
4993    if (len === 0) {
4994      throw new TypeError('The value "' + val +
4995        '" is invalid for argument "value"')
4996    }
4997    for (i = 0; i < end - start; ++i) {
4998      this[i + start] = bytes[i % len]
4999    }
5000  }
5001
5002  return this
5003}
5004
5005// HELPER FUNCTIONS
5006// ================
5007
5008var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
5009
5010function base64clean (str) {
5011  // Node takes equal signs as end of the Base64 encoding
5012  str = str.split('=')[0]
5013  // Node strips out invalid characters like \n and \t from the string, base64-js does not
5014  str = str.trim().replace(INVALID_BASE64_RE, '')
5015  // Node converts strings with length < 2 to ''
5016  if (str.length < 2) return ''
5017  // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
5018  while (str.length % 4 !== 0) {
5019    str = str + '='
5020  }
5021  return str
5022}
5023
5024function toHex (n) {
5025  if (n < 16) return '0' + n.toString(16)
5026  return n.toString(16)
5027}
5028
5029function utf8ToBytes (string, units) {
5030  units = units || Infinity
5031  var codePoint
5032  var length = string.length
5033  var leadSurrogate = null
5034  var bytes = []
5035
5036  for (var i = 0; i < length; ++i) {
5037    codePoint = string.charCodeAt(i)
5038
5039    // is surrogate component
5040    if (codePoint > 0xD7FF && codePoint < 0xE000) {
5041      // last char was a lead
5042      if (!leadSurrogate) {
5043        // no lead yet
5044        if (codePoint > 0xDBFF) {
5045          // unexpected trail
5046          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
5047          continue
5048        } else if (i + 1 === length) {
5049          // unpaired lead
5050          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
5051          continue
5052        }
5053
5054        // valid lead
5055        leadSurrogate = codePoint
5056
5057        continue
5058      }
5059
5060      // 2 leads in a row
5061      if (codePoint < 0xDC00) {
5062        if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
5063        leadSurrogate = codePoint
5064        continue
5065      }
5066
5067      // valid surrogate pair
5068      codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
5069    } else if (leadSurrogate) {
5070      // valid bmp char, but last char was a lead
5071      if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
5072    }
5073
5074    leadSurrogate = null
5075
5076    // encode utf8
5077    if (codePoint < 0x80) {
5078      if ((units -= 1) < 0) break
5079      bytes.push(codePoint)
5080    } else if (codePoint < 0x800) {
5081      if ((units -= 2) < 0) break
5082      bytes.push(
5083        codePoint >> 0x6 | 0xC0,
5084        codePoint & 0x3F | 0x80
5085      )
5086    } else if (codePoint < 0x10000) {
5087      if ((units -= 3) < 0) break
5088      bytes.push(
5089        codePoint >> 0xC | 0xE0,
5090        codePoint >> 0x6 & 0x3F | 0x80,
5091        codePoint & 0x3F | 0x80
5092      )
5093    } else if (codePoint < 0x110000) {
5094      if ((units -= 4) < 0) break
5095      bytes.push(
5096        codePoint >> 0x12 | 0xF0,
5097        codePoint >> 0xC & 0x3F | 0x80,
5098        codePoint >> 0x6 & 0x3F | 0x80,
5099        codePoint & 0x3F | 0x80
5100      )
5101    } else {
5102      throw new Error('Invalid code point')
5103    }
5104  }
5105
5106  return bytes
5107}
5108
5109function asciiToBytes (str) {
5110  var byteArray = []
5111  for (var i = 0; i < str.length; ++i) {
5112    // Node's code seems to be doing this and not & 0x7F..
5113    byteArray.push(str.charCodeAt(i) & 0xFF)
5114  }
5115  return byteArray
5116}
5117
5118function utf16leToBytes (str, units) {
5119  var c, hi, lo
5120  var byteArray = []
5121  for (var i = 0; i < str.length; ++i) {
5122    if ((units -= 2) < 0) break
5123
5124    c = str.charCodeAt(i)
5125    hi = c >> 8
5126    lo = c % 256
5127    byteArray.push(lo)
5128    byteArray.push(hi)
5129  }
5130
5131  return byteArray
5132}
5133
5134function base64ToBytes (str) {
5135  return base64.toByteArray(base64clean(str))
5136}
5137
5138function blitBuffer (src, dst, offset, length) {
5139  for (var i = 0; i < length; ++i) {
5140    if ((i + offset >= dst.length) || (i >= src.length)) break
5141    dst[i + offset] = src[i]
5142  }
5143  return i
5144}
5145
5146// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
5147// the `instanceof` check but they should be treated as of that type.
5148// See: https://github.com/feross/buffer/issues/166
5149function isInstance (obj, type) {
5150  return obj instanceof type ||
5151    (obj != null && obj.constructor != null && obj.constructor.name != null &&
5152      obj.constructor.name === type.name)
5153}
5154function numberIsNaN (obj) {
5155  // For IE11 support
5156  return obj !== obj // eslint-disable-line no-self-compare
5157}
5158
5159}).call(this,require("buffer").Buffer)
5160},{"base64-js":9,"buffer":10,"ieee754":11}],11:[function(require,module,exports){
5161exports.read = function (buffer, offset, isLE, mLen, nBytes) {
5162  var e, m
5163  var eLen = (nBytes * 8) - mLen - 1
5164  var eMax = (1 << eLen) - 1
5165  var eBias = eMax >> 1
5166  var nBits = -7
5167  var i = isLE ? (nBytes - 1) : 0
5168  var d = isLE ? -1 : 1
5169  var s = buffer[offset + i]
5170
5171  i += d
5172
5173  e = s & ((1 << (-nBits)) - 1)
5174  s >>= (-nBits)
5175  nBits += eLen
5176  for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
5177
5178  m = e & ((1 << (-nBits)) - 1)
5179  e >>= (-nBits)
5180  nBits += mLen
5181  for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
5182
5183  if (e === 0) {
5184    e = 1 - eBias
5185  } else if (e === eMax) {
5186    return m ? NaN : ((s ? -1 : 1) * Infinity)
5187  } else {
5188    m = m + Math.pow(2, mLen)
5189    e = e - eBias
5190  }
5191  return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
5192}
5193
5194exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
5195  var e, m, c
5196  var eLen = (nBytes * 8) - mLen - 1
5197  var eMax = (1 << eLen) - 1
5198  var eBias = eMax >> 1
5199  var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
5200  var i = isLE ? 0 : (nBytes - 1)
5201  var d = isLE ? 1 : -1
5202  var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
5203
5204  value = Math.abs(value)
5205
5206  if (isNaN(value) || value === Infinity) {
5207    m = isNaN(value) ? 1 : 0
5208    e = eMax
5209  } else {
5210    e = Math.floor(Math.log(value) / Math.LN2)
5211    if (value * (c = Math.pow(2, -e)) < 1) {
5212      e--
5213      c *= 2
5214    }
5215    if (e + eBias >= 1) {
5216      value += rt / c
5217    } else {
5218      value += rt * Math.pow(2, 1 - eBias)
5219    }
5220    if (value * c >= 2) {
5221      e++
5222      c /= 2
5223    }
5224
5225    if (e + eBias >= eMax) {
5226      m = 0
5227      e = eMax
5228    } else if (e + eBias >= 1) {
5229      m = ((value * c) - 1) * Math.pow(2, mLen)
5230      e = e + eBias
5231    } else {
5232      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
5233      e = 0
5234    }
5235  }
5236
5237  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
5238
5239  e = (e << mLen) | m
5240  eLen += mLen
5241  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
5242
5243  buffer[offset + i - d] |= s * 128
5244}
5245
5246},{}],12:[function(require,module,exports){
5247// shim for using process in browser
5248var process = module.exports = {};
5249
5250// cached from whatever global is present so that test runners that stub it
5251// don't break things.  But we need to wrap it in a try catch in case it is
5252// wrapped in strict mode code which doesn't define any globals.  It's inside a
5253// function because try/catches deoptimize in certain engines.
5254
5255var cachedSetTimeout;
5256var cachedClearTimeout;
5257
5258function defaultSetTimout() {
5259    throw new Error('setTimeout has not been defined');
5260}
5261function defaultClearTimeout () {
5262    throw new Error('clearTimeout has not been defined');
5263}
5264(function () {
5265    try {
5266        if (typeof setTimeout === 'function') {
5267            cachedSetTimeout = setTimeout;
5268        } else {
5269            cachedSetTimeout = defaultSetTimout;
5270        }
5271    } catch (e) {
5272        cachedSetTimeout = defaultSetTimout;
5273    }
5274    try {
5275        if (typeof clearTimeout === 'function') {
5276            cachedClearTimeout = clearTimeout;
5277        } else {
5278            cachedClearTimeout = defaultClearTimeout;
5279        }
5280    } catch (e) {
5281        cachedClearTimeout = defaultClearTimeout;
5282    }
5283} ())
5284function runTimeout(fun) {
5285    if (cachedSetTimeout === setTimeout) {
5286        //normal enviroments in sane situations
5287        return setTimeout(fun, 0);
5288    }
5289    // if setTimeout wasn't available but was latter defined
5290    if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
5291        cachedSetTimeout = setTimeout;
5292        return setTimeout(fun, 0);
5293    }
5294    try {
5295        // when when somebody has screwed with setTimeout but no I.E. maddness
5296        return cachedSetTimeout(fun, 0);
5297    } catch(e){
5298        try {
5299            // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
5300            return cachedSetTimeout.call(null, fun, 0);
5301        } catch(e){
5302            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
5303            return cachedSetTimeout.call(this, fun, 0);
5304        }
5305    }
5306
5307
5308}
5309function runClearTimeout(marker) {
5310    if (cachedClearTimeout === clearTimeout) {
5311        //normal enviroments in sane situations
5312        return clearTimeout(marker);
5313    }
5314    // if clearTimeout wasn't available but was latter defined
5315    if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
5316        cachedClearTimeout = clearTimeout;
5317        return clearTimeout(marker);
5318    }
5319    try {
5320        // when when somebody has screwed with setTimeout but no I.E. maddness
5321        return cachedClearTimeout(marker);
5322    } catch (e){
5323        try {
5324            // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
5325            return cachedClearTimeout.call(null, marker);
5326        } catch (e){
5327            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
5328            // Some versions of I.E. have different rules for clearTimeout vs setTimeout
5329            return cachedClearTimeout.call(this, marker);
5330        }
5331    }
5332
5333
5334
5335}
5336var queue = [];
5337var draining = false;
5338var currentQueue;
5339var queueIndex = -1;
5340
5341function cleanUpNextTick() {
5342    if (!draining || !currentQueue) {
5343        return;
5344    }
5345    draining = false;
5346    if (currentQueue.length) {
5347        queue = currentQueue.concat(queue);
5348    } else {
5349        queueIndex = -1;
5350    }
5351    if (queue.length) {
5352        drainQueue();
5353    }
5354}
5355
5356function drainQueue() {
5357    if (draining) {
5358        return;
5359    }
5360    var timeout = runTimeout(cleanUpNextTick);
5361    draining = true;
5362
5363    var len = queue.length;
5364    while(len) {
5365        currentQueue = queue;
5366        queue = [];
5367        while (++queueIndex < len) {
5368            if (currentQueue) {
5369                currentQueue[queueIndex].run();
5370            }
5371        }
5372        queueIndex = -1;
5373        len = queue.length;
5374    }
5375    currentQueue = null;
5376    draining = false;
5377    runClearTimeout(timeout);
5378}
5379
5380process.nextTick = function (fun) {
5381    var args = new Array(arguments.length - 1);
5382    if (arguments.length > 1) {
5383        for (var i = 1; i < arguments.length; i++) {
5384            args[i - 1] = arguments[i];
5385        }
5386    }
5387    queue.push(new Item(fun, args));
5388    if (queue.length === 1 && !draining) {
5389        runTimeout(drainQueue);
5390    }
5391};
5392
5393// v8 likes predictible objects
5394function Item(fun, array) {
5395    this.fun = fun;
5396    this.array = array;
5397}
5398Item.prototype.run = function () {
5399    this.fun.apply(null, this.array);
5400};
5401process.title = 'browser';
5402process.browser = true;
5403process.env = {};
5404process.argv = [];
5405process.version = ''; // empty string to avoid regexp issues
5406process.versions = {};
5407
5408function noop() {}
5409
5410process.on = noop;
5411process.addListener = noop;
5412process.once = noop;
5413process.off = noop;
5414process.removeListener = noop;
5415process.removeAllListeners = noop;
5416process.emit = noop;
5417process.prependListener = noop;
5418process.prependOnceListener = noop;
5419
5420process.listeners = function (name) { return [] }
5421
5422process.binding = function (name) {
5423    throw new Error('process.binding is not supported');
5424};
5425
5426process.cwd = function () { return '/' };
5427process.chdir = function (dir) {
5428    throw new Error('process.chdir is not supported');
5429};
5430process.umask = function() { return 0; };
5431
5432},{}]},{},[2]);