github.com/juliankolbe/go-ethereum@v1.9.992/internal/jsre/deps/web3.js (about)

     1  require = (function e(t, n, r) {
     2    function s(o, u) {
     3      if (!n[o]) {
     4        if (!t[o]) {
     5          var a = typeof require == "function" && require;
     6          if (!u && a) return a(o, !0);
     7          if (i) return i(o, !0);
     8          var f = new Error("Cannot find module '" + o + "'");
     9          throw ((f.code = "MODULE_NOT_FOUND"), f);
    10        }
    11        var l = (n[o] = { exports: {} });
    12        t[o][0].call(
    13          l.exports,
    14          function (e) {
    15            var n = t[o][1][e];
    16            return s(n ? n : e);
    17          },
    18          l,
    19          l.exports,
    20          e,
    21          t,
    22          n,
    23          r
    24        );
    25      }
    26      return n[o].exports;
    27    }
    28    var i = typeof require == "function" && require;
    29    for (var o = 0; o < r.length; o++) s(r[o]);
    30    return s;
    31  })(
    32    {
    33      1: [
    34        function (require, module, exports) {
    35          module.exports = [
    36            {
    37              constant: true,
    38              inputs: [
    39                {
    40                  name: "_owner",
    41                  type: "address",
    42                },
    43              ],
    44              name: "name",
    45              outputs: [
    46                {
    47                  name: "o_name",
    48                  type: "bytes32",
    49                },
    50              ],
    51              type: "function",
    52            },
    53            {
    54              constant: true,
    55              inputs: [
    56                {
    57                  name: "_name",
    58                  type: "bytes32",
    59                },
    60              ],
    61              name: "owner",
    62              outputs: [
    63                {
    64                  name: "",
    65                  type: "address",
    66                },
    67              ],
    68              type: "function",
    69            },
    70            {
    71              constant: true,
    72              inputs: [
    73                {
    74                  name: "_name",
    75                  type: "bytes32",
    76                },
    77              ],
    78              name: "content",
    79              outputs: [
    80                {
    81                  name: "",
    82                  type: "bytes32",
    83                },
    84              ],
    85              type: "function",
    86            },
    87            {
    88              constant: true,
    89              inputs: [
    90                {
    91                  name: "_name",
    92                  type: "bytes32",
    93                },
    94              ],
    95              name: "addr",
    96              outputs: [
    97                {
    98                  name: "",
    99                  type: "address",
   100                },
   101              ],
   102              type: "function",
   103            },
   104            {
   105              constant: false,
   106              inputs: [
   107                {
   108                  name: "_name",
   109                  type: "bytes32",
   110                },
   111              ],
   112              name: "reserve",
   113              outputs: [],
   114              type: "function",
   115            },
   116            {
   117              constant: true,
   118              inputs: [
   119                {
   120                  name: "_name",
   121                  type: "bytes32",
   122                },
   123              ],
   124              name: "subRegistrar",
   125              outputs: [
   126                {
   127                  name: "",
   128                  type: "address",
   129                },
   130              ],
   131              type: "function",
   132            },
   133            {
   134              constant: false,
   135              inputs: [
   136                {
   137                  name: "_name",
   138                  type: "bytes32",
   139                },
   140                {
   141                  name: "_newOwner",
   142                  type: "address",
   143                },
   144              ],
   145              name: "transfer",
   146              outputs: [],
   147              type: "function",
   148            },
   149            {
   150              constant: false,
   151              inputs: [
   152                {
   153                  name: "_name",
   154                  type: "bytes32",
   155                },
   156                {
   157                  name: "_registrar",
   158                  type: "address",
   159                },
   160              ],
   161              name: "setSubRegistrar",
   162              outputs: [],
   163              type: "function",
   164            },
   165            {
   166              constant: false,
   167              inputs: [],
   168              name: "Registrar",
   169              outputs: [],
   170              type: "function",
   171            },
   172            {
   173              constant: false,
   174              inputs: [
   175                {
   176                  name: "_name",
   177                  type: "bytes32",
   178                },
   179                {
   180                  name: "_a",
   181                  type: "address",
   182                },
   183                {
   184                  name: "_primary",
   185                  type: "bool",
   186                },
   187              ],
   188              name: "setAddress",
   189              outputs: [],
   190              type: "function",
   191            },
   192            {
   193              constant: false,
   194              inputs: [
   195                {
   196                  name: "_name",
   197                  type: "bytes32",
   198                },
   199                {
   200                  name: "_content",
   201                  type: "bytes32",
   202                },
   203              ],
   204              name: "setContent",
   205              outputs: [],
   206              type: "function",
   207            },
   208            {
   209              constant: false,
   210              inputs: [
   211                {
   212                  name: "_name",
   213                  type: "bytes32",
   214                },
   215              ],
   216              name: "disown",
   217              outputs: [],
   218              type: "function",
   219            },
   220            {
   221              anonymous: false,
   222              inputs: [
   223                {
   224                  indexed: true,
   225                  name: "_name",
   226                  type: "bytes32",
   227                },
   228                {
   229                  indexed: false,
   230                  name: "_winner",
   231                  type: "address",
   232                },
   233              ],
   234              name: "AuctionEnded",
   235              type: "event",
   236            },
   237            {
   238              anonymous: false,
   239              inputs: [
   240                {
   241                  indexed: true,
   242                  name: "_name",
   243                  type: "bytes32",
   244                },
   245                {
   246                  indexed: false,
   247                  name: "_bidder",
   248                  type: "address",
   249                },
   250                {
   251                  indexed: false,
   252                  name: "_value",
   253                  type: "uint256",
   254                },
   255              ],
   256              name: "NewBid",
   257              type: "event",
   258            },
   259            {
   260              anonymous: false,
   261              inputs: [
   262                {
   263                  indexed: true,
   264                  name: "name",
   265                  type: "bytes32",
   266                },
   267              ],
   268              name: "Changed",
   269              type: "event",
   270            },
   271            {
   272              anonymous: false,
   273              inputs: [
   274                {
   275                  indexed: true,
   276                  name: "name",
   277                  type: "bytes32",
   278                },
   279                {
   280                  indexed: true,
   281                  name: "addr",
   282                  type: "address",
   283                },
   284              ],
   285              name: "PrimaryChanged",
   286              type: "event",
   287            },
   288          ];
   289        },
   290        {},
   291      ],
   292      2: [
   293        function (require, module, exports) {
   294          module.exports = [
   295            {
   296              constant: true,
   297              inputs: [
   298                {
   299                  name: "_name",
   300                  type: "bytes32",
   301                },
   302              ],
   303              name: "owner",
   304              outputs: [
   305                {
   306                  name: "",
   307                  type: "address",
   308                },
   309              ],
   310              type: "function",
   311            },
   312            {
   313              constant: false,
   314              inputs: [
   315                {
   316                  name: "_name",
   317                  type: "bytes32",
   318                },
   319                {
   320                  name: "_refund",
   321                  type: "address",
   322                },
   323              ],
   324              name: "disown",
   325              outputs: [],
   326              type: "function",
   327            },
   328            {
   329              constant: true,
   330              inputs: [
   331                {
   332                  name: "_name",
   333                  type: "bytes32",
   334                },
   335              ],
   336              name: "addr",
   337              outputs: [
   338                {
   339                  name: "",
   340                  type: "address",
   341                },
   342              ],
   343              type: "function",
   344            },
   345            {
   346              constant: false,
   347              inputs: [
   348                {
   349                  name: "_name",
   350                  type: "bytes32",
   351                },
   352              ],
   353              name: "reserve",
   354              outputs: [],
   355              type: "function",
   356            },
   357            {
   358              constant: false,
   359              inputs: [
   360                {
   361                  name: "_name",
   362                  type: "bytes32",
   363                },
   364                {
   365                  name: "_newOwner",
   366                  type: "address",
   367                },
   368              ],
   369              name: "transfer",
   370              outputs: [],
   371              type: "function",
   372            },
   373            {
   374              constant: false,
   375              inputs: [
   376                {
   377                  name: "_name",
   378                  type: "bytes32",
   379                },
   380                {
   381                  name: "_a",
   382                  type: "address",
   383                },
   384              ],
   385              name: "setAddr",
   386              outputs: [],
   387              type: "function",
   388            },
   389            {
   390              anonymous: false,
   391              inputs: [
   392                {
   393                  indexed: true,
   394                  name: "name",
   395                  type: "bytes32",
   396                },
   397              ],
   398              name: "Changed",
   399              type: "event",
   400            },
   401          ];
   402        },
   403        {},
   404      ],
   405      3: [
   406        function (require, module, exports) {
   407          module.exports = [
   408            {
   409              constant: false,
   410              inputs: [
   411                {
   412                  name: "from",
   413                  type: "bytes32",
   414                },
   415                {
   416                  name: "to",
   417                  type: "address",
   418                },
   419                {
   420                  name: "value",
   421                  type: "uint256",
   422                },
   423              ],
   424              name: "transfer",
   425              outputs: [],
   426              type: "function",
   427            },
   428            {
   429              constant: false,
   430              inputs: [
   431                {
   432                  name: "from",
   433                  type: "bytes32",
   434                },
   435                {
   436                  name: "to",
   437                  type: "address",
   438                },
   439                {
   440                  name: "indirectId",
   441                  type: "bytes32",
   442                },
   443                {
   444                  name: "value",
   445                  type: "uint256",
   446                },
   447              ],
   448              name: "icapTransfer",
   449              outputs: [],
   450              type: "function",
   451            },
   452            {
   453              constant: false,
   454              inputs: [
   455                {
   456                  name: "to",
   457                  type: "bytes32",
   458                },
   459              ],
   460              name: "deposit",
   461              outputs: [],
   462              payable: true,
   463              type: "function",
   464            },
   465            {
   466              anonymous: false,
   467              inputs: [
   468                {
   469                  indexed: true,
   470                  name: "from",
   471                  type: "address",
   472                },
   473                {
   474                  indexed: false,
   475                  name: "value",
   476                  type: "uint256",
   477                },
   478              ],
   479              name: "AnonymousDeposit",
   480              type: "event",
   481            },
   482            {
   483              anonymous: false,
   484              inputs: [
   485                {
   486                  indexed: true,
   487                  name: "from",
   488                  type: "address",
   489                },
   490                {
   491                  indexed: true,
   492                  name: "to",
   493                  type: "bytes32",
   494                },
   495                {
   496                  indexed: false,
   497                  name: "value",
   498                  type: "uint256",
   499                },
   500              ],
   501              name: "Deposit",
   502              type: "event",
   503            },
   504            {
   505              anonymous: false,
   506              inputs: [
   507                {
   508                  indexed: true,
   509                  name: "from",
   510                  type: "bytes32",
   511                },
   512                {
   513                  indexed: true,
   514                  name: "to",
   515                  type: "address",
   516                },
   517                {
   518                  indexed: false,
   519                  name: "value",
   520                  type: "uint256",
   521                },
   522              ],
   523              name: "Transfer",
   524              type: "event",
   525            },
   526            {
   527              anonymous: false,
   528              inputs: [
   529                {
   530                  indexed: true,
   531                  name: "from",
   532                  type: "bytes32",
   533                },
   534                {
   535                  indexed: true,
   536                  name: "to",
   537                  type: "address",
   538                },
   539                {
   540                  indexed: false,
   541                  name: "indirectId",
   542                  type: "bytes32",
   543                },
   544                {
   545                  indexed: false,
   546                  name: "value",
   547                  type: "uint256",
   548                },
   549              ],
   550              name: "IcapTransfer",
   551              type: "event",
   552            },
   553          ];
   554        },
   555        {},
   556      ],
   557      4: [
   558        function (require, module, exports) {
   559          var f = require("./formatters");
   560          var SolidityType = require("./type");
   561  
   562          /**
   563           * SolidityTypeAddress is a prootype that represents address type
   564           * It matches:
   565           * address
   566           * address[]
   567           * address[4]
   568           * address[][]
   569           * address[3][]
   570           * address[][6][], ...
   571           */
   572          var SolidityTypeAddress = function () {
   573            this._inputFormatter = f.formatInputInt;
   574            this._outputFormatter = f.formatOutputAddress;
   575          };
   576  
   577          SolidityTypeAddress.prototype = new SolidityType({});
   578          SolidityTypeAddress.prototype.constructor = SolidityTypeAddress;
   579  
   580          SolidityTypeAddress.prototype.isType = function (name) {
   581            return !!name.match(/address(\[([0-9]*)\])?/);
   582          };
   583  
   584          module.exports = SolidityTypeAddress;
   585        },
   586        { "./formatters": 9, "./type": 14 },
   587      ],
   588      5: [
   589        function (require, module, exports) {
   590          var f = require("./formatters");
   591          var SolidityType = require("./type");
   592  
   593          /**
   594           * SolidityTypeBool is a prootype that represents bool type
   595           * It matches:
   596           * bool
   597           * bool[]
   598           * bool[4]
   599           * bool[][]
   600           * bool[3][]
   601           * bool[][6][], ...
   602           */
   603          var SolidityTypeBool = function () {
   604            this._inputFormatter = f.formatInputBool;
   605            this._outputFormatter = f.formatOutputBool;
   606          };
   607  
   608          SolidityTypeBool.prototype = new SolidityType({});
   609          SolidityTypeBool.prototype.constructor = SolidityTypeBool;
   610  
   611          SolidityTypeBool.prototype.isType = function (name) {
   612            return !!name.match(/^bool(\[([0-9]*)\])*$/);
   613          };
   614  
   615          module.exports = SolidityTypeBool;
   616        },
   617        { "./formatters": 9, "./type": 14 },
   618      ],
   619      6: [
   620        function (require, module, exports) {
   621          var f = require("./formatters");
   622          var SolidityType = require("./type");
   623  
   624          /**
   625           * SolidityTypeBytes is a prototype that represents the bytes type.
   626           * It matches:
   627           * bytes
   628           * bytes[]
   629           * bytes[4]
   630           * bytes[][]
   631           * bytes[3][]
   632           * bytes[][6][], ...
   633           * bytes32
   634           * bytes8[4]
   635           * bytes[3][]
   636           */
   637          var SolidityTypeBytes = function () {
   638            this._inputFormatter = f.formatInputBytes;
   639            this._outputFormatter = f.formatOutputBytes;
   640          };
   641  
   642          SolidityTypeBytes.prototype = new SolidityType({});
   643          SolidityTypeBytes.prototype.constructor = SolidityTypeBytes;
   644  
   645          SolidityTypeBytes.prototype.isType = function (name) {
   646            return !!name.match(/^bytes([0-9]{1,})(\[([0-9]*)\])*$/);
   647          };
   648  
   649          module.exports = SolidityTypeBytes;
   650        },
   651        { "./formatters": 9, "./type": 14 },
   652      ],
   653      7: [
   654        function (require, module, exports) {
   655          /*
   656      This file is part of web3.js.
   657  
   658      web3.js is free software: you can redistribute it and/or modify
   659      it under the terms of the GNU Lesser General Public License as published by
   660      the Free Software Foundation, either version 3 of the License, or
   661      (at your option) any later version.
   662  
   663      web3.js is distributed in the hope that it will be useful,
   664      but WITHOUT ANY WARRANTY; without even the implied warranty of
   665      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   666      GNU Lesser General Public License for more details.
   667  
   668      You should have received a copy of the GNU Lesser General Public License
   669      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
   670  */
   671          /**
   672           * @file coder.js
   673           * @author Marek Kotewicz <marek@ethdev.com>
   674           * @date 2015
   675           */
   676  
   677          var f = require("./formatters");
   678  
   679          var SolidityTypeAddress = require("./address");
   680          var SolidityTypeBool = require("./bool");
   681          var SolidityTypeInt = require("./int");
   682          var SolidityTypeUInt = require("./uint");
   683          var SolidityTypeDynamicBytes = require("./dynamicbytes");
   684          var SolidityTypeString = require("./string");
   685          var SolidityTypeReal = require("./real");
   686          var SolidityTypeUReal = require("./ureal");
   687          var SolidityTypeBytes = require("./bytes");
   688  
   689          var isDynamic = function (solidityType, type) {
   690            return (
   691              solidityType.isDynamicType(type) ||
   692              solidityType.isDynamicArray(type)
   693            );
   694          };
   695  
   696          /**
   697           * SolidityCoder prototype should be used to encode/decode solidity params of any type
   698           */
   699          var SolidityCoder = function (types) {
   700            this._types = types;
   701          };
   702  
   703          /**
   704           * This method should be used to transform type to SolidityType
   705           *
   706           * @method _requireType
   707           * @param {String} type
   708           * @returns {SolidityType}
   709           * @throws {Error} throws if no matching type is found
   710           */
   711          SolidityCoder.prototype._requireType = function (type) {
   712            var solidityType = this._types.filter(function (t) {
   713              return t.isType(type);
   714            })[0];
   715  
   716            if (!solidityType) {
   717              throw Error("invalid solidity type!: " + type);
   718            }
   719  
   720            return solidityType;
   721          };
   722  
   723          /**
   724           * Should be used to encode plain param
   725           *
   726           * @method encodeParam
   727           * @param {String} type
   728           * @param {Object} plain param
   729           * @return {String} encoded plain param
   730           */
   731          SolidityCoder.prototype.encodeParam = function (type, param) {
   732            return this.encodeParams([type], [param]);
   733          };
   734  
   735          /**
   736           * Should be used to encode list of params
   737           *
   738           * @method encodeParams
   739           * @param {Array} types
   740           * @param {Array} params
   741           * @return {String} encoded list of params
   742           */
   743          SolidityCoder.prototype.encodeParams = function (types, params) {
   744            var solidityTypes = this.getSolidityTypes(types);
   745  
   746            var encodeds = solidityTypes.map(function (solidityType, index) {
   747              return solidityType.encode(params[index], types[index]);
   748            });
   749  
   750            var dynamicOffset = solidityTypes.reduce(function (
   751              acc,
   752              solidityType,
   753              index
   754            ) {
   755              var staticPartLength = solidityType.staticPartLength(types[index]);
   756              var roundedStaticPartLength =
   757                Math.floor((staticPartLength + 31) / 32) * 32;
   758  
   759              return (
   760                acc +
   761                (isDynamic(solidityTypes[index], types[index])
   762                  ? 32
   763                  : roundedStaticPartLength)
   764              );
   765            },
   766            0);
   767  
   768            var result = this.encodeMultiWithOffset(
   769              types,
   770              solidityTypes,
   771              encodeds,
   772              dynamicOffset
   773            );
   774  
   775            return result;
   776          };
   777  
   778          SolidityCoder.prototype.encodeMultiWithOffset = function (
   779            types,
   780            solidityTypes,
   781            encodeds,
   782            dynamicOffset
   783          ) {
   784            var result = "";
   785            var self = this;
   786  
   787            types.forEach(function (type, i) {
   788              if (isDynamic(solidityTypes[i], types[i])) {
   789                result += f.formatInputInt(dynamicOffset).encode();
   790                var e = self.encodeWithOffset(
   791                  types[i],
   792                  solidityTypes[i],
   793                  encodeds[i],
   794                  dynamicOffset
   795                );
   796                dynamicOffset += e.length / 2;
   797              } else {
   798                // don't add length to dynamicOffset. it's already counted
   799                result += self.encodeWithOffset(
   800                  types[i],
   801                  solidityTypes[i],
   802                  encodeds[i],
   803                  dynamicOffset
   804                );
   805              }
   806  
   807              // TODO: figure out nested arrays
   808            });
   809  
   810            types.forEach(function (type, i) {
   811              if (isDynamic(solidityTypes[i], types[i])) {
   812                var e = self.encodeWithOffset(
   813                  types[i],
   814                  solidityTypes[i],
   815                  encodeds[i],
   816                  dynamicOffset
   817                );
   818                dynamicOffset += e.length / 2;
   819                result += e;
   820              }
   821            });
   822            return result;
   823          };
   824  
   825          // TODO: refactor whole encoding!
   826          SolidityCoder.prototype.encodeWithOffset = function (
   827            type,
   828            solidityType,
   829            encoded,
   830            offset
   831          ) {
   832            var self = this;
   833            if (solidityType.isDynamicArray(type)) {
   834              return (function () {
   835                // offset was already set
   836                var nestedName = solidityType.nestedName(type);
   837                var nestedStaticPartLength = solidityType.staticPartLength(
   838                  nestedName
   839                );
   840                var result = encoded[0];
   841  
   842                (function () {
   843                  var previousLength = 2; // in int
   844                  if (solidityType.isDynamicArray(nestedName)) {
   845                    for (var i = 1; i < encoded.length; i++) {
   846                      previousLength += +encoded[i - 1][0] || 0;
   847                      result += f
   848                        .formatInputInt(
   849                          offset +
   850                            i * nestedStaticPartLength +
   851                            previousLength * 32
   852                        )
   853                        .encode();
   854                    }
   855                  }
   856                })();
   857  
   858                // first element is length, skip it
   859                (function () {
   860                  for (var i = 0; i < encoded.length - 1; i++) {
   861                    var additionalOffset = result / 2;
   862                    result += self.encodeWithOffset(
   863                      nestedName,
   864                      solidityType,
   865                      encoded[i + 1],
   866                      offset + additionalOffset
   867                    );
   868                  }
   869                })();
   870  
   871                return result;
   872              })();
   873            } else if (solidityType.isStaticArray(type)) {
   874              return (function () {
   875                var nestedName = solidityType.nestedName(type);
   876                var nestedStaticPartLength = solidityType.staticPartLength(
   877                  nestedName
   878                );
   879                var result = "";
   880  
   881                if (solidityType.isDynamicArray(nestedName)) {
   882                  (function () {
   883                    var previousLength = 0; // in int
   884                    for (var i = 0; i < encoded.length; i++) {
   885                      // calculate length of previous item
   886                      previousLength += +(encoded[i - 1] || [])[0] || 0;
   887                      result += f
   888                        .formatInputInt(
   889                          offset +
   890                            i * nestedStaticPartLength +
   891                            previousLength * 32
   892                        )
   893                        .encode();
   894                    }
   895                  })();
   896                }
   897  
   898                (function () {
   899                  for (var i = 0; i < encoded.length; i++) {
   900                    var additionalOffset = result / 2;
   901                    result += self.encodeWithOffset(
   902                      nestedName,
   903                      solidityType,
   904                      encoded[i],
   905                      offset + additionalOffset
   906                    );
   907                  }
   908                })();
   909  
   910                return result;
   911              })();
   912            }
   913  
   914            return encoded;
   915          };
   916  
   917          /**
   918           * Should be used to decode bytes to plain param
   919           *
   920           * @method decodeParam
   921           * @param {String} type
   922           * @param {String} bytes
   923           * @return {Object} plain param
   924           */
   925          SolidityCoder.prototype.decodeParam = function (type, bytes) {
   926            return this.decodeParams([type], bytes)[0];
   927          };
   928  
   929          /**
   930           * Should be used to decode list of params
   931           *
   932           * @method decodeParam
   933           * @param {Array} types
   934           * @param {String} bytes
   935           * @return {Array} array of plain params
   936           */
   937          SolidityCoder.prototype.decodeParams = function (types, bytes) {
   938            var solidityTypes = this.getSolidityTypes(types);
   939            var offsets = this.getOffsets(types, solidityTypes);
   940  
   941            return solidityTypes.map(function (solidityType, index) {
   942              return solidityType.decode(
   943                bytes,
   944                offsets[index],
   945                types[index],
   946                index
   947              );
   948            });
   949          };
   950  
   951          SolidityCoder.prototype.getOffsets = function (types, solidityTypes) {
   952            var lengths = solidityTypes.map(function (solidityType, index) {
   953              return solidityType.staticPartLength(types[index]);
   954            });
   955  
   956            for (var i = 1; i < lengths.length; i++) {
   957              // sum with length of previous element
   958              lengths[i] += lengths[i - 1];
   959            }
   960  
   961            return lengths.map(function (length, index) {
   962              // remove the current length, so the length is sum of previous elements
   963              var staticPartLength = solidityTypes[index].staticPartLength(
   964                types[index]
   965              );
   966              return length - staticPartLength;
   967            });
   968          };
   969  
   970          SolidityCoder.prototype.getSolidityTypes = function (types) {
   971            var self = this;
   972            return types.map(function (type) {
   973              return self._requireType(type);
   974            });
   975          };
   976  
   977          var coder = new SolidityCoder([
   978            new SolidityTypeAddress(),
   979            new SolidityTypeBool(),
   980            new SolidityTypeInt(),
   981            new SolidityTypeUInt(),
   982            new SolidityTypeDynamicBytes(),
   983            new SolidityTypeBytes(),
   984            new SolidityTypeString(),
   985            new SolidityTypeReal(),
   986            new SolidityTypeUReal(),
   987          ]);
   988  
   989          module.exports = coder;
   990        },
   991        {
   992          "./address": 4,
   993          "./bool": 5,
   994          "./bytes": 6,
   995          "./dynamicbytes": 8,
   996          "./formatters": 9,
   997          "./int": 10,
   998          "./real": 12,
   999          "./string": 13,
  1000          "./uint": 15,
  1001          "./ureal": 16,
  1002        },
  1003      ],
  1004      8: [
  1005        function (require, module, exports) {
  1006          var f = require("./formatters");
  1007          var SolidityType = require("./type");
  1008  
  1009          var SolidityTypeDynamicBytes = function () {
  1010            this._inputFormatter = f.formatInputDynamicBytes;
  1011            this._outputFormatter = f.formatOutputDynamicBytes;
  1012          };
  1013  
  1014          SolidityTypeDynamicBytes.prototype = new SolidityType({});
  1015          SolidityTypeDynamicBytes.prototype.constructor = SolidityTypeDynamicBytes;
  1016  
  1017          SolidityTypeDynamicBytes.prototype.isType = function (name) {
  1018            return !!name.match(/^bytes(\[([0-9]*)\])*$/);
  1019          };
  1020  
  1021          SolidityTypeDynamicBytes.prototype.isDynamicType = function () {
  1022            return true;
  1023          };
  1024  
  1025          module.exports = SolidityTypeDynamicBytes;
  1026        },
  1027        { "./formatters": 9, "./type": 14 },
  1028      ],
  1029      9: [
  1030        function (require, module, exports) {
  1031          /*
  1032      This file is part of web3.js.
  1033  
  1034      web3.js is free software: you can redistribute it and/or modify
  1035      it under the terms of the GNU Lesser General Public License as published by
  1036      the Free Software Foundation, either version 3 of the License, or
  1037      (at your option) any later version.
  1038  
  1039      web3.js is distributed in the hope that it will be useful,
  1040      but WITHOUT ANY WARRANTY; without even the implied warranty of
  1041      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1042      GNU Lesser General Public License for more details.
  1043  
  1044      You should have received a copy of the GNU Lesser General Public License
  1045      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  1046  */
  1047          /**
  1048           * @file formatters.js
  1049           * @author Marek Kotewicz <marek@ethdev.com>
  1050           * @date 2015
  1051           */
  1052  
  1053          var BigNumber = require("bignumber.js");
  1054          var utils = require("../utils/utils");
  1055          var c = require("../utils/config");
  1056          var SolidityParam = require("./param");
  1057  
  1058          /**
  1059           * Formats input value to byte representation of int
  1060           * If value is negative, return it's two's complement
  1061           * If the value is floating point, round it down
  1062           *
  1063           * @method formatInputInt
  1064           * @param {String|Number|BigNumber} value that needs to be formatted
  1065           * @returns {SolidityParam}
  1066           */
  1067          var formatInputInt = function (value) {
  1068            BigNumber.config(c.ETH_BIGNUMBER_ROUNDING_MODE);
  1069            var result = utils.padLeft(
  1070              utils.toTwosComplement(value).toString(16),
  1071              64
  1072            );
  1073            return new SolidityParam(result);
  1074          };
  1075  
  1076          /**
  1077           * Formats input bytes
  1078           *
  1079           * @method formatInputBytes
  1080           * @param {String}
  1081           * @returns {SolidityParam}
  1082           */
  1083          var formatInputBytes = function (value) {
  1084            var result = utils.toHex(value).substr(2);
  1085            var l = Math.floor((result.length + 63) / 64);
  1086            result = utils.padRight(result, l * 64);
  1087            return new SolidityParam(result);
  1088          };
  1089  
  1090          /**
  1091           * Formats input bytes
  1092           *
  1093           * @method formatDynamicInputBytes
  1094           * @param {String}
  1095           * @returns {SolidityParam}
  1096           */
  1097          var formatInputDynamicBytes = function (value) {
  1098            var result = utils.toHex(value).substr(2);
  1099            var length = result.length / 2;
  1100            var l = Math.floor((result.length + 63) / 64);
  1101            result = utils.padRight(result, l * 64);
  1102            return new SolidityParam(formatInputInt(length).value + result);
  1103          };
  1104  
  1105          /**
  1106           * Formats input value to byte representation of string
  1107           *
  1108           * @method formatInputString
  1109           * @param {String}
  1110           * @returns {SolidityParam}
  1111           */
  1112          var formatInputString = function (value) {
  1113            var result = utils.fromUtf8(value).substr(2);
  1114            var length = result.length / 2;
  1115            var l = Math.floor((result.length + 63) / 64);
  1116            result = utils.padRight(result, l * 64);
  1117            return new SolidityParam(formatInputInt(length).value + result);
  1118          };
  1119  
  1120          /**
  1121           * Formats input value to byte representation of bool
  1122           *
  1123           * @method formatInputBool
  1124           * @param {Boolean}
  1125           * @returns {SolidityParam}
  1126           */
  1127          var formatInputBool = function (value) {
  1128            var result =
  1129              "000000000000000000000000000000000000000000000000000000000000000" +
  1130              (value ? "1" : "0");
  1131            return new SolidityParam(result);
  1132          };
  1133  
  1134          /**
  1135           * Formats input value to byte representation of real
  1136           * Values are multiplied by 2^m and encoded as integers
  1137           *
  1138           * @method formatInputReal
  1139           * @param {String|Number|BigNumber}
  1140           * @returns {SolidityParam}
  1141           */
  1142          var formatInputReal = function (value) {
  1143            return formatInputInt(
  1144              new BigNumber(value).times(new BigNumber(2).pow(128))
  1145            );
  1146          };
  1147  
  1148          /**
  1149           * Check if input value is negative
  1150           *
  1151           * @method signedIsNegative
  1152           * @param {String} value is hex format
  1153           * @returns {Boolean} true if it is negative, otherwise false
  1154           */
  1155          var signedIsNegative = function (value) {
  1156            return (
  1157              new BigNumber(value.substr(0, 1), 16).toString(2).substr(0, 1) ===
  1158              "1"
  1159            );
  1160          };
  1161  
  1162          /**
  1163           * Formats right-aligned output bytes to int
  1164           *
  1165           * @method formatOutputInt
  1166           * @param {SolidityParam} param
  1167           * @returns {BigNumber} right-aligned output bytes formatted to big number
  1168           */
  1169          var formatOutputInt = function (param) {
  1170            var value = param.staticPart() || "0";
  1171  
  1172            // check if it's negative number
  1173            // it is, return two's complement
  1174            if (signedIsNegative(value)) {
  1175              return new BigNumber(value, 16)
  1176                .minus(
  1177                  new BigNumber(
  1178                    "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
  1179                    16
  1180                  )
  1181                )
  1182                .minus(1);
  1183            }
  1184            return new BigNumber(value, 16);
  1185          };
  1186  
  1187          /**
  1188           * Formats right-aligned output bytes to uint
  1189           *
  1190           * @method formatOutputUInt
  1191           * @param {SolidityParam}
  1192           * @returns {BigNumeber} right-aligned output bytes formatted to uint
  1193           */
  1194          var formatOutputUInt = function (param) {
  1195            var value = param.staticPart() || "0";
  1196            return new BigNumber(value, 16);
  1197          };
  1198  
  1199          /**
  1200           * Formats right-aligned output bytes to real
  1201           *
  1202           * @method formatOutputReal
  1203           * @param {SolidityParam}
  1204           * @returns {BigNumber} input bytes formatted to real
  1205           */
  1206          var formatOutputReal = function (param) {
  1207            return formatOutputInt(param).dividedBy(new BigNumber(2).pow(128));
  1208          };
  1209  
  1210          /**
  1211           * Formats right-aligned output bytes to ureal
  1212           *
  1213           * @method formatOutputUReal
  1214           * @param {SolidityParam}
  1215           * @returns {BigNumber} input bytes formatted to ureal
  1216           */
  1217          var formatOutputUReal = function (param) {
  1218            return formatOutputUInt(param).dividedBy(new BigNumber(2).pow(128));
  1219          };
  1220  
  1221          /**
  1222           * Should be used to format output bool
  1223           *
  1224           * @method formatOutputBool
  1225           * @param {SolidityParam}
  1226           * @returns {Boolean} right-aligned input bytes formatted to bool
  1227           */
  1228          var formatOutputBool = function (param) {
  1229            return param.staticPart() ===
  1230              "0000000000000000000000000000000000000000000000000000000000000001"
  1231              ? true
  1232              : false;
  1233          };
  1234  
  1235          /**
  1236           * Should be used to format output bytes
  1237           *
  1238           * @method formatOutputBytes
  1239           * @param {SolidityParam} left-aligned hex representation of string
  1240           * @param {String} name type name
  1241           * @returns {String} hex string
  1242           */
  1243          var formatOutputBytes = function (param, name) {
  1244            var matches = name.match(/^bytes([0-9]*)/);
  1245            var size = parseInt(matches[1]);
  1246            return "0x" + param.staticPart().slice(0, 2 * size);
  1247          };
  1248  
  1249          /**
  1250           * Should be used to format output bytes
  1251           *
  1252           * @method formatOutputDynamicBytes
  1253           * @param {SolidityParam} left-aligned hex representation of string
  1254           * @returns {String} hex string
  1255           */
  1256          var formatOutputDynamicBytes = function (param) {
  1257            var length =
  1258              new BigNumber(param.dynamicPart().slice(0, 64), 16).toNumber() * 2;
  1259            return "0x" + param.dynamicPart().substr(64, length);
  1260          };
  1261  
  1262          /**
  1263           * Should be used to format output string
  1264           *
  1265           * @method formatOutputString
  1266           * @param {SolidityParam} left-aligned hex representation of string
  1267           * @returns {String} ascii string
  1268           */
  1269          var formatOutputString = function (param) {
  1270            var length =
  1271              new BigNumber(param.dynamicPart().slice(0, 64), 16).toNumber() * 2;
  1272            return utils.toUtf8(param.dynamicPart().substr(64, length));
  1273          };
  1274  
  1275          /**
  1276           * Should be used to format output address
  1277           *
  1278           * @method formatOutputAddress
  1279           * @param {SolidityParam} right-aligned input bytes
  1280           * @returns {String} address
  1281           */
  1282          var formatOutputAddress = function (param) {
  1283            var value = param.staticPart();
  1284            return "0x" + value.slice(value.length - 40, value.length);
  1285          };
  1286  
  1287          module.exports = {
  1288            formatInputInt: formatInputInt,
  1289            formatInputBytes: formatInputBytes,
  1290            formatInputDynamicBytes: formatInputDynamicBytes,
  1291            formatInputString: formatInputString,
  1292            formatInputBool: formatInputBool,
  1293            formatInputReal: formatInputReal,
  1294            formatOutputInt: formatOutputInt,
  1295            formatOutputUInt: formatOutputUInt,
  1296            formatOutputReal: formatOutputReal,
  1297            formatOutputUReal: formatOutputUReal,
  1298            formatOutputBool: formatOutputBool,
  1299            formatOutputBytes: formatOutputBytes,
  1300            formatOutputDynamicBytes: formatOutputDynamicBytes,
  1301            formatOutputString: formatOutputString,
  1302            formatOutputAddress: formatOutputAddress,
  1303          };
  1304        },
  1305        {
  1306          "../utils/config": 18,
  1307          "../utils/utils": 20,
  1308          "./param": 11,
  1309          "bignumber.js": "bignumber.js",
  1310        },
  1311      ],
  1312      10: [
  1313        function (require, module, exports) {
  1314          var f = require("./formatters");
  1315          var SolidityType = require("./type");
  1316  
  1317          /**
  1318           * SolidityTypeInt is a prootype that represents int type
  1319           * It matches:
  1320           * int
  1321           * int[]
  1322           * int[4]
  1323           * int[][]
  1324           * int[3][]
  1325           * int[][6][], ...
  1326           * int32
  1327           * int64[]
  1328           * int8[4]
  1329           * int256[][]
  1330           * int[3][]
  1331           * int64[][6][], ...
  1332           */
  1333          var SolidityTypeInt = function () {
  1334            this._inputFormatter = f.formatInputInt;
  1335            this._outputFormatter = f.formatOutputInt;
  1336          };
  1337  
  1338          SolidityTypeInt.prototype = new SolidityType({});
  1339          SolidityTypeInt.prototype.constructor = SolidityTypeInt;
  1340  
  1341          SolidityTypeInt.prototype.isType = function (name) {
  1342            return !!name.match(/^int([0-9]*)?(\[([0-9]*)\])*$/);
  1343          };
  1344  
  1345          module.exports = SolidityTypeInt;
  1346        },
  1347        { "./formatters": 9, "./type": 14 },
  1348      ],
  1349      11: [
  1350        function (require, module, exports) {
  1351          /*
  1352      This file is part of web3.js.
  1353  
  1354      web3.js is free software: you can redistribute it and/or modify
  1355      it under the terms of the GNU Lesser General Public License as published by
  1356      the Free Software Foundation, either version 3 of the License, or
  1357      (at your option) any later version.
  1358  
  1359      web3.js is distributed in the hope that it will be useful,
  1360      but WITHOUT ANY WARRANTY; without even the implied warranty of
  1361      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1362      GNU Lesser General Public License for more details.
  1363  
  1364      You should have received a copy of the GNU Lesser General Public License
  1365      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  1366  */
  1367          /**
  1368           * @file param.js
  1369           * @author Marek Kotewicz <marek@ethdev.com>
  1370           * @date 2015
  1371           */
  1372  
  1373          var utils = require("../utils/utils");
  1374  
  1375          /**
  1376           * SolidityParam object prototype.
  1377           * Should be used when encoding, decoding solidity bytes
  1378           */
  1379          var SolidityParam = function (value, offset) {
  1380            this.value = value || "";
  1381            this.offset = offset; // offset in bytes
  1382          };
  1383  
  1384          /**
  1385           * This method should be used to get length of params's dynamic part
  1386           *
  1387           * @method dynamicPartLength
  1388           * @returns {Number} length of dynamic part (in bytes)
  1389           */
  1390          SolidityParam.prototype.dynamicPartLength = function () {
  1391            return this.dynamicPart().length / 2;
  1392          };
  1393  
  1394          /**
  1395           * This method should be used to create copy of solidity param with different offset
  1396           *
  1397           * @method withOffset
  1398           * @param {Number} offset length in bytes
  1399           * @returns {SolidityParam} new solidity param with applied offset
  1400           */
  1401          SolidityParam.prototype.withOffset = function (offset) {
  1402            return new SolidityParam(this.value, offset);
  1403          };
  1404  
  1405          /**
  1406           * This method should be used to combine solidity params together
  1407           * eg. when appending an array
  1408           *
  1409           * @method combine
  1410           * @param {SolidityParam} param with which we should combine
  1411           * @param {SolidityParam} result of combination
  1412           */
  1413          SolidityParam.prototype.combine = function (param) {
  1414            return new SolidityParam(this.value + param.value);
  1415          };
  1416  
  1417          /**
  1418           * This method should be called to check if param has dynamic size.
  1419           * If it has, it returns true, otherwise false
  1420           *
  1421           * @method isDynamic
  1422           * @returns {Boolean}
  1423           */
  1424          SolidityParam.prototype.isDynamic = function () {
  1425            return this.offset !== undefined;
  1426          };
  1427  
  1428          /**
  1429           * This method should be called to transform offset to bytes
  1430           *
  1431           * @method offsetAsBytes
  1432           * @returns {String} bytes representation of offset
  1433           */
  1434          SolidityParam.prototype.offsetAsBytes = function () {
  1435            return !this.isDynamic()
  1436              ? ""
  1437              : utils.padLeft(
  1438                  utils.toTwosComplement(this.offset).toString(16),
  1439                  64
  1440                );
  1441          };
  1442  
  1443          /**
  1444           * This method should be called to get static part of param
  1445           *
  1446           * @method staticPart
  1447           * @returns {String} offset if it is a dynamic param, otherwise value
  1448           */
  1449          SolidityParam.prototype.staticPart = function () {
  1450            if (!this.isDynamic()) {
  1451              return this.value;
  1452            }
  1453            return this.offsetAsBytes();
  1454          };
  1455  
  1456          /**
  1457           * This method should be called to get dynamic part of param
  1458           *
  1459           * @method dynamicPart
  1460           * @returns {String} returns a value if it is a dynamic param, otherwise empty string
  1461           */
  1462          SolidityParam.prototype.dynamicPart = function () {
  1463            return this.isDynamic() ? this.value : "";
  1464          };
  1465  
  1466          /**
  1467           * This method should be called to encode param
  1468           *
  1469           * @method encode
  1470           * @returns {String}
  1471           */
  1472          SolidityParam.prototype.encode = function () {
  1473            return this.staticPart() + this.dynamicPart();
  1474          };
  1475  
  1476          /**
  1477           * This method should be called to encode array of params
  1478           *
  1479           * @method encodeList
  1480           * @param {Array[SolidityParam]} params
  1481           * @returns {String}
  1482           */
  1483          SolidityParam.encodeList = function (params) {
  1484            // updating offsets
  1485            var totalOffset = params.length * 32;
  1486            var offsetParams = params.map(function (param) {
  1487              if (!param.isDynamic()) {
  1488                return param;
  1489              }
  1490              var offset = totalOffset;
  1491              totalOffset += param.dynamicPartLength();
  1492              return param.withOffset(offset);
  1493            });
  1494  
  1495            // encode everything!
  1496            return offsetParams.reduce(
  1497              function (result, param) {
  1498                return result + param.dynamicPart();
  1499              },
  1500              offsetParams.reduce(function (result, param) {
  1501                return result + param.staticPart();
  1502              }, "")
  1503            );
  1504          };
  1505  
  1506          module.exports = SolidityParam;
  1507        },
  1508        { "../utils/utils": 20 },
  1509      ],
  1510      12: [
  1511        function (require, module, exports) {
  1512          var f = require("./formatters");
  1513          var SolidityType = require("./type");
  1514  
  1515          /**
  1516           * SolidityTypeReal is a prootype that represents real type
  1517           * It matches:
  1518           * real
  1519           * real[]
  1520           * real[4]
  1521           * real[][]
  1522           * real[3][]
  1523           * real[][6][], ...
  1524           * real32
  1525           * real64[]
  1526           * real8[4]
  1527           * real256[][]
  1528           * real[3][]
  1529           * real64[][6][], ...
  1530           */
  1531          var SolidityTypeReal = function () {
  1532            this._inputFormatter = f.formatInputReal;
  1533            this._outputFormatter = f.formatOutputReal;
  1534          };
  1535  
  1536          SolidityTypeReal.prototype = new SolidityType({});
  1537          SolidityTypeReal.prototype.constructor = SolidityTypeReal;
  1538  
  1539          SolidityTypeReal.prototype.isType = function (name) {
  1540            return !!name.match(/real([0-9]*)?(\[([0-9]*)\])?/);
  1541          };
  1542  
  1543          module.exports = SolidityTypeReal;
  1544        },
  1545        { "./formatters": 9, "./type": 14 },
  1546      ],
  1547      13: [
  1548        function (require, module, exports) {
  1549          var f = require("./formatters");
  1550          var SolidityType = require("./type");
  1551  
  1552          var SolidityTypeString = function () {
  1553            this._inputFormatter = f.formatInputString;
  1554            this._outputFormatter = f.formatOutputString;
  1555          };
  1556  
  1557          SolidityTypeString.prototype = new SolidityType({});
  1558          SolidityTypeString.prototype.constructor = SolidityTypeString;
  1559  
  1560          SolidityTypeString.prototype.isType = function (name) {
  1561            return !!name.match(/^string(\[([0-9]*)\])*$/);
  1562          };
  1563  
  1564          SolidityTypeString.prototype.isDynamicType = function () {
  1565            return true;
  1566          };
  1567  
  1568          module.exports = SolidityTypeString;
  1569        },
  1570        { "./formatters": 9, "./type": 14 },
  1571      ],
  1572      14: [
  1573        function (require, module, exports) {
  1574          var f = require("./formatters");
  1575          var SolidityParam = require("./param");
  1576  
  1577          /**
  1578           * SolidityType prototype is used to encode/decode solidity params of certain type
  1579           */
  1580          var SolidityType = function (config) {
  1581            this._inputFormatter = config.inputFormatter;
  1582            this._outputFormatter = config.outputFormatter;
  1583          };
  1584  
  1585          /**
  1586           * Should be used to determine if this SolidityType do match given name
  1587           *
  1588           * @method isType
  1589           * @param {String} name
  1590           * @return {Bool} true if type match this SolidityType, otherwise false
  1591           */
  1592          SolidityType.prototype.isType = function (name) {
  1593            throw "this method should be overrwritten for type " + name;
  1594          };
  1595  
  1596          /**
  1597           * Should be used to determine what is the length of static part in given type
  1598           *
  1599           * @method staticPartLength
  1600           * @param {String} name
  1601           * @return {Number} length of static part in bytes
  1602           */
  1603          SolidityType.prototype.staticPartLength = function (name) {
  1604            // If name isn't an array then treat it like a single element array.
  1605            return (this.nestedTypes(name) || ["[1]"])
  1606              .map(function (type) {
  1607                // the length of the nested array
  1608                return parseInt(type.slice(1, -1), 10) || 1;
  1609              })
  1610              .reduce(function (previous, current) {
  1611                return previous * current;
  1612                // all basic types are 32 bytes long
  1613              }, 32);
  1614          };
  1615  
  1616          /**
  1617           * Should be used to determine if type is dynamic array
  1618           * eg:
  1619           * "type[]" => true
  1620           * "type[4]" => false
  1621           *
  1622           * @method isDynamicArray
  1623           * @param {String} name
  1624           * @return {Bool} true if the type is dynamic array
  1625           */
  1626          SolidityType.prototype.isDynamicArray = function (name) {
  1627            var nestedTypes = this.nestedTypes(name);
  1628            return (
  1629              !!nestedTypes &&
  1630              !nestedTypes[nestedTypes.length - 1].match(/[0-9]{1,}/g)
  1631            );
  1632          };
  1633  
  1634          /**
  1635           * Should be used to determine if type is static array
  1636           * eg:
  1637           * "type[]" => false
  1638           * "type[4]" => true
  1639           *
  1640           * @method isStaticArray
  1641           * @param {String} name
  1642           * @return {Bool} true if the type is static array
  1643           */
  1644          SolidityType.prototype.isStaticArray = function (name) {
  1645            var nestedTypes = this.nestedTypes(name);
  1646            return (
  1647              !!nestedTypes &&
  1648              !!nestedTypes[nestedTypes.length - 1].match(/[0-9]{1,}/g)
  1649            );
  1650          };
  1651  
  1652          /**
  1653           * Should return length of static array
  1654           * eg.
  1655           * "int[32]" => 32
  1656           * "int256[14]" => 14
  1657           * "int[2][3]" => 3
  1658           * "int" => 1
  1659           * "int[1]" => 1
  1660           * "int[]" => 1
  1661           *
  1662           * @method staticArrayLength
  1663           * @param {String} name
  1664           * @return {Number} static array length
  1665           */
  1666          SolidityType.prototype.staticArrayLength = function (name) {
  1667            var nestedTypes = this.nestedTypes(name);
  1668            if (nestedTypes) {
  1669              return parseInt(
  1670                nestedTypes[nestedTypes.length - 1].match(/[0-9]{1,}/g) || 1
  1671              );
  1672            }
  1673            return 1;
  1674          };
  1675  
  1676          /**
  1677           * Should return nested type
  1678           * eg.
  1679           * "int[32]" => "int"
  1680           * "int256[14]" => "int256"
  1681           * "int[2][3]" => "int[2]"
  1682           * "int" => "int"
  1683           * "int[]" => "int"
  1684           *
  1685           * @method nestedName
  1686           * @param {String} name
  1687           * @return {String} nested name
  1688           */
  1689          SolidityType.prototype.nestedName = function (name) {
  1690            // remove last [] in name
  1691            var nestedTypes = this.nestedTypes(name);
  1692            if (!nestedTypes) {
  1693              return name;
  1694            }
  1695  
  1696            return name.substr(
  1697              0,
  1698              name.length - nestedTypes[nestedTypes.length - 1].length
  1699            );
  1700          };
  1701  
  1702          /**
  1703           * Should return true if type has dynamic size by default
  1704           * such types are "string", "bytes"
  1705           *
  1706           * @method isDynamicType
  1707           * @param {String} name
  1708           * @return {Bool} true if is dynamic, otherwise false
  1709           */
  1710          SolidityType.prototype.isDynamicType = function () {
  1711            return false;
  1712          };
  1713  
  1714          /**
  1715           * Should return array of nested types
  1716           * eg.
  1717           * "int[2][3][]" => ["[2]", "[3]", "[]"]
  1718           * "int[] => ["[]"]
  1719           * "int" => null
  1720           *
  1721           * @method nestedTypes
  1722           * @param {String} name
  1723           * @return {Array} array of nested types
  1724           */
  1725          SolidityType.prototype.nestedTypes = function (name) {
  1726            // return list of strings eg. "[]", "[3]", "[]", "[2]"
  1727            return name.match(/(\[[0-9]*\])/g);
  1728          };
  1729  
  1730          /**
  1731           * Should be used to encode the value
  1732           *
  1733           * @method encode
  1734           * @param {Object} value
  1735           * @param {String} name
  1736           * @return {String} encoded value
  1737           */
  1738          SolidityType.prototype.encode = function (value, name) {
  1739            var self = this;
  1740            if (this.isDynamicArray(name)) {
  1741              return (function () {
  1742                var length = value.length; // in int
  1743                var nestedName = self.nestedName(name);
  1744  
  1745                var result = [];
  1746                result.push(f.formatInputInt(length).encode());
  1747  
  1748                value.forEach(function (v) {
  1749                  result.push(self.encode(v, nestedName));
  1750                });
  1751  
  1752                return result;
  1753              })();
  1754            } else if (this.isStaticArray(name)) {
  1755              return (function () {
  1756                var length = self.staticArrayLength(name); // in int
  1757                var nestedName = self.nestedName(name);
  1758  
  1759                var result = [];
  1760                for (var i = 0; i < length; i++) {
  1761                  result.push(self.encode(value[i], nestedName));
  1762                }
  1763  
  1764                return result;
  1765              })();
  1766            }
  1767  
  1768            return this._inputFormatter(value, name).encode();
  1769          };
  1770  
  1771          /**
  1772           * Should be used to decode value from bytes
  1773           *
  1774           * @method decode
  1775           * @param {String} bytes
  1776           * @param {Number} offset in bytes
  1777           * @param {String} name type name
  1778           * @returns {Object} decoded value
  1779           */
  1780          SolidityType.prototype.decode = function (bytes, offset, name) {
  1781            var self = this;
  1782  
  1783            if (this.isDynamicArray(name)) {
  1784              return (function () {
  1785                var arrayOffset = parseInt("0x" + bytes.substr(offset * 2, 64)); // in bytes
  1786                var length = parseInt("0x" + bytes.substr(arrayOffset * 2, 64)); // in int
  1787                var arrayStart = arrayOffset + 32; // array starts after length; // in bytes
  1788  
  1789                var nestedName = self.nestedName(name);
  1790                var nestedStaticPartLength = self.staticPartLength(nestedName); // in bytes
  1791                var roundedNestedStaticPartLength =
  1792                  Math.floor((nestedStaticPartLength + 31) / 32) * 32;
  1793                var result = [];
  1794  
  1795                for (
  1796                  var i = 0;
  1797                  i < length * roundedNestedStaticPartLength;
  1798                  i += roundedNestedStaticPartLength
  1799                ) {
  1800                  result.push(self.decode(bytes, arrayStart + i, nestedName));
  1801                }
  1802  
  1803                return result;
  1804              })();
  1805            } else if (this.isStaticArray(name)) {
  1806              return (function () {
  1807                var length = self.staticArrayLength(name); // in int
  1808                var arrayStart = offset; // in bytes
  1809  
  1810                var nestedName = self.nestedName(name);
  1811                var nestedStaticPartLength = self.staticPartLength(nestedName); // in bytes
  1812                var roundedNestedStaticPartLength =
  1813                  Math.floor((nestedStaticPartLength + 31) / 32) * 32;
  1814                var result = [];
  1815  
  1816                for (
  1817                  var i = 0;
  1818                  i < length * roundedNestedStaticPartLength;
  1819                  i += roundedNestedStaticPartLength
  1820                ) {
  1821                  result.push(self.decode(bytes, arrayStart + i, nestedName));
  1822                }
  1823  
  1824                return result;
  1825              })();
  1826            } else if (this.isDynamicType(name)) {
  1827              return (function () {
  1828                var dynamicOffset = parseInt("0x" + bytes.substr(offset * 2, 64)); // in bytes
  1829                var length = parseInt("0x" + bytes.substr(dynamicOffset * 2, 64)); // in bytes
  1830                var roundedLength = Math.floor((length + 31) / 32); // in int
  1831                var param = new SolidityParam(
  1832                  bytes.substr(dynamicOffset * 2, (1 + roundedLength) * 64),
  1833                  0
  1834                );
  1835                return self._outputFormatter(param, name);
  1836              })();
  1837            }
  1838  
  1839            var length = this.staticPartLength(name);
  1840            var param = new SolidityParam(bytes.substr(offset * 2, length * 2));
  1841            return this._outputFormatter(param, name);
  1842          };
  1843  
  1844          module.exports = SolidityType;
  1845        },
  1846        { "./formatters": 9, "./param": 11 },
  1847      ],
  1848      15: [
  1849        function (require, module, exports) {
  1850          var f = require("./formatters");
  1851          var SolidityType = require("./type");
  1852  
  1853          /**
  1854           * SolidityTypeUInt is a prootype that represents uint type
  1855           * It matches:
  1856           * uint
  1857           * uint[]
  1858           * uint[4]
  1859           * uint[][]
  1860           * uint[3][]
  1861           * uint[][6][], ...
  1862           * uint32
  1863           * uint64[]
  1864           * uint8[4]
  1865           * uint256[][]
  1866           * uint[3][]
  1867           * uint64[][6][], ...
  1868           */
  1869          var SolidityTypeUInt = function () {
  1870            this._inputFormatter = f.formatInputInt;
  1871            this._outputFormatter = f.formatOutputUInt;
  1872          };
  1873  
  1874          SolidityTypeUInt.prototype = new SolidityType({});
  1875          SolidityTypeUInt.prototype.constructor = SolidityTypeUInt;
  1876  
  1877          SolidityTypeUInt.prototype.isType = function (name) {
  1878            return !!name.match(/^uint([0-9]*)?(\[([0-9]*)\])*$/);
  1879          };
  1880  
  1881          module.exports = SolidityTypeUInt;
  1882        },
  1883        { "./formatters": 9, "./type": 14 },
  1884      ],
  1885      16: [
  1886        function (require, module, exports) {
  1887          var f = require("./formatters");
  1888          var SolidityType = require("./type");
  1889  
  1890          /**
  1891           * SolidityTypeUReal is a prootype that represents ureal type
  1892           * It matches:
  1893           * ureal
  1894           * ureal[]
  1895           * ureal[4]
  1896           * ureal[][]
  1897           * ureal[3][]
  1898           * ureal[][6][], ...
  1899           * ureal32
  1900           * ureal64[]
  1901           * ureal8[4]
  1902           * ureal256[][]
  1903           * ureal[3][]
  1904           * ureal64[][6][], ...
  1905           */
  1906          var SolidityTypeUReal = function () {
  1907            this._inputFormatter = f.formatInputReal;
  1908            this._outputFormatter = f.formatOutputUReal;
  1909          };
  1910  
  1911          SolidityTypeUReal.prototype = new SolidityType({});
  1912          SolidityTypeUReal.prototype.constructor = SolidityTypeUReal;
  1913  
  1914          SolidityTypeUReal.prototype.isType = function (name) {
  1915            return !!name.match(/^ureal([0-9]*)?(\[([0-9]*)\])*$/);
  1916          };
  1917  
  1918          module.exports = SolidityTypeUReal;
  1919        },
  1920        { "./formatters": 9, "./type": 14 },
  1921      ],
  1922      17: [
  1923        function (require, module, exports) {
  1924          "use strict";
  1925  
  1926          // go env doesn't have and need XMLHttpRequest
  1927          if (typeof XMLHttpRequest === "undefined") {
  1928            exports.XMLHttpRequest = {};
  1929          } else {
  1930            exports.XMLHttpRequest = XMLHttpRequest; // jshint ignore:line
  1931          }
  1932        },
  1933        {},
  1934      ],
  1935      18: [
  1936        function (require, module, exports) {
  1937          /*
  1938      This file is part of web3.js.
  1939  
  1940      web3.js is free software: you can redistribute it and/or modify
  1941      it under the terms of the GNU Lesser General Public License as published by
  1942      the Free Software Foundation, either version 3 of the License, or
  1943      (at your option) any later version.
  1944  
  1945      web3.js is distributed in the hope that it will be useful,
  1946      but WITHOUT ANY WARRANTY; without even the implied warranty of
  1947      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1948      GNU Lesser General Public License for more details.
  1949  
  1950      You should have received a copy of the GNU Lesser General Public License
  1951      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  1952  */
  1953          /** @file config.js
  1954           * @authors:
  1955           *   Marek Kotewicz <marek@ethdev.com>
  1956           * @date 2015
  1957           */
  1958  
  1959          /**
  1960           * Utils
  1961           *
  1962           * @module utils
  1963           */
  1964  
  1965          /**
  1966           * Utility functions
  1967           *
  1968           * @class [utils] config
  1969           * @constructor
  1970           */
  1971  
  1972          /// required to define ETH_BIGNUMBER_ROUNDING_MODE
  1973          var BigNumber = require("bignumber.js");
  1974  
  1975          var ETH_UNITS = [
  1976            "wei",
  1977            "kwei",
  1978            "Mwei",
  1979            "Gwei",
  1980            "szabo",
  1981            "finney",
  1982            "femtoether",
  1983            "picoether",
  1984            "nanoether",
  1985            "microether",
  1986            "milliether",
  1987            "nano",
  1988            "micro",
  1989            "milli",
  1990            "ether",
  1991            "grand",
  1992            "Mether",
  1993            "Gether",
  1994            "Tether",
  1995            "Pether",
  1996            "Eether",
  1997            "Zether",
  1998            "Yether",
  1999            "Nether",
  2000            "Dether",
  2001            "Vether",
  2002            "Uether",
  2003          ];
  2004  
  2005          module.exports = {
  2006            ETH_PADDING: 32,
  2007            ETH_SIGNATURE_LENGTH: 4,
  2008            ETH_UNITS: ETH_UNITS,
  2009            ETH_BIGNUMBER_ROUNDING_MODE: { ROUNDING_MODE: BigNumber.ROUND_DOWN },
  2010            ETH_POLLING_TIMEOUT: 1000 / 2,
  2011            defaultBlock: "latest",
  2012            defaultAccount: undefined,
  2013          };
  2014        },
  2015        { "bignumber.js": "bignumber.js" },
  2016      ],
  2017      19: [
  2018        function (require, module, exports) {
  2019          /*
  2020      This file is part of web3.js.
  2021  
  2022      web3.js is free software: you can redistribute it and/or modify
  2023      it under the terms of the GNU Lesser General Public License as published by
  2024      the Free Software Foundation, either version 3 of the License, or
  2025      (at your option) any later version.
  2026  
  2027      web3.js is distributed in the hope that it will be useful,
  2028      but WITHOUT ANY WARRANTY; without even the implied warranty of
  2029      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2030      GNU Lesser General Public License for more details.
  2031  
  2032      You should have received a copy of the GNU Lesser General Public License
  2033      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  2034  */
  2035          /**
  2036           * @file sha3.js
  2037           * @author Marek Kotewicz <marek@ethdev.com>
  2038           * @date 2015
  2039           */
  2040  
  2041          var CryptoJS = require("crypto-js");
  2042          var sha3 = require("crypto-js/sha3");
  2043  
  2044          module.exports = function (value, options) {
  2045            if (options && options.encoding === "hex") {
  2046              if (value.length > 2 && value.substr(0, 2) === "0x") {
  2047                value = value.substr(2);
  2048              }
  2049              value = CryptoJS.enc.Hex.parse(value);
  2050            }
  2051  
  2052            return sha3(value, {
  2053              outputLength: 256,
  2054            }).toString();
  2055          };
  2056        },
  2057        { "crypto-js": 59, "crypto-js/sha3": 80 },
  2058      ],
  2059      20: [
  2060        function (require, module, exports) {
  2061          /*
  2062      This file is part of web3.js.
  2063  
  2064      web3.js is free software: you can redistribute it and/or modify
  2065      it under the terms of the GNU Lesser General Public License as published by
  2066      the Free Software Foundation, either version 3 of the License, or
  2067      (at your option) any later version.
  2068  
  2069      web3.js is distributed in the hope that it will be useful,
  2070      but WITHOUT ANY WARRANTY; without even the implied warranty of
  2071      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2072      GNU Lesser General Public License for more details.
  2073  
  2074      You should have received a copy of the GNU Lesser General Public License
  2075      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  2076  */
  2077          /**
  2078           * @file utils.js
  2079           * @author Marek Kotewicz <marek@ethdev.com>
  2080           * @date 2015
  2081           */
  2082  
  2083          /**
  2084           * Utils
  2085           *
  2086           * @module utils
  2087           */
  2088  
  2089          /**
  2090           * Utility functions
  2091           *
  2092           * @class [utils] utils
  2093           * @constructor
  2094           */
  2095  
  2096          var BigNumber = require("bignumber.js");
  2097          var sha3 = require("./sha3.js");
  2098          var utf8 = require("utf8");
  2099  
  2100          var unitMap = {
  2101            noether: "0",
  2102            wei: "1",
  2103            kwei: "1000",
  2104            Kwei: "1000",
  2105            babbage: "1000",
  2106            femtoether: "1000",
  2107            mwei: "1000000",
  2108            Mwei: "1000000",
  2109            lovelace: "1000000",
  2110            picoether: "1000000",
  2111            gwei: "1000000000",
  2112            Gwei: "1000000000",
  2113            shannon: "1000000000",
  2114            nanoether: "1000000000",
  2115            nano: "1000000000",
  2116            szabo: "1000000000000",
  2117            microether: "1000000000000",
  2118            micro: "1000000000000",
  2119            finney: "1000000000000000",
  2120            milliether: "1000000000000000",
  2121            milli: "1000000000000000",
  2122            ether: "1000000000000000000",
  2123            kether: "1000000000000000000000",
  2124            grand: "1000000000000000000000",
  2125            mether: "1000000000000000000000000",
  2126            gether: "1000000000000000000000000000",
  2127            tether: "1000000000000000000000000000000",
  2128          };
  2129  
  2130          /**
  2131           * Should be called to pad string to expected length
  2132           *
  2133           * @method padLeft
  2134           * @param {String} string to be padded
  2135           * @param {Number} characters that result string should have
  2136           * @param {String} sign, by default 0
  2137           * @returns {String} right aligned string
  2138           */
  2139          var padLeft = function (string, chars, sign) {
  2140            return (
  2141              new Array(chars - string.length + 1).join(sign ? sign : "0") +
  2142              string
  2143            );
  2144          };
  2145  
  2146          /**
  2147           * Should be called to pad string to expected length
  2148           *
  2149           * @method padRight
  2150           * @param {String} string to be padded
  2151           * @param {Number} characters that result string should have
  2152           * @param {String} sign, by default 0
  2153           * @returns {String} right aligned string
  2154           */
  2155          var padRight = function (string, chars, sign) {
  2156            return (
  2157              string +
  2158              new Array(chars - string.length + 1).join(sign ? sign : "0")
  2159            );
  2160          };
  2161  
  2162          /**
  2163           * Should be called to get utf8 from it's hex representation
  2164           *
  2165           * @method toUtf8
  2166           * @param {String} string in hex
  2167           * @returns {String} ascii string representation of hex value
  2168           */
  2169          var toUtf8 = function (hex) {
  2170            // Find termination
  2171            var str = "";
  2172            var i = 0,
  2173              l = hex.length;
  2174            if (hex.substring(0, 2) === "0x") {
  2175              i = 2;
  2176            }
  2177            for (; i < l; i += 2) {
  2178              var code = parseInt(hex.substr(i, 2), 16);
  2179              if (code === 0) break;
  2180              str += String.fromCharCode(code);
  2181            }
  2182  
  2183            return utf8.decode(str);
  2184          };
  2185  
  2186          /**
  2187           * Should be called to get ascii from it's hex representation
  2188           *
  2189           * @method toAscii
  2190           * @param {String} string in hex
  2191           * @returns {String} ascii string representation of hex value
  2192           */
  2193          var toAscii = function (hex) {
  2194            // Find termination
  2195            var str = "";
  2196            var i = 0,
  2197              l = hex.length;
  2198            if (hex.substring(0, 2) === "0x") {
  2199              i = 2;
  2200            }
  2201            for (; i < l; i += 2) {
  2202              var code = parseInt(hex.substr(i, 2), 16);
  2203              str += String.fromCharCode(code);
  2204            }
  2205  
  2206            return str;
  2207          };
  2208  
  2209          /**
  2210           * Should be called to get hex representation (prefixed by 0x) of utf8 string
  2211           *
  2212           * @method fromUtf8
  2213           * @param {String} string
  2214           * @param {Number} optional padding
  2215           * @returns {String} hex representation of input string
  2216           */
  2217          var fromUtf8 = function (str) {
  2218            str = utf8.encode(str);
  2219            var hex = "";
  2220            for (var i = 0; i < str.length; i++) {
  2221              var code = str.charCodeAt(i);
  2222              if (code === 0) break;
  2223              var n = code.toString(16);
  2224              hex += n.length < 2 ? "0" + n : n;
  2225            }
  2226  
  2227            return "0x" + hex;
  2228          };
  2229  
  2230          /**
  2231           * Should be called to get hex representation (prefixed by 0x) of ascii string
  2232           *
  2233           * @method fromAscii
  2234           * @param {String} string
  2235           * @param {Number} optional padding
  2236           * @returns {String} hex representation of input string
  2237           */
  2238          var fromAscii = function (str) {
  2239            var hex = "";
  2240            for (var i = 0; i < str.length; i++) {
  2241              var code = str.charCodeAt(i);
  2242              var n = code.toString(16);
  2243              hex += n.length < 2 ? "0" + n : n;
  2244            }
  2245  
  2246            return "0x" + hex;
  2247          };
  2248  
  2249          /**
  2250           * Should be used to create full function/event name from json abi
  2251           *
  2252           * @method transformToFullName
  2253           * @param {Object} json-abi
  2254           * @return {String} full fnction/event name
  2255           */
  2256          var transformToFullName = function (json) {
  2257            if (json.name.indexOf("(") !== -1) {
  2258              return json.name;
  2259            }
  2260  
  2261            var typeName = json.inputs
  2262              .map(function (i) {
  2263                return i.type;
  2264              })
  2265              .join();
  2266            return json.name + "(" + typeName + ")";
  2267          };
  2268  
  2269          /**
  2270           * Should be called to get display name of contract function
  2271           *
  2272           * @method extractDisplayName
  2273           * @param {String} name of function/event
  2274           * @returns {String} display name for function/event eg. multiply(uint256) -> multiply
  2275           */
  2276          var extractDisplayName = function (name) {
  2277            var length = name.indexOf("(");
  2278            return length !== -1 ? name.substr(0, length) : name;
  2279          };
  2280  
  2281          /// @returns overloaded part of function/event name
  2282          var extractTypeName = function (name) {
  2283            /// TODO: make it invulnerable
  2284            var length = name.indexOf("(");
  2285            return length !== -1
  2286              ? name
  2287                  .substr(length + 1, name.length - 1 - (length + 1))
  2288                  .replace(" ", "")
  2289              : "";
  2290          };
  2291  
  2292          /**
  2293           * Converts value to it's decimal representation in string
  2294           *
  2295           * @method toDecimal
  2296           * @param {String|Number|BigNumber}
  2297           * @return {String}
  2298           */
  2299          var toDecimal = function (value) {
  2300            return toBigNumber(value).toNumber();
  2301          };
  2302  
  2303          /**
  2304           * Converts value to it's hex representation
  2305           *
  2306           * @method fromDecimal
  2307           * @param {String|Number|BigNumber}
  2308           * @return {String}
  2309           */
  2310          var fromDecimal = function (value) {
  2311            var number = toBigNumber(value);
  2312            var result = number.toString(16);
  2313  
  2314            return number.lessThan(0) ? "-0x" + result.substr(1) : "0x" + result;
  2315          };
  2316  
  2317          /**
  2318           * Auto converts any given value into it's hex representation.
  2319           *
  2320           * And even stringifys objects before.
  2321           *
  2322           * @method toHex
  2323           * @param {String|Number|BigNumber|Object}
  2324           * @return {String}
  2325           */
  2326          var toHex = function (val) {
  2327            /*jshint maxcomplexity: 8 */
  2328  
  2329            if (isBoolean(val)) return fromDecimal(+val);
  2330  
  2331            if (isBigNumber(val)) return fromDecimal(val);
  2332  
  2333            if (typeof val === "object") return fromUtf8(JSON.stringify(val));
  2334  
  2335            // if its a negative number, pass it through fromDecimal
  2336            if (isString(val)) {
  2337              if (val.indexOf("-0x") === 0) return fromDecimal(val);
  2338              else if (val.indexOf("0x") === 0) return val;
  2339              else if (!isFinite(val)) return fromAscii(val);
  2340            }
  2341  
  2342            return fromDecimal(val);
  2343          };
  2344  
  2345          /**
  2346           * Returns value of unit in Wei
  2347           *
  2348           * @method getValueOfUnit
  2349           * @param {String} unit the unit to convert to, default ether
  2350           * @returns {BigNumber} value of the unit (in Wei)
  2351           * @throws error if the unit is not correct:w
  2352           */
  2353          var getValueOfUnit = function (unit) {
  2354            unit = unit ? unit.toLowerCase() : "ether";
  2355            var unitValue = unitMap[unit];
  2356            if (unitValue === undefined) {
  2357              throw new Error(
  2358                "This unit doesn't exists, please use the one of the following units" +
  2359                  JSON.stringify(unitMap, null, 2)
  2360              );
  2361            }
  2362            return new BigNumber(unitValue, 10);
  2363          };
  2364  
  2365          /**
  2366           * Takes a number of wei and converts it to any other ether unit.
  2367           *
  2368           * Possible units are:
  2369           *   SI Short   SI Full        Effigy       Other
  2370           * - kwei       femtoether     babbage
  2371           * - mwei       picoether      lovelace
  2372           * - gwei       nanoether      shannon      nano
  2373           * - --         microether     szabo        micro
  2374           * - --         milliether     finney       milli
  2375           * - ether      --             --
  2376           * - kether                    --           grand
  2377           * - mether
  2378           * - gether
  2379           * - tether
  2380           *
  2381           * @method fromWei
  2382           * @param {Number|String} number can be a number, number string or a HEX of a decimal
  2383           * @param {String} unit the unit to convert to, default ether
  2384           * @return {String|Object} When given a BigNumber object it returns one as well, otherwise a number
  2385           */
  2386          var fromWei = function (number, unit) {
  2387            var returnValue = toBigNumber(number).dividedBy(getValueOfUnit(unit));
  2388  
  2389            return isBigNumber(number) ? returnValue : returnValue.toString(10);
  2390          };
  2391  
  2392          /**
  2393           * Takes a number of a unit and converts it to wei.
  2394           *
  2395           * Possible units are:
  2396           *   SI Short   SI Full        Effigy       Other
  2397           * - kwei       femtoether     babbage
  2398           * - mwei       picoether      lovelace
  2399           * - gwei       nanoether      shannon      nano
  2400           * - --         microether     szabo        micro
  2401           * - --         microether     szabo        micro
  2402           * - --         milliether     finney       milli
  2403           * - ether      --             --
  2404           * - kether                    --           grand
  2405           * - mether
  2406           * - gether
  2407           * - tether
  2408           *
  2409           * @method toWei
  2410           * @param {Number|String|BigNumber} number can be a number, number string or a HEX of a decimal
  2411           * @param {String} unit the unit to convert from, default ether
  2412           * @return {String|Object} When given a BigNumber object it returns one as well, otherwise a number
  2413           */
  2414          var toWei = function (number, unit) {
  2415            var returnValue = toBigNumber(number).times(getValueOfUnit(unit));
  2416  
  2417            return isBigNumber(number) ? returnValue : returnValue.toString(10);
  2418          };
  2419  
  2420          /**
  2421           * Takes an input and transforms it into a bignumber
  2422           *
  2423           * @method toBigNumber
  2424           * @param {Number|String|BigNumber} a number, string, HEX string or BigNumber
  2425           * @return {BigNumber} BigNumber
  2426           */
  2427          var toBigNumber = function (number) {
  2428            /*jshint maxcomplexity:5 */
  2429            number = number || 0;
  2430            if (isBigNumber(number)) return number;
  2431  
  2432            if (
  2433              isString(number) &&
  2434              (number.indexOf("0x") === 0 || number.indexOf("-0x") === 0)
  2435            ) {
  2436              return new BigNumber(number.replace("0x", ""), 16);
  2437            }
  2438  
  2439            return new BigNumber(number.toString(10), 10);
  2440          };
  2441  
  2442          /**
  2443           * Takes and input transforms it into bignumber and if it is negative value, into two's complement
  2444           *
  2445           * @method toTwosComplement
  2446           * @param {Number|String|BigNumber}
  2447           * @return {BigNumber}
  2448           */
  2449          var toTwosComplement = function (number) {
  2450            var bigNumber = toBigNumber(number).round();
  2451            if (bigNumber.lessThan(0)) {
  2452              return new BigNumber(
  2453                "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
  2454                16
  2455              )
  2456                .plus(bigNumber)
  2457                .plus(1);
  2458            }
  2459            return bigNumber;
  2460          };
  2461  
  2462          /**
  2463           * Checks if the given string is strictly an address
  2464           *
  2465           * @method isStrictAddress
  2466           * @param {String} address the given HEX address
  2467           * @return {Boolean}
  2468           */
  2469          var isStrictAddress = function (address) {
  2470            return /^0x[0-9a-f]{40}$/i.test(address);
  2471          };
  2472  
  2473          /**
  2474           * Checks if the given string is an address
  2475           *
  2476           * @method isAddress
  2477           * @param {String} address the given HEX address
  2478           * @return {Boolean}
  2479           */
  2480          var isAddress = function (address) {
  2481            if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) {
  2482              // check if it has the basic requirements of an address
  2483              return false;
  2484            } else if (
  2485              /^(0x)?[0-9a-f]{40}$/.test(address) ||
  2486              /^(0x)?[0-9A-F]{40}$/.test(address)
  2487            ) {
  2488              // If it's all small caps or all caps, return true
  2489              return true;
  2490            } else {
  2491              // Otherwise check each case
  2492              return isChecksumAddress(address);
  2493            }
  2494          };
  2495  
  2496          /**
  2497           * Checks if the given string is a checksummed address
  2498           *
  2499           * @method isChecksumAddress
  2500           * @param {String} address the given HEX address
  2501           * @return {Boolean}
  2502           */
  2503          var isChecksumAddress = function (address) {
  2504            // Check each case
  2505            address = address.replace("0x", "");
  2506            var addressHash = sha3(address.toLowerCase());
  2507  
  2508            for (var i = 0; i < 40; i++) {
  2509              // the nth letter should be uppercase if the nth digit of casemap is 1
  2510              if (
  2511                (parseInt(addressHash[i], 16) > 7 &&
  2512                  address[i].toUpperCase() !== address[i]) ||
  2513                (parseInt(addressHash[i], 16) <= 7 &&
  2514                  address[i].toLowerCase() !== address[i])
  2515              ) {
  2516                return false;
  2517              }
  2518            }
  2519            return true;
  2520          };
  2521  
  2522          /**
  2523           * Makes a checksum address
  2524           *
  2525           * @method toChecksumAddress
  2526           * @param {String} address the given HEX address
  2527           * @return {String}
  2528           */
  2529          var toChecksumAddress = function (address) {
  2530            if (typeof address === "undefined") return "";
  2531  
  2532            address = address.toLowerCase().replace("0x", "");
  2533            var addressHash = sha3(address);
  2534            var checksumAddress = "0x";
  2535  
  2536            for (var i = 0; i < address.length; i++) {
  2537              // If ith character is 9 to f then make it uppercase
  2538              if (parseInt(addressHash[i], 16) > 7) {
  2539                checksumAddress += address[i].toUpperCase();
  2540              } else {
  2541                checksumAddress += address[i];
  2542              }
  2543            }
  2544            return checksumAddress;
  2545          };
  2546  
  2547          /**
  2548           * Transforms given string to valid 20 bytes-length addres with 0x prefix
  2549           *
  2550           * @method toAddress
  2551           * @param {String} address
  2552           * @return {String} formatted address
  2553           */
  2554          var toAddress = function (address) {
  2555            if (isStrictAddress(address)) {
  2556              return address;
  2557            }
  2558  
  2559            if (/^[0-9a-f]{40}$/.test(address)) {
  2560              return "0x" + address;
  2561            }
  2562  
  2563            return "0x" + padLeft(toHex(address).substr(2), 40);
  2564          };
  2565  
  2566          /**
  2567           * Returns true if object is BigNumber, otherwise false
  2568           *
  2569           * @method isBigNumber
  2570           * @param {Object}
  2571           * @return {Boolean}
  2572           */
  2573          var isBigNumber = function (object) {
  2574            return (
  2575              object instanceof BigNumber ||
  2576              (object &&
  2577                object.constructor &&
  2578                object.constructor.name === "BigNumber")
  2579            );
  2580          };
  2581  
  2582          /**
  2583           * Returns true if object is string, otherwise false
  2584           *
  2585           * @method isString
  2586           * @param {Object}
  2587           * @return {Boolean}
  2588           */
  2589          var isString = function (object) {
  2590            return (
  2591              typeof object === "string" ||
  2592              (object &&
  2593                object.constructor &&
  2594                object.constructor.name === "String")
  2595            );
  2596          };
  2597  
  2598          /**
  2599           * Returns true if object is function, otherwise false
  2600           *
  2601           * @method isFunction
  2602           * @param {Object}
  2603           * @return {Boolean}
  2604           */
  2605          var isFunction = function (object) {
  2606            return typeof object === "function";
  2607          };
  2608  
  2609          /**
  2610           * Returns true if object is Objet, otherwise false
  2611           *
  2612           * @method isObject
  2613           * @param {Object}
  2614           * @return {Boolean}
  2615           */
  2616          var isObject = function (object) {
  2617            return (
  2618              object !== null &&
  2619              !(object instanceof Array) &&
  2620              typeof object === "object"
  2621            );
  2622          };
  2623  
  2624          /**
  2625           * Returns true if object is boolean, otherwise false
  2626           *
  2627           * @method isBoolean
  2628           * @param {Object}
  2629           * @return {Boolean}
  2630           */
  2631          var isBoolean = function (object) {
  2632            return typeof object === "boolean";
  2633          };
  2634  
  2635          /**
  2636           * Returns true if object is array, otherwise false
  2637           *
  2638           * @method isArray
  2639           * @param {Object}
  2640           * @return {Boolean}
  2641           */
  2642          var isArray = function (object) {
  2643            return object instanceof Array;
  2644          };
  2645  
  2646          /**
  2647           * Returns true if given string is valid json object
  2648           *
  2649           * @method isJson
  2650           * @param {String}
  2651           * @return {Boolean}
  2652           */
  2653          var isJson = function (str) {
  2654            try {
  2655              return !!JSON.parse(str);
  2656            } catch (e) {
  2657              return false;
  2658            }
  2659          };
  2660  
  2661          /**
  2662           * Returns true if given string is a valid Ethereum block header bloom.
  2663           *
  2664           * @method isBloom
  2665           * @param {String} hex encoded bloom filter
  2666           * @return {Boolean}
  2667           */
  2668          var isBloom = function (bloom) {
  2669            if (!/^(0x)?[0-9a-f]{512}$/i.test(bloom)) {
  2670              return false;
  2671            } else if (
  2672              /^(0x)?[0-9a-f]{512}$/.test(bloom) ||
  2673              /^(0x)?[0-9A-F]{512}$/.test(bloom)
  2674            ) {
  2675              return true;
  2676            }
  2677            return false;
  2678          };
  2679  
  2680          /**
  2681           * Returns true if given string is a valid log topic.
  2682           *
  2683           * @method isTopic
  2684           * @param {String} hex encoded topic
  2685           * @return {Boolean}
  2686           */
  2687          var isTopic = function (topic) {
  2688            if (!/^(0x)?[0-9a-f]{64}$/i.test(topic)) {
  2689              return false;
  2690            } else if (
  2691              /^(0x)?[0-9a-f]{64}$/.test(topic) ||
  2692              /^(0x)?[0-9A-F]{64}$/.test(topic)
  2693            ) {
  2694              return true;
  2695            }
  2696            return false;
  2697          };
  2698  
  2699          module.exports = {
  2700            padLeft: padLeft,
  2701            padRight: padRight,
  2702            toHex: toHex,
  2703            toDecimal: toDecimal,
  2704            fromDecimal: fromDecimal,
  2705            toUtf8: toUtf8,
  2706            toAscii: toAscii,
  2707            fromUtf8: fromUtf8,
  2708            fromAscii: fromAscii,
  2709            transformToFullName: transformToFullName,
  2710            extractDisplayName: extractDisplayName,
  2711            extractTypeName: extractTypeName,
  2712            toWei: toWei,
  2713            fromWei: fromWei,
  2714            toBigNumber: toBigNumber,
  2715            toTwosComplement: toTwosComplement,
  2716            toAddress: toAddress,
  2717            isBigNumber: isBigNumber,
  2718            isStrictAddress: isStrictAddress,
  2719            isAddress: isAddress,
  2720            isChecksumAddress: isChecksumAddress,
  2721            toChecksumAddress: toChecksumAddress,
  2722            isFunction: isFunction,
  2723            isString: isString,
  2724            isObject: isObject,
  2725            isBoolean: isBoolean,
  2726            isArray: isArray,
  2727            isJson: isJson,
  2728            isBloom: isBloom,
  2729            isTopic: isTopic,
  2730          };
  2731        },
  2732        { "./sha3.js": 19, "bignumber.js": "bignumber.js", utf8: 85 },
  2733      ],
  2734      21: [
  2735        function (require, module, exports) {
  2736          module.exports = {
  2737            version: "0.20.1",
  2738          };
  2739        },
  2740        {},
  2741      ],
  2742      22: [
  2743        function (require, module, exports) {
  2744          /*
  2745      This file is part of web3.js.
  2746  
  2747      web3.js is free software: you can redistribute it and/or modify
  2748      it under the terms of the GNU Lesser General Public License as published by
  2749      the Free Software Foundation, either version 3 of the License, or
  2750      (at your option) any later version.
  2751  
  2752      web3.js is distributed in the hope that it will be useful,
  2753      but WITHOUT ANY WARRANTY; without even the implied warranty of
  2754      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2755      GNU Lesser General Public License for more details.
  2756  
  2757      You should have received a copy of the GNU Lesser General Public License
  2758      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  2759  */
  2760          /**
  2761           * @file web3.js
  2762           * @authors:
  2763           *   Jeffrey Wilcke <jeff@ethdev.com>
  2764           *   Marek Kotewicz <marek@ethdev.com>
  2765           *   Marian Oancea <marian@ethdev.com>
  2766           *   Fabian Vogelsteller <fabian@ethdev.com>
  2767           *   Gav Wood <g@ethdev.com>
  2768           * @date 2014
  2769           */
  2770  
  2771          var RequestManager = require("./web3/requestmanager");
  2772          var Iban = require("./web3/iban");
  2773          var Eth = require("./web3/methods/eth");
  2774          var DB = require("./web3/methods/db");
  2775          var Shh = require("./web3/methods/shh");
  2776          var Net = require("./web3/methods/net");
  2777          var Personal = require("./web3/methods/personal");
  2778          var Swarm = require("./web3/methods/swarm");
  2779          var Settings = require("./web3/settings");
  2780          var version = require("./version.json");
  2781          var utils = require("./utils/utils");
  2782          var sha3 = require("./utils/sha3");
  2783          var extend = require("./web3/extend");
  2784          var Batch = require("./web3/batch");
  2785          var Property = require("./web3/property");
  2786          var HttpProvider = require("./web3/httpprovider");
  2787          var IpcProvider = require("./web3/ipcprovider");
  2788          var BigNumber = require("bignumber.js");
  2789  
  2790          function Web3(provider) {
  2791            this._requestManager = new RequestManager(provider);
  2792            this.currentProvider = provider;
  2793            this.eth = new Eth(this);
  2794            this.db = new DB(this);
  2795            this.shh = new Shh(this);
  2796            this.net = new Net(this);
  2797            this.personal = new Personal(this);
  2798            this.bzz = new Swarm(this);
  2799            this.settings = new Settings();
  2800            this.version = {
  2801              api: version.version,
  2802            };
  2803            this.providers = {
  2804              HttpProvider: HttpProvider,
  2805              IpcProvider: IpcProvider,
  2806            };
  2807            this._extend = extend(this);
  2808            this._extend({
  2809              properties: properties(),
  2810            });
  2811          }
  2812  
  2813          // expose providers on the class
  2814          Web3.providers = {
  2815            HttpProvider: HttpProvider,
  2816            IpcProvider: IpcProvider,
  2817          };
  2818  
  2819          Web3.prototype.setProvider = function (provider) {
  2820            this._requestManager.setProvider(provider);
  2821            this.currentProvider = provider;
  2822          };
  2823  
  2824          Web3.prototype.reset = function (keepIsSyncing) {
  2825            this._requestManager.reset(keepIsSyncing);
  2826            this.settings = new Settings();
  2827          };
  2828  
  2829          Web3.prototype.BigNumber = BigNumber;
  2830          Web3.prototype.toHex = utils.toHex;
  2831          Web3.prototype.toAscii = utils.toAscii;
  2832          Web3.prototype.toUtf8 = utils.toUtf8;
  2833          Web3.prototype.fromAscii = utils.fromAscii;
  2834          Web3.prototype.fromUtf8 = utils.fromUtf8;
  2835          Web3.prototype.toDecimal = utils.toDecimal;
  2836          Web3.prototype.fromDecimal = utils.fromDecimal;
  2837          Web3.prototype.toBigNumber = utils.toBigNumber;
  2838          Web3.prototype.toWei = utils.toWei;
  2839          Web3.prototype.fromWei = utils.fromWei;
  2840          Web3.prototype.isAddress = utils.isAddress;
  2841          Web3.prototype.isChecksumAddress = utils.isChecksumAddress;
  2842          Web3.prototype.toChecksumAddress = utils.toChecksumAddress;
  2843          Web3.prototype.isIBAN = utils.isIBAN;
  2844          Web3.prototype.padLeft = utils.padLeft;
  2845          Web3.prototype.padRight = utils.padRight;
  2846  
  2847          Web3.prototype.sha3 = function (string, options) {
  2848            return "0x" + sha3(string, options);
  2849          };
  2850  
  2851          /**
  2852           * Transforms direct icap to address
  2853           */
  2854          Web3.prototype.fromICAP = function (icap) {
  2855            var iban = new Iban(icap);
  2856            return iban.address();
  2857          };
  2858  
  2859          var properties = function () {
  2860            return [
  2861              new Property({
  2862                name: "version.node",
  2863                getter: "web3_clientVersion",
  2864              }),
  2865              new Property({
  2866                name: "version.network",
  2867                getter: "net_version",
  2868                inputFormatter: utils.toDecimal,
  2869              }),
  2870              new Property({
  2871                name: "version.ethereum",
  2872                getter: "eth_protocolVersion",
  2873                inputFormatter: utils.toDecimal,
  2874              }),
  2875              new Property({
  2876                name: "version.whisper",
  2877                getter: "shh_version",
  2878                inputFormatter: utils.toDecimal,
  2879              }),
  2880            ];
  2881          };
  2882  
  2883          Web3.prototype.isConnected = function () {
  2884            return this.currentProvider && this.currentProvider.isConnected();
  2885          };
  2886  
  2887          Web3.prototype.createBatch = function () {
  2888            return new Batch(this);
  2889          };
  2890  
  2891          module.exports = Web3;
  2892        },
  2893        {
  2894          "./utils/sha3": 19,
  2895          "./utils/utils": 20,
  2896          "./version.json": 21,
  2897          "./web3/batch": 24,
  2898          "./web3/extend": 28,
  2899          "./web3/httpprovider": 32,
  2900          "./web3/iban": 33,
  2901          "./web3/ipcprovider": 34,
  2902          "./web3/methods/db": 37,
  2903          "./web3/methods/eth": 38,
  2904          "./web3/methods/net": 39,
  2905          "./web3/methods/personal": 40,
  2906          "./web3/methods/shh": 41,
  2907          "./web3/methods/swarm": 42,
  2908          "./web3/property": 45,
  2909          "./web3/requestmanager": 46,
  2910          "./web3/settings": 47,
  2911          "bignumber.js": "bignumber.js",
  2912        },
  2913      ],
  2914      23: [
  2915        function (require, module, exports) {
  2916          /*
  2917      This file is part of web3.js.
  2918  
  2919      web3.js is free software: you can redistribute it and/or modify
  2920      it under the terms of the GNU Lesser General Public License as published by
  2921      the Free Software Foundation, either version 3 of the License, or
  2922      (at your option) any later version.
  2923  
  2924      web3.js is distributed in the hope that it will be useful,
  2925      but WITHOUT ANY WARRANTY; without even the implied warranty of
  2926      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2927      GNU Lesser General Public License for more details.
  2928  
  2929      You should have received a copy of the GNU Lesser General Public License
  2930      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  2931  */
  2932          /**
  2933           * @file allevents.js
  2934           * @author Marek Kotewicz <marek@ethdev.com>
  2935           * @date 2014
  2936           */
  2937  
  2938          var sha3 = require("../utils/sha3");
  2939          var SolidityEvent = require("./event");
  2940          var formatters = require("./formatters");
  2941          var utils = require("../utils/utils");
  2942          var Filter = require("./filter");
  2943          var watches = require("./methods/watches");
  2944  
  2945          var AllSolidityEvents = function (requestManager, json, address) {
  2946            this._requestManager = requestManager;
  2947            this._json = json;
  2948            this._address = address;
  2949          };
  2950  
  2951          AllSolidityEvents.prototype.encode = function (options) {
  2952            options = options || {};
  2953            var result = {};
  2954  
  2955            ["fromBlock", "toBlock"]
  2956              .filter(function (f) {
  2957                return options[f] !== undefined;
  2958              })
  2959              .forEach(function (f) {
  2960                result[f] = formatters.inputBlockNumberFormatter(options[f]);
  2961              });
  2962  
  2963            result.address = this._address;
  2964  
  2965            return result;
  2966          };
  2967  
  2968          AllSolidityEvents.prototype.decode = function (data) {
  2969            data.data = data.data || "";
  2970            data.topics = data.topics || [];
  2971  
  2972            var eventTopic = data.topics[0].slice(2);
  2973            var match = this._json.filter(function (j) {
  2974              return eventTopic === sha3(utils.transformToFullName(j));
  2975            })[0];
  2976  
  2977            if (!match) {
  2978              // cannot find matching event?
  2979              console.warn("cannot find event for log");
  2980              return data;
  2981            }
  2982  
  2983            var event = new SolidityEvent(
  2984              this._requestManager,
  2985              match,
  2986              this._address
  2987            );
  2988            return event.decode(data);
  2989          };
  2990  
  2991          AllSolidityEvents.prototype.execute = function (options, callback) {
  2992            if (utils.isFunction(arguments[arguments.length - 1])) {
  2993              callback = arguments[arguments.length - 1];
  2994              if (arguments.length === 1) options = null;
  2995            }
  2996  
  2997            var o = this.encode(options);
  2998            var formatter = this.decode.bind(this);
  2999            return new Filter(
  3000              o,
  3001              "eth",
  3002              this._requestManager,
  3003              watches.eth(),
  3004              formatter,
  3005              callback
  3006            );
  3007          };
  3008  
  3009          AllSolidityEvents.prototype.attachToContract = function (contract) {
  3010            var execute = this.execute.bind(this);
  3011            contract.allEvents = execute;
  3012          };
  3013  
  3014          module.exports = AllSolidityEvents;
  3015        },
  3016        {
  3017          "../utils/sha3": 19,
  3018          "../utils/utils": 20,
  3019          "./event": 27,
  3020          "./filter": 29,
  3021          "./formatters": 30,
  3022          "./methods/watches": 43,
  3023        },
  3024      ],
  3025      24: [
  3026        function (require, module, exports) {
  3027          /*
  3028      This file is part of web3.js.
  3029  
  3030      web3.js is free software: you can redistribute it and/or modify
  3031      it under the terms of the GNU Lesser General Public License as published by
  3032      the Free Software Foundation, either version 3 of the License, or
  3033      (at your option) any later version.
  3034  
  3035      web3.js is distributed in the hope that it will be useful,
  3036      but WITHOUT ANY WARRANTY; without even the implied warranty of
  3037      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3038      GNU Lesser General Public License for more details.
  3039  
  3040      You should have received a copy of the GNU Lesser General Public License
  3041      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  3042  */
  3043          /**
  3044           * @file batch.js
  3045           * @author Marek Kotewicz <marek@ethdev.com>
  3046           * @date 2015
  3047           */
  3048  
  3049          var Jsonrpc = require("./jsonrpc");
  3050          var errors = require("./errors");
  3051  
  3052          var Batch = function (web3) {
  3053            this.requestManager = web3._requestManager;
  3054            this.requests = [];
  3055          };
  3056  
  3057          /**
  3058           * Should be called to add create new request to batch request
  3059           *
  3060           * @method add
  3061           * @param {Object} jsonrpc requet object
  3062           */
  3063          Batch.prototype.add = function (request) {
  3064            this.requests.push(request);
  3065          };
  3066  
  3067          /**
  3068           * Should be called to execute batch request
  3069           *
  3070           * @method execute
  3071           */
  3072          Batch.prototype.execute = function () {
  3073            var requests = this.requests;
  3074            this.requestManager.sendBatch(requests, function (err, results) {
  3075              results = results || [];
  3076              requests
  3077                .map(function (request, index) {
  3078                  return results[index] || {};
  3079                })
  3080                .forEach(function (result, index) {
  3081                  if (requests[index].callback) {
  3082                    if (!Jsonrpc.isValidResponse(result)) {
  3083                      return requests[index].callback(
  3084                        errors.InvalidResponse(result)
  3085                      );
  3086                    }
  3087  
  3088                    requests[index].callback(
  3089                      null,
  3090                      requests[index].format
  3091                        ? requests[index].format(result.result)
  3092                        : result.result
  3093                    );
  3094                  }
  3095                });
  3096            });
  3097          };
  3098  
  3099          module.exports = Batch;
  3100        },
  3101        { "./errors": 26, "./jsonrpc": 35 },
  3102      ],
  3103      25: [
  3104        function (require, module, exports) {
  3105          /*
  3106      This file is part of web3.js.
  3107  
  3108      web3.js is free software: you can redistribute it and/or modify
  3109      it under the terms of the GNU Lesser General Public License as published by
  3110      the Free Software Foundation, either version 3 of the License, or
  3111      (at your option) any later version.
  3112  
  3113      web3.js is distributed in the hope that it will be useful,
  3114      but WITHOUT ANY WARRANTY; without even the implied warranty of
  3115      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3116      GNU Lesser General Public License for more details.
  3117  
  3118      You should have received a copy of the GNU Lesser General Public License
  3119      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  3120  */
  3121          /**
  3122           * @file contract.js
  3123           * @author Marek Kotewicz <marek@ethdev.com>
  3124           * @date 2014
  3125           */
  3126  
  3127          var utils = require("../utils/utils");
  3128          var coder = require("../solidity/coder");
  3129          var SolidityEvent = require("./event");
  3130          var SolidityFunction = require("./function");
  3131          var AllEvents = require("./allevents");
  3132  
  3133          /**
  3134           * Should be called to encode constructor params
  3135           *
  3136           * @method encodeConstructorParams
  3137           * @param {Array} abi
  3138           * @param {Array} constructor params
  3139           */
  3140          var encodeConstructorParams = function (abi, params) {
  3141            return (
  3142              abi
  3143                .filter(function (json) {
  3144                  return (
  3145                    json.type === "constructor" &&
  3146                    json.inputs.length === params.length
  3147                  );
  3148                })
  3149                .map(function (json) {
  3150                  return json.inputs.map(function (input) {
  3151                    return input.type;
  3152                  });
  3153                })
  3154                .map(function (types) {
  3155                  return coder.encodeParams(types, params);
  3156                })[0] || ""
  3157            );
  3158          };
  3159  
  3160          /**
  3161           * Should be called to add functions to contract object
  3162           *
  3163           * @method addFunctionsToContract
  3164           * @param {Contract} contract
  3165           * @param {Array} abi
  3166           */
  3167          var addFunctionsToContract = function (contract) {
  3168            contract.abi
  3169              .filter(function (json) {
  3170                return json.type === "function";
  3171              })
  3172              .map(function (json) {
  3173                return new SolidityFunction(
  3174                  contract._eth,
  3175                  json,
  3176                  contract.address
  3177                );
  3178              })
  3179              .forEach(function (f) {
  3180                f.attachToContract(contract);
  3181              });
  3182          };
  3183  
  3184          /**
  3185           * Should be called to add events to contract object
  3186           *
  3187           * @method addEventsToContract
  3188           * @param {Contract} contract
  3189           * @param {Array} abi
  3190           */
  3191          var addEventsToContract = function (contract) {
  3192            var events = contract.abi.filter(function (json) {
  3193              return json.type === "event";
  3194            });
  3195  
  3196            var All = new AllEvents(
  3197              contract._eth._requestManager,
  3198              events,
  3199              contract.address
  3200            );
  3201            All.attachToContract(contract);
  3202  
  3203            events
  3204              .map(function (json) {
  3205                return new SolidityEvent(
  3206                  contract._eth._requestManager,
  3207                  json,
  3208                  contract.address
  3209                );
  3210              })
  3211              .forEach(function (e) {
  3212                e.attachToContract(contract);
  3213              });
  3214          };
  3215  
  3216          /**
  3217           * Should be called to check if the contract gets properly deployed on the blockchain.
  3218           *
  3219           * @method checkForContractAddress
  3220           * @param {Object} contract
  3221           * @param {Function} callback
  3222           * @returns {Undefined}
  3223           */
  3224          var checkForContractAddress = function (contract, callback) {
  3225            var count = 0,
  3226              callbackFired = false;
  3227  
  3228            // wait for receipt
  3229            var filter = contract._eth.filter("latest", function (e) {
  3230              if (!e && !callbackFired) {
  3231                count++;
  3232  
  3233                // stop watching after 50 blocks (timeout)
  3234                if (count > 50) {
  3235                  filter.stopWatching(function () {});
  3236                  callbackFired = true;
  3237  
  3238                  if (callback)
  3239                    callback(
  3240                      new Error(
  3241                        "Contract transaction couldn't be found after 50 blocks"
  3242                      )
  3243                    );
  3244                  else
  3245                    throw new Error(
  3246                      "Contract transaction couldn't be found after 50 blocks"
  3247                    );
  3248                } else {
  3249                  contract._eth.getTransactionReceipt(
  3250                    contract.transactionHash,
  3251                    function (e, receipt) {
  3252                      if (receipt && !callbackFired) {
  3253                        contract._eth.getCode(
  3254                          receipt.contractAddress,
  3255                          function (e, code) {
  3256                            /*jshint maxcomplexity: 6 */
  3257  
  3258                            if (callbackFired || !code) return;
  3259  
  3260                            filter.stopWatching(function () {});
  3261                            callbackFired = true;
  3262  
  3263                            if (code.length > 3) {
  3264                              // console.log('Contract code deployed!');
  3265  
  3266                              contract.address = receipt.contractAddress;
  3267  
  3268                              // attach events and methods again after we have
  3269                              addFunctionsToContract(contract);
  3270                              addEventsToContract(contract);
  3271  
  3272                              // call callback for the second time
  3273                              if (callback) callback(null, contract);
  3274                            } else {
  3275                              if (callback)
  3276                                callback(
  3277                                  new Error(
  3278                                    "The contract code couldn't be stored, please check your gas amount."
  3279                                  )
  3280                                );
  3281                              else
  3282                                throw new Error(
  3283                                  "The contract code couldn't be stored, please check your gas amount."
  3284                                );
  3285                            }
  3286                          }
  3287                        );
  3288                      }
  3289                    }
  3290                  );
  3291                }
  3292              }
  3293            });
  3294          };
  3295  
  3296          /**
  3297           * Should be called to create new ContractFactory instance
  3298           *
  3299           * @method ContractFactory
  3300           * @param {Array} abi
  3301           */
  3302          var ContractFactory = function (eth, abi) {
  3303            this.eth = eth;
  3304            this.abi = abi;
  3305  
  3306            /**
  3307             * Should be called to create new contract on a blockchain
  3308             *
  3309             * @method new
  3310             * @param {Any} contract constructor param1 (optional)
  3311             * @param {Any} contract constructor param2 (optional)
  3312             * @param {Object} contract transaction object (required)
  3313             * @param {Function} callback
  3314             * @returns {Contract} returns contract instance
  3315             */
  3316            this.new = function () {
  3317              /*jshint maxcomplexity: 7 */
  3318  
  3319              var contract = new Contract(this.eth, this.abi);
  3320  
  3321              // parse arguments
  3322              var options = {}; // required!
  3323              var callback;
  3324  
  3325              var args = Array.prototype.slice.call(arguments);
  3326              if (utils.isFunction(args[args.length - 1])) {
  3327                callback = args.pop();
  3328              }
  3329  
  3330              var last = args[args.length - 1];
  3331              if (utils.isObject(last) && !utils.isArray(last)) {
  3332                options = args.pop();
  3333              }
  3334  
  3335              if (options.value > 0) {
  3336                var constructorAbi =
  3337                  abi.filter(function (json) {
  3338                    return (
  3339                      json.type === "constructor" &&
  3340                      json.inputs.length === args.length
  3341                    );
  3342                  })[0] || {};
  3343  
  3344                if (!constructorAbi.payable) {
  3345                  throw new Error("Cannot send value to non-payable constructor");
  3346                }
  3347              }
  3348  
  3349              var bytes = encodeConstructorParams(this.abi, args);
  3350              options.data += bytes;
  3351  
  3352              if (callback) {
  3353                // wait for the contract address and check if the code was deployed
  3354                this.eth.sendTransaction(options, function (err, hash) {
  3355                  if (err) {
  3356                    callback(err);
  3357                  } else {
  3358                    // add the transaction hash
  3359                    contract.transactionHash = hash;
  3360  
  3361                    // call callback for the first time
  3362                    callback(null, contract);
  3363  
  3364                    checkForContractAddress(contract, callback);
  3365                  }
  3366                });
  3367              } else {
  3368                var hash = this.eth.sendTransaction(options);
  3369                // add the transaction hash
  3370                contract.transactionHash = hash;
  3371                checkForContractAddress(contract);
  3372              }
  3373  
  3374              return contract;
  3375            };
  3376  
  3377            this.new.getData = this.getData.bind(this);
  3378          };
  3379  
  3380          /**
  3381           * Should be called to create new ContractFactory
  3382           *
  3383           * @method contract
  3384           * @param {Array} abi
  3385           * @returns {ContractFactory} new contract factory
  3386           */
  3387          //var contract = function (abi) {
  3388          //return new ContractFactory(abi);
  3389          //};
  3390  
  3391          /**
  3392           * Should be called to get access to existing contract on a blockchain
  3393           *
  3394           * @method at
  3395           * @param {Address} contract address (required)
  3396           * @param {Function} callback {optional)
  3397           * @returns {Contract} returns contract if no callback was passed,
  3398           * otherwise calls callback function (err, contract)
  3399           */
  3400          ContractFactory.prototype.at = function (address, callback) {
  3401            var contract = new Contract(this.eth, this.abi, address);
  3402  
  3403            // this functions are not part of prototype,
  3404            // because we don't want to spoil the interface
  3405            addFunctionsToContract(contract);
  3406            addEventsToContract(contract);
  3407  
  3408            if (callback) {
  3409              callback(null, contract);
  3410            }
  3411            return contract;
  3412          };
  3413  
  3414          /**
  3415           * Gets the data, which is data to deploy plus constructor params
  3416           *
  3417           * @method getData
  3418           */
  3419          ContractFactory.prototype.getData = function () {
  3420            var options = {}; // required!
  3421            var args = Array.prototype.slice.call(arguments);
  3422  
  3423            var last = args[args.length - 1];
  3424            if (utils.isObject(last) && !utils.isArray(last)) {
  3425              options = args.pop();
  3426            }
  3427  
  3428            var bytes = encodeConstructorParams(this.abi, args);
  3429            options.data += bytes;
  3430  
  3431            return options.data;
  3432          };
  3433  
  3434          /**
  3435           * Should be called to create new contract instance
  3436           *
  3437           * @method Contract
  3438           * @param {Array} abi
  3439           * @param {Address} contract address
  3440           */
  3441          var Contract = function (eth, abi, address) {
  3442            this._eth = eth;
  3443            this.transactionHash = null;
  3444            this.address = address;
  3445            this.abi = abi;
  3446          };
  3447  
  3448          module.exports = ContractFactory;
  3449        },
  3450        {
  3451          "../solidity/coder": 7,
  3452          "../utils/utils": 20,
  3453          "./allevents": 23,
  3454          "./event": 27,
  3455          "./function": 31,
  3456        },
  3457      ],
  3458      26: [
  3459        function (require, module, exports) {
  3460          /*
  3461      This file is part of web3.js.
  3462  
  3463      web3.js is free software: you can redistribute it and/or modify
  3464      it under the terms of the GNU Lesser General Public License as published by
  3465      the Free Software Foundation, either version 3 of the License, or
  3466      (at your option) any later version.
  3467  
  3468      web3.js is distributed in the hope that it will be useful,
  3469      but WITHOUT ANY WARRANTY; without even the implied warranty of
  3470      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3471      GNU Lesser General Public License for more details.
  3472  
  3473      You should have received a copy of the GNU Lesser General Public License
  3474      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  3475  */
  3476          /**
  3477           * @file errors.js
  3478           * @author Marek Kotewicz <marek@ethdev.com>
  3479           * @date 2015
  3480           */
  3481  
  3482          module.exports = {
  3483            InvalidNumberOfSolidityArgs: function () {
  3484              return new Error(
  3485                "Invalid number of arguments to Solidity function"
  3486              );
  3487            },
  3488            InvalidNumberOfRPCParams: function () {
  3489              return new Error(
  3490                "Invalid number of input parameters to RPC method"
  3491              );
  3492            },
  3493            InvalidConnection: function (host) {
  3494              return new Error(
  3495                "CONNECTION ERROR: Couldn't connect to node " + host + "."
  3496              );
  3497            },
  3498            InvalidProvider: function () {
  3499              return new Error("Provider not set or invalid");
  3500            },
  3501            InvalidResponse: function (result) {
  3502              var message =
  3503                !!result && !!result.error && !!result.error.message
  3504                  ? result.error.message
  3505                  : "Invalid JSON RPC response: " + JSON.stringify(result);
  3506              return new Error(message);
  3507            },
  3508            ConnectionTimeout: function (ms) {
  3509              return new Error(
  3510                "CONNECTION TIMEOUT: timeout of " + ms + " ms achived"
  3511              );
  3512            },
  3513          };
  3514        },
  3515        {},
  3516      ],
  3517      27: [
  3518        function (require, module, exports) {
  3519          /*
  3520      This file is part of web3.js.
  3521  
  3522      web3.js is free software: you can redistribute it and/or modify
  3523      it under the terms of the GNU Lesser General Public License as published by
  3524      the Free Software Foundation, either version 3 of the License, or
  3525      (at your option) any later version.
  3526  
  3527      web3.js is distributed in the hope that it will be useful,
  3528      but WITHOUT ANY WARRANTY; without even the implied warranty of
  3529      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3530      GNU Lesser General Public License for more details.
  3531  
  3532      You should have received a copy of the GNU Lesser General Public License
  3533      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  3534  */
  3535          /**
  3536           * @file event.js
  3537           * @author Marek Kotewicz <marek@ethdev.com>
  3538           * @date 2014
  3539           */
  3540  
  3541          var utils = require("../utils/utils");
  3542          var coder = require("../solidity/coder");
  3543          var formatters = require("./formatters");
  3544          var sha3 = require("../utils/sha3");
  3545          var Filter = require("./filter");
  3546          var watches = require("./methods/watches");
  3547  
  3548          /**
  3549           * This prototype should be used to create event filters
  3550           */
  3551          var SolidityEvent = function (requestManager, json, address) {
  3552            this._requestManager = requestManager;
  3553            this._params = json.inputs;
  3554            this._name = utils.transformToFullName(json);
  3555            this._address = address;
  3556            this._anonymous = json.anonymous;
  3557          };
  3558  
  3559          /**
  3560           * Should be used to get filtered param types
  3561           *
  3562           * @method types
  3563           * @param {Bool} decide if returned typed should be indexed
  3564           * @return {Array} array of types
  3565           */
  3566          SolidityEvent.prototype.types = function (indexed) {
  3567            return this._params
  3568              .filter(function (i) {
  3569                return i.indexed === indexed;
  3570              })
  3571              .map(function (i) {
  3572                return i.type;
  3573              });
  3574          };
  3575  
  3576          /**
  3577           * Should be used to get event display name
  3578           *
  3579           * @method displayName
  3580           * @return {String} event display name
  3581           */
  3582          SolidityEvent.prototype.displayName = function () {
  3583            return utils.extractDisplayName(this._name);
  3584          };
  3585  
  3586          /**
  3587           * Should be used to get event type name
  3588           *
  3589           * @method typeName
  3590           * @return {String} event type name
  3591           */
  3592          SolidityEvent.prototype.typeName = function () {
  3593            return utils.extractTypeName(this._name);
  3594          };
  3595  
  3596          /**
  3597           * Should be used to get event signature
  3598           *
  3599           * @method signature
  3600           * @return {String} event signature
  3601           */
  3602          SolidityEvent.prototype.signature = function () {
  3603            return sha3(this._name);
  3604          };
  3605  
  3606          /**
  3607           * Should be used to encode indexed params and options to one final object
  3608           *
  3609           * @method encode
  3610           * @param {Object} indexed
  3611           * @param {Object} options
  3612           * @return {Object} everything combined together and encoded
  3613           */
  3614          SolidityEvent.prototype.encode = function (indexed, options) {
  3615            indexed = indexed || {};
  3616            options = options || {};
  3617            var result = {};
  3618  
  3619            ["fromBlock", "toBlock"]
  3620              .filter(function (f) {
  3621                return options[f] !== undefined;
  3622              })
  3623              .forEach(function (f) {
  3624                result[f] = formatters.inputBlockNumberFormatter(options[f]);
  3625              });
  3626  
  3627            result.topics = [];
  3628  
  3629            result.address = this._address;
  3630            if (!this._anonymous) {
  3631              result.topics.push("0x" + this.signature());
  3632            }
  3633  
  3634            var indexedTopics = this._params
  3635              .filter(function (i) {
  3636                return i.indexed === true;
  3637              })
  3638              .map(function (i) {
  3639                var value = indexed[i.name];
  3640                if (value === undefined || value === null) {
  3641                  return null;
  3642                }
  3643  
  3644                if (utils.isArray(value)) {
  3645                  return value.map(function (v) {
  3646                    return "0x" + coder.encodeParam(i.type, v);
  3647                  });
  3648                }
  3649                return "0x" + coder.encodeParam(i.type, value);
  3650              });
  3651  
  3652            result.topics = result.topics.concat(indexedTopics);
  3653  
  3654            return result;
  3655          };
  3656  
  3657          /**
  3658           * Should be used to decode indexed params and options
  3659           *
  3660           * @method decode
  3661           * @param {Object} data
  3662           * @return {Object} result object with decoded indexed && not indexed params
  3663           */
  3664          SolidityEvent.prototype.decode = function (data) {
  3665            data.data = data.data || "";
  3666            data.topics = data.topics || [];
  3667  
  3668            var argTopics = this._anonymous ? data.topics : data.topics.slice(1);
  3669            var indexedData = argTopics
  3670              .map(function (topics) {
  3671                return topics.slice(2);
  3672              })
  3673              .join("");
  3674            var indexedParams = coder.decodeParams(this.types(true), indexedData);
  3675  
  3676            var notIndexedData = data.data.slice(2);
  3677            var notIndexedParams = coder.decodeParams(
  3678              this.types(false),
  3679              notIndexedData
  3680            );
  3681  
  3682            var result = formatters.outputLogFormatter(data);
  3683            result.event = this.displayName();
  3684            result.address = data.address;
  3685  
  3686            result.args = this._params.reduce(function (acc, current) {
  3687              acc[current.name] = current.indexed
  3688                ? indexedParams.shift()
  3689                : notIndexedParams.shift();
  3690              return acc;
  3691            }, {});
  3692  
  3693            delete result.data;
  3694            delete result.topics;
  3695  
  3696            return result;
  3697          };
  3698  
  3699          /**
  3700           * Should be used to create new filter object from event
  3701           *
  3702           * @method execute
  3703           * @param {Object} indexed
  3704           * @param {Object} options
  3705           * @return {Object} filter object
  3706           */
  3707          SolidityEvent.prototype.execute = function (
  3708            indexed,
  3709            options,
  3710            callback
  3711          ) {
  3712            if (utils.isFunction(arguments[arguments.length - 1])) {
  3713              callback = arguments[arguments.length - 1];
  3714              if (arguments.length === 2) options = null;
  3715              if (arguments.length === 1) {
  3716                options = null;
  3717                indexed = {};
  3718              }
  3719            }
  3720  
  3721            var o = this.encode(indexed, options);
  3722            var formatter = this.decode.bind(this);
  3723            return new Filter(
  3724              o,
  3725              "eth",
  3726              this._requestManager,
  3727              watches.eth(),
  3728              formatter,
  3729              callback
  3730            );
  3731          };
  3732  
  3733          /**
  3734           * Should be used to attach event to contract object
  3735           *
  3736           * @method attachToContract
  3737           * @param {Contract}
  3738           */
  3739          SolidityEvent.prototype.attachToContract = function (contract) {
  3740            var execute = this.execute.bind(this);
  3741            var displayName = this.displayName();
  3742            if (!contract[displayName]) {
  3743              contract[displayName] = execute;
  3744            }
  3745            contract[displayName][this.typeName()] = this.execute.bind(
  3746              this,
  3747              contract
  3748            );
  3749          };
  3750  
  3751          module.exports = SolidityEvent;
  3752        },
  3753        {
  3754          "../solidity/coder": 7,
  3755          "../utils/sha3": 19,
  3756          "../utils/utils": 20,
  3757          "./filter": 29,
  3758          "./formatters": 30,
  3759          "./methods/watches": 43,
  3760        },
  3761      ],
  3762      28: [
  3763        function (require, module, exports) {
  3764          var formatters = require("./formatters");
  3765          var utils = require("./../utils/utils");
  3766          var Method = require("./method");
  3767          var Property = require("./property");
  3768  
  3769          // TODO: refactor, so the input params are not altered.
  3770          // it's necessary to make same 'extension' work with multiple providers
  3771          var extend = function (web3) {
  3772            /* jshint maxcomplexity:5 */
  3773            var ex = function (extension) {
  3774              var extendedObject;
  3775              if (extension.property) {
  3776                if (!web3[extension.property]) {
  3777                  web3[extension.property] = {};
  3778                }
  3779                extendedObject = web3[extension.property];
  3780              } else {
  3781                extendedObject = web3;
  3782              }
  3783  
  3784              if (extension.methods) {
  3785                extension.methods.forEach(function (method) {
  3786                  method.attachToObject(extendedObject);
  3787                  method.setRequestManager(web3._requestManager);
  3788                });
  3789              }
  3790  
  3791              if (extension.properties) {
  3792                extension.properties.forEach(function (property) {
  3793                  property.attachToObject(extendedObject);
  3794                  property.setRequestManager(web3._requestManager);
  3795                });
  3796              }
  3797            };
  3798  
  3799            ex.formatters = formatters;
  3800            ex.utils = utils;
  3801            ex.Method = Method;
  3802            ex.Property = Property;
  3803  
  3804            return ex;
  3805          };
  3806  
  3807          module.exports = extend;
  3808        },
  3809        {
  3810          "./../utils/utils": 20,
  3811          "./formatters": 30,
  3812          "./method": 36,
  3813          "./property": 45,
  3814        },
  3815      ],
  3816      29: [
  3817        function (require, module, exports) {
  3818          /*
  3819      This file is part of web3.js.
  3820  
  3821      web3.js is free software: you can redistribute it and/or modify
  3822      it under the terms of the GNU Lesser General Public License as published by
  3823      the Free Software Foundation, either version 3 of the License, or
  3824      (at your option) any later version.
  3825  
  3826      web3.js is distributed in the hope that it will be useful,
  3827      but WITHOUT ANY WARRANTY; without even the implied warranty of
  3828      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3829      GNU Lesser General Public License for more details.
  3830  
  3831      You should have received a copy of the GNU Lesser General Public License
  3832      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  3833  */
  3834          /** @file filter.js
  3835           * @authors:
  3836           *   Jeffrey Wilcke <jeff@ethdev.com>
  3837           *   Marek Kotewicz <marek@ethdev.com>
  3838           *   Marian Oancea <marian@ethdev.com>
  3839           *   Fabian Vogelsteller <fabian@ethdev.com>
  3840           *   Gav Wood <g@ethdev.com>
  3841           * @date 2014
  3842           */
  3843  
  3844          var formatters = require("./formatters");
  3845          var utils = require("../utils/utils");
  3846  
  3847          /**
  3848           * Converts a given topic to a hex string, but also allows null values.
  3849           *
  3850           * @param {Mixed} value
  3851           * @return {String}
  3852           */
  3853          var toTopic = function (value) {
  3854            if (value === null || typeof value === "undefined") return null;
  3855  
  3856            value = String(value);
  3857  
  3858            if (value.indexOf("0x") === 0) return value;
  3859            else return utils.fromUtf8(value);
  3860          };
  3861  
  3862          /// This method should be called on options object, to verify deprecated properties && lazy load dynamic ones
  3863          /// @param should be string or object
  3864          /// @returns options string or object
  3865          var getOptions = function (options, type) {
  3866            /*jshint maxcomplexity: 6 */
  3867  
  3868            if (utils.isString(options)) {
  3869              return options;
  3870            }
  3871  
  3872            options = options || {};
  3873  
  3874            switch (type) {
  3875              case "eth":
  3876                // make sure topics, get converted to hex
  3877                options.topics = options.topics || [];
  3878                options.topics = options.topics.map(function (topic) {
  3879                  return utils.isArray(topic)
  3880                    ? topic.map(toTopic)
  3881                    : toTopic(topic);
  3882                });
  3883  
  3884                return {
  3885                  topics: options.topics,
  3886                  from: options.from,
  3887                  to: options.to,
  3888                  address: options.address,
  3889                  fromBlock: formatters.inputBlockNumberFormatter(
  3890                    options.fromBlock
  3891                  ),
  3892                  toBlock: formatters.inputBlockNumberFormatter(options.toBlock),
  3893                };
  3894              case "shh":
  3895                return options;
  3896            }
  3897          };
  3898  
  3899          /**
  3900  Adds the callback and sets up the methods, to iterate over the results.
  3901  
  3902  @method getLogsAtStart
  3903  @param {Object} self
  3904  @param {function} callback
  3905  */
  3906          var getLogsAtStart = function (self, callback) {
  3907            // call getFilterLogs for the first watch callback start
  3908            if (!utils.isString(self.options)) {
  3909              self.get(function (err, messages) {
  3910                // don't send all the responses to all the watches again... just to self one
  3911                if (err) {
  3912                  callback(err);
  3913                }
  3914  
  3915                if (utils.isArray(messages)) {
  3916                  messages.forEach(function (message) {
  3917                    callback(null, message);
  3918                  });
  3919                }
  3920              });
  3921            }
  3922          };
  3923  
  3924          /**
  3925  Adds the callback and sets up the methods, to iterate over the results.
  3926  
  3927  @method pollFilter
  3928  @param {Object} self
  3929  */
  3930          var pollFilter = function (self) {
  3931            var onMessage = function (error, messages) {
  3932              if (error) {
  3933                return self.callbacks.forEach(function (callback) {
  3934                  callback(error);
  3935                });
  3936              }
  3937  
  3938              if (utils.isArray(messages)) {
  3939                messages.forEach(function (message) {
  3940                  message = self.formatter ? self.formatter(message) : message;
  3941                  self.callbacks.forEach(function (callback) {
  3942                    callback(null, message);
  3943                  });
  3944                });
  3945              }
  3946            };
  3947  
  3948            self.requestManager.startPolling(
  3949              {
  3950                method: self.implementation.poll.call,
  3951                params: [self.filterId],
  3952              },
  3953              self.filterId,
  3954              onMessage,
  3955              self.stopWatching.bind(self)
  3956            );
  3957          };
  3958  
  3959          var Filter = function (
  3960            options,
  3961            type,
  3962            requestManager,
  3963            methods,
  3964            formatter,
  3965            callback,
  3966            filterCreationErrorCallback
  3967          ) {
  3968            var self = this;
  3969            var implementation = {};
  3970            methods.forEach(function (method) {
  3971              method.setRequestManager(requestManager);
  3972              method.attachToObject(implementation);
  3973            });
  3974            this.requestManager = requestManager;
  3975            this.options = getOptions(options, type);
  3976            this.implementation = implementation;
  3977            this.filterId = null;
  3978            this.callbacks = [];
  3979            this.getLogsCallbacks = [];
  3980            this.pollFilters = [];
  3981            this.formatter = formatter;
  3982            this.implementation.newFilter(this.options, function (error, id) {
  3983              if (error) {
  3984                self.callbacks.forEach(function (cb) {
  3985                  cb(error);
  3986                });
  3987                if (typeof filterCreationErrorCallback === "function") {
  3988                  filterCreationErrorCallback(error);
  3989                }
  3990              } else {
  3991                self.filterId = id;
  3992  
  3993                // check if there are get pending callbacks as a consequence
  3994                // of calling get() with filterId unassigned.
  3995                self.getLogsCallbacks.forEach(function (cb) {
  3996                  self.get(cb);
  3997                });
  3998                self.getLogsCallbacks = [];
  3999  
  4000                // get filter logs for the already existing watch calls
  4001                self.callbacks.forEach(function (cb) {
  4002                  getLogsAtStart(self, cb);
  4003                });
  4004                if (self.callbacks.length > 0) pollFilter(self);
  4005  
  4006                // start to watch immediately
  4007                if (typeof callback === "function") {
  4008                  return self.watch(callback);
  4009                }
  4010              }
  4011            });
  4012  
  4013            return this;
  4014          };
  4015  
  4016          Filter.prototype.watch = function (callback) {
  4017            this.callbacks.push(callback);
  4018  
  4019            if (this.filterId) {
  4020              getLogsAtStart(this, callback);
  4021              pollFilter(this);
  4022            }
  4023  
  4024            return this;
  4025          };
  4026  
  4027          Filter.prototype.stopWatching = function (callback) {
  4028            this.requestManager.stopPolling(this.filterId);
  4029            this.callbacks = [];
  4030            // remove filter async
  4031            if (callback) {
  4032              this.implementation.uninstallFilter(this.filterId, callback);
  4033            } else {
  4034              return this.implementation.uninstallFilter(this.filterId);
  4035            }
  4036          };
  4037  
  4038          Filter.prototype.get = function (callback) {
  4039            var self = this;
  4040            if (utils.isFunction(callback)) {
  4041              if (this.filterId === null) {
  4042                // If filterId is not set yet, call it back
  4043                // when newFilter() assigns it.
  4044                this.getLogsCallbacks.push(callback);
  4045              } else {
  4046                this.implementation.getLogs(this.filterId, function (err, res) {
  4047                  if (err) {
  4048                    callback(err);
  4049                  } else {
  4050                    callback(
  4051                      null,
  4052                      res.map(function (log) {
  4053                        return self.formatter ? self.formatter(log) : log;
  4054                      })
  4055                    );
  4056                  }
  4057                });
  4058              }
  4059            } else {
  4060              if (this.filterId === null) {
  4061                throw new Error(
  4062                  "Filter ID Error: filter().get() can't be chained synchronous, please provide a callback for the get() method."
  4063                );
  4064              }
  4065              var logs = this.implementation.getLogs(this.filterId);
  4066              return logs.map(function (log) {
  4067                return self.formatter ? self.formatter(log) : log;
  4068              });
  4069            }
  4070  
  4071            return this;
  4072          };
  4073  
  4074          module.exports = Filter;
  4075        },
  4076        { "../utils/utils": 20, "./formatters": 30 },
  4077      ],
  4078      30: [
  4079        function (require, module, exports) {
  4080          "use strict";
  4081  
  4082          /*
  4083      This file is part of web3.js.
  4084  
  4085      web3.js is free software: you can redistribute it and/or modify
  4086      it under the terms of the GNU Lesser General Public License as published by
  4087      the Free Software Foundation, either version 3 of the License, or
  4088      (at your option) any later version.
  4089  
  4090      web3.js is distributed in the hope that it will be useful,
  4091      but WITHOUT ANY WARRANTY; without even the implied warranty of
  4092      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4093      GNU Lesser General Public License for more details.
  4094  
  4095      You should have received a copy of the GNU Lesser General Public License
  4096      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  4097  */
  4098          /**
  4099           * @file formatters.js
  4100           * @author Marek Kotewicz <marek@ethdev.com>
  4101           * @author Fabian Vogelsteller <fabian@ethdev.com>
  4102           * @date 2015
  4103           */
  4104  
  4105          var utils = require("../utils/utils");
  4106          var config = require("../utils/config");
  4107          var Iban = require("./iban");
  4108  
  4109          /**
  4110           * Should the format output to a big number
  4111           *
  4112           * @method outputBigNumberFormatter
  4113           * @param {String|Number|BigNumber}
  4114           * @returns {BigNumber} object
  4115           */
  4116          var outputBigNumberFormatter = function (number) {
  4117            return utils.toBigNumber(number);
  4118          };
  4119  
  4120          var isPredefinedBlockNumber = function (blockNumber) {
  4121            return (
  4122              blockNumber === "latest" ||
  4123              blockNumber === "pending" ||
  4124              blockNumber === "earliest"
  4125            );
  4126          };
  4127  
  4128          var inputDefaultBlockNumberFormatter = function (blockNumber) {
  4129            if (blockNumber === undefined) {
  4130              return config.defaultBlock;
  4131            }
  4132            return inputBlockNumberFormatter(blockNumber);
  4133          };
  4134  
  4135          var inputBlockNumberFormatter = function (blockNumber) {
  4136            if (blockNumber === undefined) {
  4137              return undefined;
  4138            } else if (isPredefinedBlockNumber(blockNumber)) {
  4139              return blockNumber;
  4140            }
  4141            return utils.toHex(blockNumber);
  4142          };
  4143  
  4144          /**
  4145           * Formats the input of a transaction and converts all values to HEX
  4146           *
  4147           * @method inputCallFormatter
  4148           * @param {Object} transaction options
  4149           * @returns object
  4150           */
  4151          var inputCallFormatter = function (options) {
  4152            options.from = options.from || config.defaultAccount;
  4153  
  4154            if (options.from) {
  4155              options.from = inputAddressFormatter(options.from);
  4156            }
  4157  
  4158            if (options.to) {
  4159              // it might be contract creation
  4160              options.to = inputAddressFormatter(options.to);
  4161            }
  4162  
  4163            ["gasPrice", "gas", "value", "nonce"]
  4164              .filter(function (key) {
  4165                return options[key] !== undefined;
  4166              })
  4167              .forEach(function (key) {
  4168                options[key] = utils.fromDecimal(options[key]);
  4169              });
  4170  
  4171            return options;
  4172          };
  4173  
  4174          /**
  4175           * Formats the input of a transaction and converts all values to HEX
  4176           *
  4177           * @method inputTransactionFormatter
  4178           * @param {Object} transaction options
  4179           * @returns object
  4180           */
  4181          var inputTransactionFormatter = function (options) {
  4182            options.from = options.from || config.defaultAccount;
  4183            options.from = inputAddressFormatter(options.from);
  4184  
  4185            if (options.to) {
  4186              // it might be contract creation
  4187              options.to = inputAddressFormatter(options.to);
  4188            }
  4189  
  4190            ["gasPrice", "gas", "value", "nonce"]
  4191              .filter(function (key) {
  4192                return options[key] !== undefined;
  4193              })
  4194              .forEach(function (key) {
  4195                options[key] = utils.fromDecimal(options[key]);
  4196              });
  4197  
  4198            return options;
  4199          };
  4200  
  4201          /**
  4202           * Formats the output of a transaction to its proper values
  4203           *
  4204           * @method outputTransactionFormatter
  4205           * @param {Object} tx
  4206           * @returns {Object}
  4207           */
  4208          var outputTransactionFormatter = function (tx) {
  4209            if (tx.blockNumber !== null)
  4210              tx.blockNumber = utils.toDecimal(tx.blockNumber);
  4211            if (tx.transactionIndex !== null)
  4212              tx.transactionIndex = utils.toDecimal(tx.transactionIndex);
  4213            tx.nonce = utils.toDecimal(tx.nonce);
  4214            tx.gas = utils.toDecimal(tx.gas);
  4215            tx.gasPrice = utils.toBigNumber(tx.gasPrice);
  4216            tx.value = utils.toBigNumber(tx.value);
  4217            return tx;
  4218          };
  4219  
  4220          /**
  4221           * Formats the output of a transaction receipt to its proper values
  4222           *
  4223           * @method outputTransactionReceiptFormatter
  4224           * @param {Object} receipt
  4225           * @returns {Object}
  4226           */
  4227          var outputTransactionReceiptFormatter = function (receipt) {
  4228            if (receipt.blockNumber !== null)
  4229              receipt.blockNumber = utils.toDecimal(receipt.blockNumber);
  4230            if (receipt.transactionIndex !== null)
  4231              receipt.transactionIndex = utils.toDecimal(
  4232                receipt.transactionIndex
  4233              );
  4234            receipt.cumulativeGasUsed = utils.toDecimal(
  4235              receipt.cumulativeGasUsed
  4236            );
  4237            receipt.gasUsed = utils.toDecimal(receipt.gasUsed);
  4238  
  4239            if (utils.isArray(receipt.logs)) {
  4240              receipt.logs = receipt.logs.map(function (log) {
  4241                return outputLogFormatter(log);
  4242              });
  4243            }
  4244  
  4245            return receipt;
  4246          };
  4247  
  4248          /**
  4249           * Formats the output of a block to its proper values
  4250           *
  4251           * @method outputBlockFormatter
  4252           * @param {Object} block
  4253           * @returns {Object}
  4254           */
  4255          var outputBlockFormatter = function (block) {
  4256            // transform to number
  4257            block.gasLimit = utils.toDecimal(block.gasLimit);
  4258            block.gasUsed = utils.toDecimal(block.gasUsed);
  4259            block.size = utils.toDecimal(block.size);
  4260            block.timestamp = utils.toDecimal(block.timestamp);
  4261            if (block.number !== null)
  4262              block.number = utils.toDecimal(block.number);
  4263  
  4264            block.difficulty = utils.toBigNumber(block.difficulty);
  4265            block.totalDifficulty = utils.toBigNumber(block.totalDifficulty);
  4266  
  4267            if (utils.isArray(block.transactions)) {
  4268              block.transactions.forEach(function (item) {
  4269                if (!utils.isString(item))
  4270                  return outputTransactionFormatter(item);
  4271              });
  4272            }
  4273  
  4274            return block;
  4275          };
  4276  
  4277          /**
  4278           * Formats the output of a log
  4279           *
  4280           * @method outputLogFormatter
  4281           * @param {Object} log object
  4282           * @returns {Object} log
  4283           */
  4284          var outputLogFormatter = function (log) {
  4285            if (log.blockNumber)
  4286              log.blockNumber = utils.toDecimal(log.blockNumber);
  4287            if (log.transactionIndex)
  4288              log.transactionIndex = utils.toDecimal(log.transactionIndex);
  4289            if (log.logIndex) log.logIndex = utils.toDecimal(log.logIndex);
  4290  
  4291            return log;
  4292          };
  4293  
  4294          /**
  4295           * Formats the input of a whisper post and converts all values to HEX
  4296           *
  4297           * @method inputPostFormatter
  4298           * @param {Object} transaction object
  4299           * @returns {Object}
  4300           */
  4301          var inputPostFormatter = function (post) {
  4302            // post.payload = utils.toHex(post.payload);
  4303            post.ttl = utils.fromDecimal(post.ttl);
  4304            post.workToProve = utils.fromDecimal(post.workToProve);
  4305            post.priority = utils.fromDecimal(post.priority);
  4306  
  4307            // fallback
  4308            if (!utils.isArray(post.topics)) {
  4309              post.topics = post.topics ? [post.topics] : [];
  4310            }
  4311  
  4312            // format the following options
  4313            post.topics = post.topics.map(function (topic) {
  4314              // convert only if not hex
  4315              return topic.indexOf("0x") === 0 ? topic : utils.fromUtf8(topic);
  4316            });
  4317  
  4318            return post;
  4319          };
  4320  
  4321          /**
  4322           * Formats the output of a received post message
  4323           *
  4324           * @method outputPostFormatter
  4325           * @param {Object}
  4326           * @returns {Object}
  4327           */
  4328          var outputPostFormatter = function (post) {
  4329            post.expiry = utils.toDecimal(post.expiry);
  4330            post.sent = utils.toDecimal(post.sent);
  4331            post.ttl = utils.toDecimal(post.ttl);
  4332            post.workProved = utils.toDecimal(post.workProved);
  4333            // post.payloadRaw = post.payload;
  4334            // post.payload = utils.toAscii(post.payload);
  4335  
  4336            // if (utils.isJson(post.payload)) {
  4337            //     post.payload = JSON.parse(post.payload);
  4338            // }
  4339  
  4340            // format the following options
  4341            if (!post.topics) {
  4342              post.topics = [];
  4343            }
  4344            post.topics = post.topics.map(function (topic) {
  4345              return utils.toAscii(topic);
  4346            });
  4347  
  4348            return post;
  4349          };
  4350  
  4351          var inputAddressFormatter = function (address) {
  4352            var iban = new Iban(address);
  4353            if (iban.isValid() && iban.isDirect()) {
  4354              return "0x" + iban.address();
  4355            } else if (utils.isStrictAddress(address)) {
  4356              return address;
  4357            } else if (utils.isAddress(address)) {
  4358              return "0x" + address;
  4359            }
  4360            throw new Error("invalid address");
  4361          };
  4362  
  4363          var outputSyncingFormatter = function (result) {
  4364            if (!result) {
  4365              return result;
  4366            }
  4367  
  4368            result.startingBlock = utils.toDecimal(result.startingBlock);
  4369            result.currentBlock = utils.toDecimal(result.currentBlock);
  4370            result.highestBlock = utils.toDecimal(result.highestBlock);
  4371            if (result.knownStates) {
  4372              result.knownStates = utils.toDecimal(result.knownStates);
  4373              result.pulledStates = utils.toDecimal(result.pulledStates);
  4374            }
  4375  
  4376            return result;
  4377          };
  4378  
  4379          module.exports = {
  4380            inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter,
  4381            inputBlockNumberFormatter: inputBlockNumberFormatter,
  4382            inputCallFormatter: inputCallFormatter,
  4383            inputTransactionFormatter: inputTransactionFormatter,
  4384            inputAddressFormatter: inputAddressFormatter,
  4385            inputPostFormatter: inputPostFormatter,
  4386            outputBigNumberFormatter: outputBigNumberFormatter,
  4387            outputTransactionFormatter: outputTransactionFormatter,
  4388            outputTransactionReceiptFormatter: outputTransactionReceiptFormatter,
  4389            outputBlockFormatter: outputBlockFormatter,
  4390            outputLogFormatter: outputLogFormatter,
  4391            outputPostFormatter: outputPostFormatter,
  4392            outputSyncingFormatter: outputSyncingFormatter,
  4393          };
  4394        },
  4395        { "../utils/config": 18, "../utils/utils": 20, "./iban": 33 },
  4396      ],
  4397      31: [
  4398        function (require, module, exports) {
  4399          /*
  4400      This file is part of web3.js.
  4401  
  4402      web3.js is free software: you can redistribute it and/or modify
  4403      it under the terms of the GNU Lesser General Public License as published by
  4404      the Free Software Foundation, either version 3 of the License, or
  4405      (at your option) any later version.
  4406  
  4407      web3.js is distributed in the hope that it will be useful,
  4408      but WITHOUT ANY WARRANTY; without even the implied warranty of
  4409      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4410      GNU Lesser General Public License for more details.
  4411  
  4412      You should have received a copy of the GNU Lesser General Public License
  4413      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  4414  */
  4415          /**
  4416           * @file function.js
  4417           * @author Marek Kotewicz <marek@ethdev.com>
  4418           * @date 2015
  4419           */
  4420  
  4421          var coder = require("../solidity/coder");
  4422          var utils = require("../utils/utils");
  4423          var errors = require("./errors");
  4424          var formatters = require("./formatters");
  4425          var sha3 = require("../utils/sha3");
  4426  
  4427          /**
  4428           * This prototype should be used to call/sendTransaction to solidity functions
  4429           */
  4430          var SolidityFunction = function (eth, json, address) {
  4431            this._eth = eth;
  4432            this._inputTypes = json.inputs.map(function (i) {
  4433              return i.type;
  4434            });
  4435            this._outputTypes = json.outputs.map(function (i) {
  4436              return i.type;
  4437            });
  4438            this._constant = json.constant;
  4439            this._payable = json.payable;
  4440            this._name = utils.transformToFullName(json);
  4441            this._address = address;
  4442          };
  4443  
  4444          SolidityFunction.prototype.extractCallback = function (args) {
  4445            if (utils.isFunction(args[args.length - 1])) {
  4446              return args.pop(); // modify the args array!
  4447            }
  4448          };
  4449  
  4450          SolidityFunction.prototype.extractDefaultBlock = function (args) {
  4451            if (
  4452              args.length > this._inputTypes.length &&
  4453              !utils.isObject(args[args.length - 1])
  4454            ) {
  4455              return formatters.inputDefaultBlockNumberFormatter(args.pop()); // modify the args array!
  4456            }
  4457          };
  4458  
  4459          /**
  4460           * Should be called to check if the number of arguments is correct
  4461           *
  4462           * @method validateArgs
  4463           * @param {Array} arguments
  4464           * @throws {Error} if it is not
  4465           */
  4466          SolidityFunction.prototype.validateArgs = function (args) {
  4467            var inputArgs = args.filter(function (a) {
  4468              // filter the options object but not arguments that are arrays
  4469              return !(
  4470                utils.isObject(a) === true &&
  4471                utils.isArray(a) === false &&
  4472                utils.isBigNumber(a) === false
  4473              );
  4474            });
  4475            if (inputArgs.length !== this._inputTypes.length) {
  4476              throw errors.InvalidNumberOfSolidityArgs();
  4477            }
  4478          };
  4479  
  4480          /**
  4481           * Should be used to create payload from arguments
  4482           *
  4483           * @method toPayload
  4484           * @param {Array} solidity function params
  4485           * @param {Object} optional payload options
  4486           */
  4487          SolidityFunction.prototype.toPayload = function (args) {
  4488            var options = {};
  4489            if (
  4490              args.length > this._inputTypes.length &&
  4491              utils.isObject(args[args.length - 1])
  4492            ) {
  4493              options = args[args.length - 1];
  4494            }
  4495            this.validateArgs(args);
  4496            options.to = this._address;
  4497            options.data =
  4498              "0x" +
  4499              this.signature() +
  4500              coder.encodeParams(this._inputTypes, args);
  4501            return options;
  4502          };
  4503  
  4504          /**
  4505           * Should be used to get function signature
  4506           *
  4507           * @method signature
  4508           * @return {String} function signature
  4509           */
  4510          SolidityFunction.prototype.signature = function () {
  4511            return sha3(this._name).slice(0, 8);
  4512          };
  4513  
  4514          SolidityFunction.prototype.unpackOutput = function (output) {
  4515            if (!output) {
  4516              return;
  4517            }
  4518  
  4519            output = output.length >= 2 ? output.slice(2) : output;
  4520            var result = coder.decodeParams(this._outputTypes, output);
  4521            return result.length === 1 ? result[0] : result;
  4522          };
  4523  
  4524          /**
  4525           * Calls a contract function.
  4526           *
  4527           * @method call
  4528           * @param {...Object} Contract function arguments
  4529           * @param {function} If the last argument is a function, the contract function
  4530           *   call will be asynchronous, and the callback will be passed the
  4531           *   error and result.
  4532           * @return {String} output bytes
  4533           */
  4534          SolidityFunction.prototype.call = function () {
  4535            var args = Array.prototype.slice.call(arguments).filter(function (a) {
  4536              return a !== undefined;
  4537            });
  4538            var callback = this.extractCallback(args);
  4539            var defaultBlock = this.extractDefaultBlock(args);
  4540            var payload = this.toPayload(args);
  4541  
  4542            if (!callback) {
  4543              var output = this._eth.call(payload, defaultBlock);
  4544              return this.unpackOutput(output);
  4545            }
  4546  
  4547            var self = this;
  4548            this._eth.call(payload, defaultBlock, function (error, output) {
  4549              if (error) return callback(error, null);
  4550  
  4551              var unpacked = null;
  4552              try {
  4553                unpacked = self.unpackOutput(output);
  4554              } catch (e) {
  4555                error = e;
  4556              }
  4557  
  4558              callback(error, unpacked);
  4559            });
  4560          };
  4561  
  4562          /**
  4563           * Should be used to sendTransaction to solidity function
  4564           *
  4565           * @method sendTransaction
  4566           */
  4567          SolidityFunction.prototype.sendTransaction = function () {
  4568            var args = Array.prototype.slice.call(arguments).filter(function (a) {
  4569              return a !== undefined;
  4570            });
  4571            var callback = this.extractCallback(args);
  4572            var payload = this.toPayload(args);
  4573  
  4574            if (payload.value > 0 && !this._payable) {
  4575              throw new Error("Cannot send value to non-payable function");
  4576            }
  4577  
  4578            if (!callback) {
  4579              return this._eth.sendTransaction(payload);
  4580            }
  4581  
  4582            this._eth.sendTransaction(payload, callback);
  4583          };
  4584  
  4585          /**
  4586           * Should be used to estimateGas of solidity function
  4587           *
  4588           * @method estimateGas
  4589           */
  4590          SolidityFunction.prototype.estimateGas = function () {
  4591            var args = Array.prototype.slice.call(arguments);
  4592            var callback = this.extractCallback(args);
  4593            var payload = this.toPayload(args);
  4594  
  4595            if (!callback) {
  4596              return this._eth.estimateGas(payload);
  4597            }
  4598  
  4599            this._eth.estimateGas(payload, callback);
  4600          };
  4601  
  4602          /**
  4603           * Return the encoded data of the call
  4604           *
  4605           * @method getData
  4606           * @return {String} the encoded data
  4607           */
  4608          SolidityFunction.prototype.getData = function () {
  4609            var args = Array.prototype.slice.call(arguments);
  4610            var payload = this.toPayload(args);
  4611  
  4612            return payload.data;
  4613          };
  4614  
  4615          /**
  4616           * Should be used to get function display name
  4617           *
  4618           * @method displayName
  4619           * @return {String} display name of the function
  4620           */
  4621          SolidityFunction.prototype.displayName = function () {
  4622            return utils.extractDisplayName(this._name);
  4623          };
  4624  
  4625          /**
  4626           * Should be used to get function type name
  4627           *
  4628           * @method typeName
  4629           * @return {String} type name of the function
  4630           */
  4631          SolidityFunction.prototype.typeName = function () {
  4632            return utils.extractTypeName(this._name);
  4633          };
  4634  
  4635          /**
  4636           * Should be called to get rpc requests from solidity function
  4637           *
  4638           * @method request
  4639           * @returns {Object}
  4640           */
  4641          SolidityFunction.prototype.request = function () {
  4642            var args = Array.prototype.slice.call(arguments);
  4643            var callback = this.extractCallback(args);
  4644            var payload = this.toPayload(args);
  4645            var format = this.unpackOutput.bind(this);
  4646  
  4647            return {
  4648              method: this._constant ? "eth_call" : "eth_sendTransaction",
  4649              callback: callback,
  4650              params: [payload],
  4651              format: format,
  4652            };
  4653          };
  4654  
  4655          /**
  4656           * Should be called to execute function
  4657           *
  4658           * @method execute
  4659           */
  4660          SolidityFunction.prototype.execute = function () {
  4661            var transaction = !this._constant;
  4662  
  4663            // send transaction
  4664            if (transaction) {
  4665              return this.sendTransaction.apply(
  4666                this,
  4667                Array.prototype.slice.call(arguments)
  4668              );
  4669            }
  4670  
  4671            // call
  4672            return this.call.apply(this, Array.prototype.slice.call(arguments));
  4673          };
  4674  
  4675          /**
  4676           * Should be called to attach function to contract
  4677           *
  4678           * @method attachToContract
  4679           * @param {Contract}
  4680           */
  4681          SolidityFunction.prototype.attachToContract = function (contract) {
  4682            var execute = this.execute.bind(this);
  4683            execute.request = this.request.bind(this);
  4684            execute.call = this.call.bind(this);
  4685            execute.sendTransaction = this.sendTransaction.bind(this);
  4686            execute.estimateGas = this.estimateGas.bind(this);
  4687            execute.getData = this.getData.bind(this);
  4688            var displayName = this.displayName();
  4689            if (!contract[displayName]) {
  4690              contract[displayName] = execute;
  4691            }
  4692            contract[displayName][this.typeName()] = execute; // circular!!!!
  4693          };
  4694  
  4695          module.exports = SolidityFunction;
  4696        },
  4697        {
  4698          "../solidity/coder": 7,
  4699          "../utils/sha3": 19,
  4700          "../utils/utils": 20,
  4701          "./errors": 26,
  4702          "./formatters": 30,
  4703        },
  4704      ],
  4705      32: [
  4706        function (require, module, exports) {
  4707          /*
  4708      This file is part of web3.js.
  4709  
  4710      web3.js is free software: you can redistribute it and/or modify
  4711      it under the terms of the GNU Lesser General Public License as published by
  4712      the Free Software Foundation, either version 3 of the License, or
  4713      (at your option) any later version.
  4714  
  4715      web3.js is distributed in the hope that it will be useful,
  4716      but WITHOUT ANY WARRANTY; without even the implied warranty of
  4717      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4718      GNU Lesser General Public License for more details.
  4719  
  4720      You should have received a copy of the GNU Lesser General Public License
  4721      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  4722  */
  4723          /** @file httpprovider.js
  4724           * @authors:
  4725           *   Marek Kotewicz <marek@ethdev.com>
  4726           *   Marian Oancea <marian@ethdev.com>
  4727           *   Fabian Vogelsteller <fabian@ethdev.com>
  4728           * @date 2015
  4729           */
  4730  
  4731          var errors = require("./errors");
  4732  
  4733          // workaround to use httpprovider in different envs
  4734  
  4735          // browser
  4736          if (typeof window !== "undefined" && window.XMLHttpRequest) {
  4737            XMLHttpRequest = window.XMLHttpRequest; // jshint ignore: line
  4738            // node
  4739          } else {
  4740            XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; // jshint ignore: line
  4741          }
  4742  
  4743          var XHR2 = require("xhr2"); // jshint ignore: line
  4744  
  4745          /**
  4746           * HttpProvider should be used to send rpc calls over http
  4747           */
  4748          var HttpProvider = function (host, timeout, user, password) {
  4749            this.host = host || "http://localhost:8545";
  4750            this.timeout = timeout || 0;
  4751            this.user = user;
  4752            this.password = password;
  4753          };
  4754  
  4755          /**
  4756           * Should be called to prepare new XMLHttpRequest
  4757           *
  4758           * @method prepareRequest
  4759           * @param {Boolean} true if request should be async
  4760           * @return {XMLHttpRequest} object
  4761           */
  4762          HttpProvider.prototype.prepareRequest = function (async) {
  4763            var request;
  4764  
  4765            if (async) {
  4766              request = new XHR2();
  4767              request.timeout = this.timeout;
  4768            } else {
  4769              request = new XMLHttpRequest();
  4770            }
  4771  
  4772            request.open("POST", this.host, async);
  4773            if (this.user && this.password) {
  4774              var auth =
  4775                "Basic " +
  4776                new Buffer(this.user + ":" + this.password).toString("base64");
  4777              request.setRequestHeader("Authorization", auth);
  4778            }
  4779            request.setRequestHeader("Content-Type", "application/json");
  4780            return request;
  4781          };
  4782  
  4783          /**
  4784           * Should be called to make sync request
  4785           *
  4786           * @method send
  4787           * @param {Object} payload
  4788           * @return {Object} result
  4789           */
  4790          HttpProvider.prototype.send = function (payload) {
  4791            var request = this.prepareRequest(false);
  4792  
  4793            try {
  4794              request.send(JSON.stringify(payload));
  4795            } catch (error) {
  4796              throw errors.InvalidConnection(this.host);
  4797            }
  4798  
  4799            var result = request.responseText;
  4800  
  4801            try {
  4802              result = JSON.parse(result);
  4803            } catch (e) {
  4804              throw errors.InvalidResponse(request.responseText);
  4805            }
  4806  
  4807            return result;
  4808          };
  4809  
  4810          /**
  4811           * Should be used to make async request
  4812           *
  4813           * @method sendAsync
  4814           * @param {Object} payload
  4815           * @param {Function} callback triggered on end with (err, result)
  4816           */
  4817          HttpProvider.prototype.sendAsync = function (payload, callback) {
  4818            var request = this.prepareRequest(true);
  4819  
  4820            request.onreadystatechange = function () {
  4821              if (request.readyState === 4 && request.timeout !== 1) {
  4822                var result = request.responseText;
  4823                var error = null;
  4824  
  4825                try {
  4826                  result = JSON.parse(result);
  4827                } catch (e) {
  4828                  error = errors.InvalidResponse(request.responseText);
  4829                }
  4830  
  4831                callback(error, result);
  4832              }
  4833            };
  4834  
  4835            request.ontimeout = function () {
  4836              callback(errors.ConnectionTimeout(this.timeout));
  4837            };
  4838  
  4839            try {
  4840              request.send(JSON.stringify(payload));
  4841            } catch (error) {
  4842              callback(errors.InvalidConnection(this.host));
  4843            }
  4844          };
  4845  
  4846          /**
  4847           * Synchronously tries to make Http request
  4848           *
  4849           * @method isConnected
  4850           * @return {Boolean} returns true if request haven't failed. Otherwise false
  4851           */
  4852          HttpProvider.prototype.isConnected = function () {
  4853            try {
  4854              this.send({
  4855                id: 9999999999,
  4856                jsonrpc: "2.0",
  4857                method: "net_listening",
  4858                params: [],
  4859              });
  4860              return true;
  4861            } catch (e) {
  4862              return false;
  4863            }
  4864          };
  4865  
  4866          module.exports = HttpProvider;
  4867        },
  4868        { "./errors": 26, xhr2: 86, xmlhttprequest: 17 },
  4869      ],
  4870      33: [
  4871        function (require, module, exports) {
  4872          /*
  4873      This file is part of web3.js.
  4874  
  4875      web3.js is free software: you can redistribute it and/or modify
  4876      it under the terms of the GNU Lesser General Public License as published by
  4877      the Free Software Foundation, either version 3 of the License, or
  4878      (at your option) any later version.
  4879  
  4880      web3.js is distributed in the hope that it will be useful,
  4881      but WITHOUT ANY WARRANTY; without even the implied warranty of
  4882      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4883      GNU Lesser General Public License for more details.
  4884  
  4885      You should have received a copy of the GNU Lesser General Public License
  4886      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  4887  */
  4888          /**
  4889           * @file iban.js
  4890           * @author Marek Kotewicz <marek@ethdev.com>
  4891           * @date 2015
  4892           */
  4893  
  4894          var BigNumber = require("bignumber.js");
  4895  
  4896          var padLeft = function (string, bytes) {
  4897            var result = string;
  4898            while (result.length < bytes * 2) {
  4899              result = "0" + result;
  4900            }
  4901            return result;
  4902          };
  4903  
  4904          /**
  4905           * Prepare an IBAN for mod 97 computation by moving the first 4 chars to the end and transforming the letters to
  4906           * numbers (A = 10, B = 11, ..., Z = 35), as specified in ISO13616.
  4907           *
  4908           * @method iso13616Prepare
  4909           * @param {String} iban the IBAN
  4910           * @returns {String} the prepared IBAN
  4911           */
  4912          var iso13616Prepare = function (iban) {
  4913            var A = "A".charCodeAt(0);
  4914            var Z = "Z".charCodeAt(0);
  4915  
  4916            iban = iban.toUpperCase();
  4917            iban = iban.substr(4) + iban.substr(0, 4);
  4918  
  4919            return iban
  4920              .split("")
  4921              .map(function (n) {
  4922                var code = n.charCodeAt(0);
  4923                if (code >= A && code <= Z) {
  4924                  // A = 10, B = 11, ... Z = 35
  4925                  return code - A + 10;
  4926                } else {
  4927                  return n;
  4928                }
  4929              })
  4930              .join("");
  4931          };
  4932  
  4933          /**
  4934           * Calculates the MOD 97 10 of the passed IBAN as specified in ISO7064.
  4935           *
  4936           * @method mod9710
  4937           * @param {String} iban
  4938           * @returns {Number}
  4939           */
  4940          var mod9710 = function (iban) {
  4941            var remainder = iban,
  4942              block;
  4943  
  4944            while (remainder.length > 2) {
  4945              block = remainder.slice(0, 9);
  4946              remainder =
  4947                (parseInt(block, 10) % 97) + remainder.slice(block.length);
  4948            }
  4949  
  4950            return parseInt(remainder, 10) % 97;
  4951          };
  4952  
  4953          /**
  4954           * This prototype should be used to create iban object from iban correct string
  4955           *
  4956           * @param {String} iban
  4957           */
  4958          var Iban = function (iban) {
  4959            this._iban = iban;
  4960          };
  4961  
  4962          /**
  4963           * This method should be used to create iban object from ethereum address
  4964           *
  4965           * @method fromAddress
  4966           * @param {String} address
  4967           * @return {Iban} the IBAN object
  4968           */
  4969          Iban.fromAddress = function (address) {
  4970            var asBn = new BigNumber(address, 16);
  4971            var base36 = asBn.toString(36);
  4972            var padded = padLeft(base36, 15);
  4973            return Iban.fromBban(padded.toUpperCase());
  4974          };
  4975  
  4976          /**
  4977           * Convert the passed BBAN to an IBAN for this country specification.
  4978           * Please note that <i>"generation of the IBAN shall be the exclusive responsibility of the bank/branch servicing the account"</i>.
  4979           * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits
  4980           *
  4981           * @method fromBban
  4982           * @param {String} bban the BBAN to convert to IBAN
  4983           * @returns {Iban} the IBAN object
  4984           */
  4985          Iban.fromBban = function (bban) {
  4986            var countryCode = "XE";
  4987  
  4988            var remainder = mod9710(iso13616Prepare(countryCode + "00" + bban));
  4989            var checkDigit = ("0" + (98 - remainder)).slice(-2);
  4990  
  4991            return new Iban(countryCode + checkDigit + bban);
  4992          };
  4993  
  4994          /**
  4995           * Should be used to create IBAN object for given institution and identifier
  4996           *
  4997           * @method createIndirect
  4998           * @param {Object} options, required options are "institution" and "identifier"
  4999           * @return {Iban} the IBAN object
  5000           */
  5001          Iban.createIndirect = function (options) {
  5002            return Iban.fromBban(
  5003              "ETH" + options.institution + options.identifier
  5004            );
  5005          };
  5006  
  5007          /**
  5008           * Thos method should be used to check if given string is valid iban object
  5009           *
  5010           * @method isValid
  5011           * @param {String} iban string
  5012           * @return {Boolean} true if it is valid IBAN
  5013           */
  5014          Iban.isValid = function (iban) {
  5015            var i = new Iban(iban);
  5016            return i.isValid();
  5017          };
  5018  
  5019          /**
  5020           * Should be called to check if iban is correct
  5021           *
  5022           * @method isValid
  5023           * @returns {Boolean} true if it is, otherwise false
  5024           */
  5025          Iban.prototype.isValid = function () {
  5026            return (
  5027              /^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(this._iban) &&
  5028              mod9710(iso13616Prepare(this._iban)) === 1
  5029            );
  5030          };
  5031  
  5032          /**
  5033           * Should be called to check if iban number is direct
  5034           *
  5035           * @method isDirect
  5036           * @returns {Boolean} true if it is, otherwise false
  5037           */
  5038          Iban.prototype.isDirect = function () {
  5039            return this._iban.length === 34 || this._iban.length === 35;
  5040          };
  5041  
  5042          /**
  5043           * Should be called to check if iban number if indirect
  5044           *
  5045           * @method isIndirect
  5046           * @returns {Boolean} true if it is, otherwise false
  5047           */
  5048          Iban.prototype.isIndirect = function () {
  5049            return this._iban.length === 20;
  5050          };
  5051  
  5052          /**
  5053           * Should be called to get iban checksum
  5054           * Uses the mod-97-10 checksumming protocol (ISO/IEC 7064:2003)
  5055           *
  5056           * @method checksum
  5057           * @returns {String} checksum
  5058           */
  5059          Iban.prototype.checksum = function () {
  5060            return this._iban.substr(2, 2);
  5061          };
  5062  
  5063          /**
  5064           * Should be called to get institution identifier
  5065           * eg. XREG
  5066           *
  5067           * @method institution
  5068           * @returns {String} institution identifier
  5069           */
  5070          Iban.prototype.institution = function () {
  5071            return this.isIndirect() ? this._iban.substr(7, 4) : "";
  5072          };
  5073  
  5074          /**
  5075           * Should be called to get client identifier within institution
  5076           * eg. GAVOFYORK
  5077           *
  5078           * @method client
  5079           * @returns {String} client identifier
  5080           */
  5081          Iban.prototype.client = function () {
  5082            return this.isIndirect() ? this._iban.substr(11) : "";
  5083          };
  5084  
  5085          /**
  5086           * Should be called to get client direct address
  5087           *
  5088           * @method address
  5089           * @returns {String} client direct address
  5090           */
  5091          Iban.prototype.address = function () {
  5092            if (this.isDirect()) {
  5093              var base36 = this._iban.substr(4);
  5094              var asBn = new BigNumber(base36, 36);
  5095              return padLeft(asBn.toString(16), 20);
  5096            }
  5097  
  5098            return "";
  5099          };
  5100  
  5101          Iban.prototype.toString = function () {
  5102            return this._iban;
  5103          };
  5104  
  5105          module.exports = Iban;
  5106        },
  5107        { "bignumber.js": "bignumber.js" },
  5108      ],
  5109      34: [
  5110        function (require, module, exports) {
  5111          /*
  5112      This file is part of web3.js.
  5113  
  5114      web3.js is free software: you can redistribute it and/or modify
  5115      it under the terms of the GNU Lesser General Public License as published by
  5116      the Free Software Foundation, either version 3 of the License, or
  5117      (at your option) any later version.
  5118  
  5119      web3.js is distributed in the hope that it will be useful,
  5120      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5121      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5122      GNU Lesser General Public License for more details.
  5123  
  5124      You should have received a copy of the GNU Lesser General Public License
  5125      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5126  */
  5127          /** @file ipcprovider.js
  5128           * @authors:
  5129           *   Fabian Vogelsteller <fabian@ethdev.com>
  5130           * @date 2015
  5131           */
  5132  
  5133          "use strict";
  5134  
  5135          var utils = require("../utils/utils");
  5136          var errors = require("./errors");
  5137  
  5138          var IpcProvider = function (path, net) {
  5139            var _this = this;
  5140            this.responseCallbacks = {};
  5141            this.path = path;
  5142  
  5143            this.connection = net.connect({ path: this.path });
  5144  
  5145            this.connection.on("error", function (e) {
  5146              console.error("IPC Connection Error", e);
  5147              _this._timeout();
  5148            });
  5149  
  5150            this.connection.on("end", function () {
  5151              _this._timeout();
  5152            });
  5153  
  5154            // LISTEN FOR CONNECTION RESPONSES
  5155            this.connection.on("data", function (data) {
  5156              /*jshint maxcomplexity: 6 */
  5157  
  5158              _this._parseResponse(data.toString()).forEach(function (result) {
  5159                var id = null;
  5160  
  5161                // get the id which matches the returned id
  5162                if (utils.isArray(result)) {
  5163                  result.forEach(function (load) {
  5164                    if (_this.responseCallbacks[load.id]) id = load.id;
  5165                  });
  5166                } else {
  5167                  id = result.id;
  5168                }
  5169  
  5170                // fire the callback
  5171                if (_this.responseCallbacks[id]) {
  5172                  _this.responseCallbacks[id](null, result);
  5173                  delete _this.responseCallbacks[id];
  5174                }
  5175              });
  5176            });
  5177          };
  5178  
  5179          /**
  5180  Will parse the response and make an array out of it.
  5181  
  5182  @method _parseResponse
  5183  @param {String} data
  5184  */
  5185          IpcProvider.prototype._parseResponse = function (data) {
  5186            var _this = this,
  5187              returnValues = [];
  5188  
  5189            // DE-CHUNKER
  5190            var dechunkedData = data
  5191              .replace(/\}[\n\r]?\{/g, "}|--|{") // }{
  5192              .replace(/\}\][\n\r]?\[\{/g, "}]|--|[{") // }][{
  5193              .replace(/\}[\n\r]?\[\{/g, "}|--|[{") // }[{
  5194              .replace(/\}\][\n\r]?\{/g, "}]|--|{") // }]{
  5195              .split("|--|");
  5196  
  5197            dechunkedData.forEach(function (data) {
  5198              // prepend the last chunk
  5199              if (_this.lastChunk) data = _this.lastChunk + data;
  5200  
  5201              var result = null;
  5202  
  5203              try {
  5204                result = JSON.parse(data);
  5205              } catch (e) {
  5206                _this.lastChunk = data;
  5207  
  5208                // start timeout to cancel all requests
  5209                clearTimeout(_this.lastChunkTimeout);
  5210                _this.lastChunkTimeout = setTimeout(function () {
  5211                  _this._timeout();
  5212                  throw errors.InvalidResponse(data);
  5213                }, 1000 * 15);
  5214  
  5215                return;
  5216              }
  5217  
  5218              // cancel timeout and set chunk to null
  5219              clearTimeout(_this.lastChunkTimeout);
  5220              _this.lastChunk = null;
  5221  
  5222              if (result) returnValues.push(result);
  5223            });
  5224  
  5225            return returnValues;
  5226          };
  5227  
  5228          /**
  5229  Get the adds a callback to the responseCallbacks object,
  5230  which will be called if a response matching the response Id will arrive.
  5231  
  5232  @method _addResponseCallback
  5233  */
  5234          IpcProvider.prototype._addResponseCallback = function (
  5235            payload,
  5236            callback
  5237          ) {
  5238            var id = payload.id || payload[0].id;
  5239            var method = payload.method || payload[0].method;
  5240  
  5241            this.responseCallbacks[id] = callback;
  5242            this.responseCallbacks[id].method = method;
  5243          };
  5244  
  5245          /**
  5246  Timeout all requests when the end/error event is fired
  5247  
  5248  @method _timeout
  5249  */
  5250          IpcProvider.prototype._timeout = function () {
  5251            for (var key in this.responseCallbacks) {
  5252              if (this.responseCallbacks.hasOwnProperty(key)) {
  5253                this.responseCallbacks[key](errors.InvalidConnection("on IPC"));
  5254                delete this.responseCallbacks[key];
  5255              }
  5256            }
  5257          };
  5258  
  5259          /**
  5260  Check if the current connection is still valid.
  5261  
  5262  @method isConnected
  5263  */
  5264          IpcProvider.prototype.isConnected = function () {
  5265            var _this = this;
  5266  
  5267            // try reconnect, when connection is gone
  5268            if (!_this.connection.writable)
  5269              _this.connection.connect({ path: _this.path });
  5270  
  5271            return !!this.connection.writable;
  5272          };
  5273  
  5274          IpcProvider.prototype.send = function (payload) {
  5275            if (this.connection.writeSync) {
  5276              var result;
  5277  
  5278              // try reconnect, when connection is gone
  5279              if (!this.connection.writable)
  5280                this.connection.connect({ path: this.path });
  5281  
  5282              var data = this.connection.writeSync(JSON.stringify(payload));
  5283  
  5284              try {
  5285                result = JSON.parse(data);
  5286              } catch (e) {
  5287                throw errors.InvalidResponse(data);
  5288              }
  5289  
  5290              return result;
  5291            } else {
  5292              throw new Error(
  5293                'You tried to send "' +
  5294                  payload.method +
  5295                  '" synchronously. Synchronous requests are not supported by the IPC provider.'
  5296              );
  5297            }
  5298          };
  5299  
  5300          IpcProvider.prototype.sendAsync = function (payload, callback) {
  5301            // try reconnect, when connection is gone
  5302            if (!this.connection.writable)
  5303              this.connection.connect({ path: this.path });
  5304  
  5305            this.connection.write(JSON.stringify(payload));
  5306            this._addResponseCallback(payload, callback);
  5307          };
  5308  
  5309          module.exports = IpcProvider;
  5310        },
  5311        { "../utils/utils": 20, "./errors": 26 },
  5312      ],
  5313      35: [
  5314        function (require, module, exports) {
  5315          /*
  5316      This file is part of web3.js.
  5317  
  5318      web3.js is free software: you can redistribute it and/or modify
  5319      it under the terms of the GNU Lesser General Public License as published by
  5320      the Free Software Foundation, either version 3 of the License, or
  5321      (at your option) any later version.
  5322  
  5323      web3.js is distributed in the hope that it will be useful,
  5324      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5325      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5326      GNU Lesser General Public License for more details.
  5327  
  5328      You should have received a copy of the GNU Lesser General Public License
  5329      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5330  */
  5331          /** @file jsonrpc.js
  5332           * @authors:
  5333           *   Marek Kotewicz <marek@ethdev.com>
  5334           *   Aaron Kumavis <aaron@kumavis.me>
  5335           * @date 2015
  5336           */
  5337  
  5338          // Initialize Jsonrpc as a simple object with utility functions.
  5339          var Jsonrpc = {
  5340            messageId: 0,
  5341          };
  5342  
  5343          /**
  5344           * Should be called to valid json create payload object
  5345           *
  5346           * @method toPayload
  5347           * @param {Function} method of jsonrpc call, required
  5348           * @param {Array} params, an array of method params, optional
  5349           * @returns {Object} valid jsonrpc payload object
  5350           */
  5351          Jsonrpc.toPayload = function (method, params) {
  5352            if (!method) console.error("jsonrpc method should be specified!");
  5353  
  5354            // advance message ID
  5355            Jsonrpc.messageId++;
  5356  
  5357            return {
  5358              jsonrpc: "2.0",
  5359              id: Jsonrpc.messageId,
  5360              method: method,
  5361              params: params || [],
  5362            };
  5363          };
  5364  
  5365          /**
  5366           * Should be called to check if jsonrpc response is valid
  5367           *
  5368           * @method isValidResponse
  5369           * @param {Object}
  5370           * @returns {Boolean} true if response is valid, otherwise false
  5371           */
  5372          Jsonrpc.isValidResponse = function (response) {
  5373            return Array.isArray(response)
  5374              ? response.every(validateSingleMessage)
  5375              : validateSingleMessage(response);
  5376  
  5377            function validateSingleMessage(message) {
  5378              return (
  5379                !!message &&
  5380                !message.error &&
  5381                message.jsonrpc === "2.0" &&
  5382                typeof message.id === "number" &&
  5383                message.result !== undefined
  5384              ); // only undefined is not valid json object
  5385            }
  5386          };
  5387  
  5388          /**
  5389           * Should be called to create batch payload object
  5390           *
  5391           * @method toBatchPayload
  5392           * @param {Array} messages, an array of objects with method (required) and params (optional) fields
  5393           * @returns {Array} batch payload
  5394           */
  5395          Jsonrpc.toBatchPayload = function (messages) {
  5396            return messages.map(function (message) {
  5397              return Jsonrpc.toPayload(message.method, message.params);
  5398            });
  5399          };
  5400  
  5401          module.exports = Jsonrpc;
  5402        },
  5403        {},
  5404      ],
  5405      36: [
  5406        function (require, module, exports) {
  5407          /*
  5408      This file is part of web3.js.
  5409  
  5410      web3.js is free software: you can redistribute it and/or modify
  5411      it under the terms of the GNU Lesser General Public License as published by
  5412      the Free Software Foundation, either version 3 of the License, or
  5413      (at your option) any later version.
  5414  
  5415      web3.js is distributed in the hope that it will be useful,
  5416      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5417      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5418      GNU Lesser General Public License for more details.
  5419  
  5420      You should have received a copy of the GNU Lesser General Public License
  5421      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5422  */
  5423          /**
  5424           * @file method.js
  5425           * @author Marek Kotewicz <marek@ethdev.com>
  5426           * @date 2015
  5427           */
  5428  
  5429          var utils = require("../utils/utils");
  5430          var errors = require("./errors");
  5431  
  5432          var Method = function (options) {
  5433            this.name = options.name;
  5434            this.call = options.call;
  5435            this.params = options.params || 0;
  5436            this.inputFormatter = options.inputFormatter;
  5437            this.outputFormatter = options.outputFormatter;
  5438            this.requestManager = null;
  5439          };
  5440  
  5441          Method.prototype.setRequestManager = function (rm) {
  5442            this.requestManager = rm;
  5443          };
  5444  
  5445          /**
  5446           * Should be used to determine name of the jsonrpc method based on arguments
  5447           *
  5448           * @method getCall
  5449           * @param {Array} arguments
  5450           * @return {String} name of jsonrpc method
  5451           */
  5452          Method.prototype.getCall = function (args) {
  5453            return utils.isFunction(this.call) ? this.call(args) : this.call;
  5454          };
  5455  
  5456          /**
  5457           * Should be used to extract callback from array of arguments. Modifies input param
  5458           *
  5459           * @method extractCallback
  5460           * @param {Array} arguments
  5461           * @return {Function|Null} callback, if exists
  5462           */
  5463          Method.prototype.extractCallback = function (args) {
  5464            if (utils.isFunction(args[args.length - 1])) {
  5465              return args.pop(); // modify the args array!
  5466            }
  5467          };
  5468  
  5469          /**
  5470           * Should be called to check if the number of arguments is correct
  5471           *
  5472           * @method validateArgs
  5473           * @param {Array} arguments
  5474           * @throws {Error} if it is not
  5475           */
  5476          Method.prototype.validateArgs = function (args) {
  5477            if (args.length !== this.params) {
  5478              throw errors.InvalidNumberOfRPCParams();
  5479            }
  5480          };
  5481  
  5482          /**
  5483           * Should be called to format input args of method
  5484           *
  5485           * @method formatInput
  5486           * @param {Array}
  5487           * @return {Array}
  5488           */
  5489          Method.prototype.formatInput = function (args) {
  5490            if (!this.inputFormatter) {
  5491              return args;
  5492            }
  5493  
  5494            return this.inputFormatter.map(function (formatter, index) {
  5495              return formatter ? formatter(args[index]) : args[index];
  5496            });
  5497          };
  5498  
  5499          /**
  5500           * Should be called to format output(result) of method
  5501           *
  5502           * @method formatOutput
  5503           * @param {Object}
  5504           * @return {Object}
  5505           */
  5506          Method.prototype.formatOutput = function (result) {
  5507            return this.outputFormatter && result
  5508              ? this.outputFormatter(result)
  5509              : result;
  5510          };
  5511  
  5512          /**
  5513           * Should create payload from given input args
  5514           *
  5515           * @method toPayload
  5516           * @param {Array} args
  5517           * @return {Object}
  5518           */
  5519          Method.prototype.toPayload = function (args) {
  5520            var call = this.getCall(args);
  5521            var callback = this.extractCallback(args);
  5522            var params = this.formatInput(args);
  5523            this.validateArgs(params);
  5524  
  5525            return {
  5526              method: call,
  5527              params: params,
  5528              callback: callback,
  5529            };
  5530          };
  5531  
  5532          Method.prototype.attachToObject = function (obj) {
  5533            var func = this.buildCall();
  5534            func.call = this.call; // TODO!!! that's ugly. filter.js uses it
  5535            var name = this.name.split(".");
  5536            if (name.length > 1) {
  5537              obj[name[0]] = obj[name[0]] || {};
  5538              obj[name[0]][name[1]] = func;
  5539            } else {
  5540              obj[name[0]] = func;
  5541            }
  5542          };
  5543  
  5544          Method.prototype.buildCall = function () {
  5545            var method = this;
  5546            var send = function () {
  5547              var payload = method.toPayload(
  5548                Array.prototype.slice.call(arguments)
  5549              );
  5550              if (payload.callback) {
  5551                return method.requestManager.sendAsync(
  5552                  payload,
  5553                  function (err, result) {
  5554                    payload.callback(err, method.formatOutput(result));
  5555                  }
  5556                );
  5557              }
  5558              return method.formatOutput(method.requestManager.send(payload));
  5559            };
  5560            send.request = this.request.bind(this);
  5561            return send;
  5562          };
  5563  
  5564          /**
  5565           * Should be called to create pure JSONRPC request which can be used in batch request
  5566           *
  5567           * @method request
  5568           * @param {...} params
  5569           * @return {Object} jsonrpc request
  5570           */
  5571          Method.prototype.request = function () {
  5572            var payload = this.toPayload(Array.prototype.slice.call(arguments));
  5573            payload.format = this.formatOutput.bind(this);
  5574            return payload;
  5575          };
  5576  
  5577          module.exports = Method;
  5578        },
  5579        { "../utils/utils": 20, "./errors": 26 },
  5580      ],
  5581      37: [
  5582        function (require, module, exports) {
  5583          /*
  5584      This file is part of web3.js.
  5585  
  5586      web3.js is free software: you can redistribute it and/or modify
  5587      it under the terms of the GNU Lesser General Public License as published by
  5588      the Free Software Foundation, either version 3 of the License, or
  5589      (at your option) any later version.
  5590  
  5591      web3.js is distributed in the hope that it will be useful,
  5592      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5593      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5594      GNU Lesser General Public License for more details.
  5595  
  5596      You should have received a copy of the GNU Lesser General Public License
  5597      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5598  */
  5599          /** @file db.js
  5600           * @authors:
  5601           *   Marek Kotewicz <marek@ethdev.com>
  5602           * @date 2015
  5603           */
  5604  
  5605          var Method = require("../method");
  5606  
  5607          var DB = function (web3) {
  5608            this._requestManager = web3._requestManager;
  5609  
  5610            var self = this;
  5611  
  5612            methods().forEach(function (method) {
  5613              method.attachToObject(self);
  5614              method.setRequestManager(web3._requestManager);
  5615            });
  5616          };
  5617  
  5618          var methods = function () {
  5619            var putString = new Method({
  5620              name: "putString",
  5621              call: "db_putString",
  5622              params: 3,
  5623            });
  5624  
  5625            var getString = new Method({
  5626              name: "getString",
  5627              call: "db_getString",
  5628              params: 2,
  5629            });
  5630  
  5631            var putHex = new Method({
  5632              name: "putHex",
  5633              call: "db_putHex",
  5634              params: 3,
  5635            });
  5636  
  5637            var getHex = new Method({
  5638              name: "getHex",
  5639              call: "db_getHex",
  5640              params: 2,
  5641            });
  5642  
  5643            return [putString, getString, putHex, getHex];
  5644          };
  5645  
  5646          module.exports = DB;
  5647        },
  5648        { "../method": 36 },
  5649      ],
  5650      38: [
  5651        function (require, module, exports) {
  5652          /*
  5653      This file is part of web3.js.
  5654  
  5655      web3.js is free software: you can redistribute it and/or modify
  5656      it under the terms of the GNU Lesser General Public License as published by
  5657      the Free Software Foundation, either version 3 of the License, or
  5658      (at your option) any later version.
  5659  
  5660      web3.js is distributed in the hope that it will be useful,
  5661      but WITHOUT ANY WARRANTY; without even the implied warranty of
  5662      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  5663      GNU Lesser General Public License for more details.
  5664  
  5665      You should have received a copy of the GNU Lesser General Public License
  5666      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  5667  */
  5668          /**
  5669           * @file eth.js
  5670           * @author Marek Kotewicz <marek@ethdev.com>
  5671           * @author Fabian Vogelsteller <fabian@ethdev.com>
  5672           * @date 2015
  5673           */
  5674  
  5675          "use strict";
  5676  
  5677          var formatters = require("../formatters");
  5678          var utils = require("../../utils/utils");
  5679          var Method = require("../method");
  5680          var Property = require("../property");
  5681          var c = require("../../utils/config");
  5682          var Contract = require("../contract");
  5683          var watches = require("./watches");
  5684          var Filter = require("../filter");
  5685          var IsSyncing = require("../syncing");
  5686          var namereg = require("../namereg");
  5687          var Iban = require("../iban");
  5688          var transfer = require("../transfer");
  5689  
  5690          var blockCall = function (args) {
  5691            return utils.isString(args[0]) && args[0].indexOf("0x") === 0
  5692              ? "eth_getBlockByHash"
  5693              : "eth_getBlockByNumber";
  5694          };
  5695  
  5696          var transactionFromBlockCall = function (args) {
  5697            return utils.isString(args[0]) && args[0].indexOf("0x") === 0
  5698              ? "eth_getTransactionByBlockHashAndIndex"
  5699              : "eth_getTransactionByBlockNumberAndIndex";
  5700          };
  5701  
  5702          var uncleCall = function (args) {
  5703            return utils.isString(args[0]) && args[0].indexOf("0x") === 0
  5704              ? "eth_getUncleByBlockHashAndIndex"
  5705              : "eth_getUncleByBlockNumberAndIndex";
  5706          };
  5707  
  5708          var getBlockTransactionCountCall = function (args) {
  5709            return utils.isString(args[0]) && args[0].indexOf("0x") === 0
  5710              ? "eth_getBlockTransactionCountByHash"
  5711              : "eth_getBlockTransactionCountByNumber";
  5712          };
  5713  
  5714          var uncleCountCall = function (args) {
  5715            return utils.isString(args[0]) && args[0].indexOf("0x") === 0
  5716              ? "eth_getUncleCountByBlockHash"
  5717              : "eth_getUncleCountByBlockNumber";
  5718          };
  5719  
  5720          function Eth(web3) {
  5721            this._requestManager = web3._requestManager;
  5722  
  5723            var self = this;
  5724  
  5725            methods().forEach(function (method) {
  5726              method.attachToObject(self);
  5727              method.setRequestManager(self._requestManager);
  5728            });
  5729  
  5730            properties().forEach(function (p) {
  5731              p.attachToObject(self);
  5732              p.setRequestManager(self._requestManager);
  5733            });
  5734  
  5735            this.iban = Iban;
  5736            this.sendIBANTransaction = transfer.bind(null, this);
  5737          }
  5738  
  5739          Object.defineProperty(Eth.prototype, "defaultBlock", {
  5740            get: function () {
  5741              return c.defaultBlock;
  5742            },
  5743            set: function (val) {
  5744              c.defaultBlock = val;
  5745              return val;
  5746            },
  5747          });
  5748  
  5749          Object.defineProperty(Eth.prototype, "defaultAccount", {
  5750            get: function () {
  5751              return c.defaultAccount;
  5752            },
  5753            set: function (val) {
  5754              c.defaultAccount = val;
  5755              return val;
  5756            },
  5757          });
  5758  
  5759          var methods = function () {
  5760            var getBalance = new Method({
  5761              name: "getBalance",
  5762              call: "eth_getBalance",
  5763              params: 2,
  5764              inputFormatter: [
  5765                formatters.inputAddressFormatter,
  5766                formatters.inputDefaultBlockNumberFormatter,
  5767              ],
  5768              outputFormatter: formatters.outputBigNumberFormatter,
  5769            });
  5770  
  5771            var getStorageAt = new Method({
  5772              name: "getStorageAt",
  5773              call: "eth_getStorageAt",
  5774              params: 3,
  5775              inputFormatter: [
  5776                null,
  5777                utils.toHex,
  5778                formatters.inputDefaultBlockNumberFormatter,
  5779              ],
  5780            });
  5781  
  5782            var getCode = new Method({
  5783              name: "getCode",
  5784              call: "eth_getCode",
  5785              params: 2,
  5786              inputFormatter: [
  5787                formatters.inputAddressFormatter,
  5788                formatters.inputDefaultBlockNumberFormatter,
  5789              ],
  5790            });
  5791  
  5792            var getBlock = new Method({
  5793              name: "getBlock",
  5794              call: blockCall,
  5795              params: 2,
  5796              inputFormatter: [
  5797                formatters.inputBlockNumberFormatter,
  5798                function (val) {
  5799                  return !!val;
  5800                },
  5801              ],
  5802              outputFormatter: formatters.outputBlockFormatter,
  5803            });
  5804  
  5805            var getUncle = new Method({
  5806              name: "getUncle",
  5807              call: uncleCall,
  5808              params: 2,
  5809              inputFormatter: [formatters.inputBlockNumberFormatter, utils.toHex],
  5810              outputFormatter: formatters.outputBlockFormatter,
  5811            });
  5812  
  5813            var getCompilers = new Method({
  5814              name: "getCompilers",
  5815              call: "eth_getCompilers",
  5816              params: 0,
  5817            });
  5818  
  5819            var getBlockTransactionCount = new Method({
  5820              name: "getBlockTransactionCount",
  5821              call: getBlockTransactionCountCall,
  5822              params: 1,
  5823              inputFormatter: [formatters.inputBlockNumberFormatter],
  5824              outputFormatter: utils.toDecimal,
  5825            });
  5826  
  5827            var getBlockUncleCount = new Method({
  5828              name: "getBlockUncleCount",
  5829              call: uncleCountCall,
  5830              params: 1,
  5831              inputFormatter: [formatters.inputBlockNumberFormatter],
  5832              outputFormatter: utils.toDecimal,
  5833            });
  5834  
  5835            var getTransaction = new Method({
  5836              name: "getTransaction",
  5837              call: "eth_getTransactionByHash",
  5838              params: 1,
  5839              outputFormatter: formatters.outputTransactionFormatter,
  5840            });
  5841  
  5842            var getTransactionFromBlock = new Method({
  5843              name: "getTransactionFromBlock",
  5844              call: transactionFromBlockCall,
  5845              params: 2,
  5846              inputFormatter: [formatters.inputBlockNumberFormatter, utils.toHex],
  5847              outputFormatter: formatters.outputTransactionFormatter,
  5848            });
  5849  
  5850            var getTransactionReceipt = new Method({
  5851              name: "getTransactionReceipt",
  5852              call: "eth_getTransactionReceipt",
  5853              params: 1,
  5854              outputFormatter: formatters.outputTransactionReceiptFormatter,
  5855            });
  5856  
  5857            var getTransactionCount = new Method({
  5858              name: "getTransactionCount",
  5859              call: "eth_getTransactionCount",
  5860              params: 2,
  5861              inputFormatter: [null, formatters.inputDefaultBlockNumberFormatter],
  5862              outputFormatter: utils.toDecimal,
  5863            });
  5864  
  5865            var sendRawTransaction = new Method({
  5866              name: "sendRawTransaction",
  5867              call: "eth_sendRawTransaction",
  5868              params: 1,
  5869              inputFormatter: [null],
  5870            });
  5871  
  5872            var sendTransaction = new Method({
  5873              name: "sendTransaction",
  5874              call: "eth_sendTransaction",
  5875              params: 1,
  5876              inputFormatter: [formatters.inputTransactionFormatter],
  5877            });
  5878  
  5879            var signTransaction = new Method({
  5880              name: "signTransaction",
  5881              call: "eth_signTransaction",
  5882              params: 1,
  5883              inputFormatter: [formatters.inputTransactionFormatter],
  5884            });
  5885  
  5886            var sign = new Method({
  5887              name: "sign",
  5888              call: "eth_sign",
  5889              params: 2,
  5890              inputFormatter: [formatters.inputAddressFormatter, null],
  5891            });
  5892  
  5893            var call = new Method({
  5894              name: "call",
  5895              call: "eth_call",
  5896              params: 2,
  5897              inputFormatter: [
  5898                formatters.inputCallFormatter,
  5899                formatters.inputDefaultBlockNumberFormatter,
  5900              ],
  5901            });
  5902  
  5903            var estimateGas = new Method({
  5904              name: "estimateGas",
  5905              call: "eth_estimateGas",
  5906              params: 1,
  5907              inputFormatter: [formatters.inputCallFormatter],
  5908              outputFormatter: utils.toDecimal,
  5909            });
  5910  
  5911            var compileSolidity = new Method({
  5912              name: "compile.solidity",
  5913              call: "eth_compileSolidity",
  5914              params: 1,
  5915            });
  5916  
  5917            var compileLLL = new Method({
  5918              name: "compile.lll",
  5919              call: "eth_compileLLL",
  5920              params: 1,
  5921            });
  5922  
  5923            var compileSerpent = new Method({
  5924              name: "compile.serpent",
  5925              call: "eth_compileSerpent",
  5926              params: 1,
  5927            });
  5928  
  5929            var submitWork = new Method({
  5930              name: "submitWork",
  5931              call: "eth_submitWork",
  5932              params: 3,
  5933            });
  5934  
  5935            var getWork = new Method({
  5936              name: "getWork",
  5937              call: "eth_getWork",
  5938              params: 0,
  5939            });
  5940  
  5941            return [
  5942              getBalance,
  5943              getStorageAt,
  5944              getCode,
  5945              getBlock,
  5946              getUncle,
  5947              getCompilers,
  5948              getBlockTransactionCount,
  5949              getBlockUncleCount,
  5950              getTransaction,
  5951              getTransactionFromBlock,
  5952              getTransactionReceipt,
  5953              getTransactionCount,
  5954              call,
  5955              estimateGas,
  5956              sendRawTransaction,
  5957              signTransaction,
  5958              sendTransaction,
  5959              sign,
  5960              compileSolidity,
  5961              compileLLL,
  5962              compileSerpent,
  5963              submitWork,
  5964              getWork,
  5965            ];
  5966          };
  5967  
  5968          var properties = function () {
  5969            return [
  5970              new Property({
  5971                name: "coinbase",
  5972                getter: "eth_coinbase",
  5973              }),
  5974              new Property({
  5975                name: "mining",
  5976                getter: "eth_mining",
  5977              }),
  5978              new Property({
  5979                name: "hashrate",
  5980                getter: "eth_hashrate",
  5981                outputFormatter: utils.toDecimal,
  5982              }),
  5983              new Property({
  5984                name: "syncing",
  5985                getter: "eth_syncing",
  5986                outputFormatter: formatters.outputSyncingFormatter,
  5987              }),
  5988              new Property({
  5989                name: "gasPrice",
  5990                getter: "eth_gasPrice",
  5991                outputFormatter: formatters.outputBigNumberFormatter,
  5992              }),
  5993              new Property({
  5994                name: "accounts",
  5995                getter: "eth_accounts",
  5996              }),
  5997              new Property({
  5998                name: "blockNumber",
  5999                getter: "eth_blockNumber",
  6000                outputFormatter: utils.toDecimal,
  6001              }),
  6002              new Property({
  6003                name: "protocolVersion",
  6004                getter: "eth_protocolVersion",
  6005              }),
  6006            ];
  6007          };
  6008  
  6009          Eth.prototype.contract = function (abi) {
  6010            var factory = new Contract(this, abi);
  6011            return factory;
  6012          };
  6013  
  6014          Eth.prototype.filter = function (
  6015            options,
  6016            callback,
  6017            filterCreationErrorCallback
  6018          ) {
  6019            return new Filter(
  6020              options,
  6021              "eth",
  6022              this._requestManager,
  6023              watches.eth(),
  6024              formatters.outputLogFormatter,
  6025              callback,
  6026              filterCreationErrorCallback
  6027            );
  6028          };
  6029  
  6030          Eth.prototype.namereg = function () {
  6031            return this.contract(namereg.global.abi).at(namereg.global.address);
  6032          };
  6033  
  6034          Eth.prototype.icapNamereg = function () {
  6035            return this.contract(namereg.icap.abi).at(namereg.icap.address);
  6036          };
  6037  
  6038          Eth.prototype.isSyncing = function (callback) {
  6039            return new IsSyncing(this._requestManager, callback);
  6040          };
  6041  
  6042          module.exports = Eth;
  6043        },
  6044        {
  6045          "../../utils/config": 18,
  6046          "../../utils/utils": 20,
  6047          "../contract": 25,
  6048          "../filter": 29,
  6049          "../formatters": 30,
  6050          "../iban": 33,
  6051          "../method": 36,
  6052          "../namereg": 44,
  6053          "../property": 45,
  6054          "../syncing": 48,
  6055          "../transfer": 49,
  6056          "./watches": 43,
  6057        },
  6058      ],
  6059      39: [
  6060        function (require, module, exports) {
  6061          /*
  6062      This file is part of web3.js.
  6063  
  6064      web3.js is free software: you can redistribute it and/or modify
  6065      it under the terms of the GNU Lesser General Public License as published by
  6066      the Free Software Foundation, either version 3 of the License, or
  6067      (at your option) any later version.
  6068  
  6069      web3.js is distributed in the hope that it will be useful,
  6070      but WITHOUT ANY WARRANTY; without even the implied warranty of
  6071      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6072      GNU Lesser General Public License for more details.
  6073  
  6074      You should have received a copy of the GNU Lesser General Public License
  6075      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  6076  */
  6077          /** @file eth.js
  6078           * @authors:
  6079           *   Marek Kotewicz <marek@ethdev.com>
  6080           * @date 2015
  6081           */
  6082  
  6083          var utils = require("../../utils/utils");
  6084          var Property = require("../property");
  6085  
  6086          var Net = function (web3) {
  6087            this._requestManager = web3._requestManager;
  6088  
  6089            var self = this;
  6090  
  6091            properties().forEach(function (p) {
  6092              p.attachToObject(self);
  6093              p.setRequestManager(web3._requestManager);
  6094            });
  6095          };
  6096  
  6097          /// @returns an array of objects describing web3.eth api properties
  6098          var properties = function () {
  6099            return [
  6100              new Property({
  6101                name: "listening",
  6102                getter: "net_listening",
  6103              }),
  6104              new Property({
  6105                name: "peerCount",
  6106                getter: "net_peerCount",
  6107                outputFormatter: utils.toDecimal,
  6108              }),
  6109            ];
  6110          };
  6111  
  6112          module.exports = Net;
  6113        },
  6114        { "../../utils/utils": 20, "../property": 45 },
  6115      ],
  6116      40: [
  6117        function (require, module, exports) {
  6118          /*
  6119      This file is part of web3.js.
  6120  
  6121      web3.js is free software: you can redistribute it and/or modify
  6122      it under the terms of the GNU Lesser General Public License as published by
  6123      the Free Software Foundation, either version 3 of the License, or
  6124      (at your option) any later version.
  6125  
  6126      web3.js is distributed in the hope that it will be useful,
  6127      but WITHOUT ANY WARRANTY; without even the implied warranty of
  6128      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6129      GNU Lesser General Public License for more details.
  6130  
  6131      You should have received a copy of the GNU Lesser General Public License
  6132      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  6133  */
  6134          /**
  6135           * @file eth.js
  6136           * @author Marek Kotewicz <marek@ethdev.com>
  6137           * @author Fabian Vogelsteller <fabian@ethdev.com>
  6138           * @date 2015
  6139           */
  6140  
  6141          "use strict";
  6142  
  6143          var Method = require("../method");
  6144          var Property = require("../property");
  6145          var formatters = require("../formatters");
  6146  
  6147          function Personal(web3) {
  6148            this._requestManager = web3._requestManager;
  6149  
  6150            var self = this;
  6151  
  6152            methods().forEach(function (method) {
  6153              method.attachToObject(self);
  6154              method.setRequestManager(self._requestManager);
  6155            });
  6156  
  6157            properties().forEach(function (p) {
  6158              p.attachToObject(self);
  6159              p.setRequestManager(self._requestManager);
  6160            });
  6161          }
  6162  
  6163          var methods = function () {
  6164            var newAccount = new Method({
  6165              name: "newAccount",
  6166              call: "personal_newAccount",
  6167              params: 1,
  6168              inputFormatter: [null],
  6169            });
  6170  
  6171            var importRawKey = new Method({
  6172              name: "importRawKey",
  6173              call: "personal_importRawKey",
  6174              params: 2,
  6175            });
  6176  
  6177            var sign = new Method({
  6178              name: "sign",
  6179              call: "personal_sign",
  6180              params: 3,
  6181              inputFormatter: [null, formatters.inputAddressFormatter, null],
  6182            });
  6183  
  6184            var ecRecover = new Method({
  6185              name: "ecRecover",
  6186              call: "personal_ecRecover",
  6187              params: 2,
  6188            });
  6189  
  6190            var unlockAccount = new Method({
  6191              name: "unlockAccount",
  6192              call: "personal_unlockAccount",
  6193              params: 3,
  6194              inputFormatter: [formatters.inputAddressFormatter, null, null],
  6195            });
  6196  
  6197            var sendTransaction = new Method({
  6198              name: "sendTransaction",
  6199              call: "personal_sendTransaction",
  6200              params: 2,
  6201              inputFormatter: [formatters.inputTransactionFormatter, null],
  6202            });
  6203  
  6204            var lockAccount = new Method({
  6205              name: "lockAccount",
  6206              call: "personal_lockAccount",
  6207              params: 1,
  6208              inputFormatter: [formatters.inputAddressFormatter],
  6209            });
  6210  
  6211            return [
  6212              newAccount,
  6213              importRawKey,
  6214              unlockAccount,
  6215              ecRecover,
  6216              sign,
  6217              sendTransaction,
  6218              lockAccount,
  6219            ];
  6220          };
  6221  
  6222          var properties = function () {
  6223            return [
  6224              new Property({
  6225                name: "listAccounts",
  6226                getter: "personal_listAccounts",
  6227              }),
  6228            ];
  6229          };
  6230  
  6231          module.exports = Personal;
  6232        },
  6233        { "../formatters": 30, "../method": 36, "../property": 45 },
  6234      ],
  6235      41: [
  6236        function (require, module, exports) {
  6237          /*
  6238      This file is part of web3.js.
  6239  
  6240      web3.js is free software: you can redistribute it and/or modify
  6241      it under the terms of the GNU Lesser General Public License as published by
  6242      the Free Software Foundation, either version 3 of the License, or
  6243      (at your option) any later version.
  6244  
  6245      web3.js is distributed in the hope that it will be useful,
  6246      but WITHOUT ANY WARRANTY; without even the implied warranty of
  6247      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6248      GNU Lesser General Public License for more details.
  6249  
  6250      You should have received a copy of the GNU Lesser General Public License
  6251      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  6252  */
  6253          /** @file shh.js
  6254           * @authors:
  6255           *   Fabian Vogelsteller <fabian@ethereum.org>
  6256           *   Marek Kotewicz <marek@ethcore.io>
  6257           * @date 2017
  6258           */
  6259  
  6260          var Method = require("../method");
  6261          var Filter = require("../filter");
  6262          var watches = require("./watches");
  6263  
  6264          var Shh = function (web3) {
  6265            this._requestManager = web3._requestManager;
  6266  
  6267            var self = this;
  6268  
  6269            methods().forEach(function (method) {
  6270              method.attachToObject(self);
  6271              method.setRequestManager(self._requestManager);
  6272            });
  6273          };
  6274  
  6275          Shh.prototype.newMessageFilter = function (
  6276            options,
  6277            callback,
  6278            filterCreationErrorCallback
  6279          ) {
  6280            return new Filter(
  6281              options,
  6282              "shh",
  6283              this._requestManager,
  6284              watches.shh(),
  6285              null,
  6286              callback,
  6287              filterCreationErrorCallback
  6288            );
  6289          };
  6290  
  6291          var methods = function () {
  6292            return [
  6293              new Method({
  6294                name: "version",
  6295                call: "shh_version",
  6296                params: 0,
  6297              }),
  6298              new Method({
  6299                name: "info",
  6300                call: "shh_info",
  6301                params: 0,
  6302              }),
  6303              new Method({
  6304                name: "setMaxMessageSize",
  6305                call: "shh_setMaxMessageSize",
  6306                params: 1,
  6307              }),
  6308              new Method({
  6309                name: "setMinPoW",
  6310                call: "shh_setMinPoW",
  6311                params: 1,
  6312              }),
  6313              new Method({
  6314                name: "markTrustedPeer",
  6315                call: "shh_markTrustedPeer",
  6316                params: 1,
  6317              }),
  6318              new Method({
  6319                name: "newKeyPair",
  6320                call: "shh_newKeyPair",
  6321                params: 0,
  6322              }),
  6323              new Method({
  6324                name: "addPrivateKey",
  6325                call: "shh_addPrivateKey",
  6326                params: 1,
  6327              }),
  6328              new Method({
  6329                name: "deleteKeyPair",
  6330                call: "shh_deleteKeyPair",
  6331                params: 1,
  6332              }),
  6333              new Method({
  6334                name: "hasKeyPair",
  6335                call: "shh_hasKeyPair",
  6336                params: 1,
  6337              }),
  6338              new Method({
  6339                name: "getPublicKey",
  6340                call: "shh_getPublicKey",
  6341                params: 1,
  6342              }),
  6343              new Method({
  6344                name: "getPrivateKey",
  6345                call: "shh_getPrivateKey",
  6346                params: 1,
  6347              }),
  6348              new Method({
  6349                name: "newSymKey",
  6350                call: "shh_newSymKey",
  6351                params: 0,
  6352              }),
  6353              new Method({
  6354                name: "addSymKey",
  6355                call: "shh_addSymKey",
  6356                params: 1,
  6357              }),
  6358              new Method({
  6359                name: "generateSymKeyFromPassword",
  6360                call: "shh_generateSymKeyFromPassword",
  6361                params: 1,
  6362              }),
  6363              new Method({
  6364                name: "hasSymKey",
  6365                call: "shh_hasSymKey",
  6366                params: 1,
  6367              }),
  6368              new Method({
  6369                name: "getSymKey",
  6370                call: "shh_getSymKey",
  6371                params: 1,
  6372              }),
  6373              new Method({
  6374                name: "deleteSymKey",
  6375                call: "shh_deleteSymKey",
  6376                params: 1,
  6377              }),
  6378  
  6379              // subscribe and unsubscribe missing
  6380  
  6381              new Method({
  6382                name: "post",
  6383                call: "shh_post",
  6384                params: 1,
  6385                inputFormatter: [null],
  6386              }),
  6387            ];
  6388          };
  6389  
  6390          module.exports = Shh;
  6391        },
  6392        { "../filter": 29, "../method": 36, "./watches": 43 },
  6393      ],
  6394      42: [
  6395        function (require, module, exports) {
  6396          /*
  6397      This file is part of web3.js.
  6398  
  6399      web3.js is free software: you can redistribute it and/or modify
  6400      it under the terms of the GNU Lesser General Public License as published by
  6401      the Free Software Foundation, either version 3 of the License, or
  6402      (at your option) any later version.
  6403  
  6404      web3.js is distributed in the hope that it will be useful,
  6405      but WITHOUT ANY WARRANTY; without even the implied warranty of
  6406      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6407      GNU Lesser General Public License for more details.
  6408  
  6409      You should have received a copy of the GNU Lesser General Public License
  6410      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  6411  */
  6412          /**
  6413           * @file bzz.js
  6414           * @author Alex Beregszaszi <alex@rtfs.hu>
  6415           * @date 2016
  6416           *
  6417           * Reference: https://github.com/juliankolbe/go-ethereum/blob/swarm/internal/web3ext/web3ext.go#L33
  6418           */
  6419  
  6420          "use strict";
  6421  
  6422          var Method = require("../method");
  6423          var Property = require("../property");
  6424  
  6425          function Swarm(web3) {
  6426            this._requestManager = web3._requestManager;
  6427  
  6428            var self = this;
  6429  
  6430            methods().forEach(function (method) {
  6431              method.attachToObject(self);
  6432              method.setRequestManager(self._requestManager);
  6433            });
  6434  
  6435            properties().forEach(function (p) {
  6436              p.attachToObject(self);
  6437              p.setRequestManager(self._requestManager);
  6438            });
  6439          }
  6440  
  6441          var methods = function () {
  6442            var blockNetworkRead = new Method({
  6443              name: "blockNetworkRead",
  6444              call: "bzz_blockNetworkRead",
  6445              params: 1,
  6446              inputFormatter: [null],
  6447            });
  6448  
  6449            var syncEnabled = new Method({
  6450              name: "syncEnabled",
  6451              call: "bzz_syncEnabled",
  6452              params: 1,
  6453              inputFormatter: [null],
  6454            });
  6455  
  6456            var swapEnabled = new Method({
  6457              name: "swapEnabled",
  6458              call: "bzz_swapEnabled",
  6459              params: 1,
  6460              inputFormatter: [null],
  6461            });
  6462  
  6463            var download = new Method({
  6464              name: "download",
  6465              call: "bzz_download",
  6466              params: 2,
  6467              inputFormatter: [null, null],
  6468            });
  6469  
  6470            var upload = new Method({
  6471              name: "upload",
  6472              call: "bzz_upload",
  6473              params: 2,
  6474              inputFormatter: [null, null],
  6475            });
  6476  
  6477            var retrieve = new Method({
  6478              name: "retrieve",
  6479              call: "bzz_retrieve",
  6480              params: 1,
  6481              inputFormatter: [null],
  6482            });
  6483  
  6484            var store = new Method({
  6485              name: "store",
  6486              call: "bzz_store",
  6487              params: 2,
  6488              inputFormatter: [null, null],
  6489            });
  6490  
  6491            var get = new Method({
  6492              name: "get",
  6493              call: "bzz_get",
  6494              params: 1,
  6495              inputFormatter: [null],
  6496            });
  6497  
  6498            var put = new Method({
  6499              name: "put",
  6500              call: "bzz_put",
  6501              params: 2,
  6502              inputFormatter: [null, null],
  6503            });
  6504  
  6505            var modify = new Method({
  6506              name: "modify",
  6507              call: "bzz_modify",
  6508              params: 4,
  6509              inputFormatter: [null, null, null, null],
  6510            });
  6511  
  6512            return [
  6513              blockNetworkRead,
  6514              syncEnabled,
  6515              swapEnabled,
  6516              download,
  6517              upload,
  6518              retrieve,
  6519              store,
  6520              get,
  6521              put,
  6522              modify,
  6523            ];
  6524          };
  6525  
  6526          var properties = function () {
  6527            return [
  6528              new Property({
  6529                name: "hive",
  6530                getter: "bzz_hive",
  6531              }),
  6532              new Property({
  6533                name: "info",
  6534                getter: "bzz_info",
  6535              }),
  6536            ];
  6537          };
  6538  
  6539          module.exports = Swarm;
  6540        },
  6541        { "../method": 36, "../property": 45 },
  6542      ],
  6543      43: [
  6544        function (require, module, exports) {
  6545          /*
  6546      This file is part of web3.js.
  6547  
  6548      web3.js is free software: you can redistribute it and/or modify
  6549      it under the terms of the GNU Lesser General Public License as published by
  6550      the Free Software Foundation, either version 3 of the License, or
  6551      (at your option) any later version.
  6552  
  6553      web3.js is distributed in the hope that it will be useful,
  6554      but WITHOUT ANY WARRANTY; without even the implied warranty of
  6555      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6556      GNU Lesser General Public License for more details.
  6557  
  6558      You should have received a copy of the GNU Lesser General Public License
  6559      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  6560  */
  6561          /** @file watches.js
  6562           * @authors:
  6563           *   Marek Kotewicz <marek@ethdev.com>
  6564           * @date 2015
  6565           */
  6566  
  6567          var Method = require("../method");
  6568  
  6569          /// @returns an array of objects describing web3.eth.filter api methods
  6570          var eth = function () {
  6571            var newFilterCall = function (args) {
  6572              var type = args[0];
  6573  
  6574              switch (type) {
  6575                case "latest":
  6576                  args.shift();
  6577                  this.params = 0;
  6578                  return "eth_newBlockFilter";
  6579                case "pending":
  6580                  args.shift();
  6581                  this.params = 0;
  6582                  return "eth_newPendingTransactionFilter";
  6583                default:
  6584                  return "eth_newFilter";
  6585              }
  6586            };
  6587  
  6588            var newFilter = new Method({
  6589              name: "newFilter",
  6590              call: newFilterCall,
  6591              params: 1,
  6592            });
  6593  
  6594            var uninstallFilter = new Method({
  6595              name: "uninstallFilter",
  6596              call: "eth_uninstallFilter",
  6597              params: 1,
  6598            });
  6599  
  6600            var getLogs = new Method({
  6601              name: "getLogs",
  6602              call: "eth_getFilterLogs",
  6603              params: 1,
  6604            });
  6605  
  6606            var poll = new Method({
  6607              name: "poll",
  6608              call: "eth_getFilterChanges",
  6609              params: 1,
  6610            });
  6611  
  6612            return [newFilter, uninstallFilter, getLogs, poll];
  6613          };
  6614  
  6615          /// @returns an array of objects describing web3.shh.watch api methods
  6616          var shh = function () {
  6617            return [
  6618              new Method({
  6619                name: "newFilter",
  6620                call: "shh_newMessageFilter",
  6621                params: 1,
  6622              }),
  6623              new Method({
  6624                name: "uninstallFilter",
  6625                call: "shh_deleteMessageFilter",
  6626                params: 1,
  6627              }),
  6628              new Method({
  6629                name: "getLogs",
  6630                call: "shh_getFilterMessages",
  6631                params: 1,
  6632              }),
  6633              new Method({
  6634                name: "poll",
  6635                call: "shh_getFilterMessages",
  6636                params: 1,
  6637              }),
  6638            ];
  6639          };
  6640  
  6641          module.exports = {
  6642            eth: eth,
  6643            shh: shh,
  6644          };
  6645        },
  6646        { "../method": 36 },
  6647      ],
  6648      44: [
  6649        function (require, module, exports) {
  6650          /*
  6651      This file is part of web3.js.
  6652  
  6653      web3.js is free software: you can redistribute it and/or modify
  6654      it under the terms of the GNU Lesser General Public License as published by
  6655      the Free Software Foundation, either version 3 of the License, or
  6656      (at your option) any later version.
  6657  
  6658      web3.js is distributed in the hope that it will be useful,
  6659      but WITHOUT ANY WARRANTY; without even the implied warranty of
  6660      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6661      GNU Lesser General Public License for more details.
  6662  
  6663      You should have received a copy of the GNU Lesser General Public License
  6664      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  6665  */
  6666          /**
  6667           * @file namereg.js
  6668           * @author Marek Kotewicz <marek@ethdev.com>
  6669           * @date 2015
  6670           */
  6671  
  6672          var globalRegistrarAbi = require("../contracts/GlobalRegistrar.json");
  6673          var icapRegistrarAbi = require("../contracts/ICAPRegistrar.json");
  6674  
  6675          var globalNameregAddress = "0xc6d9d2cd449a754c494264e1809c50e34d64562b";
  6676          var icapNameregAddress = "0xa1a111bc074c9cfa781f0c38e63bd51c91b8af00";
  6677  
  6678          module.exports = {
  6679            global: {
  6680              abi: globalRegistrarAbi,
  6681              address: globalNameregAddress,
  6682            },
  6683            icap: {
  6684              abi: icapRegistrarAbi,
  6685              address: icapNameregAddress,
  6686            },
  6687          };
  6688        },
  6689        {
  6690          "../contracts/GlobalRegistrar.json": 1,
  6691          "../contracts/ICAPRegistrar.json": 2,
  6692        },
  6693      ],
  6694      45: [
  6695        function (require, module, exports) {
  6696          /*
  6697      This file is part of web3.js.
  6698  
  6699      web3.js is free software: you can redistribute it and/or modify
  6700      it under the terms of the GNU Lesser General Public License as published by
  6701      the Free Software Foundation, either version 3 of the License, or
  6702      (at your option) any later version.
  6703  
  6704      web3.js is distributed in the hope that it will be useful,
  6705      but WITHOUT ANY WARRANTY; without even the implied warranty of
  6706      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6707      GNU Lesser General Public License for more details.
  6708  
  6709      You should have received a copy of the GNU Lesser General Public License
  6710      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  6711  */
  6712          /**
  6713           * @file property.js
  6714           * @author Fabian Vogelsteller <fabian@frozeman.de>
  6715           * @author Marek Kotewicz <marek@ethdev.com>
  6716           * @date 2015
  6717           */
  6718  
  6719          var utils = require("../utils/utils");
  6720  
  6721          var Property = function (options) {
  6722            this.name = options.name;
  6723            this.getter = options.getter;
  6724            this.setter = options.setter;
  6725            this.outputFormatter = options.outputFormatter;
  6726            this.inputFormatter = options.inputFormatter;
  6727            this.requestManager = null;
  6728          };
  6729  
  6730          Property.prototype.setRequestManager = function (rm) {
  6731            this.requestManager = rm;
  6732          };
  6733  
  6734          /**
  6735           * Should be called to format input args of method
  6736           *
  6737           * @method formatInput
  6738           * @param {Array}
  6739           * @return {Array}
  6740           */
  6741          Property.prototype.formatInput = function (arg) {
  6742            return this.inputFormatter ? this.inputFormatter(arg) : arg;
  6743          };
  6744  
  6745          /**
  6746           * Should be called to format output(result) of method
  6747           *
  6748           * @method formatOutput
  6749           * @param {Object}
  6750           * @return {Object}
  6751           */
  6752          Property.prototype.formatOutput = function (result) {
  6753            return this.outputFormatter && result !== null && result !== undefined
  6754              ? this.outputFormatter(result)
  6755              : result;
  6756          };
  6757  
  6758          /**
  6759           * Should be used to extract callback from array of arguments. Modifies input param
  6760           *
  6761           * @method extractCallback
  6762           * @param {Array} arguments
  6763           * @return {Function|Null} callback, if exists
  6764           */
  6765          Property.prototype.extractCallback = function (args) {
  6766            if (utils.isFunction(args[args.length - 1])) {
  6767              return args.pop(); // modify the args array!
  6768            }
  6769          };
  6770  
  6771          /**
  6772           * Should attach function to method
  6773           *
  6774           * @method attachToObject
  6775           * @param {Object}
  6776           * @param {Function}
  6777           */
  6778          Property.prototype.attachToObject = function (obj) {
  6779            var proto = {
  6780              get: this.buildGet(),
  6781              enumerable: true,
  6782            };
  6783  
  6784            var names = this.name.split(".");
  6785            var name = names[0];
  6786            if (names.length > 1) {
  6787              obj[names[0]] = obj[names[0]] || {};
  6788              obj = obj[names[0]];
  6789              name = names[1];
  6790            }
  6791  
  6792            Object.defineProperty(obj, name, proto);
  6793            obj[asyncGetterName(name)] = this.buildAsyncGet();
  6794          };
  6795  
  6796          var asyncGetterName = function (name) {
  6797            return "get" + name.charAt(0).toUpperCase() + name.slice(1);
  6798          };
  6799  
  6800          Property.prototype.buildGet = function () {
  6801            var property = this;
  6802            return function get() {
  6803              return property.formatOutput(
  6804                property.requestManager.send({
  6805                  method: property.getter,
  6806                })
  6807              );
  6808            };
  6809          };
  6810  
  6811          Property.prototype.buildAsyncGet = function () {
  6812            var property = this;
  6813            var get = function (callback) {
  6814              property.requestManager.sendAsync(
  6815                {
  6816                  method: property.getter,
  6817                },
  6818                function (err, result) {
  6819                  callback(err, property.formatOutput(result));
  6820                }
  6821              );
  6822            };
  6823            get.request = this.request.bind(this);
  6824            return get;
  6825          };
  6826  
  6827          /**
  6828           * Should be called to create pure JSONRPC request which can be used in batch request
  6829           *
  6830           * @method request
  6831           * @param {...} params
  6832           * @return {Object} jsonrpc request
  6833           */
  6834          Property.prototype.request = function () {
  6835            var payload = {
  6836              method: this.getter,
  6837              params: [],
  6838              callback: this.extractCallback(
  6839                Array.prototype.slice.call(arguments)
  6840              ),
  6841            };
  6842            payload.format = this.formatOutput.bind(this);
  6843            return payload;
  6844          };
  6845  
  6846          module.exports = Property;
  6847        },
  6848        { "../utils/utils": 20 },
  6849      ],
  6850      46: [
  6851        function (require, module, exports) {
  6852          /*
  6853      This file is part of web3.js.
  6854  
  6855      web3.js is free software: you can redistribute it and/or modify
  6856      it under the terms of the GNU Lesser General Public License as published by
  6857      the Free Software Foundation, either version 3 of the License, or
  6858      (at your option) any later version.
  6859  
  6860      web3.js is distributed in the hope that it will be useful,
  6861      but WITHOUT ANY WARRANTY; without even the implied warranty of
  6862      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6863      GNU Lesser General Public License for more details.
  6864  
  6865      You should have received a copy of the GNU Lesser General Public License
  6866      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  6867  */
  6868          /**
  6869           * @file requestmanager.js
  6870           * @author Jeffrey Wilcke <jeff@ethdev.com>
  6871           * @author Marek Kotewicz <marek@ethdev.com>
  6872           * @author Marian Oancea <marian@ethdev.com>
  6873           * @author Fabian Vogelsteller <fabian@ethdev.com>
  6874           * @author Gav Wood <g@ethdev.com>
  6875           * @date 2014
  6876           */
  6877  
  6878          var Jsonrpc = require("./jsonrpc");
  6879          var utils = require("../utils/utils");
  6880          var c = require("../utils/config");
  6881          var errors = require("./errors");
  6882  
  6883          /**
  6884           * It's responsible for passing messages to providers
  6885           * It's also responsible for polling the ethereum node for incoming messages
  6886           * Default poll timeout is 1 second
  6887           * Singleton
  6888           */
  6889          var RequestManager = function (provider) {
  6890            this.provider = provider;
  6891            this.polls = {};
  6892            this.timeout = null;
  6893          };
  6894  
  6895          /**
  6896           * Should be used to synchronously send request
  6897           *
  6898           * @method send
  6899           * @param {Object} data
  6900           * @return {Object}
  6901           */
  6902          RequestManager.prototype.send = function (data) {
  6903            if (!this.provider) {
  6904              console.error(errors.InvalidProvider());
  6905              return null;
  6906            }
  6907  
  6908            var payload = Jsonrpc.toPayload(data.method, data.params);
  6909            var result = this.provider.send(payload);
  6910  
  6911            if (!Jsonrpc.isValidResponse(result)) {
  6912              throw errors.InvalidResponse(result);
  6913            }
  6914  
  6915            return result.result;
  6916          };
  6917  
  6918          /**
  6919           * Should be used to asynchronously send request
  6920           *
  6921           * @method sendAsync
  6922           * @param {Object} data
  6923           * @param {Function} callback
  6924           */
  6925          RequestManager.prototype.sendAsync = function (data, callback) {
  6926            if (!this.provider) {
  6927              return callback(errors.InvalidProvider());
  6928            }
  6929  
  6930            var payload = Jsonrpc.toPayload(data.method, data.params);
  6931            this.provider.sendAsync(payload, function (err, result) {
  6932              if (err) {
  6933                return callback(err);
  6934              }
  6935  
  6936              if (!Jsonrpc.isValidResponse(result)) {
  6937                return callback(errors.InvalidResponse(result));
  6938              }
  6939  
  6940              callback(null, result.result);
  6941            });
  6942          };
  6943  
  6944          /**
  6945           * Should be called to asynchronously send batch request
  6946           *
  6947           * @method sendBatch
  6948           * @param {Array} batch data
  6949           * @param {Function} callback
  6950           */
  6951          RequestManager.prototype.sendBatch = function (data, callback) {
  6952            if (!this.provider) {
  6953              return callback(errors.InvalidProvider());
  6954            }
  6955  
  6956            var payload = Jsonrpc.toBatchPayload(data);
  6957  
  6958            this.provider.sendAsync(payload, function (err, results) {
  6959              if (err) {
  6960                return callback(err);
  6961              }
  6962  
  6963              if (!utils.isArray(results)) {
  6964                return callback(errors.InvalidResponse(results));
  6965              }
  6966  
  6967              callback(err, results);
  6968            });
  6969          };
  6970  
  6971          /**
  6972           * Should be used to set provider of request manager
  6973           *
  6974           * @method setProvider
  6975           * @param {Object}
  6976           */
  6977          RequestManager.prototype.setProvider = function (p) {
  6978            this.provider = p;
  6979          };
  6980  
  6981          /**
  6982           * Should be used to start polling
  6983           *
  6984           * @method startPolling
  6985           * @param {Object} data
  6986           * @param {Number} pollId
  6987           * @param {Function} callback
  6988           * @param {Function} uninstall
  6989           *
  6990           * @todo cleanup number of params
  6991           */
  6992          RequestManager.prototype.startPolling = function (
  6993            data,
  6994            pollId,
  6995            callback,
  6996            uninstall
  6997          ) {
  6998            this.polls[pollId] = {
  6999              data: data,
  7000              id: pollId,
  7001              callback: callback,
  7002              uninstall: uninstall,
  7003            };
  7004  
  7005            // start polling
  7006            if (!this.timeout) {
  7007              this.poll();
  7008            }
  7009          };
  7010  
  7011          /**
  7012           * Should be used to stop polling for filter with given id
  7013           *
  7014           * @method stopPolling
  7015           * @param {Number} pollId
  7016           */
  7017          RequestManager.prototype.stopPolling = function (pollId) {
  7018            delete this.polls[pollId];
  7019  
  7020            // stop polling
  7021            if (Object.keys(this.polls).length === 0 && this.timeout) {
  7022              clearTimeout(this.timeout);
  7023              this.timeout = null;
  7024            }
  7025          };
  7026  
  7027          /**
  7028           * Should be called to reset the polling mechanism of the request manager
  7029           *
  7030           * @method reset
  7031           */
  7032          RequestManager.prototype.reset = function (keepIsSyncing) {
  7033            /*jshint maxcomplexity:5 */
  7034  
  7035            for (var key in this.polls) {
  7036              // remove all polls, except sync polls,
  7037              // they need to be removed manually by calling syncing.stopWatching()
  7038              if (!keepIsSyncing || key.indexOf("syncPoll_") === -1) {
  7039                this.polls[key].uninstall();
  7040                delete this.polls[key];
  7041              }
  7042            }
  7043  
  7044            // stop polling
  7045            if (Object.keys(this.polls).length === 0 && this.timeout) {
  7046              clearTimeout(this.timeout);
  7047              this.timeout = null;
  7048            }
  7049          };
  7050  
  7051          /**
  7052           * Should be called to poll for changes on filter with given id
  7053           *
  7054           * @method poll
  7055           */
  7056          RequestManager.prototype.poll = function () {
  7057            /*jshint maxcomplexity: 6 */
  7058            this.timeout = setTimeout(
  7059              this.poll.bind(this),
  7060              c.ETH_POLLING_TIMEOUT
  7061            );
  7062  
  7063            if (Object.keys(this.polls).length === 0) {
  7064              return;
  7065            }
  7066  
  7067            if (!this.provider) {
  7068              console.error(errors.InvalidProvider());
  7069              return;
  7070            }
  7071  
  7072            var pollsData = [];
  7073            var pollsIds = [];
  7074            for (var key in this.polls) {
  7075              pollsData.push(this.polls[key].data);
  7076              pollsIds.push(key);
  7077            }
  7078  
  7079            if (pollsData.length === 0) {
  7080              return;
  7081            }
  7082  
  7083            var payload = Jsonrpc.toBatchPayload(pollsData);
  7084  
  7085            // map the request id to they poll id
  7086            var pollsIdMap = {};
  7087            payload.forEach(function (load, index) {
  7088              pollsIdMap[load.id] = pollsIds[index];
  7089            });
  7090  
  7091            var self = this;
  7092            this.provider.sendAsync(payload, function (error, results) {
  7093              // TODO: console log?
  7094              if (error) {
  7095                return;
  7096              }
  7097  
  7098              if (!utils.isArray(results)) {
  7099                throw errors.InvalidResponse(results);
  7100              }
  7101              results
  7102                .map(function (result) {
  7103                  var id = pollsIdMap[result.id];
  7104  
  7105                  // make sure the filter is still installed after arrival of the request
  7106                  if (self.polls[id]) {
  7107                    result.callback = self.polls[id].callback;
  7108                    return result;
  7109                  } else return false;
  7110                })
  7111                .filter(function (result) {
  7112                  return !!result;
  7113                })
  7114                .filter(function (result) {
  7115                  var valid = Jsonrpc.isValidResponse(result);
  7116                  if (!valid) {
  7117                    result.callback(errors.InvalidResponse(result));
  7118                  }
  7119                  return valid;
  7120                })
  7121                .forEach(function (result) {
  7122                  result.callback(null, result.result);
  7123                });
  7124            });
  7125          };
  7126  
  7127          module.exports = RequestManager;
  7128        },
  7129        {
  7130          "../utils/config": 18,
  7131          "../utils/utils": 20,
  7132          "./errors": 26,
  7133          "./jsonrpc": 35,
  7134        },
  7135      ],
  7136      47: [
  7137        function (require, module, exports) {
  7138          var Settings = function () {
  7139            this.defaultBlock = "latest";
  7140            this.defaultAccount = undefined;
  7141          };
  7142  
  7143          module.exports = Settings;
  7144        },
  7145        {},
  7146      ],
  7147      48: [
  7148        function (require, module, exports) {
  7149          /*
  7150      This file is part of web3.js.
  7151  
  7152      web3.js is free software: you can redistribute it and/or modify
  7153      it under the terms of the GNU Lesser General Public License as published by
  7154      the Free Software Foundation, either version 3 of the License, or
  7155      (at your option) any later version.
  7156  
  7157      web3.js is distributed in the hope that it will be useful,
  7158      but WITHOUT ANY WARRANTY; without even the implied warranty of
  7159      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  7160      GNU Lesser General Public License for more details.
  7161  
  7162      You should have received a copy of the GNU Lesser General Public License
  7163      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  7164  */
  7165          /** @file syncing.js
  7166           * @authors:
  7167           *   Fabian Vogelsteller <fabian@ethdev.com>
  7168           * @date 2015
  7169           */
  7170  
  7171          var formatters = require("./formatters");
  7172          var utils = require("../utils/utils");
  7173  
  7174          var count = 1;
  7175  
  7176          /**
  7177  Adds the callback and sets up the methods, to iterate over the results.
  7178  
  7179  @method pollSyncing
  7180  @param {Object} self
  7181  */
  7182          var pollSyncing = function (self) {
  7183            var onMessage = function (error, sync) {
  7184              if (error) {
  7185                return self.callbacks.forEach(function (callback) {
  7186                  callback(error);
  7187                });
  7188              }
  7189  
  7190              if (utils.isObject(sync) && sync.startingBlock)
  7191                sync = formatters.outputSyncingFormatter(sync);
  7192  
  7193              self.callbacks.forEach(function (callback) {
  7194                if (self.lastSyncState !== sync) {
  7195                  // call the callback with true first so the app can stop anything, before receiving the sync data
  7196                  if (!self.lastSyncState && utils.isObject(sync))
  7197                    callback(null, true);
  7198  
  7199                  // call on the next CPU cycle, so the actions of the sync stop can be processes first
  7200                  setTimeout(function () {
  7201                    callback(null, sync);
  7202                  }, 0);
  7203  
  7204                  self.lastSyncState = sync;
  7205                }
  7206              });
  7207            };
  7208  
  7209            self.requestManager.startPolling(
  7210              {
  7211                method: "eth_syncing",
  7212                params: [],
  7213              },
  7214              self.pollId,
  7215              onMessage,
  7216              self.stopWatching.bind(self)
  7217            );
  7218          };
  7219  
  7220          var IsSyncing = function (requestManager, callback) {
  7221            this.requestManager = requestManager;
  7222            this.pollId = "syncPoll_" + count++;
  7223            this.callbacks = [];
  7224            this.addCallback(callback);
  7225            this.lastSyncState = false;
  7226            pollSyncing(this);
  7227  
  7228            return this;
  7229          };
  7230  
  7231          IsSyncing.prototype.addCallback = function (callback) {
  7232            if (callback) this.callbacks.push(callback);
  7233            return this;
  7234          };
  7235  
  7236          IsSyncing.prototype.stopWatching = function () {
  7237            this.requestManager.stopPolling(this.pollId);
  7238            this.callbacks = [];
  7239          };
  7240  
  7241          module.exports = IsSyncing;
  7242        },
  7243        { "../utils/utils": 20, "./formatters": 30 },
  7244      ],
  7245      49: [
  7246        function (require, module, exports) {
  7247          /*
  7248      This file is part of web3.js.
  7249  
  7250      web3.js is free software: you can redistribute it and/or modify
  7251      it under the terms of the GNU Lesser General Public License as published by
  7252      the Free Software Foundation, either version 3 of the License, or
  7253      (at your option) any later version.
  7254  
  7255      web3.js is distributed in the hope that it will be useful,
  7256      but WITHOUT ANY WARRANTY; without even the implied warranty of
  7257      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  7258      GNU Lesser General Public License for more details.
  7259  
  7260      You should have received a copy of the GNU Lesser General Public License
  7261      along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
  7262  */
  7263          /**
  7264           * @file transfer.js
  7265           * @author Marek Kotewicz <marek@ethdev.com>
  7266           * @date 2015
  7267           */
  7268  
  7269          var Iban = require("./iban");
  7270          var exchangeAbi = require("../contracts/SmartExchange.json");
  7271  
  7272          /**
  7273           * Should be used to make Iban transfer
  7274           *
  7275           * @method transfer
  7276           * @param {String} from
  7277           * @param {String} to iban
  7278           * @param {Value} value to be tranfered
  7279           * @param {Function} callback, callback
  7280           */
  7281          var transfer = function (eth, from, to, value, callback) {
  7282            var iban = new Iban(to);
  7283            if (!iban.isValid()) {
  7284              throw new Error("invalid iban address");
  7285            }
  7286  
  7287            if (iban.isDirect()) {
  7288              return transferToAddress(
  7289                eth,
  7290                from,
  7291                iban.address(),
  7292                value,
  7293                callback
  7294              );
  7295            }
  7296  
  7297            if (!callback) {
  7298              var address = eth.icapNamereg().addr(iban.institution());
  7299              return deposit(eth, from, address, value, iban.client());
  7300            }
  7301  
  7302            eth.icapNamereg().addr(iban.institution(), function (err, address) {
  7303              return deposit(eth, from, address, value, iban.client(), callback);
  7304            });
  7305          };
  7306  
  7307          /**
  7308           * Should be used to transfer funds to certain address
  7309           *
  7310           * @method transferToAddress
  7311           * @param {String} from
  7312           * @param {String} to
  7313           * @param {Value} value to be tranfered
  7314           * @param {Function} callback, callback
  7315           */
  7316          var transferToAddress = function (eth, from, to, value, callback) {
  7317            return eth.sendTransaction(
  7318              {
  7319                address: to,
  7320                from: from,
  7321                value: value,
  7322              },
  7323              callback
  7324            );
  7325          };
  7326  
  7327          /**
  7328           * Should be used to deposit funds to generic Exchange contract (must implement deposit(bytes32) method!)
  7329           *
  7330           * @method deposit
  7331           * @param {String} from
  7332           * @param {String} to
  7333           * @param {Value} value to be transferred
  7334           * @param {String} client unique identifier
  7335           * @param {Function} callback, callback
  7336           */
  7337          var deposit = function (eth, from, to, value, client, callback) {
  7338            var abi = exchangeAbi;
  7339            return eth.contract(abi).at(to).deposit(
  7340              client,
  7341              {
  7342                from: from,
  7343                value: value,
  7344              },
  7345              callback
  7346            );
  7347          };
  7348  
  7349          module.exports = transfer;
  7350        },
  7351        { "../contracts/SmartExchange.json": 3, "./iban": 33 },
  7352      ],
  7353      50: [function (require, module, exports) {}, {}],
  7354      51: [
  7355        function (require, module, exports) {
  7356          (function (root, factory, undef) {
  7357            if (typeof exports === "object") {
  7358              // CommonJS
  7359              module.exports = exports = factory(
  7360                require("./core"),
  7361                require("./enc-base64"),
  7362                require("./md5"),
  7363                require("./evpkdf"),
  7364                require("./cipher-core")
  7365              );
  7366            } else if (typeof define === "function" && define.amd) {
  7367              // AMD
  7368              define([
  7369                "./core",
  7370                "./enc-base64",
  7371                "./md5",
  7372                "./evpkdf",
  7373                "./cipher-core",
  7374              ], factory);
  7375            } else {
  7376              // Global (browser)
  7377              factory(root.CryptoJS);
  7378            }
  7379          })(this, function (CryptoJS) {
  7380            (function () {
  7381              // Shortcuts
  7382              var C = CryptoJS;
  7383              var C_lib = C.lib;
  7384              var BlockCipher = C_lib.BlockCipher;
  7385              var C_algo = C.algo;
  7386  
  7387              // Lookup tables
  7388              var SBOX = [];
  7389              var INV_SBOX = [];
  7390              var SUB_MIX_0 = [];
  7391              var SUB_MIX_1 = [];
  7392              var SUB_MIX_2 = [];
  7393              var SUB_MIX_3 = [];
  7394              var INV_SUB_MIX_0 = [];
  7395              var INV_SUB_MIX_1 = [];
  7396              var INV_SUB_MIX_2 = [];
  7397              var INV_SUB_MIX_3 = [];
  7398  
  7399              // Compute lookup tables
  7400              (function () {
  7401                // Compute double table
  7402                var d = [];
  7403                for (var i = 0; i < 256; i++) {
  7404                  if (i < 128) {
  7405                    d[i] = i << 1;
  7406                  } else {
  7407                    d[i] = (i << 1) ^ 0x11b;
  7408                  }
  7409                }
  7410  
  7411                // Walk GF(2^8)
  7412                var x = 0;
  7413                var xi = 0;
  7414                for (var i = 0; i < 256; i++) {
  7415                  // Compute sbox
  7416                  var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
  7417                  sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
  7418                  SBOX[x] = sx;
  7419                  INV_SBOX[sx] = x;
  7420  
  7421                  // Compute multiplication
  7422                  var x2 = d[x];
  7423                  var x4 = d[x2];
  7424                  var x8 = d[x4];
  7425  
  7426                  // Compute sub bytes, mix columns tables
  7427                  var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
  7428                  SUB_MIX_0[x] = (t << 24) | (t >>> 8);
  7429                  SUB_MIX_1[x] = (t << 16) | (t >>> 16);
  7430                  SUB_MIX_2[x] = (t << 8) | (t >>> 24);
  7431                  SUB_MIX_3[x] = t;
  7432  
  7433                  // Compute inv sub bytes, inv mix columns tables
  7434                  var t =
  7435                    (x8 * 0x1010101) ^
  7436                    (x4 * 0x10001) ^
  7437                    (x2 * 0x101) ^
  7438                    (x * 0x1010100);
  7439                  INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
  7440                  INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
  7441                  INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
  7442                  INV_SUB_MIX_3[sx] = t;
  7443  
  7444                  // Compute next counter
  7445                  if (!x) {
  7446                    x = xi = 1;
  7447                  } else {
  7448                    x = x2 ^ d[d[d[x8 ^ x2]]];
  7449                    xi ^= d[d[xi]];
  7450                  }
  7451                }
  7452              })();
  7453  
  7454              // Precomputed Rcon lookup
  7455              var RCON = [
  7456                0x00,
  7457                0x01,
  7458                0x02,
  7459                0x04,
  7460                0x08,
  7461                0x10,
  7462                0x20,
  7463                0x40,
  7464                0x80,
  7465                0x1b,
  7466                0x36,
  7467              ];
  7468  
  7469              /**
  7470               * AES block cipher algorithm.
  7471               */
  7472              var AES = (C_algo.AES = BlockCipher.extend({
  7473                _doReset: function () {
  7474                  // Skip reset of nRounds has been set before and key did not change
  7475                  if (this._nRounds && this._keyPriorReset === this._key) {
  7476                    return;
  7477                  }
  7478  
  7479                  // Shortcuts
  7480                  var key = (this._keyPriorReset = this._key);
  7481                  var keyWords = key.words;
  7482                  var keySize = key.sigBytes / 4;
  7483  
  7484                  // Compute number of rounds
  7485                  var nRounds = (this._nRounds = keySize + 6);
  7486  
  7487                  // Compute number of key schedule rows
  7488                  var ksRows = (nRounds + 1) * 4;
  7489  
  7490                  // Compute key schedule
  7491                  var keySchedule = (this._keySchedule = []);
  7492                  for (var ksRow = 0; ksRow < ksRows; ksRow++) {
  7493                    if (ksRow < keySize) {
  7494                      keySchedule[ksRow] = keyWords[ksRow];
  7495                    } else {
  7496                      var t = keySchedule[ksRow - 1];
  7497  
  7498                      if (!(ksRow % keySize)) {
  7499                        // Rot word
  7500                        t = (t << 8) | (t >>> 24);
  7501  
  7502                        // Sub word
  7503                        t =
  7504                          (SBOX[t >>> 24] << 24) |
  7505                          (SBOX[(t >>> 16) & 0xff] << 16) |
  7506                          (SBOX[(t >>> 8) & 0xff] << 8) |
  7507                          SBOX[t & 0xff];
  7508  
  7509                        // Mix Rcon
  7510                        t ^= RCON[(ksRow / keySize) | 0] << 24;
  7511                      } else if (keySize > 6 && ksRow % keySize == 4) {
  7512                        // Sub word
  7513                        t =
  7514                          (SBOX[t >>> 24] << 24) |
  7515                          (SBOX[(t >>> 16) & 0xff] << 16) |
  7516                          (SBOX[(t >>> 8) & 0xff] << 8) |
  7517                          SBOX[t & 0xff];
  7518                      }
  7519  
  7520                      keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
  7521                    }
  7522                  }
  7523  
  7524                  // Compute inv key schedule
  7525                  var invKeySchedule = (this._invKeySchedule = []);
  7526                  for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
  7527                    var ksRow = ksRows - invKsRow;
  7528  
  7529                    if (invKsRow % 4) {
  7530                      var t = keySchedule[ksRow];
  7531                    } else {
  7532                      var t = keySchedule[ksRow - 4];
  7533                    }
  7534  
  7535                    if (invKsRow < 4 || ksRow <= 4) {
  7536                      invKeySchedule[invKsRow] = t;
  7537                    } else {
  7538                      invKeySchedule[invKsRow] =
  7539                        INV_SUB_MIX_0[SBOX[t >>> 24]] ^
  7540                        INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
  7541                        INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^
  7542                        INV_SUB_MIX_3[SBOX[t & 0xff]];
  7543                    }
  7544                  }
  7545                },
  7546  
  7547                encryptBlock: function (M, offset) {
  7548                  this._doCryptBlock(
  7549                    M,
  7550                    offset,
  7551                    this._keySchedule,
  7552                    SUB_MIX_0,
  7553                    SUB_MIX_1,
  7554                    SUB_MIX_2,
  7555                    SUB_MIX_3,
  7556                    SBOX
  7557                  );
  7558                },
  7559  
  7560                decryptBlock: function (M, offset) {
  7561                  // Swap 2nd and 4th rows
  7562                  var t = M[offset + 1];
  7563                  M[offset + 1] = M[offset + 3];
  7564                  M[offset + 3] = t;
  7565  
  7566                  this._doCryptBlock(
  7567                    M,
  7568                    offset,
  7569                    this._invKeySchedule,
  7570                    INV_SUB_MIX_0,
  7571                    INV_SUB_MIX_1,
  7572                    INV_SUB_MIX_2,
  7573                    INV_SUB_MIX_3,
  7574                    INV_SBOX
  7575                  );
  7576  
  7577                  // Inv swap 2nd and 4th rows
  7578                  var t = M[offset + 1];
  7579                  M[offset + 1] = M[offset + 3];
  7580                  M[offset + 3] = t;
  7581                },
  7582  
  7583                _doCryptBlock: function (
  7584                  M,
  7585                  offset,
  7586                  keySchedule,
  7587                  SUB_MIX_0,
  7588                  SUB_MIX_1,
  7589                  SUB_MIX_2,
  7590                  SUB_MIX_3,
  7591                  SBOX
  7592                ) {
  7593                  // Shortcut
  7594                  var nRounds = this._nRounds;
  7595  
  7596                  // Get input, add round key
  7597                  var s0 = M[offset] ^ keySchedule[0];
  7598                  var s1 = M[offset + 1] ^ keySchedule[1];
  7599                  var s2 = M[offset + 2] ^ keySchedule[2];
  7600                  var s3 = M[offset + 3] ^ keySchedule[3];
  7601  
  7602                  // Key schedule row counter
  7603                  var ksRow = 4;
  7604  
  7605                  // Rounds
  7606                  for (var round = 1; round < nRounds; round++) {
  7607                    // Shift rows, sub bytes, mix columns, add round key
  7608                    var t0 =
  7609                      SUB_MIX_0[s0 >>> 24] ^
  7610                      SUB_MIX_1[(s1 >>> 16) & 0xff] ^
  7611                      SUB_MIX_2[(s2 >>> 8) & 0xff] ^
  7612                      SUB_MIX_3[s3 & 0xff] ^
  7613                      keySchedule[ksRow++];
  7614                    var t1 =
  7615                      SUB_MIX_0[s1 >>> 24] ^
  7616                      SUB_MIX_1[(s2 >>> 16) & 0xff] ^
  7617                      SUB_MIX_2[(s3 >>> 8) & 0xff] ^
  7618                      SUB_MIX_3[s0 & 0xff] ^
  7619                      keySchedule[ksRow++];
  7620                    var t2 =
  7621                      SUB_MIX_0[s2 >>> 24] ^
  7622                      SUB_MIX_1[(s3 >>> 16) & 0xff] ^
  7623                      SUB_MIX_2[(s0 >>> 8) & 0xff] ^
  7624                      SUB_MIX_3[s1 & 0xff] ^
  7625                      keySchedule[ksRow++];
  7626                    var t3 =
  7627                      SUB_MIX_0[s3 >>> 24] ^
  7628                      SUB_MIX_1[(s0 >>> 16) & 0xff] ^
  7629                      SUB_MIX_2[(s1 >>> 8) & 0xff] ^
  7630                      SUB_MIX_3[s2 & 0xff] ^
  7631                      keySchedule[ksRow++];
  7632  
  7633                    // Update state
  7634                    s0 = t0;
  7635                    s1 = t1;
  7636                    s2 = t2;
  7637                    s3 = t3;
  7638                  }
  7639  
  7640                  // Shift rows, sub bytes, add round key
  7641                  var t0 =
  7642                    ((SBOX[s0 >>> 24] << 24) |
  7643                      (SBOX[(s1 >>> 16) & 0xff] << 16) |
  7644                      (SBOX[(s2 >>> 8) & 0xff] << 8) |
  7645                      SBOX[s3 & 0xff]) ^
  7646                    keySchedule[ksRow++];
  7647                  var t1 =
  7648                    ((SBOX[s1 >>> 24] << 24) |
  7649                      (SBOX[(s2 >>> 16) & 0xff] << 16) |
  7650                      (SBOX[(s3 >>> 8) & 0xff] << 8) |
  7651                      SBOX[s0 & 0xff]) ^
  7652                    keySchedule[ksRow++];
  7653                  var t2 =
  7654                    ((SBOX[s2 >>> 24] << 24) |
  7655                      (SBOX[(s3 >>> 16) & 0xff] << 16) |
  7656                      (SBOX[(s0 >>> 8) & 0xff] << 8) |
  7657                      SBOX[s1 & 0xff]) ^
  7658                    keySchedule[ksRow++];
  7659                  var t3 =
  7660                    ((SBOX[s3 >>> 24] << 24) |
  7661                      (SBOX[(s0 >>> 16) & 0xff] << 16) |
  7662                      (SBOX[(s1 >>> 8) & 0xff] << 8) |
  7663                      SBOX[s2 & 0xff]) ^
  7664                    keySchedule[ksRow++];
  7665  
  7666                  // Set output
  7667                  M[offset] = t0;
  7668                  M[offset + 1] = t1;
  7669                  M[offset + 2] = t2;
  7670                  M[offset + 3] = t3;
  7671                },
  7672  
  7673                keySize: 256 / 32,
  7674              }));
  7675  
  7676              /**
  7677               * Shortcut functions to the cipher's object interface.
  7678               *
  7679               * @example
  7680               *
  7681               *     var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
  7682               *     var plaintext  = CryptoJS.AES.decrypt(ciphertext, key, cfg);
  7683               */
  7684              C.AES = BlockCipher._createHelper(AES);
  7685            })();
  7686  
  7687            return CryptoJS.AES;
  7688          });
  7689        },
  7690        {
  7691          "./cipher-core": 52,
  7692          "./core": 53,
  7693          "./enc-base64": 54,
  7694          "./evpkdf": 56,
  7695          "./md5": 61,
  7696        },
  7697      ],
  7698      52: [
  7699        function (require, module, exports) {
  7700          (function (root, factory) {
  7701            if (typeof exports === "object") {
  7702              // CommonJS
  7703              module.exports = exports = factory(require("./core"));
  7704            } else if (typeof define === "function" && define.amd) {
  7705              // AMD
  7706              define(["./core"], factory);
  7707            } else {
  7708              // Global (browser)
  7709              factory(root.CryptoJS);
  7710            }
  7711          })(this, function (CryptoJS) {
  7712            /**
  7713             * Cipher core components.
  7714             */
  7715            CryptoJS.lib.Cipher ||
  7716              (function (undefined) {
  7717                // Shortcuts
  7718                var C = CryptoJS;
  7719                var C_lib = C.lib;
  7720                var Base = C_lib.Base;
  7721                var WordArray = C_lib.WordArray;
  7722                var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
  7723                var C_enc = C.enc;
  7724                var Utf8 = C_enc.Utf8;
  7725                var Base64 = C_enc.Base64;
  7726                var C_algo = C.algo;
  7727                var EvpKDF = C_algo.EvpKDF;
  7728  
  7729                /**
  7730                 * Abstract base cipher template.
  7731                 *
  7732                 * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
  7733                 * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
  7734                 * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
  7735                 * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
  7736                 */
  7737                var Cipher = (C_lib.Cipher = BufferedBlockAlgorithm.extend({
  7738                  /**
  7739                   * Configuration options.
  7740                   *
  7741                   * @property {WordArray} iv The IV to use for this operation.
  7742                   */
  7743                  cfg: Base.extend(),
  7744  
  7745                  /**
  7746                   * Creates this cipher in encryption mode.
  7747                   *
  7748                   * @param {WordArray} key The key.
  7749                   * @param {Object} cfg (Optional) The configuration options to use for this operation.
  7750                   *
  7751                   * @return {Cipher} A cipher instance.
  7752                   *
  7753                   * @static
  7754                   *
  7755                   * @example
  7756                   *
  7757                   *     var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
  7758                   */
  7759                  createEncryptor: function (key, cfg) {
  7760                    return this.create(this._ENC_XFORM_MODE, key, cfg);
  7761                  },
  7762  
  7763                  /**
  7764                   * Creates this cipher in decryption mode.
  7765                   *
  7766                   * @param {WordArray} key The key.
  7767                   * @param {Object} cfg (Optional) The configuration options to use for this operation.
  7768                   *
  7769                   * @return {Cipher} A cipher instance.
  7770                   *
  7771                   * @static
  7772                   *
  7773                   * @example
  7774                   *
  7775                   *     var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
  7776                   */
  7777                  createDecryptor: function (key, cfg) {
  7778                    return this.create(this._DEC_XFORM_MODE, key, cfg);
  7779                  },
  7780  
  7781                  /**
  7782                   * Initializes a newly created cipher.
  7783                   *
  7784                   * @param {number} xformMode Either the encryption or decryption transormation mode constant.
  7785                   * @param {WordArray} key The key.
  7786                   * @param {Object} cfg (Optional) The configuration options to use for this operation.
  7787                   *
  7788                   * @example
  7789                   *
  7790                   *     var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
  7791                   */
  7792                  init: function (xformMode, key, cfg) {
  7793                    // Apply config defaults
  7794                    this.cfg = this.cfg.extend(cfg);
  7795  
  7796                    // Store transform mode and key
  7797                    this._xformMode = xformMode;
  7798                    this._key = key;
  7799  
  7800                    // Set initial values
  7801                    this.reset();
  7802                  },
  7803  
  7804                  /**
  7805                   * Resets this cipher to its initial state.
  7806                   *
  7807                   * @example
  7808                   *
  7809                   *     cipher.reset();
  7810                   */
  7811                  reset: function () {
  7812                    // Reset data buffer
  7813                    BufferedBlockAlgorithm.reset.call(this);
  7814  
  7815                    // Perform concrete-cipher logic
  7816                    this._doReset();
  7817                  },
  7818  
  7819                  /**
  7820                   * Adds data to be encrypted or decrypted.
  7821                   *
  7822                   * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
  7823                   *
  7824                   * @return {WordArray} The data after processing.
  7825                   *
  7826                   * @example
  7827                   *
  7828                   *     var encrypted = cipher.process('data');
  7829                   *     var encrypted = cipher.process(wordArray);
  7830                   */
  7831                  process: function (dataUpdate) {
  7832                    // Append
  7833                    this._append(dataUpdate);
  7834  
  7835                    // Process available blocks
  7836                    return this._process();
  7837                  },
  7838  
  7839                  /**
  7840                   * Finalizes the encryption or decryption process.
  7841                   * Note that the finalize operation is effectively a destructive, read-once operation.
  7842                   *
  7843                   * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
  7844                   *
  7845                   * @return {WordArray} The data after final processing.
  7846                   *
  7847                   * @example
  7848                   *
  7849                   *     var encrypted = cipher.finalize();
  7850                   *     var encrypted = cipher.finalize('data');
  7851                   *     var encrypted = cipher.finalize(wordArray);
  7852                   */
  7853                  finalize: function (dataUpdate) {
  7854                    // Final data update
  7855                    if (dataUpdate) {
  7856                      this._append(dataUpdate);
  7857                    }
  7858  
  7859                    // Perform concrete-cipher logic
  7860                    var finalProcessedData = this._doFinalize();
  7861  
  7862                    return finalProcessedData;
  7863                  },
  7864  
  7865                  keySize: 128 / 32,
  7866  
  7867                  ivSize: 128 / 32,
  7868  
  7869                  _ENC_XFORM_MODE: 1,
  7870  
  7871                  _DEC_XFORM_MODE: 2,
  7872  
  7873                  /**
  7874                   * Creates shortcut functions to a cipher's object interface.
  7875                   *
  7876                   * @param {Cipher} cipher The cipher to create a helper for.
  7877                   *
  7878                   * @return {Object} An object with encrypt and decrypt shortcut functions.
  7879                   *
  7880                   * @static
  7881                   *
  7882                   * @example
  7883                   *
  7884                   *     var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
  7885                   */
  7886                  _createHelper: (function () {
  7887                    function selectCipherStrategy(key) {
  7888                      if (typeof key == "string") {
  7889                        return PasswordBasedCipher;
  7890                      } else {
  7891                        return SerializableCipher;
  7892                      }
  7893                    }
  7894  
  7895                    return function (cipher) {
  7896                      return {
  7897                        encrypt: function (message, key, cfg) {
  7898                          return selectCipherStrategy(key).encrypt(
  7899                            cipher,
  7900                            message,
  7901                            key,
  7902                            cfg
  7903                          );
  7904                        },
  7905  
  7906                        decrypt: function (ciphertext, key, cfg) {
  7907                          return selectCipherStrategy(key).decrypt(
  7908                            cipher,
  7909                            ciphertext,
  7910                            key,
  7911                            cfg
  7912                          );
  7913                        },
  7914                      };
  7915                    };
  7916                  })(),
  7917                }));
  7918  
  7919                /**
  7920                 * Abstract base stream cipher template.
  7921                 *
  7922                 * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
  7923                 */
  7924                var StreamCipher = (C_lib.StreamCipher = Cipher.extend({
  7925                  _doFinalize: function () {
  7926                    // Process partial blocks
  7927                    var finalProcessedBlocks = this._process(!!"flush");
  7928  
  7929                    return finalProcessedBlocks;
  7930                  },
  7931  
  7932                  blockSize: 1,
  7933                }));
  7934  
  7935                /**
  7936                 * Mode namespace.
  7937                 */
  7938                var C_mode = (C.mode = {});
  7939  
  7940                /**
  7941                 * Abstract base block cipher mode template.
  7942                 */
  7943                var BlockCipherMode = (C_lib.BlockCipherMode = Base.extend({
  7944                  /**
  7945                   * Creates this mode for encryption.
  7946                   *
  7947                   * @param {Cipher} cipher A block cipher instance.
  7948                   * @param {Array} iv The IV words.
  7949                   *
  7950                   * @static
  7951                   *
  7952                   * @example
  7953                   *
  7954                   *     var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
  7955                   */
  7956                  createEncryptor: function (cipher, iv) {
  7957                    return this.Encryptor.create(cipher, iv);
  7958                  },
  7959  
  7960                  /**
  7961                   * Creates this mode for decryption.
  7962                   *
  7963                   * @param {Cipher} cipher A block cipher instance.
  7964                   * @param {Array} iv The IV words.
  7965                   *
  7966                   * @static
  7967                   *
  7968                   * @example
  7969                   *
  7970                   *     var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
  7971                   */
  7972                  createDecryptor: function (cipher, iv) {
  7973                    return this.Decryptor.create(cipher, iv);
  7974                  },
  7975  
  7976                  /**
  7977                   * Initializes a newly created mode.
  7978                   *
  7979                   * @param {Cipher} cipher A block cipher instance.
  7980                   * @param {Array} iv The IV words.
  7981                   *
  7982                   * @example
  7983                   *
  7984                   *     var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
  7985                   */
  7986                  init: function (cipher, iv) {
  7987                    this._cipher = cipher;
  7988                    this._iv = iv;
  7989                  },
  7990                }));
  7991  
  7992                /**
  7993                 * Cipher Block Chaining mode.
  7994                 */
  7995                var CBC = (C_mode.CBC = (function () {
  7996                  /**
  7997                   * Abstract base CBC mode.
  7998                   */
  7999                  var CBC = BlockCipherMode.extend();
  8000  
  8001                  /**
  8002                   * CBC encryptor.
  8003                   */
  8004                  CBC.Encryptor = CBC.extend({
  8005                    /**
  8006                     * Processes the data block at offset.
  8007                     *
  8008                     * @param {Array} words The data words to operate on.
  8009                     * @param {number} offset The offset where the block starts.
  8010                     *
  8011                     * @example
  8012                     *
  8013                     *     mode.processBlock(data.words, offset);
  8014                     */
  8015                    processBlock: function (words, offset) {
  8016                      // Shortcuts
  8017                      var cipher = this._cipher;
  8018                      var blockSize = cipher.blockSize;
  8019  
  8020                      // XOR and encrypt
  8021                      xorBlock.call(this, words, offset, blockSize);
  8022                      cipher.encryptBlock(words, offset);
  8023  
  8024                      // Remember this block to use with next block
  8025                      this._prevBlock = words.slice(offset, offset + blockSize);
  8026                    },
  8027                  });
  8028  
  8029                  /**
  8030                   * CBC decryptor.
  8031                   */
  8032                  CBC.Decryptor = CBC.extend({
  8033                    /**
  8034                     * Processes the data block at offset.
  8035                     *
  8036                     * @param {Array} words The data words to operate on.
  8037                     * @param {number} offset The offset where the block starts.
  8038                     *
  8039                     * @example
  8040                     *
  8041                     *     mode.processBlock(data.words, offset);
  8042                     */
  8043                    processBlock: function (words, offset) {
  8044                      // Shortcuts
  8045                      var cipher = this._cipher;
  8046                      var blockSize = cipher.blockSize;
  8047  
  8048                      // Remember this block to use with next block
  8049                      var thisBlock = words.slice(offset, offset + blockSize);
  8050  
  8051                      // Decrypt and XOR
  8052                      cipher.decryptBlock(words, offset);
  8053                      xorBlock.call(this, words, offset, blockSize);
  8054  
  8055                      // This block becomes the previous block
  8056                      this._prevBlock = thisBlock;
  8057                    },
  8058                  });
  8059  
  8060                  function xorBlock(words, offset, blockSize) {
  8061                    // Shortcut
  8062                    var iv = this._iv;
  8063  
  8064                    // Choose mixing block
  8065                    if (iv) {
  8066                      var block = iv;
  8067  
  8068                      // Remove IV for subsequent blocks
  8069                      this._iv = undefined;
  8070                    } else {
  8071                      var block = this._prevBlock;
  8072                    }
  8073  
  8074                    // XOR blocks
  8075                    for (var i = 0; i < blockSize; i++) {
  8076                      words[offset + i] ^= block[i];
  8077                    }
  8078                  }
  8079  
  8080                  return CBC;
  8081                })());
  8082  
  8083                /**
  8084                 * Padding namespace.
  8085                 */
  8086                var C_pad = (C.pad = {});
  8087  
  8088                /**
  8089                 * PKCS #5/7 padding strategy.
  8090                 */
  8091                var Pkcs7 = (C_pad.Pkcs7 = {
  8092                  /**
  8093                   * Pads data using the algorithm defined in PKCS #5/7.
  8094                   *
  8095                   * @param {WordArray} data The data to pad.
  8096                   * @param {number} blockSize The multiple that the data should be padded to.
  8097                   *
  8098                   * @static
  8099                   *
  8100                   * @example
  8101                   *
  8102                   *     CryptoJS.pad.Pkcs7.pad(wordArray, 4);
  8103                   */
  8104                  pad: function (data, blockSize) {
  8105                    // Shortcut
  8106                    var blockSizeBytes = blockSize * 4;
  8107  
  8108                    // Count padding bytes
  8109                    var nPaddingBytes =
  8110                      blockSizeBytes - (data.sigBytes % blockSizeBytes);
  8111  
  8112                    // Create padding word
  8113                    var paddingWord =
  8114                      (nPaddingBytes << 24) |
  8115                      (nPaddingBytes << 16) |
  8116                      (nPaddingBytes << 8) |
  8117                      nPaddingBytes;
  8118  
  8119                    // Create padding
  8120                    var paddingWords = [];
  8121                    for (var i = 0; i < nPaddingBytes; i += 4) {
  8122                      paddingWords.push(paddingWord);
  8123                    }
  8124                    var padding = WordArray.create(paddingWords, nPaddingBytes);
  8125  
  8126                    // Add padding
  8127                    data.concat(padding);
  8128                  },
  8129  
  8130                  /**
  8131                   * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
  8132                   *
  8133                   * @param {WordArray} data The data to unpad.
  8134                   *
  8135                   * @static
  8136                   *
  8137                   * @example
  8138                   *
  8139                   *     CryptoJS.pad.Pkcs7.unpad(wordArray);
  8140                   */
  8141                  unpad: function (data) {
  8142                    // Get number of padding bytes from last byte
  8143                    var nPaddingBytes =
  8144                      data.words[(data.sigBytes - 1) >>> 2] & 0xff;
  8145  
  8146                    // Remove padding
  8147                    data.sigBytes -= nPaddingBytes;
  8148                  },
  8149                });
  8150  
  8151                /**
  8152                 * Abstract base block cipher template.
  8153                 *
  8154                 * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
  8155                 */
  8156                var BlockCipher = (C_lib.BlockCipher = Cipher.extend({
  8157                  /**
  8158                   * Configuration options.
  8159                   *
  8160                   * @property {Mode} mode The block mode to use. Default: CBC
  8161                   * @property {Padding} padding The padding strategy to use. Default: Pkcs7
  8162                   */
  8163                  cfg: Cipher.cfg.extend({
  8164                    mode: CBC,
  8165                    padding: Pkcs7,
  8166                  }),
  8167  
  8168                  reset: function () {
  8169                    // Reset cipher
  8170                    Cipher.reset.call(this);
  8171  
  8172                    // Shortcuts
  8173                    var cfg = this.cfg;
  8174                    var iv = cfg.iv;
  8175                    var mode = cfg.mode;
  8176  
  8177                    // Reset block mode
  8178                    if (this._xformMode == this._ENC_XFORM_MODE) {
  8179                      var modeCreator = mode.createEncryptor;
  8180                    } /* if (this._xformMode == this._DEC_XFORM_MODE) */ else {
  8181                      var modeCreator = mode.createDecryptor;
  8182  
  8183                      // Keep at least one block in the buffer for unpadding
  8184                      this._minBufferSize = 1;
  8185                    }
  8186                    this._mode = modeCreator.call(mode, this, iv && iv.words);
  8187                  },
  8188  
  8189                  _doProcessBlock: function (words, offset) {
  8190                    this._mode.processBlock(words, offset);
  8191                  },
  8192  
  8193                  _doFinalize: function () {
  8194                    // Shortcut
  8195                    var padding = this.cfg.padding;
  8196  
  8197                    // Finalize
  8198                    if (this._xformMode == this._ENC_XFORM_MODE) {
  8199                      // Pad data
  8200                      padding.pad(this._data, this.blockSize);
  8201  
  8202                      // Process final blocks
  8203                      var finalProcessedBlocks = this._process(!!"flush");
  8204                    } /* if (this._xformMode == this._DEC_XFORM_MODE) */ else {
  8205                      // Process final blocks
  8206                      var finalProcessedBlocks = this._process(!!"flush");
  8207  
  8208                      // Unpad data
  8209                      padding.unpad(finalProcessedBlocks);
  8210                    }
  8211  
  8212                    return finalProcessedBlocks;
  8213                  },
  8214  
  8215                  blockSize: 128 / 32,
  8216                }));
  8217  
  8218                /**
  8219                 * A collection of cipher parameters.
  8220                 *
  8221                 * @property {WordArray} ciphertext The raw ciphertext.
  8222                 * @property {WordArray} key The key to this ciphertext.
  8223                 * @property {WordArray} iv The IV used in the ciphering operation.
  8224                 * @property {WordArray} salt The salt used with a key derivation function.
  8225                 * @property {Cipher} algorithm The cipher algorithm.
  8226                 * @property {Mode} mode The block mode used in the ciphering operation.
  8227                 * @property {Padding} padding The padding scheme used in the ciphering operation.
  8228                 * @property {number} blockSize The block size of the cipher.
  8229                 * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
  8230                 */
  8231                var CipherParams = (C_lib.CipherParams = Base.extend({
  8232                  /**
  8233                   * Initializes a newly created cipher params object.
  8234                   *
  8235                   * @param {Object} cipherParams An object with any of the possible cipher parameters.
  8236                   *
  8237                   * @example
  8238                   *
  8239                   *     var cipherParams = CryptoJS.lib.CipherParams.create({
  8240                   *         ciphertext: ciphertextWordArray,
  8241                   *         key: keyWordArray,
  8242                   *         iv: ivWordArray,
  8243                   *         salt: saltWordArray,
  8244                   *         algorithm: CryptoJS.algo.AES,
  8245                   *         mode: CryptoJS.mode.CBC,
  8246                   *         padding: CryptoJS.pad.PKCS7,
  8247                   *         blockSize: 4,
  8248                   *         formatter: CryptoJS.format.OpenSSL
  8249                   *     });
  8250                   */
  8251                  init: function (cipherParams) {
  8252                    this.mixIn(cipherParams);
  8253                  },
  8254  
  8255                  /**
  8256                   * Converts this cipher params object to a string.
  8257                   *
  8258                   * @param {Format} formatter (Optional) The formatting strategy to use.
  8259                   *
  8260                   * @return {string} The stringified cipher params.
  8261                   *
  8262                   * @throws Error If neither the formatter nor the default formatter is set.
  8263                   *
  8264                   * @example
  8265                   *
  8266                   *     var string = cipherParams + '';
  8267                   *     var string = cipherParams.toString();
  8268                   *     var string = cipherParams.toString(CryptoJS.format.OpenSSL);
  8269                   */
  8270                  toString: function (formatter) {
  8271                    return (formatter || this.formatter).stringify(this);
  8272                  },
  8273                }));
  8274  
  8275                /**
  8276                 * Format namespace.
  8277                 */
  8278                var C_format = (C.format = {});
  8279  
  8280                /**
  8281                 * OpenSSL formatting strategy.
  8282                 */
  8283                var OpenSSLFormatter = (C_format.OpenSSL = {
  8284                  /**
  8285                   * Converts a cipher params object to an OpenSSL-compatible string.
  8286                   *
  8287                   * @param {CipherParams} cipherParams The cipher params object.
  8288                   *
  8289                   * @return {string} The OpenSSL-compatible string.
  8290                   *
  8291                   * @static
  8292                   *
  8293                   * @example
  8294                   *
  8295                   *     var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
  8296                   */
  8297                  stringify: function (cipherParams) {
  8298                    // Shortcuts
  8299                    var ciphertext = cipherParams.ciphertext;
  8300                    var salt = cipherParams.salt;
  8301  
  8302                    // Format
  8303                    if (salt) {
  8304                      var wordArray = WordArray.create([0x53616c74, 0x65645f5f])
  8305                        .concat(salt)
  8306                        .concat(ciphertext);
  8307                    } else {
  8308                      var wordArray = ciphertext;
  8309                    }
  8310  
  8311                    return wordArray.toString(Base64);
  8312                  },
  8313  
  8314                  /**
  8315                   * Converts an OpenSSL-compatible string to a cipher params object.
  8316                   *
  8317                   * @param {string} openSSLStr The OpenSSL-compatible string.
  8318                   *
  8319                   * @return {CipherParams} The cipher params object.
  8320                   *
  8321                   * @static
  8322                   *
  8323                   * @example
  8324                   *
  8325                   *     var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
  8326                   */
  8327                  parse: function (openSSLStr) {
  8328                    // Parse base64
  8329                    var ciphertext = Base64.parse(openSSLStr);
  8330  
  8331                    // Shortcut
  8332                    var ciphertextWords = ciphertext.words;
  8333  
  8334                    // Test for salt
  8335                    if (
  8336                      ciphertextWords[0] == 0x53616c74 &&
  8337                      ciphertextWords[1] == 0x65645f5f
  8338                    ) {
  8339                      // Extract salt
  8340                      var salt = WordArray.create(ciphertextWords.slice(2, 4));
  8341  
  8342                      // Remove salt from ciphertext
  8343                      ciphertextWords.splice(0, 4);
  8344                      ciphertext.sigBytes -= 16;
  8345                    }
  8346  
  8347                    return CipherParams.create({
  8348                      ciphertext: ciphertext,
  8349                      salt: salt,
  8350                    });
  8351                  },
  8352                });
  8353  
  8354                /**
  8355                 * A cipher wrapper that returns ciphertext as a serializable cipher params object.
  8356                 */
  8357                var SerializableCipher = (C_lib.SerializableCipher = Base.extend({
  8358                  /**
  8359                   * Configuration options.
  8360                   *
  8361                   * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
  8362                   */
  8363                  cfg: Base.extend({
  8364                    format: OpenSSLFormatter,
  8365                  }),
  8366  
  8367                  /**
  8368                   * Encrypts a message.
  8369                   *
  8370                   * @param {Cipher} cipher The cipher algorithm to use.
  8371                   * @param {WordArray|string} message The message to encrypt.
  8372                   * @param {WordArray} key The key.
  8373                   * @param {Object} cfg (Optional) The configuration options to use for this operation.
  8374                   *
  8375                   * @return {CipherParams} A cipher params object.
  8376                   *
  8377                   * @static
  8378                   *
  8379                   * @example
  8380                   *
  8381                   *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
  8382                   *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
  8383                   *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  8384                   */
  8385                  encrypt: function (cipher, message, key, cfg) {
  8386                    // Apply config defaults
  8387                    cfg = this.cfg.extend(cfg);
  8388  
  8389                    // Encrypt
  8390                    var encryptor = cipher.createEncryptor(key, cfg);
  8391                    var ciphertext = encryptor.finalize(message);
  8392  
  8393                    // Shortcut
  8394                    var cipherCfg = encryptor.cfg;
  8395  
  8396                    // Create and return serializable cipher params
  8397                    return CipherParams.create({
  8398                      ciphertext: ciphertext,
  8399                      key: key,
  8400                      iv: cipherCfg.iv,
  8401                      algorithm: cipher,
  8402                      mode: cipherCfg.mode,
  8403                      padding: cipherCfg.padding,
  8404                      blockSize: cipher.blockSize,
  8405                      formatter: cfg.format,
  8406                    });
  8407                  },
  8408  
  8409                  /**
  8410                   * Decrypts serialized ciphertext.
  8411                   *
  8412                   * @param {Cipher} cipher The cipher algorithm to use.
  8413                   * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
  8414                   * @param {WordArray} key The key.
  8415                   * @param {Object} cfg (Optional) The configuration options to use for this operation.
  8416                   *
  8417                   * @return {WordArray} The plaintext.
  8418                   *
  8419                   * @static
  8420                   *
  8421                   * @example
  8422                   *
  8423                   *     var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  8424                   *     var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  8425                   */
  8426                  decrypt: function (cipher, ciphertext, key, cfg) {
  8427                    // Apply config defaults
  8428                    cfg = this.cfg.extend(cfg);
  8429  
  8430                    // Convert string to CipherParams
  8431                    ciphertext = this._parse(ciphertext, cfg.format);
  8432  
  8433                    // Decrypt
  8434                    var plaintext = cipher
  8435                      .createDecryptor(key, cfg)
  8436                      .finalize(ciphertext.ciphertext);
  8437  
  8438                    return plaintext;
  8439                  },
  8440  
  8441                  /**
  8442                   * Converts serialized ciphertext to CipherParams,
  8443                   * else assumed CipherParams already and returns ciphertext unchanged.
  8444                   *
  8445                   * @param {CipherParams|string} ciphertext The ciphertext.
  8446                   * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
  8447                   *
  8448                   * @return {CipherParams} The unserialized ciphertext.
  8449                   *
  8450                   * @static
  8451                   *
  8452                   * @example
  8453                   *
  8454                   *     var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
  8455                   */
  8456                  _parse: function (ciphertext, format) {
  8457                    if (typeof ciphertext == "string") {
  8458                      return format.parse(ciphertext, this);
  8459                    } else {
  8460                      return ciphertext;
  8461                    }
  8462                  },
  8463                }));
  8464  
  8465                /**
  8466                 * Key derivation function namespace.
  8467                 */
  8468                var C_kdf = (C.kdf = {});
  8469  
  8470                /**
  8471                 * OpenSSL key derivation function.
  8472                 */
  8473                var OpenSSLKdf = (C_kdf.OpenSSL = {
  8474                  /**
  8475                   * Derives a key and IV from a password.
  8476                   *
  8477                   * @param {string} password The password to derive from.
  8478                   * @param {number} keySize The size in words of the key to generate.
  8479                   * @param {number} ivSize The size in words of the IV to generate.
  8480                   * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
  8481                   *
  8482                   * @return {CipherParams} A cipher params object with the key, IV, and salt.
  8483                   *
  8484                   * @static
  8485                   *
  8486                   * @example
  8487                   *
  8488                   *     var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
  8489                   *     var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
  8490                   */
  8491                  execute: function (password, keySize, ivSize, salt) {
  8492                    // Generate random salt
  8493                    if (!salt) {
  8494                      salt = WordArray.random(64 / 8);
  8495                    }
  8496  
  8497                    // Derive key and IV
  8498                    var key = EvpKDF.create({
  8499                      keySize: keySize + ivSize,
  8500                    }).compute(password, salt);
  8501  
  8502                    // Separate key and IV
  8503                    var iv = WordArray.create(
  8504                      key.words.slice(keySize),
  8505                      ivSize * 4
  8506                    );
  8507                    key.sigBytes = keySize * 4;
  8508  
  8509                    // Return params
  8510                    return CipherParams.create({ key: key, iv: iv, salt: salt });
  8511                  },
  8512                });
  8513  
  8514                /**
  8515                 * A serializable cipher wrapper that derives the key from a password,
  8516                 * and returns ciphertext as a serializable cipher params object.
  8517                 */
  8518                var PasswordBasedCipher = (C_lib.PasswordBasedCipher = SerializableCipher.extend(
  8519                  {
  8520                    /**
  8521                     * Configuration options.
  8522                     *
  8523                     * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
  8524                     */
  8525                    cfg: SerializableCipher.cfg.extend({
  8526                      kdf: OpenSSLKdf,
  8527                    }),
  8528  
  8529                    /**
  8530                     * Encrypts a message using a password.
  8531                     *
  8532                     * @param {Cipher} cipher The cipher algorithm to use.
  8533                     * @param {WordArray|string} message The message to encrypt.
  8534                     * @param {string} password The password.
  8535                     * @param {Object} cfg (Optional) The configuration options to use for this operation.
  8536                     *
  8537                     * @return {CipherParams} A cipher params object.
  8538                     *
  8539                     * @static
  8540                     *
  8541                     * @example
  8542                     *
  8543                     *     var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
  8544                     *     var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
  8545                     */
  8546                    encrypt: function (cipher, message, password, cfg) {
  8547                      // Apply config defaults
  8548                      cfg = this.cfg.extend(cfg);
  8549  
  8550                      // Derive key and other params
  8551                      var derivedParams = cfg.kdf.execute(
  8552                        password,
  8553                        cipher.keySize,
  8554                        cipher.ivSize
  8555                      );
  8556  
  8557                      // Add IV to config
  8558                      cfg.iv = derivedParams.iv;
  8559  
  8560                      // Encrypt
  8561                      var ciphertext = SerializableCipher.encrypt.call(
  8562                        this,
  8563                        cipher,
  8564                        message,
  8565                        derivedParams.key,
  8566                        cfg
  8567                      );
  8568  
  8569                      // Mix in derived params
  8570                      ciphertext.mixIn(derivedParams);
  8571  
  8572                      return ciphertext;
  8573                    },
  8574  
  8575                    /**
  8576                     * Decrypts serialized ciphertext using a password.
  8577                     *
  8578                     * @param {Cipher} cipher The cipher algorithm to use.
  8579                     * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
  8580                     * @param {string} password The password.
  8581                     * @param {Object} cfg (Optional) The configuration options to use for this operation.
  8582                     *
  8583                     * @return {WordArray} The plaintext.
  8584                     *
  8585                     * @static
  8586                     *
  8587                     * @example
  8588                     *
  8589                     *     var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
  8590                     *     var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
  8591                     */
  8592                    decrypt: function (cipher, ciphertext, password, cfg) {
  8593                      // Apply config defaults
  8594                      cfg = this.cfg.extend(cfg);
  8595  
  8596                      // Convert string to CipherParams
  8597                      ciphertext = this._parse(ciphertext, cfg.format);
  8598  
  8599                      // Derive key and other params
  8600                      var derivedParams = cfg.kdf.execute(
  8601                        password,
  8602                        cipher.keySize,
  8603                        cipher.ivSize,
  8604                        ciphertext.salt
  8605                      );
  8606  
  8607                      // Add IV to config
  8608                      cfg.iv = derivedParams.iv;
  8609  
  8610                      // Decrypt
  8611                      var plaintext = SerializableCipher.decrypt.call(
  8612                        this,
  8613                        cipher,
  8614                        ciphertext,
  8615                        derivedParams.key,
  8616                        cfg
  8617                      );
  8618  
  8619                      return plaintext;
  8620                    },
  8621                  }
  8622                ));
  8623              })();
  8624          });
  8625        },
  8626        { "./core": 53 },
  8627      ],
  8628      53: [
  8629        function (require, module, exports) {
  8630          (function (root, factory) {
  8631            if (typeof exports === "object") {
  8632              // CommonJS
  8633              module.exports = exports = factory();
  8634            } else if (typeof define === "function" && define.amd) {
  8635              // AMD
  8636              define([], factory);
  8637            } else {
  8638              // Global (browser)
  8639              root.CryptoJS = factory();
  8640            }
  8641          })(this, function () {
  8642            /**
  8643             * CryptoJS core components.
  8644             */
  8645            var CryptoJS =
  8646              CryptoJS ||
  8647              (function (Math, undefined) {
  8648                /*
  8649                 * Local polyfil of Object.create
  8650                 */
  8651                var create =
  8652                  Object.create ||
  8653                  (function () {
  8654                    function F() {}
  8655  
  8656                    return function (obj) {
  8657                      var subtype;
  8658  
  8659                      F.prototype = obj;
  8660  
  8661                      subtype = new F();
  8662  
  8663                      F.prototype = null;
  8664  
  8665                      return subtype;
  8666                    };
  8667                  })();
  8668  
  8669                /**
  8670                 * CryptoJS namespace.
  8671                 */
  8672                var C = {};
  8673  
  8674                /**
  8675                 * Library namespace.
  8676                 */
  8677                var C_lib = (C.lib = {});
  8678  
  8679                /**
  8680                 * Base object for prototypal inheritance.
  8681                 */
  8682                var Base = (C_lib.Base = (function () {
  8683                  return {
  8684                    /**
  8685                     * Creates a new object that inherits from this object.
  8686                     *
  8687                     * @param {Object} overrides Properties to copy into the new object.
  8688                     *
  8689                     * @return {Object} The new object.
  8690                     *
  8691                     * @static
  8692                     *
  8693                     * @example
  8694                     *
  8695                     *     var MyType = CryptoJS.lib.Base.extend({
  8696                     *         field: 'value',
  8697                     *
  8698                     *         method: function () {
  8699                     *         }
  8700                     *     });
  8701                     */
  8702                    extend: function (overrides) {
  8703                      // Spawn
  8704                      var subtype = create(this);
  8705  
  8706                      // Augment
  8707                      if (overrides) {
  8708                        subtype.mixIn(overrides);
  8709                      }
  8710  
  8711                      // Create default initializer
  8712                      if (
  8713                        !subtype.hasOwnProperty("init") ||
  8714                        this.init === subtype.init
  8715                      ) {
  8716                        subtype.init = function () {
  8717                          subtype.$super.init.apply(this, arguments);
  8718                        };
  8719                      }
  8720  
  8721                      // Initializer's prototype is the subtype object
  8722                      subtype.init.prototype = subtype;
  8723  
  8724                      // Reference supertype
  8725                      subtype.$super = this;
  8726  
  8727                      return subtype;
  8728                    },
  8729  
  8730                    /**
  8731                     * Extends this object and runs the init method.
  8732                     * Arguments to create() will be passed to init().
  8733                     *
  8734                     * @return {Object} The new object.
  8735                     *
  8736                     * @static
  8737                     *
  8738                     * @example
  8739                     *
  8740                     *     var instance = MyType.create();
  8741                     */
  8742                    create: function () {
  8743                      var instance = this.extend();
  8744                      instance.init.apply(instance, arguments);
  8745  
  8746                      return instance;
  8747                    },
  8748  
  8749                    /**
  8750                     * Initializes a newly created object.
  8751                     * Override this method to add some logic when your objects are created.
  8752                     *
  8753                     * @example
  8754                     *
  8755                     *     var MyType = CryptoJS.lib.Base.extend({
  8756                     *         init: function () {
  8757                     *             // ...
  8758                     *         }
  8759                     *     });
  8760                     */
  8761                    init: function () {},
  8762  
  8763                    /**
  8764                     * Copies properties into this object.
  8765                     *
  8766                     * @param {Object} properties The properties to mix in.
  8767                     *
  8768                     * @example
  8769                     *
  8770                     *     MyType.mixIn({
  8771                     *         field: 'value'
  8772                     *     });
  8773                     */
  8774                    mixIn: function (properties) {
  8775                      for (var propertyName in properties) {
  8776                        if (properties.hasOwnProperty(propertyName)) {
  8777                          this[propertyName] = properties[propertyName];
  8778                        }
  8779                      }
  8780  
  8781                      // IE won't copy toString using the loop above
  8782                      if (properties.hasOwnProperty("toString")) {
  8783                        this.toString = properties.toString;
  8784                      }
  8785                    },
  8786  
  8787                    /**
  8788                     * Creates a copy of this object.
  8789                     *
  8790                     * @return {Object} The clone.
  8791                     *
  8792                     * @example
  8793                     *
  8794                     *     var clone = instance.clone();
  8795                     */
  8796                    clone: function () {
  8797                      return this.init.prototype.extend(this);
  8798                    },
  8799                  };
  8800                })());
  8801  
  8802                /**
  8803                 * An array of 32-bit words.
  8804                 *
  8805                 * @property {Array} words The array of 32-bit words.
  8806                 * @property {number} sigBytes The number of significant bytes in this word array.
  8807                 */
  8808                var WordArray = (C_lib.WordArray = Base.extend({
  8809                  /**
  8810                   * Initializes a newly created word array.
  8811                   *
  8812                   * @param {Array} words (Optional) An array of 32-bit words.
  8813                   * @param {number} sigBytes (Optional) The number of significant bytes in the words.
  8814                   *
  8815                   * @example
  8816                   *
  8817                   *     var wordArray = CryptoJS.lib.WordArray.create();
  8818                   *     var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
  8819                   *     var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
  8820                   */
  8821                  init: function (words, sigBytes) {
  8822                    words = this.words = words || [];
  8823  
  8824                    if (sigBytes != undefined) {
  8825                      this.sigBytes = sigBytes;
  8826                    } else {
  8827                      this.sigBytes = words.length * 4;
  8828                    }
  8829                  },
  8830  
  8831                  /**
  8832                   * Converts this word array to a string.
  8833                   *
  8834                   * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
  8835                   *
  8836                   * @return {string} The stringified word array.
  8837                   *
  8838                   * @example
  8839                   *
  8840                   *     var string = wordArray + '';
  8841                   *     var string = wordArray.toString();
  8842                   *     var string = wordArray.toString(CryptoJS.enc.Utf8);
  8843                   */
  8844                  toString: function (encoder) {
  8845                    return (encoder || Hex).stringify(this);
  8846                  },
  8847  
  8848                  /**
  8849                   * Concatenates a word array to this word array.
  8850                   *
  8851                   * @param {WordArray} wordArray The word array to append.
  8852                   *
  8853                   * @return {WordArray} This word array.
  8854                   *
  8855                   * @example
  8856                   *
  8857                   *     wordArray1.concat(wordArray2);
  8858                   */
  8859                  concat: function (wordArray) {
  8860                    // Shortcuts
  8861                    var thisWords = this.words;
  8862                    var thatWords = wordArray.words;
  8863                    var thisSigBytes = this.sigBytes;
  8864                    var thatSigBytes = wordArray.sigBytes;
  8865  
  8866                    // Clamp excess bits
  8867                    this.clamp();
  8868  
  8869                    // Concat
  8870                    if (thisSigBytes % 4) {
  8871                      // Copy one byte at a time
  8872                      for (var i = 0; i < thatSigBytes; i++) {
  8873                        var thatByte =
  8874                          (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  8875                        thisWords[(thisSigBytes + i) >>> 2] |=
  8876                          thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
  8877                      }
  8878                    } else {
  8879                      // Copy one word at a time
  8880                      for (var i = 0; i < thatSigBytes; i += 4) {
  8881                        thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];
  8882                      }
  8883                    }
  8884                    this.sigBytes += thatSigBytes;
  8885  
  8886                    // Chainable
  8887                    return this;
  8888                  },
  8889  
  8890                  /**
  8891                   * Removes insignificant bits.
  8892                   *
  8893                   * @example
  8894                   *
  8895                   *     wordArray.clamp();
  8896                   */
  8897                  clamp: function () {
  8898                    // Shortcuts
  8899                    var words = this.words;
  8900                    var sigBytes = this.sigBytes;
  8901  
  8902                    // Clamp
  8903                    words[sigBytes >>> 2] &=
  8904                      0xffffffff << (32 - (sigBytes % 4) * 8);
  8905                    words.length = Math.ceil(sigBytes / 4);
  8906                  },
  8907  
  8908                  /**
  8909                   * Creates a copy of this word array.
  8910                   *
  8911                   * @return {WordArray} The clone.
  8912                   *
  8913                   * @example
  8914                   *
  8915                   *     var clone = wordArray.clone();
  8916                   */
  8917                  clone: function () {
  8918                    var clone = Base.clone.call(this);
  8919                    clone.words = this.words.slice(0);
  8920  
  8921                    return clone;
  8922                  },
  8923  
  8924                  /**
  8925                   * Creates a word array filled with random bytes.
  8926                   *
  8927                   * @param {number} nBytes The number of random bytes to generate.
  8928                   *
  8929                   * @return {WordArray} The random word array.
  8930                   *
  8931                   * @static
  8932                   *
  8933                   * @example
  8934                   *
  8935                   *     var wordArray = CryptoJS.lib.WordArray.random(16);
  8936                   */
  8937                  random: function (nBytes) {
  8938                    var words = [];
  8939  
  8940                    var r = function (m_w) {
  8941                      var m_w = m_w;
  8942                      var m_z = 0x3ade68b1;
  8943                      var mask = 0xffffffff;
  8944  
  8945                      return function () {
  8946                        m_z = (0x9069 * (m_z & 0xffff) + (m_z >> 0x10)) & mask;
  8947                        m_w = (0x4650 * (m_w & 0xffff) + (m_w >> 0x10)) & mask;
  8948                        var result = ((m_z << 0x10) + m_w) & mask;
  8949                        result /= 0x100000000;
  8950                        result += 0.5;
  8951                        return result * (Math.random() > 0.5 ? 1 : -1);
  8952                      };
  8953                    };
  8954  
  8955                    for (var i = 0, rcache; i < nBytes; i += 4) {
  8956                      var _r = r((rcache || Math.random()) * 0x100000000);
  8957  
  8958                      rcache = _r() * 0x3ade67b7;
  8959                      words.push((_r() * 0x100000000) | 0);
  8960                    }
  8961  
  8962                    return new WordArray.init(words, nBytes);
  8963                  },
  8964                }));
  8965  
  8966                /**
  8967                 * Encoder namespace.
  8968                 */
  8969                var C_enc = (C.enc = {});
  8970  
  8971                /**
  8972                 * Hex encoding strategy.
  8973                 */
  8974                var Hex = (C_enc.Hex = {
  8975                  /**
  8976                   * Converts a word array to a hex string.
  8977                   *
  8978                   * @param {WordArray} wordArray The word array.
  8979                   *
  8980                   * @return {string} The hex string.
  8981                   *
  8982                   * @static
  8983                   *
  8984                   * @example
  8985                   *
  8986                   *     var hexString = CryptoJS.enc.Hex.stringify(wordArray);
  8987                   */
  8988                  stringify: function (wordArray) {
  8989                    // Shortcuts
  8990                    var words = wordArray.words;
  8991                    var sigBytes = wordArray.sigBytes;
  8992  
  8993                    // Convert
  8994                    var hexChars = [];
  8995                    for (var i = 0; i < sigBytes; i++) {
  8996                      var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  8997                      hexChars.push((bite >>> 4).toString(16));
  8998                      hexChars.push((bite & 0x0f).toString(16));
  8999                    }
  9000  
  9001                    return hexChars.join("");
  9002                  },
  9003  
  9004                  /**
  9005                   * Converts a hex string to a word array.
  9006                   *
  9007                   * @param {string} hexStr The hex string.
  9008                   *
  9009                   * @return {WordArray} The word array.
  9010                   *
  9011                   * @static
  9012                   *
  9013                   * @example
  9014                   *
  9015                   *     var wordArray = CryptoJS.enc.Hex.parse(hexString);
  9016                   */
  9017                  parse: function (hexStr) {
  9018                    // Shortcut
  9019                    var hexStrLength = hexStr.length;
  9020  
  9021                    // Convert
  9022                    var words = [];
  9023                    for (var i = 0; i < hexStrLength; i += 2) {
  9024                      words[i >>> 3] |=
  9025                        parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
  9026                    }
  9027  
  9028                    return new WordArray.init(words, hexStrLength / 2);
  9029                  },
  9030                });
  9031  
  9032                /**
  9033                 * Latin1 encoding strategy.
  9034                 */
  9035                var Latin1 = (C_enc.Latin1 = {
  9036                  /**
  9037                   * Converts a word array to a Latin1 string.
  9038                   *
  9039                   * @param {WordArray} wordArray The word array.
  9040                   *
  9041                   * @return {string} The Latin1 string.
  9042                   *
  9043                   * @static
  9044                   *
  9045                   * @example
  9046                   *
  9047                   *     var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
  9048                   */
  9049                  stringify: function (wordArray) {
  9050                    // Shortcuts
  9051                    var words = wordArray.words;
  9052                    var sigBytes = wordArray.sigBytes;
  9053  
  9054                    // Convert
  9055                    var latin1Chars = [];
  9056                    for (var i = 0; i < sigBytes; i++) {
  9057                      var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  9058                      latin1Chars.push(String.fromCharCode(bite));
  9059                    }
  9060  
  9061                    return latin1Chars.join("");
  9062                  },
  9063  
  9064                  /**
  9065                   * Converts a Latin1 string to a word array.
  9066                   *
  9067                   * @param {string} latin1Str The Latin1 string.
  9068                   *
  9069                   * @return {WordArray} The word array.
  9070                   *
  9071                   * @static
  9072                   *
  9073                   * @example
  9074                   *
  9075                   *     var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
  9076                   */
  9077                  parse: function (latin1Str) {
  9078                    // Shortcut
  9079                    var latin1StrLength = latin1Str.length;
  9080  
  9081                    // Convert
  9082                    var words = [];
  9083                    for (var i = 0; i < latin1StrLength; i++) {
  9084                      words[i >>> 2] |=
  9085                        (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
  9086                    }
  9087  
  9088                    return new WordArray.init(words, latin1StrLength);
  9089                  },
  9090                });
  9091  
  9092                /**
  9093                 * UTF-8 encoding strategy.
  9094                 */
  9095                var Utf8 = (C_enc.Utf8 = {
  9096                  /**
  9097                   * Converts a word array to a UTF-8 string.
  9098                   *
  9099                   * @param {WordArray} wordArray The word array.
  9100                   *
  9101                   * @return {string} The UTF-8 string.
  9102                   *
  9103                   * @static
  9104                   *
  9105                   * @example
  9106                   *
  9107                   *     var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
  9108                   */
  9109                  stringify: function (wordArray) {
  9110                    try {
  9111                      return decodeURIComponent(
  9112                        escape(Latin1.stringify(wordArray))
  9113                      );
  9114                    } catch (e) {
  9115                      throw new Error("Malformed UTF-8 data");
  9116                    }
  9117                  },
  9118  
  9119                  /**
  9120                   * Converts a UTF-8 string to a word array.
  9121                   *
  9122                   * @param {string} utf8Str The UTF-8 string.
  9123                   *
  9124                   * @return {WordArray} The word array.
  9125                   *
  9126                   * @static
  9127                   *
  9128                   * @example
  9129                   *
  9130                   *     var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
  9131                   */
  9132                  parse: function (utf8Str) {
  9133                    return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
  9134                  },
  9135                });
  9136  
  9137                /**
  9138                 * Abstract buffered block algorithm template.
  9139                 *
  9140                 * The property blockSize must be implemented in a concrete subtype.
  9141                 *
  9142                 * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
  9143                 */
  9144                var BufferedBlockAlgorithm = (C_lib.BufferedBlockAlgorithm = Base.extend(
  9145                  {
  9146                    /**
  9147                     * Resets this block algorithm's data buffer to its initial state.
  9148                     *
  9149                     * @example
  9150                     *
  9151                     *     bufferedBlockAlgorithm.reset();
  9152                     */
  9153                    reset: function () {
  9154                      // Initial values
  9155                      this._data = new WordArray.init();
  9156                      this._nDataBytes = 0;
  9157                    },
  9158  
  9159                    /**
  9160                     * Adds new data to this block algorithm's buffer.
  9161                     *
  9162                     * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
  9163                     *
  9164                     * @example
  9165                     *
  9166                     *     bufferedBlockAlgorithm._append('data');
  9167                     *     bufferedBlockAlgorithm._append(wordArray);
  9168                     */
  9169                    _append: function (data) {
  9170                      // Convert string to WordArray, else assume WordArray already
  9171                      if (typeof data == "string") {
  9172                        data = Utf8.parse(data);
  9173                      }
  9174  
  9175                      // Append
  9176                      this._data.concat(data);
  9177                      this._nDataBytes += data.sigBytes;
  9178                    },
  9179  
  9180                    /**
  9181                     * Processes available data blocks.
  9182                     *
  9183                     * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
  9184                     *
  9185                     * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
  9186                     *
  9187                     * @return {WordArray} The processed data.
  9188                     *
  9189                     * @example
  9190                     *
  9191                     *     var processedData = bufferedBlockAlgorithm._process();
  9192                     *     var processedData = bufferedBlockAlgorithm._process(!!'flush');
  9193                     */
  9194                    _process: function (doFlush) {
  9195                      // Shortcuts
  9196                      var data = this._data;
  9197                      var dataWords = data.words;
  9198                      var dataSigBytes = data.sigBytes;
  9199                      var blockSize = this.blockSize;
  9200                      var blockSizeBytes = blockSize * 4;
  9201  
  9202                      // Count blocks ready
  9203                      var nBlocksReady = dataSigBytes / blockSizeBytes;
  9204                      if (doFlush) {
  9205                        // Round up to include partial blocks
  9206                        nBlocksReady = Math.ceil(nBlocksReady);
  9207                      } else {
  9208                        // Round down to include only full blocks,
  9209                        // less the number of blocks that must remain in the buffer
  9210                        nBlocksReady = Math.max(
  9211                          (nBlocksReady | 0) - this._minBufferSize,
  9212                          0
  9213                        );
  9214                      }
  9215  
  9216                      // Count words ready
  9217                      var nWordsReady = nBlocksReady * blockSize;
  9218  
  9219                      // Count bytes ready
  9220                      var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
  9221  
  9222                      // Process blocks
  9223                      if (nWordsReady) {
  9224                        for (
  9225                          var offset = 0;
  9226                          offset < nWordsReady;
  9227                          offset += blockSize
  9228                        ) {
  9229                          // Perform concrete-algorithm logic
  9230                          this._doProcessBlock(dataWords, offset);
  9231                        }
  9232  
  9233                        // Remove processed words
  9234                        var processedWords = dataWords.splice(0, nWordsReady);
  9235                        data.sigBytes -= nBytesReady;
  9236                      }
  9237  
  9238                      // Return processed words
  9239                      return new WordArray.init(processedWords, nBytesReady);
  9240                    },
  9241  
  9242                    /**
  9243                     * Creates a copy of this object.
  9244                     *
  9245                     * @return {Object} The clone.
  9246                     *
  9247                     * @example
  9248                     *
  9249                     *     var clone = bufferedBlockAlgorithm.clone();
  9250                     */
  9251                    clone: function () {
  9252                      var clone = Base.clone.call(this);
  9253                      clone._data = this._data.clone();
  9254  
  9255                      return clone;
  9256                    },
  9257  
  9258                    _minBufferSize: 0,
  9259                  }
  9260                ));
  9261  
  9262                /**
  9263                 * Abstract hasher template.
  9264                 *
  9265                 * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
  9266                 */
  9267                var Hasher = (C_lib.Hasher = BufferedBlockAlgorithm.extend({
  9268                  /**
  9269                   * Configuration options.
  9270                   */
  9271                  cfg: Base.extend(),
  9272  
  9273                  /**
  9274                   * Initializes a newly created hasher.
  9275                   *
  9276                   * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
  9277                   *
  9278                   * @example
  9279                   *
  9280                   *     var hasher = CryptoJS.algo.SHA256.create();
  9281                   */
  9282                  init: function (cfg) {
  9283                    // Apply config defaults
  9284                    this.cfg = this.cfg.extend(cfg);
  9285  
  9286                    // Set initial values
  9287                    this.reset();
  9288                  },
  9289  
  9290                  /**
  9291                   * Resets this hasher to its initial state.
  9292                   *
  9293                   * @example
  9294                   *
  9295                   *     hasher.reset();
  9296                   */
  9297                  reset: function () {
  9298                    // Reset data buffer
  9299                    BufferedBlockAlgorithm.reset.call(this);
  9300  
  9301                    // Perform concrete-hasher logic
  9302                    this._doReset();
  9303                  },
  9304  
  9305                  /**
  9306                   * Updates this hasher with a message.
  9307                   *
  9308                   * @param {WordArray|string} messageUpdate The message to append.
  9309                   *
  9310                   * @return {Hasher} This hasher.
  9311                   *
  9312                   * @example
  9313                   *
  9314                   *     hasher.update('message');
  9315                   *     hasher.update(wordArray);
  9316                   */
  9317                  update: function (messageUpdate) {
  9318                    // Append
  9319                    this._append(messageUpdate);
  9320  
  9321                    // Update the hash
  9322                    this._process();
  9323  
  9324                    // Chainable
  9325                    return this;
  9326                  },
  9327  
  9328                  /**
  9329                   * Finalizes the hash computation.
  9330                   * Note that the finalize operation is effectively a destructive, read-once operation.
  9331                   *
  9332                   * @param {WordArray|string} messageUpdate (Optional) A final message update.
  9333                   *
  9334                   * @return {WordArray} The hash.
  9335                   *
  9336                   * @example
  9337                   *
  9338                   *     var hash = hasher.finalize();
  9339                   *     var hash = hasher.finalize('message');
  9340                   *     var hash = hasher.finalize(wordArray);
  9341                   */
  9342                  finalize: function (messageUpdate) {
  9343                    // Final message update
  9344                    if (messageUpdate) {
  9345                      this._append(messageUpdate);
  9346                    }
  9347  
  9348                    // Perform concrete-hasher logic
  9349                    var hash = this._doFinalize();
  9350  
  9351                    return hash;
  9352                  },
  9353  
  9354                  blockSize: 512 / 32,
  9355  
  9356                  /**
  9357                   * Creates a shortcut function to a hasher's object interface.
  9358                   *
  9359                   * @param {Hasher} hasher The hasher to create a helper for.
  9360                   *
  9361                   * @return {Function} The shortcut function.
  9362                   *
  9363                   * @static
  9364                   *
  9365                   * @example
  9366                   *
  9367                   *     var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
  9368                   */
  9369                  _createHelper: function (hasher) {
  9370                    return function (message, cfg) {
  9371                      return new hasher.init(cfg).finalize(message);
  9372                    };
  9373                  },
  9374  
  9375                  /**
  9376                   * Creates a shortcut function to the HMAC's object interface.
  9377                   *
  9378                   * @param {Hasher} hasher The hasher to use in this HMAC helper.
  9379                   *
  9380                   * @return {Function} The shortcut function.
  9381                   *
  9382                   * @static
  9383                   *
  9384                   * @example
  9385                   *
  9386                   *     var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
  9387                   */
  9388                  _createHmacHelper: function (hasher) {
  9389                    return function (message, key) {
  9390                      return new C_algo.HMAC.init(hasher, key).finalize(message);
  9391                    };
  9392                  },
  9393                }));
  9394  
  9395                /**
  9396                 * Algorithm namespace.
  9397                 */
  9398                var C_algo = (C.algo = {});
  9399  
  9400                return C;
  9401              })(Math);
  9402  
  9403            return CryptoJS;
  9404          });
  9405        },
  9406        {},
  9407      ],
  9408      54: [
  9409        function (require, module, exports) {
  9410          (function (root, factory) {
  9411            if (typeof exports === "object") {
  9412              // CommonJS
  9413              module.exports = exports = factory(require("./core"));
  9414            } else if (typeof define === "function" && define.amd) {
  9415              // AMD
  9416              define(["./core"], factory);
  9417            } else {
  9418              // Global (browser)
  9419              factory(root.CryptoJS);
  9420            }
  9421          })(this, function (CryptoJS) {
  9422            (function () {
  9423              // Shortcuts
  9424              var C = CryptoJS;
  9425              var C_lib = C.lib;
  9426              var WordArray = C_lib.WordArray;
  9427              var C_enc = C.enc;
  9428  
  9429              /**
  9430               * Base64 encoding strategy.
  9431               */
  9432              var Base64 = (C_enc.Base64 = {
  9433                /**
  9434                 * Converts a word array to a Base64 string.
  9435                 *
  9436                 * @param {WordArray} wordArray The word array.
  9437                 *
  9438                 * @return {string} The Base64 string.
  9439                 *
  9440                 * @static
  9441                 *
  9442                 * @example
  9443                 *
  9444                 *     var base64String = CryptoJS.enc.Base64.stringify(wordArray);
  9445                 */
  9446                stringify: function (wordArray) {
  9447                  // Shortcuts
  9448                  var words = wordArray.words;
  9449                  var sigBytes = wordArray.sigBytes;
  9450                  var map = this._map;
  9451  
  9452                  // Clamp excess bits
  9453                  wordArray.clamp();
  9454  
  9455                  // Convert
  9456                  var base64Chars = [];
  9457                  for (var i = 0; i < sigBytes; i += 3) {
  9458                    var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  9459                    var byte2 =
  9460                      (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
  9461                    var byte3 =
  9462                      (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
  9463  
  9464                    var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
  9465  
  9466                    for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) {
  9467                      base64Chars.push(
  9468                        map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)
  9469                      );
  9470                    }
  9471                  }
  9472  
  9473                  // Add padding
  9474                  var paddingChar = map.charAt(64);
  9475                  if (paddingChar) {
  9476                    while (base64Chars.length % 4) {
  9477                      base64Chars.push(paddingChar);
  9478                    }
  9479                  }
  9480  
  9481                  return base64Chars.join("");
  9482                },
  9483  
  9484                /**
  9485                 * Converts a Base64 string to a word array.
  9486                 *
  9487                 * @param {string} base64Str The Base64 string.
  9488                 *
  9489                 * @return {WordArray} The word array.
  9490                 *
  9491                 * @static
  9492                 *
  9493                 * @example
  9494                 *
  9495                 *     var wordArray = CryptoJS.enc.Base64.parse(base64String);
  9496                 */
  9497                parse: function (base64Str) {
  9498                  // Shortcuts
  9499                  var base64StrLength = base64Str.length;
  9500                  var map = this._map;
  9501                  var reverseMap = this._reverseMap;
  9502  
  9503                  if (!reverseMap) {
  9504                    reverseMap = this._reverseMap = [];
  9505                    for (var j = 0; j < map.length; j++) {
  9506                      reverseMap[map.charCodeAt(j)] = j;
  9507                    }
  9508                  }
  9509  
  9510                  // Ignore padding
  9511                  var paddingChar = map.charAt(64);
  9512                  if (paddingChar) {
  9513                    var paddingIndex = base64Str.indexOf(paddingChar);
  9514                    if (paddingIndex !== -1) {
  9515                      base64StrLength = paddingIndex;
  9516                    }
  9517                  }
  9518  
  9519                  // Convert
  9520                  return parseLoop(base64Str, base64StrLength, reverseMap);
  9521                },
  9522  
  9523                _map:
  9524                  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
  9525              });
  9526  
  9527              function parseLoop(base64Str, base64StrLength, reverseMap) {
  9528                var words = [];
  9529                var nBytes = 0;
  9530                for (var i = 0; i < base64StrLength; i++) {
  9531                  if (i % 4) {
  9532                    var bits1 =
  9533                      reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
  9534                    var bits2 =
  9535                      reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
  9536                    words[nBytes >>> 2] |=
  9537                      (bits1 | bits2) << (24 - (nBytes % 4) * 8);
  9538                    nBytes++;
  9539                  }
  9540                }
  9541                return WordArray.create(words, nBytes);
  9542              }
  9543            })();
  9544  
  9545            return CryptoJS.enc.Base64;
  9546          });
  9547        },
  9548        { "./core": 53 },
  9549      ],
  9550      55: [
  9551        function (require, module, exports) {
  9552          (function (root, factory) {
  9553            if (typeof exports === "object") {
  9554              // CommonJS
  9555              module.exports = exports = factory(require("./core"));
  9556            } else if (typeof define === "function" && define.amd) {
  9557              // AMD
  9558              define(["./core"], factory);
  9559            } else {
  9560              // Global (browser)
  9561              factory(root.CryptoJS);
  9562            }
  9563          })(this, function (CryptoJS) {
  9564            (function () {
  9565              // Shortcuts
  9566              var C = CryptoJS;
  9567              var C_lib = C.lib;
  9568              var WordArray = C_lib.WordArray;
  9569              var C_enc = C.enc;
  9570  
  9571              /**
  9572               * UTF-16 BE encoding strategy.
  9573               */
  9574              var Utf16BE = (C_enc.Utf16 = C_enc.Utf16BE = {
  9575                /**
  9576                 * Converts a word array to a UTF-16 BE string.
  9577                 *
  9578                 * @param {WordArray} wordArray The word array.
  9579                 *
  9580                 * @return {string} The UTF-16 BE string.
  9581                 *
  9582                 * @static
  9583                 *
  9584                 * @example
  9585                 *
  9586                 *     var utf16String = CryptoJS.enc.Utf16.stringify(wordArray);
  9587                 */
  9588                stringify: function (wordArray) {
  9589                  // Shortcuts
  9590                  var words = wordArray.words;
  9591                  var sigBytes = wordArray.sigBytes;
  9592  
  9593                  // Convert
  9594                  var utf16Chars = [];
  9595                  for (var i = 0; i < sigBytes; i += 2) {
  9596                    var codePoint =
  9597                      (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff;
  9598                    utf16Chars.push(String.fromCharCode(codePoint));
  9599                  }
  9600  
  9601                  return utf16Chars.join("");
  9602                },
  9603  
  9604                /**
  9605                 * Converts a UTF-16 BE string to a word array.
  9606                 *
  9607                 * @param {string} utf16Str The UTF-16 BE string.
  9608                 *
  9609                 * @return {WordArray} The word array.
  9610                 *
  9611                 * @static
  9612                 *
  9613                 * @example
  9614                 *
  9615                 *     var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
  9616                 */
  9617                parse: function (utf16Str) {
  9618                  // Shortcut
  9619                  var utf16StrLength = utf16Str.length;
  9620  
  9621                  // Convert
  9622                  var words = [];
  9623                  for (var i = 0; i < utf16StrLength; i++) {
  9624                    words[i >>> 1] |=
  9625                      utf16Str.charCodeAt(i) << (16 - (i % 2) * 16);
  9626                  }
  9627  
  9628                  return WordArray.create(words, utf16StrLength * 2);
  9629                },
  9630              });
  9631  
  9632              /**
  9633               * UTF-16 LE encoding strategy.
  9634               */
  9635              C_enc.Utf16LE = {
  9636                /**
  9637                 * Converts a word array to a UTF-16 LE string.
  9638                 *
  9639                 * @param {WordArray} wordArray The word array.
  9640                 *
  9641                 * @return {string} The UTF-16 LE string.
  9642                 *
  9643                 * @static
  9644                 *
  9645                 * @example
  9646                 *
  9647                 *     var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);
  9648                 */
  9649                stringify: function (wordArray) {
  9650                  // Shortcuts
  9651                  var words = wordArray.words;
  9652                  var sigBytes = wordArray.sigBytes;
  9653  
  9654                  // Convert
  9655                  var utf16Chars = [];
  9656                  for (var i = 0; i < sigBytes; i += 2) {
  9657                    var codePoint = swapEndian(
  9658                      (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff
  9659                    );
  9660                    utf16Chars.push(String.fromCharCode(codePoint));
  9661                  }
  9662  
  9663                  return utf16Chars.join("");
  9664                },
  9665  
  9666                /**
  9667                 * Converts a UTF-16 LE string to a word array.
  9668                 *
  9669                 * @param {string} utf16Str The UTF-16 LE string.
  9670                 *
  9671                 * @return {WordArray} The word array.
  9672                 *
  9673                 * @static
  9674                 *
  9675                 * @example
  9676                 *
  9677                 *     var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);
  9678                 */
  9679                parse: function (utf16Str) {
  9680                  // Shortcut
  9681                  var utf16StrLength = utf16Str.length;
  9682  
  9683                  // Convert
  9684                  var words = [];
  9685                  for (var i = 0; i < utf16StrLength; i++) {
  9686                    words[i >>> 1] |= swapEndian(
  9687                      utf16Str.charCodeAt(i) << (16 - (i % 2) * 16)
  9688                    );
  9689                  }
  9690  
  9691                  return WordArray.create(words, utf16StrLength * 2);
  9692                },
  9693              };
  9694  
  9695              function swapEndian(word) {
  9696                return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff);
  9697              }
  9698            })();
  9699  
  9700            return CryptoJS.enc.Utf16;
  9701          });
  9702        },
  9703        { "./core": 53 },
  9704      ],
  9705      56: [
  9706        function (require, module, exports) {
  9707          (function (root, factory, undef) {
  9708            if (typeof exports === "object") {
  9709              // CommonJS
  9710              module.exports = exports = factory(
  9711                require("./core"),
  9712                require("./sha1"),
  9713                require("./hmac")
  9714              );
  9715            } else if (typeof define === "function" && define.amd) {
  9716              // AMD
  9717              define(["./core", "./sha1", "./hmac"], factory);
  9718            } else {
  9719              // Global (browser)
  9720              factory(root.CryptoJS);
  9721            }
  9722          })(this, function (CryptoJS) {
  9723            (function () {
  9724              // Shortcuts
  9725              var C = CryptoJS;
  9726              var C_lib = C.lib;
  9727              var Base = C_lib.Base;
  9728              var WordArray = C_lib.WordArray;
  9729              var C_algo = C.algo;
  9730              var MD5 = C_algo.MD5;
  9731  
  9732              /**
  9733               * This key derivation function is meant to conform with EVP_BytesToKey.
  9734               * www.openssl.org/docs/crypto/EVP_BytesToKey.html
  9735               */
  9736              var EvpKDF = (C_algo.EvpKDF = Base.extend({
  9737                /**
  9738                 * Configuration options.
  9739                 *
  9740                 * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
  9741                 * @property {Hasher} hasher The hash algorithm to use. Default: MD5
  9742                 * @property {number} iterations The number of iterations to perform. Default: 1
  9743                 */
  9744                cfg: Base.extend({
  9745                  keySize: 128 / 32,
  9746                  hasher: MD5,
  9747                  iterations: 1,
  9748                }),
  9749  
  9750                /**
  9751                 * Initializes a newly created key derivation function.
  9752                 *
  9753                 * @param {Object} cfg (Optional) The configuration options to use for the derivation.
  9754                 *
  9755                 * @example
  9756                 *
  9757                 *     var kdf = CryptoJS.algo.EvpKDF.create();
  9758                 *     var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
  9759                 *     var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
  9760                 */
  9761                init: function (cfg) {
  9762                  this.cfg = this.cfg.extend(cfg);
  9763                },
  9764  
  9765                /**
  9766                 * Derives a key from a password.
  9767                 *
  9768                 * @param {WordArray|string} password The password.
  9769                 * @param {WordArray|string} salt A salt.
  9770                 *
  9771                 * @return {WordArray} The derived key.
  9772                 *
  9773                 * @example
  9774                 *
  9775                 *     var key = kdf.compute(password, salt);
  9776                 */
  9777                compute: function (password, salt) {
  9778                  // Shortcut
  9779                  var cfg = this.cfg;
  9780  
  9781                  // Init hasher
  9782                  var hasher = cfg.hasher.create();
  9783  
  9784                  // Initial values
  9785                  var derivedKey = WordArray.create();
  9786  
  9787                  // Shortcuts
  9788                  var derivedKeyWords = derivedKey.words;
  9789                  var keySize = cfg.keySize;
  9790                  var iterations = cfg.iterations;
  9791  
  9792                  // Generate key
  9793                  while (derivedKeyWords.length < keySize) {
  9794                    if (block) {
  9795                      hasher.update(block);
  9796                    }
  9797                    var block = hasher.update(password).finalize(salt);
  9798                    hasher.reset();
  9799  
  9800                    // Iterations
  9801                    for (var i = 1; i < iterations; i++) {
  9802                      block = hasher.finalize(block);
  9803                      hasher.reset();
  9804                    }
  9805  
  9806                    derivedKey.concat(block);
  9807                  }
  9808                  derivedKey.sigBytes = keySize * 4;
  9809  
  9810                  return derivedKey;
  9811                },
  9812              }));
  9813  
  9814              /**
  9815               * Derives a key from a password.
  9816               *
  9817               * @param {WordArray|string} password The password.
  9818               * @param {WordArray|string} salt A salt.
  9819               * @param {Object} cfg (Optional) The configuration options to use for this computation.
  9820               *
  9821               * @return {WordArray} The derived key.
  9822               *
  9823               * @static
  9824               *
  9825               * @example
  9826               *
  9827               *     var key = CryptoJS.EvpKDF(password, salt);
  9828               *     var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
  9829               *     var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
  9830               */
  9831              C.EvpKDF = function (password, salt, cfg) {
  9832                return EvpKDF.create(cfg).compute(password, salt);
  9833              };
  9834            })();
  9835  
  9836            return CryptoJS.EvpKDF;
  9837          });
  9838        },
  9839        { "./core": 53, "./hmac": 58, "./sha1": 77 },
  9840      ],
  9841      57: [
  9842        function (require, module, exports) {
  9843          (function (root, factory, undef) {
  9844            if (typeof exports === "object") {
  9845              // CommonJS
  9846              module.exports = exports = factory(
  9847                require("./core"),
  9848                require("./cipher-core")
  9849              );
  9850            } else if (typeof define === "function" && define.amd) {
  9851              // AMD
  9852              define(["./core", "./cipher-core"], factory);
  9853            } else {
  9854              // Global (browser)
  9855              factory(root.CryptoJS);
  9856            }
  9857          })(this, function (CryptoJS) {
  9858            (function (undefined) {
  9859              // Shortcuts
  9860              var C = CryptoJS;
  9861              var C_lib = C.lib;
  9862              var CipherParams = C_lib.CipherParams;
  9863              var C_enc = C.enc;
  9864              var Hex = C_enc.Hex;
  9865              var C_format = C.format;
  9866  
  9867              var HexFormatter = (C_format.Hex = {
  9868                /**
  9869                 * Converts the ciphertext of a cipher params object to a hexadecimally encoded string.
  9870                 *
  9871                 * @param {CipherParams} cipherParams The cipher params object.
  9872                 *
  9873                 * @return {string} The hexadecimally encoded string.
  9874                 *
  9875                 * @static
  9876                 *
  9877                 * @example
  9878                 *
  9879                 *     var hexString = CryptoJS.format.Hex.stringify(cipherParams);
  9880                 */
  9881                stringify: function (cipherParams) {
  9882                  return cipherParams.ciphertext.toString(Hex);
  9883                },
  9884  
  9885                /**
  9886                 * Converts a hexadecimally encoded ciphertext string to a cipher params object.
  9887                 *
  9888                 * @param {string} input The hexadecimally encoded string.
  9889                 *
  9890                 * @return {CipherParams} The cipher params object.
  9891                 *
  9892                 * @static
  9893                 *
  9894                 * @example
  9895                 *
  9896                 *     var cipherParams = CryptoJS.format.Hex.parse(hexString);
  9897                 */
  9898                parse: function (input) {
  9899                  var ciphertext = Hex.parse(input);
  9900                  return CipherParams.create({ ciphertext: ciphertext });
  9901                },
  9902              });
  9903            })();
  9904  
  9905            return CryptoJS.format.Hex;
  9906          });
  9907        },
  9908        { "./cipher-core": 52, "./core": 53 },
  9909      ],
  9910      58: [
  9911        function (require, module, exports) {
  9912          (function (root, factory) {
  9913            if (typeof exports === "object") {
  9914              // CommonJS
  9915              module.exports = exports = factory(require("./core"));
  9916            } else if (typeof define === "function" && define.amd) {
  9917              // AMD
  9918              define(["./core"], factory);
  9919            } else {
  9920              // Global (browser)
  9921              factory(root.CryptoJS);
  9922            }
  9923          })(this, function (CryptoJS) {
  9924            (function () {
  9925              // Shortcuts
  9926              var C = CryptoJS;
  9927              var C_lib = C.lib;
  9928              var Base = C_lib.Base;
  9929              var C_enc = C.enc;
  9930              var Utf8 = C_enc.Utf8;
  9931              var C_algo = C.algo;
  9932  
  9933              /**
  9934               * HMAC algorithm.
  9935               */
  9936              var HMAC = (C_algo.HMAC = Base.extend({
  9937                /**
  9938                 * Initializes a newly created HMAC.
  9939                 *
  9940                 * @param {Hasher} hasher The hash algorithm to use.
  9941                 * @param {WordArray|string} key The secret key.
  9942                 *
  9943                 * @example
  9944                 *
  9945                 *     var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
  9946                 */
  9947                init: function (hasher, key) {
  9948                  // Init hasher
  9949                  hasher = this._hasher = new hasher.init();
  9950  
  9951                  // Convert string to WordArray, else assume WordArray already
  9952                  if (typeof key == "string") {
  9953                    key = Utf8.parse(key);
  9954                  }
  9955  
  9956                  // Shortcuts
  9957                  var hasherBlockSize = hasher.blockSize;
  9958                  var hasherBlockSizeBytes = hasherBlockSize * 4;
  9959  
  9960                  // Allow arbitrary length keys
  9961                  if (key.sigBytes > hasherBlockSizeBytes) {
  9962                    key = hasher.finalize(key);
  9963                  }
  9964  
  9965                  // Clamp excess bits
  9966                  key.clamp();
  9967  
  9968                  // Clone key for inner and outer pads
  9969                  var oKey = (this._oKey = key.clone());
  9970                  var iKey = (this._iKey = key.clone());
  9971  
  9972                  // Shortcuts
  9973                  var oKeyWords = oKey.words;
  9974                  var iKeyWords = iKey.words;
  9975  
  9976                  // XOR keys with pad constants
  9977                  for (var i = 0; i < hasherBlockSize; i++) {
  9978                    oKeyWords[i] ^= 0x5c5c5c5c;
  9979                    iKeyWords[i] ^= 0x36363636;
  9980                  }
  9981                  oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
  9982  
  9983                  // Set initial values
  9984                  this.reset();
  9985                },
  9986  
  9987                /**
  9988                 * Resets this HMAC to its initial state.
  9989                 *
  9990                 * @example
  9991                 *
  9992                 *     hmacHasher.reset();
  9993                 */
  9994                reset: function () {
  9995                  // Shortcut
  9996                  var hasher = this._hasher;
  9997  
  9998                  // Reset
  9999                  hasher.reset();
 10000                  hasher.update(this._iKey);
 10001                },
 10002  
 10003                /**
 10004                 * Updates this HMAC with a message.
 10005                 *
 10006                 * @param {WordArray|string} messageUpdate The message to append.
 10007                 *
 10008                 * @return {HMAC} This HMAC instance.
 10009                 *
 10010                 * @example
 10011                 *
 10012                 *     hmacHasher.update('message');
 10013                 *     hmacHasher.update(wordArray);
 10014                 */
 10015                update: function (messageUpdate) {
 10016                  this._hasher.update(messageUpdate);
 10017  
 10018                  // Chainable
 10019                  return this;
 10020                },
 10021  
 10022                /**
 10023                 * Finalizes the HMAC computation.
 10024                 * Note that the finalize operation is effectively a destructive, read-once operation.
 10025                 *
 10026                 * @param {WordArray|string} messageUpdate (Optional) A final message update.
 10027                 *
 10028                 * @return {WordArray} The HMAC.
 10029                 *
 10030                 * @example
 10031                 *
 10032                 *     var hmac = hmacHasher.finalize();
 10033                 *     var hmac = hmacHasher.finalize('message');
 10034                 *     var hmac = hmacHasher.finalize(wordArray);
 10035                 */
 10036                finalize: function (messageUpdate) {
 10037                  // Shortcut
 10038                  var hasher = this._hasher;
 10039  
 10040                  // Compute HMAC
 10041                  var innerHash = hasher.finalize(messageUpdate);
 10042                  hasher.reset();
 10043                  var hmac = hasher.finalize(
 10044                    this._oKey.clone().concat(innerHash)
 10045                  );
 10046  
 10047                  return hmac;
 10048                },
 10049              }));
 10050            })();
 10051          });
 10052        },
 10053        { "./core": 53 },
 10054      ],
 10055      59: [
 10056        function (require, module, exports) {
 10057          (function (root, factory, undef) {
 10058            if (typeof exports === "object") {
 10059              // CommonJS
 10060              module.exports = exports = factory(
 10061                require("./core"),
 10062                require("./x64-core"),
 10063                require("./lib-typedarrays"),
 10064                require("./enc-utf16"),
 10065                require("./enc-base64"),
 10066                require("./md5"),
 10067                require("./sha1"),
 10068                require("./sha256"),
 10069                require("./sha224"),
 10070                require("./sha512"),
 10071                require("./sha384"),
 10072                require("./sha3"),
 10073                require("./ripemd160"),
 10074                require("./hmac"),
 10075                require("./pbkdf2"),
 10076                require("./evpkdf"),
 10077                require("./cipher-core"),
 10078                require("./mode-cfb"),
 10079                require("./mode-ctr"),
 10080                require("./mode-ctr-gladman"),
 10081                require("./mode-ofb"),
 10082                require("./mode-ecb"),
 10083                require("./pad-ansix923"),
 10084                require("./pad-iso10126"),
 10085                require("./pad-iso97971"),
 10086                require("./pad-zeropadding"),
 10087                require("./pad-nopadding"),
 10088                require("./format-hex"),
 10089                require("./aes"),
 10090                require("./tripledes"),
 10091                require("./rc4"),
 10092                require("./rabbit"),
 10093                require("./rabbit-legacy")
 10094              );
 10095            } else if (typeof define === "function" && define.amd) {
 10096              // AMD
 10097              define([
 10098                "./core",
 10099                "./x64-core",
 10100                "./lib-typedarrays",
 10101                "./enc-utf16",
 10102                "./enc-base64",
 10103                "./md5",
 10104                "./sha1",
 10105                "./sha256",
 10106                "./sha224",
 10107                "./sha512",
 10108                "./sha384",
 10109                "./sha3",
 10110                "./ripemd160",
 10111                "./hmac",
 10112                "./pbkdf2",
 10113                "./evpkdf",
 10114                "./cipher-core",
 10115                "./mode-cfb",
 10116                "./mode-ctr",
 10117                "./mode-ctr-gladman",
 10118                "./mode-ofb",
 10119                "./mode-ecb",
 10120                "./pad-ansix923",
 10121                "./pad-iso10126",
 10122                "./pad-iso97971",
 10123                "./pad-zeropadding",
 10124                "./pad-nopadding",
 10125                "./format-hex",
 10126                "./aes",
 10127                "./tripledes",
 10128                "./rc4",
 10129                "./rabbit",
 10130                "./rabbit-legacy",
 10131              ], factory);
 10132            } else {
 10133              // Global (browser)
 10134              root.CryptoJS = factory(root.CryptoJS);
 10135            }
 10136          })(this, function (CryptoJS) {
 10137            return CryptoJS;
 10138          });
 10139        },
 10140        {
 10141          "./aes": 51,
 10142          "./cipher-core": 52,
 10143          "./core": 53,
 10144          "./enc-base64": 54,
 10145          "./enc-utf16": 55,
 10146          "./evpkdf": 56,
 10147          "./format-hex": 57,
 10148          "./hmac": 58,
 10149          "./lib-typedarrays": 60,
 10150          "./md5": 61,
 10151          "./mode-cfb": 62,
 10152          "./mode-ctr": 64,
 10153          "./mode-ctr-gladman": 63,
 10154          "./mode-ecb": 65,
 10155          "./mode-ofb": 66,
 10156          "./pad-ansix923": 67,
 10157          "./pad-iso10126": 68,
 10158          "./pad-iso97971": 69,
 10159          "./pad-nopadding": 70,
 10160          "./pad-zeropadding": 71,
 10161          "./pbkdf2": 72,
 10162          "./rabbit": 74,
 10163          "./rabbit-legacy": 73,
 10164          "./rc4": 75,
 10165          "./ripemd160": 76,
 10166          "./sha1": 77,
 10167          "./sha224": 78,
 10168          "./sha256": 79,
 10169          "./sha3": 80,
 10170          "./sha384": 81,
 10171          "./sha512": 82,
 10172          "./tripledes": 83,
 10173          "./x64-core": 84,
 10174        },
 10175      ],
 10176      60: [
 10177        function (require, module, exports) {
 10178          (function (root, factory) {
 10179            if (typeof exports === "object") {
 10180              // CommonJS
 10181              module.exports = exports = factory(require("./core"));
 10182            } else if (typeof define === "function" && define.amd) {
 10183              // AMD
 10184              define(["./core"], factory);
 10185            } else {
 10186              // Global (browser)
 10187              factory(root.CryptoJS);
 10188            }
 10189          })(this, function (CryptoJS) {
 10190            (function () {
 10191              // Check if typed arrays are supported
 10192              if (typeof ArrayBuffer != "function") {
 10193                return;
 10194              }
 10195  
 10196              // Shortcuts
 10197              var C = CryptoJS;
 10198              var C_lib = C.lib;
 10199              var WordArray = C_lib.WordArray;
 10200  
 10201              // Reference original init
 10202              var superInit = WordArray.init;
 10203  
 10204              // Augment WordArray.init to handle typed arrays
 10205              var subInit = (WordArray.init = function (typedArray) {
 10206                // Convert buffers to uint8
 10207                if (typedArray instanceof ArrayBuffer) {
 10208                  typedArray = new Uint8Array(typedArray);
 10209                }
 10210  
 10211                // Convert other array views to uint8
 10212                if (
 10213                  typedArray instanceof Int8Array ||
 10214                  (typeof Uint8ClampedArray !== "undefined" &&
 10215                    typedArray instanceof Uint8ClampedArray) ||
 10216                  typedArray instanceof Int16Array ||
 10217                  typedArray instanceof Uint16Array ||
 10218                  typedArray instanceof Int32Array ||
 10219                  typedArray instanceof Uint32Array ||
 10220                  typedArray instanceof Float32Array ||
 10221                  typedArray instanceof Float64Array
 10222                ) {
 10223                  typedArray = new Uint8Array(
 10224                    typedArray.buffer,
 10225                    typedArray.byteOffset,
 10226                    typedArray.byteLength
 10227                  );
 10228                }
 10229  
 10230                // Handle Uint8Array
 10231                if (typedArray instanceof Uint8Array) {
 10232                  // Shortcut
 10233                  var typedArrayByteLength = typedArray.byteLength;
 10234  
 10235                  // Extract bytes
 10236                  var words = [];
 10237                  for (var i = 0; i < typedArrayByteLength; i++) {
 10238                    words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);
 10239                  }
 10240  
 10241                  // Initialize this word array
 10242                  superInit.call(this, words, typedArrayByteLength);
 10243                } else {
 10244                  // Else call normal init
 10245                  superInit.apply(this, arguments);
 10246                }
 10247              });
 10248  
 10249              subInit.prototype = WordArray;
 10250            })();
 10251  
 10252            return CryptoJS.lib.WordArray;
 10253          });
 10254        },
 10255        { "./core": 53 },
 10256      ],
 10257      61: [
 10258        function (require, module, exports) {
 10259          (function (root, factory) {
 10260            if (typeof exports === "object") {
 10261              // CommonJS
 10262              module.exports = exports = factory(require("./core"));
 10263            } else if (typeof define === "function" && define.amd) {
 10264              // AMD
 10265              define(["./core"], factory);
 10266            } else {
 10267              // Global (browser)
 10268              factory(root.CryptoJS);
 10269            }
 10270          })(this, function (CryptoJS) {
 10271            (function (Math) {
 10272              // Shortcuts
 10273              var C = CryptoJS;
 10274              var C_lib = C.lib;
 10275              var WordArray = C_lib.WordArray;
 10276              var Hasher = C_lib.Hasher;
 10277              var C_algo = C.algo;
 10278  
 10279              // Constants table
 10280              var T = [];
 10281  
 10282              // Compute constants
 10283              (function () {
 10284                for (var i = 0; i < 64; i++) {
 10285                  T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;
 10286                }
 10287              })();
 10288  
 10289              /**
 10290               * MD5 hash algorithm.
 10291               */
 10292              var MD5 = (C_algo.MD5 = Hasher.extend({
 10293                _doReset: function () {
 10294                  this._hash = new WordArray.init([
 10295                    0x67452301,
 10296                    0xefcdab89,
 10297                    0x98badcfe,
 10298                    0x10325476,
 10299                  ]);
 10300                },
 10301  
 10302                _doProcessBlock: function (M, offset) {
 10303                  // Swap endian
 10304                  for (var i = 0; i < 16; i++) {
 10305                    // Shortcuts
 10306                    var offset_i = offset + i;
 10307                    var M_offset_i = M[offset_i];
 10308  
 10309                    M[offset_i] =
 10310                      (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
 10311                      (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00);
 10312                  }
 10313  
 10314                  // Shortcuts
 10315                  var H = this._hash.words;
 10316  
 10317                  var M_offset_0 = M[offset + 0];
 10318                  var M_offset_1 = M[offset + 1];
 10319                  var M_offset_2 = M[offset + 2];
 10320                  var M_offset_3 = M[offset + 3];
 10321                  var M_offset_4 = M[offset + 4];
 10322                  var M_offset_5 = M[offset + 5];
 10323                  var M_offset_6 = M[offset + 6];
 10324                  var M_offset_7 = M[offset + 7];
 10325                  var M_offset_8 = M[offset + 8];
 10326                  var M_offset_9 = M[offset + 9];
 10327                  var M_offset_10 = M[offset + 10];
 10328                  var M_offset_11 = M[offset + 11];
 10329                  var M_offset_12 = M[offset + 12];
 10330                  var M_offset_13 = M[offset + 13];
 10331                  var M_offset_14 = M[offset + 14];
 10332                  var M_offset_15 = M[offset + 15];
 10333  
 10334                  // Working varialbes
 10335                  var a = H[0];
 10336                  var b = H[1];
 10337                  var c = H[2];
 10338                  var d = H[3];
 10339  
 10340                  // Computation
 10341                  a = FF(a, b, c, d, M_offset_0, 7, T[0]);
 10342                  d = FF(d, a, b, c, M_offset_1, 12, T[1]);
 10343                  c = FF(c, d, a, b, M_offset_2, 17, T[2]);
 10344                  b = FF(b, c, d, a, M_offset_3, 22, T[3]);
 10345                  a = FF(a, b, c, d, M_offset_4, 7, T[4]);
 10346                  d = FF(d, a, b, c, M_offset_5, 12, T[5]);
 10347                  c = FF(c, d, a, b, M_offset_6, 17, T[6]);
 10348                  b = FF(b, c, d, a, M_offset_7, 22, T[7]);
 10349                  a = FF(a, b, c, d, M_offset_8, 7, T[8]);
 10350                  d = FF(d, a, b, c, M_offset_9, 12, T[9]);
 10351                  c = FF(c, d, a, b, M_offset_10, 17, T[10]);
 10352                  b = FF(b, c, d, a, M_offset_11, 22, T[11]);
 10353                  a = FF(a, b, c, d, M_offset_12, 7, T[12]);
 10354                  d = FF(d, a, b, c, M_offset_13, 12, T[13]);
 10355                  c = FF(c, d, a, b, M_offset_14, 17, T[14]);
 10356                  b = FF(b, c, d, a, M_offset_15, 22, T[15]);
 10357  
 10358                  a = GG(a, b, c, d, M_offset_1, 5, T[16]);
 10359                  d = GG(d, a, b, c, M_offset_6, 9, T[17]);
 10360                  c = GG(c, d, a, b, M_offset_11, 14, T[18]);
 10361                  b = GG(b, c, d, a, M_offset_0, 20, T[19]);
 10362                  a = GG(a, b, c, d, M_offset_5, 5, T[20]);
 10363                  d = GG(d, a, b, c, M_offset_10, 9, T[21]);
 10364                  c = GG(c, d, a, b, M_offset_15, 14, T[22]);
 10365                  b = GG(b, c, d, a, M_offset_4, 20, T[23]);
 10366                  a = GG(a, b, c, d, M_offset_9, 5, T[24]);
 10367                  d = GG(d, a, b, c, M_offset_14, 9, T[25]);
 10368                  c = GG(c, d, a, b, M_offset_3, 14, T[26]);
 10369                  b = GG(b, c, d, a, M_offset_8, 20, T[27]);
 10370                  a = GG(a, b, c, d, M_offset_13, 5, T[28]);
 10371                  d = GG(d, a, b, c, M_offset_2, 9, T[29]);
 10372                  c = GG(c, d, a, b, M_offset_7, 14, T[30]);
 10373                  b = GG(b, c, d, a, M_offset_12, 20, T[31]);
 10374  
 10375                  a = HH(a, b, c, d, M_offset_5, 4, T[32]);
 10376                  d = HH(d, a, b, c, M_offset_8, 11, T[33]);
 10377                  c = HH(c, d, a, b, M_offset_11, 16, T[34]);
 10378                  b = HH(b, c, d, a, M_offset_14, 23, T[35]);
 10379                  a = HH(a, b, c, d, M_offset_1, 4, T[36]);
 10380                  d = HH(d, a, b, c, M_offset_4, 11, T[37]);
 10381                  c = HH(c, d, a, b, M_offset_7, 16, T[38]);
 10382                  b = HH(b, c, d, a, M_offset_10, 23, T[39]);
 10383                  a = HH(a, b, c, d, M_offset_13, 4, T[40]);
 10384                  d = HH(d, a, b, c, M_offset_0, 11, T[41]);
 10385                  c = HH(c, d, a, b, M_offset_3, 16, T[42]);
 10386                  b = HH(b, c, d, a, M_offset_6, 23, T[43]);
 10387                  a = HH(a, b, c, d, M_offset_9, 4, T[44]);
 10388                  d = HH(d, a, b, c, M_offset_12, 11, T[45]);
 10389                  c = HH(c, d, a, b, M_offset_15, 16, T[46]);
 10390                  b = HH(b, c, d, a, M_offset_2, 23, T[47]);
 10391  
 10392                  a = II(a, b, c, d, M_offset_0, 6, T[48]);
 10393                  d = II(d, a, b, c, M_offset_7, 10, T[49]);
 10394                  c = II(c, d, a, b, M_offset_14, 15, T[50]);
 10395                  b = II(b, c, d, a, M_offset_5, 21, T[51]);
 10396                  a = II(a, b, c, d, M_offset_12, 6, T[52]);
 10397                  d = II(d, a, b, c, M_offset_3, 10, T[53]);
 10398                  c = II(c, d, a, b, M_offset_10, 15, T[54]);
 10399                  b = II(b, c, d, a, M_offset_1, 21, T[55]);
 10400                  a = II(a, b, c, d, M_offset_8, 6, T[56]);
 10401                  d = II(d, a, b, c, M_offset_15, 10, T[57]);
 10402                  c = II(c, d, a, b, M_offset_6, 15, T[58]);
 10403                  b = II(b, c, d, a, M_offset_13, 21, T[59]);
 10404                  a = II(a, b, c, d, M_offset_4, 6, T[60]);
 10405                  d = II(d, a, b, c, M_offset_11, 10, T[61]);
 10406                  c = II(c, d, a, b, M_offset_2, 15, T[62]);
 10407                  b = II(b, c, d, a, M_offset_9, 21, T[63]);
 10408  
 10409                  // Intermediate hash value
 10410                  H[0] = (H[0] + a) | 0;
 10411                  H[1] = (H[1] + b) | 0;
 10412                  H[2] = (H[2] + c) | 0;
 10413                  H[3] = (H[3] + d) | 0;
 10414                },
 10415  
 10416                _doFinalize: function () {
 10417                  // Shortcuts
 10418                  var data = this._data;
 10419                  var dataWords = data.words;
 10420  
 10421                  var nBitsTotal = this._nDataBytes * 8;
 10422                  var nBitsLeft = data.sigBytes * 8;
 10423  
 10424                  // Add padding
 10425                  dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - (nBitsLeft % 32));
 10426  
 10427                  var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
 10428                  var nBitsTotalL = nBitsTotal;
 10429                  dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] =
 10430                    (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) |
 10431                    (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00);
 10432                  dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] =
 10433                    (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) |
 10434                    (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00);
 10435  
 10436                  data.sigBytes = (dataWords.length + 1) * 4;
 10437  
 10438                  // Hash final blocks
 10439                  this._process();
 10440  
 10441                  // Shortcuts
 10442                  var hash = this._hash;
 10443                  var H = hash.words;
 10444  
 10445                  // Swap endian
 10446                  for (var i = 0; i < 4; i++) {
 10447                    // Shortcut
 10448                    var H_i = H[i];
 10449  
 10450                    H[i] =
 10451                      (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
 10452                      (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
 10453                  }
 10454  
 10455                  // Return final computed hash
 10456                  return hash;
 10457                },
 10458  
 10459                clone: function () {
 10460                  var clone = Hasher.clone.call(this);
 10461                  clone._hash = this._hash.clone();
 10462  
 10463                  return clone;
 10464                },
 10465              }));
 10466  
 10467              function FF(a, b, c, d, x, s, t) {
 10468                var n = a + ((b & c) | (~b & d)) + x + t;
 10469                return ((n << s) | (n >>> (32 - s))) + b;
 10470              }
 10471  
 10472              function GG(a, b, c, d, x, s, t) {
 10473                var n = a + ((b & d) | (c & ~d)) + x + t;
 10474                return ((n << s) | (n >>> (32 - s))) + b;
 10475              }
 10476  
 10477              function HH(a, b, c, d, x, s, t) {
 10478                var n = a + (b ^ c ^ d) + x + t;
 10479                return ((n << s) | (n >>> (32 - s))) + b;
 10480              }
 10481  
 10482              function II(a, b, c, d, x, s, t) {
 10483                var n = a + (c ^ (b | ~d)) + x + t;
 10484                return ((n << s) | (n >>> (32 - s))) + b;
 10485              }
 10486  
 10487              /**
 10488               * Shortcut function to the hasher's object interface.
 10489               *
 10490               * @param {WordArray|string} message The message to hash.
 10491               *
 10492               * @return {WordArray} The hash.
 10493               *
 10494               * @static
 10495               *
 10496               * @example
 10497               *
 10498               *     var hash = CryptoJS.MD5('message');
 10499               *     var hash = CryptoJS.MD5(wordArray);
 10500               */
 10501              C.MD5 = Hasher._createHelper(MD5);
 10502  
 10503              /**
 10504               * Shortcut function to the HMAC's object interface.
 10505               *
 10506               * @param {WordArray|string} message The message to hash.
 10507               * @param {WordArray|string} key The secret key.
 10508               *
 10509               * @return {WordArray} The HMAC.
 10510               *
 10511               * @static
 10512               *
 10513               * @example
 10514               *
 10515               *     var hmac = CryptoJS.HmacMD5(message, key);
 10516               */
 10517              C.HmacMD5 = Hasher._createHmacHelper(MD5);
 10518            })(Math);
 10519  
 10520            return CryptoJS.MD5;
 10521          });
 10522        },
 10523        { "./core": 53 },
 10524      ],
 10525      62: [
 10526        function (require, module, exports) {
 10527          (function (root, factory, undef) {
 10528            if (typeof exports === "object") {
 10529              // CommonJS
 10530              module.exports = exports = factory(
 10531                require("./core"),
 10532                require("./cipher-core")
 10533              );
 10534            } else if (typeof define === "function" && define.amd) {
 10535              // AMD
 10536              define(["./core", "./cipher-core"], factory);
 10537            } else {
 10538              // Global (browser)
 10539              factory(root.CryptoJS);
 10540            }
 10541          })(this, function (CryptoJS) {
 10542            /**
 10543             * Cipher Feedback block mode.
 10544             */
 10545            CryptoJS.mode.CFB = (function () {
 10546              var CFB = CryptoJS.lib.BlockCipherMode.extend();
 10547  
 10548              CFB.Encryptor = CFB.extend({
 10549                processBlock: function (words, offset) {
 10550                  // Shortcuts
 10551                  var cipher = this._cipher;
 10552                  var blockSize = cipher.blockSize;
 10553  
 10554                  generateKeystreamAndEncrypt.call(
 10555                    this,
 10556                    words,
 10557                    offset,
 10558                    blockSize,
 10559                    cipher
 10560                  );
 10561  
 10562                  // Remember this block to use with next block
 10563                  this._prevBlock = words.slice(offset, offset + blockSize);
 10564                },
 10565              });
 10566  
 10567              CFB.Decryptor = CFB.extend({
 10568                processBlock: function (words, offset) {
 10569                  // Shortcuts
 10570                  var cipher = this._cipher;
 10571                  var blockSize = cipher.blockSize;
 10572  
 10573                  // Remember this block to use with next block
 10574                  var thisBlock = words.slice(offset, offset + blockSize);
 10575  
 10576                  generateKeystreamAndEncrypt.call(
 10577                    this,
 10578                    words,
 10579                    offset,
 10580                    blockSize,
 10581                    cipher
 10582                  );
 10583  
 10584                  // This block becomes the previous block
 10585                  this._prevBlock = thisBlock;
 10586                },
 10587              });
 10588  
 10589              function generateKeystreamAndEncrypt(
 10590                words,
 10591                offset,
 10592                blockSize,
 10593                cipher
 10594              ) {
 10595                // Shortcut
 10596                var iv = this._iv;
 10597  
 10598                // Generate keystream
 10599                if (iv) {
 10600                  var keystream = iv.slice(0);
 10601  
 10602                  // Remove IV for subsequent blocks
 10603                  this._iv = undefined;
 10604                } else {
 10605                  var keystream = this._prevBlock;
 10606                }
 10607                cipher.encryptBlock(keystream, 0);
 10608  
 10609                // Encrypt
 10610                for (var i = 0; i < blockSize; i++) {
 10611                  words[offset + i] ^= keystream[i];
 10612                }
 10613              }
 10614  
 10615              return CFB;
 10616            })();
 10617  
 10618            return CryptoJS.mode.CFB;
 10619          });
 10620        },
 10621        { "./cipher-core": 52, "./core": 53 },
 10622      ],
 10623      63: [
 10624        function (require, module, exports) {
 10625          (function (root, factory, undef) {
 10626            if (typeof exports === "object") {
 10627              // CommonJS
 10628              module.exports = exports = factory(
 10629                require("./core"),
 10630                require("./cipher-core")
 10631              );
 10632            } else if (typeof define === "function" && define.amd) {
 10633              // AMD
 10634              define(["./core", "./cipher-core"], factory);
 10635            } else {
 10636              // Global (browser)
 10637              factory(root.CryptoJS);
 10638            }
 10639          })(this, function (CryptoJS) {
 10640            /** @preserve
 10641             * Counter block mode compatible with  Dr Brian Gladman fileenc.c
 10642             * derived from CryptoJS.mode.CTR
 10643             * Jan Hruby jhruby.web@gmail.com
 10644             */
 10645            CryptoJS.mode.CTRGladman = (function () {
 10646              var CTRGladman = CryptoJS.lib.BlockCipherMode.extend();
 10647  
 10648              function incWord(word) {
 10649                if (((word >> 24) & 0xff) === 0xff) {
 10650                  //overflow
 10651                  var b1 = (word >> 16) & 0xff;
 10652                  var b2 = (word >> 8) & 0xff;
 10653                  var b3 = word & 0xff;
 10654  
 10655                  if (b1 === 0xff) {
 10656                    // overflow b1
 10657                    b1 = 0;
 10658                    if (b2 === 0xff) {
 10659                      b2 = 0;
 10660                      if (b3 === 0xff) {
 10661                        b3 = 0;
 10662                      } else {
 10663                        ++b3;
 10664                      }
 10665                    } else {
 10666                      ++b2;
 10667                    }
 10668                  } else {
 10669                    ++b1;
 10670                  }
 10671  
 10672                  word = 0;
 10673                  word += b1 << 16;
 10674                  word += b2 << 8;
 10675                  word += b3;
 10676                } else {
 10677                  word += 0x01 << 24;
 10678                }
 10679                return word;
 10680              }
 10681  
 10682              function incCounter(counter) {
 10683                if ((counter[0] = incWord(counter[0])) === 0) {
 10684                  // encr_data in fileenc.c from  Dr Brian Gladman's counts only with DWORD j < 8
 10685                  counter[1] = incWord(counter[1]);
 10686                }
 10687                return counter;
 10688              }
 10689  
 10690              var Encryptor = (CTRGladman.Encryptor = CTRGladman.extend({
 10691                processBlock: function (words, offset) {
 10692                  // Shortcuts
 10693                  var cipher = this._cipher;
 10694                  var blockSize = cipher.blockSize;
 10695                  var iv = this._iv;
 10696                  var counter = this._counter;
 10697  
 10698                  // Generate keystream
 10699                  if (iv) {
 10700                    counter = this._counter = iv.slice(0);
 10701  
 10702                    // Remove IV for subsequent blocks
 10703                    this._iv = undefined;
 10704                  }
 10705  
 10706                  incCounter(counter);
 10707  
 10708                  var keystream = counter.slice(0);
 10709                  cipher.encryptBlock(keystream, 0);
 10710  
 10711                  // Encrypt
 10712                  for (var i = 0; i < blockSize; i++) {
 10713                    words[offset + i] ^= keystream[i];
 10714                  }
 10715                },
 10716              }));
 10717  
 10718              CTRGladman.Decryptor = Encryptor;
 10719  
 10720              return CTRGladman;
 10721            })();
 10722  
 10723            return CryptoJS.mode.CTRGladman;
 10724          });
 10725        },
 10726        { "./cipher-core": 52, "./core": 53 },
 10727      ],
 10728      64: [
 10729        function (require, module, exports) {
 10730          (function (root, factory, undef) {
 10731            if (typeof exports === "object") {
 10732              // CommonJS
 10733              module.exports = exports = factory(
 10734                require("./core"),
 10735                require("./cipher-core")
 10736              );
 10737            } else if (typeof define === "function" && define.amd) {
 10738              // AMD
 10739              define(["./core", "./cipher-core"], factory);
 10740            } else {
 10741              // Global (browser)
 10742              factory(root.CryptoJS);
 10743            }
 10744          })(this, function (CryptoJS) {
 10745            /**
 10746             * Counter block mode.
 10747             */
 10748            CryptoJS.mode.CTR = (function () {
 10749              var CTR = CryptoJS.lib.BlockCipherMode.extend();
 10750  
 10751              var Encryptor = (CTR.Encryptor = CTR.extend({
 10752                processBlock: function (words, offset) {
 10753                  // Shortcuts
 10754                  var cipher = this._cipher;
 10755                  var blockSize = cipher.blockSize;
 10756                  var iv = this._iv;
 10757                  var counter = this._counter;
 10758  
 10759                  // Generate keystream
 10760                  if (iv) {
 10761                    counter = this._counter = iv.slice(0);
 10762  
 10763                    // Remove IV for subsequent blocks
 10764                    this._iv = undefined;
 10765                  }
 10766                  var keystream = counter.slice(0);
 10767                  cipher.encryptBlock(keystream, 0);
 10768  
 10769                  // Increment counter
 10770                  counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0;
 10771  
 10772                  // Encrypt
 10773                  for (var i = 0; i < blockSize; i++) {
 10774                    words[offset + i] ^= keystream[i];
 10775                  }
 10776                },
 10777              }));
 10778  
 10779              CTR.Decryptor = Encryptor;
 10780  
 10781              return CTR;
 10782            })();
 10783  
 10784            return CryptoJS.mode.CTR;
 10785          });
 10786        },
 10787        { "./cipher-core": 52, "./core": 53 },
 10788      ],
 10789      65: [
 10790        function (require, module, exports) {
 10791          (function (root, factory, undef) {
 10792            if (typeof exports === "object") {
 10793              // CommonJS
 10794              module.exports = exports = factory(
 10795                require("./core"),
 10796                require("./cipher-core")
 10797              );
 10798            } else if (typeof define === "function" && define.amd) {
 10799              // AMD
 10800              define(["./core", "./cipher-core"], factory);
 10801            } else {
 10802              // Global (browser)
 10803              factory(root.CryptoJS);
 10804            }
 10805          })(this, function (CryptoJS) {
 10806            /**
 10807             * Electronic Codebook block mode.
 10808             */
 10809            CryptoJS.mode.ECB = (function () {
 10810              var ECB = CryptoJS.lib.BlockCipherMode.extend();
 10811  
 10812              ECB.Encryptor = ECB.extend({
 10813                processBlock: function (words, offset) {
 10814                  this._cipher.encryptBlock(words, offset);
 10815                },
 10816              });
 10817  
 10818              ECB.Decryptor = ECB.extend({
 10819                processBlock: function (words, offset) {
 10820                  this._cipher.decryptBlock(words, offset);
 10821                },
 10822              });
 10823  
 10824              return ECB;
 10825            })();
 10826  
 10827            return CryptoJS.mode.ECB;
 10828          });
 10829        },
 10830        { "./cipher-core": 52, "./core": 53 },
 10831      ],
 10832      66: [
 10833        function (require, module, exports) {
 10834          (function (root, factory, undef) {
 10835            if (typeof exports === "object") {
 10836              // CommonJS
 10837              module.exports = exports = factory(
 10838                require("./core"),
 10839                require("./cipher-core")
 10840              );
 10841            } else if (typeof define === "function" && define.amd) {
 10842              // AMD
 10843              define(["./core", "./cipher-core"], factory);
 10844            } else {
 10845              // Global (browser)
 10846              factory(root.CryptoJS);
 10847            }
 10848          })(this, function (CryptoJS) {
 10849            /**
 10850             * Output Feedback block mode.
 10851             */
 10852            CryptoJS.mode.OFB = (function () {
 10853              var OFB = CryptoJS.lib.BlockCipherMode.extend();
 10854  
 10855              var Encryptor = (OFB.Encryptor = OFB.extend({
 10856                processBlock: function (words, offset) {
 10857                  // Shortcuts
 10858                  var cipher = this._cipher;
 10859                  var blockSize = cipher.blockSize;
 10860                  var iv = this._iv;
 10861                  var keystream = this._keystream;
 10862  
 10863                  // Generate keystream
 10864                  if (iv) {
 10865                    keystream = this._keystream = iv.slice(0);
 10866  
 10867                    // Remove IV for subsequent blocks
 10868                    this._iv = undefined;
 10869                  }
 10870                  cipher.encryptBlock(keystream, 0);
 10871  
 10872                  // Encrypt
 10873                  for (var i = 0; i < blockSize; i++) {
 10874                    words[offset + i] ^= keystream[i];
 10875                  }
 10876                },
 10877              }));
 10878  
 10879              OFB.Decryptor = Encryptor;
 10880  
 10881              return OFB;
 10882            })();
 10883  
 10884            return CryptoJS.mode.OFB;
 10885          });
 10886        },
 10887        { "./cipher-core": 52, "./core": 53 },
 10888      ],
 10889      67: [
 10890        function (require, module, exports) {
 10891          (function (root, factory, undef) {
 10892            if (typeof exports === "object") {
 10893              // CommonJS
 10894              module.exports = exports = factory(
 10895                require("./core"),
 10896                require("./cipher-core")
 10897              );
 10898            } else if (typeof define === "function" && define.amd) {
 10899              // AMD
 10900              define(["./core", "./cipher-core"], factory);
 10901            } else {
 10902              // Global (browser)
 10903              factory(root.CryptoJS);
 10904            }
 10905          })(this, function (CryptoJS) {
 10906            /**
 10907             * ANSI X.923 padding strategy.
 10908             */
 10909            CryptoJS.pad.AnsiX923 = {
 10910              pad: function (data, blockSize) {
 10911                // Shortcuts
 10912                var dataSigBytes = data.sigBytes;
 10913                var blockSizeBytes = blockSize * 4;
 10914  
 10915                // Count padding bytes
 10916                var nPaddingBytes =
 10917                  blockSizeBytes - (dataSigBytes % blockSizeBytes);
 10918  
 10919                // Compute last byte position
 10920                var lastBytePos = dataSigBytes + nPaddingBytes - 1;
 10921  
 10922                // Pad
 10923                data.clamp();
 10924                data.words[lastBytePos >>> 2] |=
 10925                  nPaddingBytes << (24 - (lastBytePos % 4) * 8);
 10926                data.sigBytes += nPaddingBytes;
 10927              },
 10928  
 10929              unpad: function (data) {
 10930                // Get number of padding bytes from last byte
 10931                var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
 10932  
 10933                // Remove padding
 10934                data.sigBytes -= nPaddingBytes;
 10935              },
 10936            };
 10937  
 10938            return CryptoJS.pad.Ansix923;
 10939          });
 10940        },
 10941        { "./cipher-core": 52, "./core": 53 },
 10942      ],
 10943      68: [
 10944        function (require, module, exports) {
 10945          (function (root, factory, undef) {
 10946            if (typeof exports === "object") {
 10947              // CommonJS
 10948              module.exports = exports = factory(
 10949                require("./core"),
 10950                require("./cipher-core")
 10951              );
 10952            } else if (typeof define === "function" && define.amd) {
 10953              // AMD
 10954              define(["./core", "./cipher-core"], factory);
 10955            } else {
 10956              // Global (browser)
 10957              factory(root.CryptoJS);
 10958            }
 10959          })(this, function (CryptoJS) {
 10960            /**
 10961             * ISO 10126 padding strategy.
 10962             */
 10963            CryptoJS.pad.Iso10126 = {
 10964              pad: function (data, blockSize) {
 10965                // Shortcut
 10966                var blockSizeBytes = blockSize * 4;
 10967  
 10968                // Count padding bytes
 10969                var nPaddingBytes =
 10970                  blockSizeBytes - (data.sigBytes % blockSizeBytes);
 10971  
 10972                // Pad
 10973                data
 10974                  .concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1))
 10975                  .concat(
 10976                    CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1)
 10977                  );
 10978              },
 10979  
 10980              unpad: function (data) {
 10981                // Get number of padding bytes from last byte
 10982                var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
 10983  
 10984                // Remove padding
 10985                data.sigBytes -= nPaddingBytes;
 10986              },
 10987            };
 10988  
 10989            return CryptoJS.pad.Iso10126;
 10990          });
 10991        },
 10992        { "./cipher-core": 52, "./core": 53 },
 10993      ],
 10994      69: [
 10995        function (require, module, exports) {
 10996          (function (root, factory, undef) {
 10997            if (typeof exports === "object") {
 10998              // CommonJS
 10999              module.exports = exports = factory(
 11000                require("./core"),
 11001                require("./cipher-core")
 11002              );
 11003            } else if (typeof define === "function" && define.amd) {
 11004              // AMD
 11005              define(["./core", "./cipher-core"], factory);
 11006            } else {
 11007              // Global (browser)
 11008              factory(root.CryptoJS);
 11009            }
 11010          })(this, function (CryptoJS) {
 11011            /**
 11012             * ISO/IEC 9797-1 Padding Method 2.
 11013             */
 11014            CryptoJS.pad.Iso97971 = {
 11015              pad: function (data, blockSize) {
 11016                // Add 0x80 byte
 11017                data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));
 11018  
 11019                // Zero pad the rest
 11020                CryptoJS.pad.ZeroPadding.pad(data, blockSize);
 11021              },
 11022  
 11023              unpad: function (data) {
 11024                // Remove zero padding
 11025                CryptoJS.pad.ZeroPadding.unpad(data);
 11026  
 11027                // Remove one more byte -- the 0x80 byte
 11028                data.sigBytes--;
 11029              },
 11030            };
 11031  
 11032            return CryptoJS.pad.Iso97971;
 11033          });
 11034        },
 11035        { "./cipher-core": 52, "./core": 53 },
 11036      ],
 11037      70: [
 11038        function (require, module, exports) {
 11039          (function (root, factory, undef) {
 11040            if (typeof exports === "object") {
 11041              // CommonJS
 11042              module.exports = exports = factory(
 11043                require("./core"),
 11044                require("./cipher-core")
 11045              );
 11046            } else if (typeof define === "function" && define.amd) {
 11047              // AMD
 11048              define(["./core", "./cipher-core"], factory);
 11049            } else {
 11050              // Global (browser)
 11051              factory(root.CryptoJS);
 11052            }
 11053          })(this, function (CryptoJS) {
 11054            /**
 11055             * A noop padding strategy.
 11056             */
 11057            CryptoJS.pad.NoPadding = {
 11058              pad: function () {},
 11059  
 11060              unpad: function () {},
 11061            };
 11062  
 11063            return CryptoJS.pad.NoPadding;
 11064          });
 11065        },
 11066        { "./cipher-core": 52, "./core": 53 },
 11067      ],
 11068      71: [
 11069        function (require, module, exports) {
 11070          (function (root, factory, undef) {
 11071            if (typeof exports === "object") {
 11072              // CommonJS
 11073              module.exports = exports = factory(
 11074                require("./core"),
 11075                require("./cipher-core")
 11076              );
 11077            } else if (typeof define === "function" && define.amd) {
 11078              // AMD
 11079              define(["./core", "./cipher-core"], factory);
 11080            } else {
 11081              // Global (browser)
 11082              factory(root.CryptoJS);
 11083            }
 11084          })(this, function (CryptoJS) {
 11085            /**
 11086             * Zero padding strategy.
 11087             */
 11088            CryptoJS.pad.ZeroPadding = {
 11089              pad: function (data, blockSize) {
 11090                // Shortcut
 11091                var blockSizeBytes = blockSize * 4;
 11092  
 11093                // Pad
 11094                data.clamp();
 11095                data.sigBytes +=
 11096                  blockSizeBytes -
 11097                  (data.sigBytes % blockSizeBytes || blockSizeBytes);
 11098              },
 11099  
 11100              unpad: function (data) {
 11101                // Shortcut
 11102                var dataWords = data.words;
 11103  
 11104                // Unpad
 11105                var i = data.sigBytes - 1;
 11106                while (!((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) {
 11107                  i--;
 11108                }
 11109                data.sigBytes = i + 1;
 11110              },
 11111            };
 11112  
 11113            return CryptoJS.pad.ZeroPadding;
 11114          });
 11115        },
 11116        { "./cipher-core": 52, "./core": 53 },
 11117      ],
 11118      72: [
 11119        function (require, module, exports) {
 11120          (function (root, factory, undef) {
 11121            if (typeof exports === "object") {
 11122              // CommonJS
 11123              module.exports = exports = factory(
 11124                require("./core"),
 11125                require("./sha1"),
 11126                require("./hmac")
 11127              );
 11128            } else if (typeof define === "function" && define.amd) {
 11129              // AMD
 11130              define(["./core", "./sha1", "./hmac"], factory);
 11131            } else {
 11132              // Global (browser)
 11133              factory(root.CryptoJS);
 11134            }
 11135          })(this, function (CryptoJS) {
 11136            (function () {
 11137              // Shortcuts
 11138              var C = CryptoJS;
 11139              var C_lib = C.lib;
 11140              var Base = C_lib.Base;
 11141              var WordArray = C_lib.WordArray;
 11142              var C_algo = C.algo;
 11143              var SHA1 = C_algo.SHA1;
 11144              var HMAC = C_algo.HMAC;
 11145  
 11146              /**
 11147               * Password-Based Key Derivation Function 2 algorithm.
 11148               */
 11149              var PBKDF2 = (C_algo.PBKDF2 = Base.extend({
 11150                /**
 11151                 * Configuration options.
 11152                 *
 11153                 * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
 11154                 * @property {Hasher} hasher The hasher to use. Default: SHA1
 11155                 * @property {number} iterations The number of iterations to perform. Default: 1
 11156                 */
 11157                cfg: Base.extend({
 11158                  keySize: 128 / 32,
 11159                  hasher: SHA1,
 11160                  iterations: 1,
 11161                }),
 11162  
 11163                /**
 11164                 * Initializes a newly created key derivation function.
 11165                 *
 11166                 * @param {Object} cfg (Optional) The configuration options to use for the derivation.
 11167                 *
 11168                 * @example
 11169                 *
 11170                 *     var kdf = CryptoJS.algo.PBKDF2.create();
 11171                 *     var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 });
 11172                 *     var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });
 11173                 */
 11174                init: function (cfg) {
 11175                  this.cfg = this.cfg.extend(cfg);
 11176                },
 11177  
 11178                /**
 11179                 * Computes the Password-Based Key Derivation Function 2.
 11180                 *
 11181                 * @param {WordArray|string} password The password.
 11182                 * @param {WordArray|string} salt A salt.
 11183                 *
 11184                 * @return {WordArray} The derived key.
 11185                 *
 11186                 * @example
 11187                 *
 11188                 *     var key = kdf.compute(password, salt);
 11189                 */
 11190                compute: function (password, salt) {
 11191                  // Shortcut
 11192                  var cfg = this.cfg;
 11193  
 11194                  // Init HMAC
 11195                  var hmac = HMAC.create(cfg.hasher, password);
 11196  
 11197                  // Initial values
 11198                  var derivedKey = WordArray.create();
 11199                  var blockIndex = WordArray.create([0x00000001]);
 11200  
 11201                  // Shortcuts
 11202                  var derivedKeyWords = derivedKey.words;
 11203                  var blockIndexWords = blockIndex.words;
 11204                  var keySize = cfg.keySize;
 11205                  var iterations = cfg.iterations;
 11206  
 11207                  // Generate key
 11208                  while (derivedKeyWords.length < keySize) {
 11209                    var block = hmac.update(salt).finalize(blockIndex);
 11210                    hmac.reset();
 11211  
 11212                    // Shortcuts
 11213                    var blockWords = block.words;
 11214                    var blockWordsLength = blockWords.length;
 11215  
 11216                    // Iterations
 11217                    var intermediate = block;
 11218                    for (var i = 1; i < iterations; i++) {
 11219                      intermediate = hmac.finalize(intermediate);
 11220                      hmac.reset();
 11221  
 11222                      // Shortcut
 11223                      var intermediateWords = intermediate.words;
 11224  
 11225                      // XOR intermediate with block
 11226                      for (var j = 0; j < blockWordsLength; j++) {
 11227                        blockWords[j] ^= intermediateWords[j];
 11228                      }
 11229                    }
 11230  
 11231                    derivedKey.concat(block);
 11232                    blockIndexWords[0]++;
 11233                  }
 11234                  derivedKey.sigBytes = keySize * 4;
 11235  
 11236                  return derivedKey;
 11237                },
 11238              }));
 11239  
 11240              /**
 11241               * Computes the Password-Based Key Derivation Function 2.
 11242               *
 11243               * @param {WordArray|string} password The password.
 11244               * @param {WordArray|string} salt A salt.
 11245               * @param {Object} cfg (Optional) The configuration options to use for this computation.
 11246               *
 11247               * @return {WordArray} The derived key.
 11248               *
 11249               * @static
 11250               *
 11251               * @example
 11252               *
 11253               *     var key = CryptoJS.PBKDF2(password, salt);
 11254               *     var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 });
 11255               *     var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
 11256               */
 11257              C.PBKDF2 = function (password, salt, cfg) {
 11258                return PBKDF2.create(cfg).compute(password, salt);
 11259              };
 11260            })();
 11261  
 11262            return CryptoJS.PBKDF2;
 11263          });
 11264        },
 11265        { "./core": 53, "./hmac": 58, "./sha1": 77 },
 11266      ],
 11267      73: [
 11268        function (require, module, exports) {
 11269          (function (root, factory, undef) {
 11270            if (typeof exports === "object") {
 11271              // CommonJS
 11272              module.exports = exports = factory(
 11273                require("./core"),
 11274                require("./enc-base64"),
 11275                require("./md5"),
 11276                require("./evpkdf"),
 11277                require("./cipher-core")
 11278              );
 11279            } else if (typeof define === "function" && define.amd) {
 11280              // AMD
 11281              define([
 11282                "./core",
 11283                "./enc-base64",
 11284                "./md5",
 11285                "./evpkdf",
 11286                "./cipher-core",
 11287              ], factory);
 11288            } else {
 11289              // Global (browser)
 11290              factory(root.CryptoJS);
 11291            }
 11292          })(this, function (CryptoJS) {
 11293            (function () {
 11294              // Shortcuts
 11295              var C = CryptoJS;
 11296              var C_lib = C.lib;
 11297              var StreamCipher = C_lib.StreamCipher;
 11298              var C_algo = C.algo;
 11299  
 11300              // Reusable objects
 11301              var S = [];
 11302              var C_ = [];
 11303              var G = [];
 11304  
 11305              /**
 11306               * Rabbit stream cipher algorithm.
 11307               *
 11308               * This is a legacy version that neglected to convert the key to little-endian.
 11309               * This error doesn't affect the cipher's security,
 11310               * but it does affect its compatibility with other implementations.
 11311               */
 11312              var RabbitLegacy = (C_algo.RabbitLegacy = StreamCipher.extend({
 11313                _doReset: function () {
 11314                  // Shortcuts
 11315                  var K = this._key.words;
 11316                  var iv = this.cfg.iv;
 11317  
 11318                  // Generate initial state values
 11319                  var X = (this._X = [
 11320                    K[0],
 11321                    (K[3] << 16) | (K[2] >>> 16),
 11322                    K[1],
 11323                    (K[0] << 16) | (K[3] >>> 16),
 11324                    K[2],
 11325                    (K[1] << 16) | (K[0] >>> 16),
 11326                    K[3],
 11327                    (K[2] << 16) | (K[1] >>> 16),
 11328                  ]);
 11329  
 11330                  // Generate initial counter values
 11331                  var C = (this._C = [
 11332                    (K[2] << 16) | (K[2] >>> 16),
 11333                    (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
 11334                    (K[3] << 16) | (K[3] >>> 16),
 11335                    (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
 11336                    (K[0] << 16) | (K[0] >>> 16),
 11337                    (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
 11338                    (K[1] << 16) | (K[1] >>> 16),
 11339                    (K[3] & 0xffff0000) | (K[0] & 0x0000ffff),
 11340                  ]);
 11341  
 11342                  // Carry bit
 11343                  this._b = 0;
 11344  
 11345                  // Iterate the system four times
 11346                  for (var i = 0; i < 4; i++) {
 11347                    nextState.call(this);
 11348                  }
 11349  
 11350                  // Modify the counters
 11351                  for (var i = 0; i < 8; i++) {
 11352                    C[i] ^= X[(i + 4) & 7];
 11353                  }
 11354  
 11355                  // IV setup
 11356                  if (iv) {
 11357                    // Shortcuts
 11358                    var IV = iv.words;
 11359                    var IV_0 = IV[0];
 11360                    var IV_1 = IV[1];
 11361  
 11362                    // Generate four subvectors
 11363                    var i0 =
 11364                      (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) |
 11365                      (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
 11366                    var i2 =
 11367                      (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) |
 11368                      (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
 11369                    var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
 11370                    var i3 = (i2 << 16) | (i0 & 0x0000ffff);
 11371  
 11372                    // Modify counter values
 11373                    C[0] ^= i0;
 11374                    C[1] ^= i1;
 11375                    C[2] ^= i2;
 11376                    C[3] ^= i3;
 11377                    C[4] ^= i0;
 11378                    C[5] ^= i1;
 11379                    C[6] ^= i2;
 11380                    C[7] ^= i3;
 11381  
 11382                    // Iterate the system four times
 11383                    for (var i = 0; i < 4; i++) {
 11384                      nextState.call(this);
 11385                    }
 11386                  }
 11387                },
 11388  
 11389                _doProcessBlock: function (M, offset) {
 11390                  // Shortcut
 11391                  var X = this._X;
 11392  
 11393                  // Iterate the system
 11394                  nextState.call(this);
 11395  
 11396                  // Generate four keystream words
 11397                  S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
 11398                  S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
 11399                  S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
 11400                  S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
 11401  
 11402                  for (var i = 0; i < 4; i++) {
 11403                    // Swap endian
 11404                    S[i] =
 11405                      (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
 11406                      (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
 11407  
 11408                    // Encrypt
 11409                    M[offset + i] ^= S[i];
 11410                  }
 11411                },
 11412  
 11413                blockSize: 128 / 32,
 11414  
 11415                ivSize: 64 / 32,
 11416              }));
 11417  
 11418              function nextState() {
 11419                // Shortcuts
 11420                var X = this._X;
 11421                var C = this._C;
 11422  
 11423                // Save old counter values
 11424                for (var i = 0; i < 8; i++) {
 11425                  C_[i] = C[i];
 11426                }
 11427  
 11428                // Calculate new counter values
 11429                C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
 11430                C[1] =
 11431                  (C[1] + 0xd34d34d3 + (C[0] >>> 0 < C_[0] >>> 0 ? 1 : 0)) | 0;
 11432                C[2] =
 11433                  (C[2] + 0x34d34d34 + (C[1] >>> 0 < C_[1] >>> 0 ? 1 : 0)) | 0;
 11434                C[3] =
 11435                  (C[3] + 0x4d34d34d + (C[2] >>> 0 < C_[2] >>> 0 ? 1 : 0)) | 0;
 11436                C[4] =
 11437                  (C[4] + 0xd34d34d3 + (C[3] >>> 0 < C_[3] >>> 0 ? 1 : 0)) | 0;
 11438                C[5] =
 11439                  (C[5] + 0x34d34d34 + (C[4] >>> 0 < C_[4] >>> 0 ? 1 : 0)) | 0;
 11440                C[6] =
 11441                  (C[6] + 0x4d34d34d + (C[5] >>> 0 < C_[5] >>> 0 ? 1 : 0)) | 0;
 11442                C[7] =
 11443                  (C[7] + 0xd34d34d3 + (C[6] >>> 0 < C_[6] >>> 0 ? 1 : 0)) | 0;
 11444                this._b = C[7] >>> 0 < C_[7] >>> 0 ? 1 : 0;
 11445  
 11446                // Calculate the g-values
 11447                for (var i = 0; i < 8; i++) {
 11448                  var gx = X[i] + C[i];
 11449  
 11450                  // Construct high and low argument for squaring
 11451                  var ga = gx & 0xffff;
 11452                  var gb = gx >>> 16;
 11453  
 11454                  // Calculate high and low result of squaring
 11455                  var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
 11456                  var gl =
 11457                    (((gx & 0xffff0000) * gx) | 0) +
 11458                    (((gx & 0x0000ffff) * gx) | 0);
 11459  
 11460                  // High XOR low
 11461                  G[i] = gh ^ gl;
 11462                }
 11463  
 11464                // Calculate new state values
 11465                X[0] =
 11466                  (G[0] +
 11467                    ((G[7] << 16) | (G[7] >>> 16)) +
 11468                    ((G[6] << 16) | (G[6] >>> 16))) |
 11469                  0;
 11470                X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;
 11471                X[2] =
 11472                  (G[2] +
 11473                    ((G[1] << 16) | (G[1] >>> 16)) +
 11474                    ((G[0] << 16) | (G[0] >>> 16))) |
 11475                  0;
 11476                X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;
 11477                X[4] =
 11478                  (G[4] +
 11479                    ((G[3] << 16) | (G[3] >>> 16)) +
 11480                    ((G[2] << 16) | (G[2] >>> 16))) |
 11481                  0;
 11482                X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;
 11483                X[6] =
 11484                  (G[6] +
 11485                    ((G[5] << 16) | (G[5] >>> 16)) +
 11486                    ((G[4] << 16) | (G[4] >>> 16))) |
 11487                  0;
 11488                X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;
 11489              }
 11490  
 11491              /**
 11492               * Shortcut functions to the cipher's object interface.
 11493               *
 11494               * @example
 11495               *
 11496               *     var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg);
 11497               *     var plaintext  = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);
 11498               */
 11499              C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy);
 11500            })();
 11501  
 11502            return CryptoJS.RabbitLegacy;
 11503          });
 11504        },
 11505        {
 11506          "./cipher-core": 52,
 11507          "./core": 53,
 11508          "./enc-base64": 54,
 11509          "./evpkdf": 56,
 11510          "./md5": 61,
 11511        },
 11512      ],
 11513      74: [
 11514        function (require, module, exports) {
 11515          (function (root, factory, undef) {
 11516            if (typeof exports === "object") {
 11517              // CommonJS
 11518              module.exports = exports = factory(
 11519                require("./core"),
 11520                require("./enc-base64"),
 11521                require("./md5"),
 11522                require("./evpkdf"),
 11523                require("./cipher-core")
 11524              );
 11525            } else if (typeof define === "function" && define.amd) {
 11526              // AMD
 11527              define([
 11528                "./core",
 11529                "./enc-base64",
 11530                "./md5",
 11531                "./evpkdf",
 11532                "./cipher-core",
 11533              ], factory);
 11534            } else {
 11535              // Global (browser)
 11536              factory(root.CryptoJS);
 11537            }
 11538          })(this, function (CryptoJS) {
 11539            (function () {
 11540              // Shortcuts
 11541              var C = CryptoJS;
 11542              var C_lib = C.lib;
 11543              var StreamCipher = C_lib.StreamCipher;
 11544              var C_algo = C.algo;
 11545  
 11546              // Reusable objects
 11547              var S = [];
 11548              var C_ = [];
 11549              var G = [];
 11550  
 11551              /**
 11552               * Rabbit stream cipher algorithm
 11553               */
 11554              var Rabbit = (C_algo.Rabbit = StreamCipher.extend({
 11555                _doReset: function () {
 11556                  // Shortcuts
 11557                  var K = this._key.words;
 11558                  var iv = this.cfg.iv;
 11559  
 11560                  // Swap endian
 11561                  for (var i = 0; i < 4; i++) {
 11562                    K[i] =
 11563                      (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) |
 11564                      (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00);
 11565                  }
 11566  
 11567                  // Generate initial state values
 11568                  var X = (this._X = [
 11569                    K[0],
 11570                    (K[3] << 16) | (K[2] >>> 16),
 11571                    K[1],
 11572                    (K[0] << 16) | (K[3] >>> 16),
 11573                    K[2],
 11574                    (K[1] << 16) | (K[0] >>> 16),
 11575                    K[3],
 11576                    (K[2] << 16) | (K[1] >>> 16),
 11577                  ]);
 11578  
 11579                  // Generate initial counter values
 11580                  var C = (this._C = [
 11581                    (K[2] << 16) | (K[2] >>> 16),
 11582                    (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
 11583                    (K[3] << 16) | (K[3] >>> 16),
 11584                    (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
 11585                    (K[0] << 16) | (K[0] >>> 16),
 11586                    (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
 11587                    (K[1] << 16) | (K[1] >>> 16),
 11588                    (K[3] & 0xffff0000) | (K[0] & 0x0000ffff),
 11589                  ]);
 11590  
 11591                  // Carry bit
 11592                  this._b = 0;
 11593  
 11594                  // Iterate the system four times
 11595                  for (var i = 0; i < 4; i++) {
 11596                    nextState.call(this);
 11597                  }
 11598  
 11599                  // Modify the counters
 11600                  for (var i = 0; i < 8; i++) {
 11601                    C[i] ^= X[(i + 4) & 7];
 11602                  }
 11603  
 11604                  // IV setup
 11605                  if (iv) {
 11606                    // Shortcuts
 11607                    var IV = iv.words;
 11608                    var IV_0 = IV[0];
 11609                    var IV_1 = IV[1];
 11610  
 11611                    // Generate four subvectors
 11612                    var i0 =
 11613                      (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) |
 11614                      (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
 11615                    var i2 =
 11616                      (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) |
 11617                      (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
 11618                    var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
 11619                    var i3 = (i2 << 16) | (i0 & 0x0000ffff);
 11620  
 11621                    // Modify counter values
 11622                    C[0] ^= i0;
 11623                    C[1] ^= i1;
 11624                    C[2] ^= i2;
 11625                    C[3] ^= i3;
 11626                    C[4] ^= i0;
 11627                    C[5] ^= i1;
 11628                    C[6] ^= i2;
 11629                    C[7] ^= i3;
 11630  
 11631                    // Iterate the system four times
 11632                    for (var i = 0; i < 4; i++) {
 11633                      nextState.call(this);
 11634                    }
 11635                  }
 11636                },
 11637  
 11638                _doProcessBlock: function (M, offset) {
 11639                  // Shortcut
 11640                  var X = this._X;
 11641  
 11642                  // Iterate the system
 11643                  nextState.call(this);
 11644  
 11645                  // Generate four keystream words
 11646                  S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
 11647                  S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
 11648                  S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
 11649                  S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
 11650  
 11651                  for (var i = 0; i < 4; i++) {
 11652                    // Swap endian
 11653                    S[i] =
 11654                      (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
 11655                      (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
 11656  
 11657                    // Encrypt
 11658                    M[offset + i] ^= S[i];
 11659                  }
 11660                },
 11661  
 11662                blockSize: 128 / 32,
 11663  
 11664                ivSize: 64 / 32,
 11665              }));
 11666  
 11667              function nextState() {
 11668                // Shortcuts
 11669                var X = this._X;
 11670                var C = this._C;
 11671  
 11672                // Save old counter values
 11673                for (var i = 0; i < 8; i++) {
 11674                  C_[i] = C[i];
 11675                }
 11676  
 11677                // Calculate new counter values
 11678                C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
 11679                C[1] =
 11680                  (C[1] + 0xd34d34d3 + (C[0] >>> 0 < C_[0] >>> 0 ? 1 : 0)) | 0;
 11681                C[2] =
 11682                  (C[2] + 0x34d34d34 + (C[1] >>> 0 < C_[1] >>> 0 ? 1 : 0)) | 0;
 11683                C[3] =
 11684                  (C[3] + 0x4d34d34d + (C[2] >>> 0 < C_[2] >>> 0 ? 1 : 0)) | 0;
 11685                C[4] =
 11686                  (C[4] + 0xd34d34d3 + (C[3] >>> 0 < C_[3] >>> 0 ? 1 : 0)) | 0;
 11687                C[5] =
 11688                  (C[5] + 0x34d34d34 + (C[4] >>> 0 < C_[4] >>> 0 ? 1 : 0)) | 0;
 11689                C[6] =
 11690                  (C[6] + 0x4d34d34d + (C[5] >>> 0 < C_[5] >>> 0 ? 1 : 0)) | 0;
 11691                C[7] =
 11692                  (C[7] + 0xd34d34d3 + (C[6] >>> 0 < C_[6] >>> 0 ? 1 : 0)) | 0;
 11693                this._b = C[7] >>> 0 < C_[7] >>> 0 ? 1 : 0;
 11694  
 11695                // Calculate the g-values
 11696                for (var i = 0; i < 8; i++) {
 11697                  var gx = X[i] + C[i];
 11698  
 11699                  // Construct high and low argument for squaring
 11700                  var ga = gx & 0xffff;
 11701                  var gb = gx >>> 16;
 11702  
 11703                  // Calculate high and low result of squaring
 11704                  var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
 11705                  var gl =
 11706                    (((gx & 0xffff0000) * gx) | 0) +
 11707                    (((gx & 0x0000ffff) * gx) | 0);
 11708  
 11709                  // High XOR low
 11710                  G[i] = gh ^ gl;
 11711                }
 11712  
 11713                // Calculate new state values
 11714                X[0] =
 11715                  (G[0] +
 11716                    ((G[7] << 16) | (G[7] >>> 16)) +
 11717                    ((G[6] << 16) | (G[6] >>> 16))) |
 11718                  0;
 11719                X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;
 11720                X[2] =
 11721                  (G[2] +
 11722                    ((G[1] << 16) | (G[1] >>> 16)) +
 11723                    ((G[0] << 16) | (G[0] >>> 16))) |
 11724                  0;
 11725                X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;
 11726                X[4] =
 11727                  (G[4] +
 11728                    ((G[3] << 16) | (G[3] >>> 16)) +
 11729                    ((G[2] << 16) | (G[2] >>> 16))) |
 11730                  0;
 11731                X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;
 11732                X[6] =
 11733                  (G[6] +
 11734                    ((G[5] << 16) | (G[5] >>> 16)) +
 11735                    ((G[4] << 16) | (G[4] >>> 16))) |
 11736                  0;
 11737                X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;
 11738              }
 11739  
 11740              /**
 11741               * Shortcut functions to the cipher's object interface.
 11742               *
 11743               * @example
 11744               *
 11745               *     var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg);
 11746               *     var plaintext  = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);
 11747               */
 11748              C.Rabbit = StreamCipher._createHelper(Rabbit);
 11749            })();
 11750  
 11751            return CryptoJS.Rabbit;
 11752          });
 11753        },
 11754        {
 11755          "./cipher-core": 52,
 11756          "./core": 53,
 11757          "./enc-base64": 54,
 11758          "./evpkdf": 56,
 11759          "./md5": 61,
 11760        },
 11761      ],
 11762      75: [
 11763        function (require, module, exports) {
 11764          (function (root, factory, undef) {
 11765            if (typeof exports === "object") {
 11766              // CommonJS
 11767              module.exports = exports = factory(
 11768                require("./core"),
 11769                require("./enc-base64"),
 11770                require("./md5"),
 11771                require("./evpkdf"),
 11772                require("./cipher-core")
 11773              );
 11774            } else if (typeof define === "function" && define.amd) {
 11775              // AMD
 11776              define([
 11777                "./core",
 11778                "./enc-base64",
 11779                "./md5",
 11780                "./evpkdf",
 11781                "./cipher-core",
 11782              ], factory);
 11783            } else {
 11784              // Global (browser)
 11785              factory(root.CryptoJS);
 11786            }
 11787          })(this, function (CryptoJS) {
 11788            (function () {
 11789              // Shortcuts
 11790              var C = CryptoJS;
 11791              var C_lib = C.lib;
 11792              var StreamCipher = C_lib.StreamCipher;
 11793              var C_algo = C.algo;
 11794  
 11795              /**
 11796               * RC4 stream cipher algorithm.
 11797               */
 11798              var RC4 = (C_algo.RC4 = StreamCipher.extend({
 11799                _doReset: function () {
 11800                  // Shortcuts
 11801                  var key = this._key;
 11802                  var keyWords = key.words;
 11803                  var keySigBytes = key.sigBytes;
 11804  
 11805                  // Init sbox
 11806                  var S = (this._S = []);
 11807                  for (var i = 0; i < 256; i++) {
 11808                    S[i] = i;
 11809                  }
 11810  
 11811                  // Key setup
 11812                  for (var i = 0, j = 0; i < 256; i++) {
 11813                    var keyByteIndex = i % keySigBytes;
 11814                    var keyByte =
 11815                      (keyWords[keyByteIndex >>> 2] >>>
 11816                        (24 - (keyByteIndex % 4) * 8)) &
 11817                      0xff;
 11818  
 11819                    j = (j + S[i] + keyByte) % 256;
 11820  
 11821                    // Swap
 11822                    var t = S[i];
 11823                    S[i] = S[j];
 11824                    S[j] = t;
 11825                  }
 11826  
 11827                  // Counters
 11828                  this._i = this._j = 0;
 11829                },
 11830  
 11831                _doProcessBlock: function (M, offset) {
 11832                  M[offset] ^= generateKeystreamWord.call(this);
 11833                },
 11834  
 11835                keySize: 256 / 32,
 11836  
 11837                ivSize: 0,
 11838              }));
 11839  
 11840              function generateKeystreamWord() {
 11841                // Shortcuts
 11842                var S = this._S;
 11843                var i = this._i;
 11844                var j = this._j;
 11845  
 11846                // Generate keystream word
 11847                var keystreamWord = 0;
 11848                for (var n = 0; n < 4; n++) {
 11849                  i = (i + 1) % 256;
 11850                  j = (j + S[i]) % 256;
 11851  
 11852                  // Swap
 11853                  var t = S[i];
 11854                  S[i] = S[j];
 11855                  S[j] = t;
 11856  
 11857                  keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8);
 11858                }
 11859  
 11860                // Update counters
 11861                this._i = i;
 11862                this._j = j;
 11863  
 11864                return keystreamWord;
 11865              }
 11866  
 11867              /**
 11868               * Shortcut functions to the cipher's object interface.
 11869               *
 11870               * @example
 11871               *
 11872               *     var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg);
 11873               *     var plaintext  = CryptoJS.RC4.decrypt(ciphertext, key, cfg);
 11874               */
 11875              C.RC4 = StreamCipher._createHelper(RC4);
 11876  
 11877              /**
 11878               * Modified RC4 stream cipher algorithm.
 11879               */
 11880              var RC4Drop = (C_algo.RC4Drop = RC4.extend({
 11881                /**
 11882                 * Configuration options.
 11883                 *
 11884                 * @property {number} drop The number of keystream words to drop. Default 192
 11885                 */
 11886                cfg: RC4.cfg.extend({
 11887                  drop: 192,
 11888                }),
 11889  
 11890                _doReset: function () {
 11891                  RC4._doReset.call(this);
 11892  
 11893                  // Drop
 11894                  for (var i = this.cfg.drop; i > 0; i--) {
 11895                    generateKeystreamWord.call(this);
 11896                  }
 11897                },
 11898              }));
 11899  
 11900              /**
 11901               * Shortcut functions to the cipher's object interface.
 11902               *
 11903               * @example
 11904               *
 11905               *     var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg);
 11906               *     var plaintext  = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);
 11907               */
 11908              C.RC4Drop = StreamCipher._createHelper(RC4Drop);
 11909            })();
 11910  
 11911            return CryptoJS.RC4;
 11912          });
 11913        },
 11914        {
 11915          "./cipher-core": 52,
 11916          "./core": 53,
 11917          "./enc-base64": 54,
 11918          "./evpkdf": 56,
 11919          "./md5": 61,
 11920        },
 11921      ],
 11922      76: [
 11923        function (require, module, exports) {
 11924          (function (root, factory) {
 11925            if (typeof exports === "object") {
 11926              // CommonJS
 11927              module.exports = exports = factory(require("./core"));
 11928            } else if (typeof define === "function" && define.amd) {
 11929              // AMD
 11930              define(["./core"], factory);
 11931            } else {
 11932              // Global (browser)
 11933              factory(root.CryptoJS);
 11934            }
 11935          })(this, function (CryptoJS) {
 11936            /** @preserve
 11937  	(c) 2012 by Cédric Mesnil. All rights reserved.
 11938  
 11939  	Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
 11940  
 11941  	    - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
 11942  	    - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
 11943  
 11944  	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 11945  	*/
 11946  
 11947            (function (Math) {
 11948              // Shortcuts
 11949              var C = CryptoJS;
 11950              var C_lib = C.lib;
 11951              var WordArray = C_lib.WordArray;
 11952              var Hasher = C_lib.Hasher;
 11953              var C_algo = C.algo;
 11954  
 11955              // Constants table
 11956              var _zl = WordArray.create([
 11957                0,
 11958                1,
 11959                2,
 11960                3,
 11961                4,
 11962                5,
 11963                6,
 11964                7,
 11965                8,
 11966                9,
 11967                10,
 11968                11,
 11969                12,
 11970                13,
 11971                14,
 11972                15,
 11973                7,
 11974                4,
 11975                13,
 11976                1,
 11977                10,
 11978                6,
 11979                15,
 11980                3,
 11981                12,
 11982                0,
 11983                9,
 11984                5,
 11985                2,
 11986                14,
 11987                11,
 11988                8,
 11989                3,
 11990                10,
 11991                14,
 11992                4,
 11993                9,
 11994                15,
 11995                8,
 11996                1,
 11997                2,
 11998                7,
 11999                0,
 12000                6,
 12001                13,
 12002                11,
 12003                5,
 12004                12,
 12005                1,
 12006                9,
 12007                11,
 12008                10,
 12009                0,
 12010                8,
 12011                12,
 12012                4,
 12013                13,
 12014                3,
 12015                7,
 12016                15,
 12017                14,
 12018                5,
 12019                6,
 12020                2,
 12021                4,
 12022                0,
 12023                5,
 12024                9,
 12025                7,
 12026                12,
 12027                2,
 12028                10,
 12029                14,
 12030                1,
 12031                3,
 12032                8,
 12033                11,
 12034                6,
 12035                15,
 12036                13,
 12037              ]);
 12038              var _zr = WordArray.create([
 12039                5,
 12040                14,
 12041                7,
 12042                0,
 12043                9,
 12044                2,
 12045                11,
 12046                4,
 12047                13,
 12048                6,
 12049                15,
 12050                8,
 12051                1,
 12052                10,
 12053                3,
 12054                12,
 12055                6,
 12056                11,
 12057                3,
 12058                7,
 12059                0,
 12060                13,
 12061                5,
 12062                10,
 12063                14,
 12064                15,
 12065                8,
 12066                12,
 12067                4,
 12068                9,
 12069                1,
 12070                2,
 12071                15,
 12072                5,
 12073                1,
 12074                3,
 12075                7,
 12076                14,
 12077                6,
 12078                9,
 12079                11,
 12080                8,
 12081                12,
 12082                2,
 12083                10,
 12084                0,
 12085                4,
 12086                13,
 12087                8,
 12088                6,
 12089                4,
 12090                1,
 12091                3,
 12092                11,
 12093                15,
 12094                0,
 12095                5,
 12096                12,
 12097                2,
 12098                13,
 12099                9,
 12100                7,
 12101                10,
 12102                14,
 12103                12,
 12104                15,
 12105                10,
 12106                4,
 12107                1,
 12108                5,
 12109                8,
 12110                7,
 12111                6,
 12112                2,
 12113                13,
 12114                14,
 12115                0,
 12116                3,
 12117                9,
 12118                11,
 12119              ]);
 12120              var _sl = WordArray.create([
 12121                11,
 12122                14,
 12123                15,
 12124                12,
 12125                5,
 12126                8,
 12127                7,
 12128                9,
 12129                11,
 12130                13,
 12131                14,
 12132                15,
 12133                6,
 12134                7,
 12135                9,
 12136                8,
 12137                7,
 12138                6,
 12139                8,
 12140                13,
 12141                11,
 12142                9,
 12143                7,
 12144                15,
 12145                7,
 12146                12,
 12147                15,
 12148                9,
 12149                11,
 12150                7,
 12151                13,
 12152                12,
 12153                11,
 12154                13,
 12155                6,
 12156                7,
 12157                14,
 12158                9,
 12159                13,
 12160                15,
 12161                14,
 12162                8,
 12163                13,
 12164                6,
 12165                5,
 12166                12,
 12167                7,
 12168                5,
 12169                11,
 12170                12,
 12171                14,
 12172                15,
 12173                14,
 12174                15,
 12175                9,
 12176                8,
 12177                9,
 12178                14,
 12179                5,
 12180                6,
 12181                8,
 12182                6,
 12183                5,
 12184                12,
 12185                9,
 12186                15,
 12187                5,
 12188                11,
 12189                6,
 12190                8,
 12191                13,
 12192                12,
 12193                5,
 12194                12,
 12195                13,
 12196                14,
 12197                11,
 12198                8,
 12199                5,
 12200                6,
 12201              ]);
 12202              var _sr = WordArray.create([
 12203                8,
 12204                9,
 12205                9,
 12206                11,
 12207                13,
 12208                15,
 12209                15,
 12210                5,
 12211                7,
 12212                7,
 12213                8,
 12214                11,
 12215                14,
 12216                14,
 12217                12,
 12218                6,
 12219                9,
 12220                13,
 12221                15,
 12222                7,
 12223                12,
 12224                8,
 12225                9,
 12226                11,
 12227                7,
 12228                7,
 12229                12,
 12230                7,
 12231                6,
 12232                15,
 12233                13,
 12234                11,
 12235                9,
 12236                7,
 12237                15,
 12238                11,
 12239                8,
 12240                6,
 12241                6,
 12242                14,
 12243                12,
 12244                13,
 12245                5,
 12246                14,
 12247                13,
 12248                13,
 12249                7,
 12250                5,
 12251                15,
 12252                5,
 12253                8,
 12254                11,
 12255                14,
 12256                14,
 12257                6,
 12258                14,
 12259                6,
 12260                9,
 12261                12,
 12262                9,
 12263                12,
 12264                5,
 12265                15,
 12266                8,
 12267                8,
 12268                5,
 12269                12,
 12270                9,
 12271                12,
 12272                5,
 12273                14,
 12274                6,
 12275                8,
 12276                13,
 12277                6,
 12278                5,
 12279                15,
 12280                13,
 12281                11,
 12282                11,
 12283              ]);
 12284  
 12285              var _hl = WordArray.create([
 12286                0x00000000,
 12287                0x5a827999,
 12288                0x6ed9eba1,
 12289                0x8f1bbcdc,
 12290                0xa953fd4e,
 12291              ]);
 12292              var _hr = WordArray.create([
 12293                0x50a28be6,
 12294                0x5c4dd124,
 12295                0x6d703ef3,
 12296                0x7a6d76e9,
 12297                0x00000000,
 12298              ]);
 12299  
 12300              /**
 12301               * RIPEMD160 hash algorithm.
 12302               */
 12303              var RIPEMD160 = (C_algo.RIPEMD160 = Hasher.extend({
 12304                _doReset: function () {
 12305                  this._hash = WordArray.create([
 12306                    0x67452301,
 12307                    0xefcdab89,
 12308                    0x98badcfe,
 12309                    0x10325476,
 12310                    0xc3d2e1f0,
 12311                  ]);
 12312                },
 12313  
 12314                _doProcessBlock: function (M, offset) {
 12315                  // Swap endian
 12316                  for (var i = 0; i < 16; i++) {
 12317                    // Shortcuts
 12318                    var offset_i = offset + i;
 12319                    var M_offset_i = M[offset_i];
 12320  
 12321                    // Swap
 12322                    M[offset_i] =
 12323                      (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
 12324                      (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00);
 12325                  }
 12326                  // Shortcut
 12327                  var H = this._hash.words;
 12328                  var hl = _hl.words;
 12329                  var hr = _hr.words;
 12330                  var zl = _zl.words;
 12331                  var zr = _zr.words;
 12332                  var sl = _sl.words;
 12333                  var sr = _sr.words;
 12334  
 12335                  // Working variables
 12336                  var al, bl, cl, dl, el;
 12337                  var ar, br, cr, dr, er;
 12338  
 12339                  ar = al = H[0];
 12340                  br = bl = H[1];
 12341                  cr = cl = H[2];
 12342                  dr = dl = H[3];
 12343                  er = el = H[4];
 12344                  // Computation
 12345                  var t;
 12346                  for (var i = 0; i < 80; i += 1) {
 12347                    t = (al + M[offset + zl[i]]) | 0;
 12348                    if (i < 16) {
 12349                      t += f1(bl, cl, dl) + hl[0];
 12350                    } else if (i < 32) {
 12351                      t += f2(bl, cl, dl) + hl[1];
 12352                    } else if (i < 48) {
 12353                      t += f3(bl, cl, dl) + hl[2];
 12354                    } else if (i < 64) {
 12355                      t += f4(bl, cl, dl) + hl[3];
 12356                    } else {
 12357                      // if (i<80) {
 12358                      t += f5(bl, cl, dl) + hl[4];
 12359                    }
 12360                    t = t | 0;
 12361                    t = rotl(t, sl[i]);
 12362                    t = (t + el) | 0;
 12363                    al = el;
 12364                    el = dl;
 12365                    dl = rotl(cl, 10);
 12366                    cl = bl;
 12367                    bl = t;
 12368  
 12369                    t = (ar + M[offset + zr[i]]) | 0;
 12370                    if (i < 16) {
 12371                      t += f5(br, cr, dr) + hr[0];
 12372                    } else if (i < 32) {
 12373                      t += f4(br, cr, dr) + hr[1];
 12374                    } else if (i < 48) {
 12375                      t += f3(br, cr, dr) + hr[2];
 12376                    } else if (i < 64) {
 12377                      t += f2(br, cr, dr) + hr[3];
 12378                    } else {
 12379                      // if (i<80) {
 12380                      t += f1(br, cr, dr) + hr[4];
 12381                    }
 12382                    t = t | 0;
 12383                    t = rotl(t, sr[i]);
 12384                    t = (t + er) | 0;
 12385                    ar = er;
 12386                    er = dr;
 12387                    dr = rotl(cr, 10);
 12388                    cr = br;
 12389                    br = t;
 12390                  }
 12391                  // Intermediate hash value
 12392                  t = (H[1] + cl + dr) | 0;
 12393                  H[1] = (H[2] + dl + er) | 0;
 12394                  H[2] = (H[3] + el + ar) | 0;
 12395                  H[3] = (H[4] + al + br) | 0;
 12396                  H[4] = (H[0] + bl + cr) | 0;
 12397                  H[0] = t;
 12398                },
 12399  
 12400                _doFinalize: function () {
 12401                  // Shortcuts
 12402                  var data = this._data;
 12403                  var dataWords = data.words;
 12404  
 12405                  var nBitsTotal = this._nDataBytes * 8;
 12406                  var nBitsLeft = data.sigBytes * 8;
 12407  
 12408                  // Add padding
 12409                  dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - (nBitsLeft % 32));
 12410                  dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] =
 12411                    (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |
 12412                    (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00);
 12413                  data.sigBytes = (dataWords.length + 1) * 4;
 12414  
 12415                  // Hash final blocks
 12416                  this._process();
 12417  
 12418                  // Shortcuts
 12419                  var hash = this._hash;
 12420                  var H = hash.words;
 12421  
 12422                  // Swap endian
 12423                  for (var i = 0; i < 5; i++) {
 12424                    // Shortcut
 12425                    var H_i = H[i];
 12426  
 12427                    // Swap
 12428                    H[i] =
 12429                      (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
 12430                      (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
 12431                  }
 12432  
 12433                  // Return final computed hash
 12434                  return hash;
 12435                },
 12436  
 12437                clone: function () {
 12438                  var clone = Hasher.clone.call(this);
 12439                  clone._hash = this._hash.clone();
 12440  
 12441                  return clone;
 12442                },
 12443              }));
 12444  
 12445              function f1(x, y, z) {
 12446                return x ^ y ^ z;
 12447              }
 12448  
 12449              function f2(x, y, z) {
 12450                return (x & y) | (~x & z);
 12451              }
 12452  
 12453              function f3(x, y, z) {
 12454                return (x | ~y) ^ z;
 12455              }
 12456  
 12457              function f4(x, y, z) {
 12458                return (x & z) | (y & ~z);
 12459              }
 12460  
 12461              function f5(x, y, z) {
 12462                return x ^ (y | ~z);
 12463              }
 12464  
 12465              function rotl(x, n) {
 12466                return (x << n) | (x >>> (32 - n));
 12467              }
 12468  
 12469              /**
 12470               * Shortcut function to the hasher's object interface.
 12471               *
 12472               * @param {WordArray|string} message The message to hash.
 12473               *
 12474               * @return {WordArray} The hash.
 12475               *
 12476               * @static
 12477               *
 12478               * @example
 12479               *
 12480               *     var hash = CryptoJS.RIPEMD160('message');
 12481               *     var hash = CryptoJS.RIPEMD160(wordArray);
 12482               */
 12483              C.RIPEMD160 = Hasher._createHelper(RIPEMD160);
 12484  
 12485              /**
 12486               * Shortcut function to the HMAC's object interface.
 12487               *
 12488               * @param {WordArray|string} message The message to hash.
 12489               * @param {WordArray|string} key The secret key.
 12490               *
 12491               * @return {WordArray} The HMAC.
 12492               *
 12493               * @static
 12494               *
 12495               * @example
 12496               *
 12497               *     var hmac = CryptoJS.HmacRIPEMD160(message, key);
 12498               */
 12499              C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160);
 12500            })(Math);
 12501  
 12502            return CryptoJS.RIPEMD160;
 12503          });
 12504        },
 12505        { "./core": 53 },
 12506      ],
 12507      77: [
 12508        function (require, module, exports) {
 12509          (function (root, factory) {
 12510            if (typeof exports === "object") {
 12511              // CommonJS
 12512              module.exports = exports = factory(require("./core"));
 12513            } else if (typeof define === "function" && define.amd) {
 12514              // AMD
 12515              define(["./core"], factory);
 12516            } else {
 12517              // Global (browser)
 12518              factory(root.CryptoJS);
 12519            }
 12520          })(this, function (CryptoJS) {
 12521            (function () {
 12522              // Shortcuts
 12523              var C = CryptoJS;
 12524              var C_lib = C.lib;
 12525              var WordArray = C_lib.WordArray;
 12526              var Hasher = C_lib.Hasher;
 12527              var C_algo = C.algo;
 12528  
 12529              // Reusable object
 12530              var W = [];
 12531  
 12532              /**
 12533               * SHA-1 hash algorithm.
 12534               */
 12535              var SHA1 = (C_algo.SHA1 = Hasher.extend({
 12536                _doReset: function () {
 12537                  this._hash = new WordArray.init([
 12538                    0x67452301,
 12539                    0xefcdab89,
 12540                    0x98badcfe,
 12541                    0x10325476,
 12542                    0xc3d2e1f0,
 12543                  ]);
 12544                },
 12545  
 12546                _doProcessBlock: function (M, offset) {
 12547                  // Shortcut
 12548                  var H = this._hash.words;
 12549  
 12550                  // Working variables
 12551                  var a = H[0];
 12552                  var b = H[1];
 12553                  var c = H[2];
 12554                  var d = H[3];
 12555                  var e = H[4];
 12556  
 12557                  // Computation
 12558                  for (var i = 0; i < 80; i++) {
 12559                    if (i < 16) {
 12560                      W[i] = M[offset + i] | 0;
 12561                    } else {
 12562                      var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
 12563                      W[i] = (n << 1) | (n >>> 31);
 12564                    }
 12565  
 12566                    var t = ((a << 5) | (a >>> 27)) + e + W[i];
 12567                    if (i < 20) {
 12568                      t += ((b & c) | (~b & d)) + 0x5a827999;
 12569                    } else if (i < 40) {
 12570                      t += (b ^ c ^ d) + 0x6ed9eba1;
 12571                    } else if (i < 60) {
 12572                      t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;
 12573                    } /* if (i < 80) */ else {
 12574                      t += (b ^ c ^ d) - 0x359d3e2a;
 12575                    }
 12576  
 12577                    e = d;
 12578                    d = c;
 12579                    c = (b << 30) | (b >>> 2);
 12580                    b = a;
 12581                    a = t;
 12582                  }
 12583  
 12584                  // Intermediate hash value
 12585                  H[0] = (H[0] + a) | 0;
 12586                  H[1] = (H[1] + b) | 0;
 12587                  H[2] = (H[2] + c) | 0;
 12588                  H[3] = (H[3] + d) | 0;
 12589                  H[4] = (H[4] + e) | 0;
 12590                },
 12591  
 12592                _doFinalize: function () {
 12593                  // Shortcuts
 12594                  var data = this._data;
 12595                  var dataWords = data.words;
 12596  
 12597                  var nBitsTotal = this._nDataBytes * 8;
 12598                  var nBitsLeft = data.sigBytes * 8;
 12599  
 12600                  // Add padding
 12601                  dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - (nBitsLeft % 32));
 12602                  dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(
 12603                    nBitsTotal / 0x100000000
 12604                  );
 12605                  dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
 12606                  data.sigBytes = dataWords.length * 4;
 12607  
 12608                  // Hash final blocks
 12609                  this._process();
 12610  
 12611                  // Return final computed hash
 12612                  return this._hash;
 12613                },
 12614  
 12615                clone: function () {
 12616                  var clone = Hasher.clone.call(this);
 12617                  clone._hash = this._hash.clone();
 12618  
 12619                  return clone;
 12620                },
 12621              }));
 12622  
 12623              /**
 12624               * Shortcut function to the hasher's object interface.
 12625               *
 12626               * @param {WordArray|string} message The message to hash.
 12627               *
 12628               * @return {WordArray} The hash.
 12629               *
 12630               * @static
 12631               *
 12632               * @example
 12633               *
 12634               *     var hash = CryptoJS.SHA1('message');
 12635               *     var hash = CryptoJS.SHA1(wordArray);
 12636               */
 12637              C.SHA1 = Hasher._createHelper(SHA1);
 12638  
 12639              /**
 12640               * Shortcut function to the HMAC's object interface.
 12641               *
 12642               * @param {WordArray|string} message The message to hash.
 12643               * @param {WordArray|string} key The secret key.
 12644               *
 12645               * @return {WordArray} The HMAC.
 12646               *
 12647               * @static
 12648               *
 12649               * @example
 12650               *
 12651               *     var hmac = CryptoJS.HmacSHA1(message, key);
 12652               */
 12653              C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
 12654            })();
 12655  
 12656            return CryptoJS.SHA1;
 12657          });
 12658        },
 12659        { "./core": 53 },
 12660      ],
 12661      78: [
 12662        function (require, module, exports) {
 12663          (function (root, factory, undef) {
 12664            if (typeof exports === "object") {
 12665              // CommonJS
 12666              module.exports = exports = factory(
 12667                require("./core"),
 12668                require("./sha256")
 12669              );
 12670            } else if (typeof define === "function" && define.amd) {
 12671              // AMD
 12672              define(["./core", "./sha256"], factory);
 12673            } else {
 12674              // Global (browser)
 12675              factory(root.CryptoJS);
 12676            }
 12677          })(this, function (CryptoJS) {
 12678            (function () {
 12679              // Shortcuts
 12680              var C = CryptoJS;
 12681              var C_lib = C.lib;
 12682              var WordArray = C_lib.WordArray;
 12683              var C_algo = C.algo;
 12684              var SHA256 = C_algo.SHA256;
 12685  
 12686              /**
 12687               * SHA-224 hash algorithm.
 12688               */
 12689              var SHA224 = (C_algo.SHA224 = SHA256.extend({
 12690                _doReset: function () {
 12691                  this._hash = new WordArray.init([
 12692                    0xc1059ed8,
 12693                    0x367cd507,
 12694                    0x3070dd17,
 12695                    0xf70e5939,
 12696                    0xffc00b31,
 12697                    0x68581511,
 12698                    0x64f98fa7,
 12699                    0xbefa4fa4,
 12700                  ]);
 12701                },
 12702  
 12703                _doFinalize: function () {
 12704                  var hash = SHA256._doFinalize.call(this);
 12705  
 12706                  hash.sigBytes -= 4;
 12707  
 12708                  return hash;
 12709                },
 12710              }));
 12711  
 12712              /**
 12713               * Shortcut function to the hasher's object interface.
 12714               *
 12715               * @param {WordArray|string} message The message to hash.
 12716               *
 12717               * @return {WordArray} The hash.
 12718               *
 12719               * @static
 12720               *
 12721               * @example
 12722               *
 12723               *     var hash = CryptoJS.SHA224('message');
 12724               *     var hash = CryptoJS.SHA224(wordArray);
 12725               */
 12726              C.SHA224 = SHA256._createHelper(SHA224);
 12727  
 12728              /**
 12729               * Shortcut function to the HMAC's object interface.
 12730               *
 12731               * @param {WordArray|string} message The message to hash.
 12732               * @param {WordArray|string} key The secret key.
 12733               *
 12734               * @return {WordArray} The HMAC.
 12735               *
 12736               * @static
 12737               *
 12738               * @example
 12739               *
 12740               *     var hmac = CryptoJS.HmacSHA224(message, key);
 12741               */
 12742              C.HmacSHA224 = SHA256._createHmacHelper(SHA224);
 12743            })();
 12744  
 12745            return CryptoJS.SHA224;
 12746          });
 12747        },
 12748        { "./core": 53, "./sha256": 79 },
 12749      ],
 12750      79: [
 12751        function (require, module, exports) {
 12752          (function (root, factory) {
 12753            if (typeof exports === "object") {
 12754              // CommonJS
 12755              module.exports = exports = factory(require("./core"));
 12756            } else if (typeof define === "function" && define.amd) {
 12757              // AMD
 12758              define(["./core"], factory);
 12759            } else {
 12760              // Global (browser)
 12761              factory(root.CryptoJS);
 12762            }
 12763          })(this, function (CryptoJS) {
 12764            (function (Math) {
 12765              // Shortcuts
 12766              var C = CryptoJS;
 12767              var C_lib = C.lib;
 12768              var WordArray = C_lib.WordArray;
 12769              var Hasher = C_lib.Hasher;
 12770              var C_algo = C.algo;
 12771  
 12772              // Initialization and round constants tables
 12773              var H = [];
 12774              var K = [];
 12775  
 12776              // Compute constants
 12777              (function () {
 12778                function isPrime(n) {
 12779                  var sqrtN = Math.sqrt(n);
 12780                  for (var factor = 2; factor <= sqrtN; factor++) {
 12781                    if (!(n % factor)) {
 12782                      return false;
 12783                    }
 12784                  }
 12785  
 12786                  return true;
 12787                }
 12788  
 12789                function getFractionalBits(n) {
 12790                  return ((n - (n | 0)) * 0x100000000) | 0;
 12791                }
 12792  
 12793                var n = 2;
 12794                var nPrime = 0;
 12795                while (nPrime < 64) {
 12796                  if (isPrime(n)) {
 12797                    if (nPrime < 8) {
 12798                      H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
 12799                    }
 12800                    K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));
 12801  
 12802                    nPrime++;
 12803                  }
 12804  
 12805                  n++;
 12806                }
 12807              })();
 12808  
 12809              // Reusable object
 12810              var W = [];
 12811  
 12812              /**
 12813               * SHA-256 hash algorithm.
 12814               */
 12815              var SHA256 = (C_algo.SHA256 = Hasher.extend({
 12816                _doReset: function () {
 12817                  this._hash = new WordArray.init(H.slice(0));
 12818                },
 12819  
 12820                _doProcessBlock: function (M, offset) {
 12821                  // Shortcut
 12822                  var H = this._hash.words;
 12823  
 12824                  // Working variables
 12825                  var a = H[0];
 12826                  var b = H[1];
 12827                  var c = H[2];
 12828                  var d = H[3];
 12829                  var e = H[4];
 12830                  var f = H[5];
 12831                  var g = H[6];
 12832                  var h = H[7];
 12833  
 12834                  // Computation
 12835                  for (var i = 0; i < 64; i++) {
 12836                    if (i < 16) {
 12837                      W[i] = M[offset + i] | 0;
 12838                    } else {
 12839                      var gamma0x = W[i - 15];
 12840                      var gamma0 =
 12841                        ((gamma0x << 25) | (gamma0x >>> 7)) ^
 12842                        ((gamma0x << 14) | (gamma0x >>> 18)) ^
 12843                        (gamma0x >>> 3);
 12844  
 12845                      var gamma1x = W[i - 2];
 12846                      var gamma1 =
 12847                        ((gamma1x << 15) | (gamma1x >>> 17)) ^
 12848                        ((gamma1x << 13) | (gamma1x >>> 19)) ^
 12849                        (gamma1x >>> 10);
 12850  
 12851                      W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
 12852                    }
 12853  
 12854                    var ch = (e & f) ^ (~e & g);
 12855                    var maj = (a & b) ^ (a & c) ^ (b & c);
 12856  
 12857                    var sigma0 =
 12858                      ((a << 30) | (a >>> 2)) ^
 12859                      ((a << 19) | (a >>> 13)) ^
 12860                      ((a << 10) | (a >>> 22));
 12861                    var sigma1 =
 12862                      ((e << 26) | (e >>> 6)) ^
 12863                      ((e << 21) | (e >>> 11)) ^
 12864                      ((e << 7) | (e >>> 25));
 12865  
 12866                    var t1 = h + sigma1 + ch + K[i] + W[i];
 12867                    var t2 = sigma0 + maj;
 12868  
 12869                    h = g;
 12870                    g = f;
 12871                    f = e;
 12872                    e = (d + t1) | 0;
 12873                    d = c;
 12874                    c = b;
 12875                    b = a;
 12876                    a = (t1 + t2) | 0;
 12877                  }
 12878  
 12879                  // Intermediate hash value
 12880                  H[0] = (H[0] + a) | 0;
 12881                  H[1] = (H[1] + b) | 0;
 12882                  H[2] = (H[2] + c) | 0;
 12883                  H[3] = (H[3] + d) | 0;
 12884                  H[4] = (H[4] + e) | 0;
 12885                  H[5] = (H[5] + f) | 0;
 12886                  H[6] = (H[6] + g) | 0;
 12887                  H[7] = (H[7] + h) | 0;
 12888                },
 12889  
 12890                _doFinalize: function () {
 12891                  // Shortcuts
 12892                  var data = this._data;
 12893                  var dataWords = data.words;
 12894  
 12895                  var nBitsTotal = this._nDataBytes * 8;
 12896                  var nBitsLeft = data.sigBytes * 8;
 12897  
 12898                  // Add padding
 12899                  dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - (nBitsLeft % 32));
 12900                  dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(
 12901                    nBitsTotal / 0x100000000
 12902                  );
 12903                  dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
 12904                  data.sigBytes = dataWords.length * 4;
 12905  
 12906                  // Hash final blocks
 12907                  this._process();
 12908  
 12909                  // Return final computed hash
 12910                  return this._hash;
 12911                },
 12912  
 12913                clone: function () {
 12914                  var clone = Hasher.clone.call(this);
 12915                  clone._hash = this._hash.clone();
 12916  
 12917                  return clone;
 12918                },
 12919              }));
 12920  
 12921              /**
 12922               * Shortcut function to the hasher's object interface.
 12923               *
 12924               * @param {WordArray|string} message The message to hash.
 12925               *
 12926               * @return {WordArray} The hash.
 12927               *
 12928               * @static
 12929               *
 12930               * @example
 12931               *
 12932               *     var hash = CryptoJS.SHA256('message');
 12933               *     var hash = CryptoJS.SHA256(wordArray);
 12934               */
 12935              C.SHA256 = Hasher._createHelper(SHA256);
 12936  
 12937              /**
 12938               * Shortcut function to the HMAC's object interface.
 12939               *
 12940               * @param {WordArray|string} message The message to hash.
 12941               * @param {WordArray|string} key The secret key.
 12942               *
 12943               * @return {WordArray} The HMAC.
 12944               *
 12945               * @static
 12946               *
 12947               * @example
 12948               *
 12949               *     var hmac = CryptoJS.HmacSHA256(message, key);
 12950               */
 12951              C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
 12952            })(Math);
 12953  
 12954            return CryptoJS.SHA256;
 12955          });
 12956        },
 12957        { "./core": 53 },
 12958      ],
 12959      80: [
 12960        function (require, module, exports) {
 12961          (function (root, factory, undef) {
 12962            if (typeof exports === "object") {
 12963              // CommonJS
 12964              module.exports = exports = factory(
 12965                require("./core"),
 12966                require("./x64-core")
 12967              );
 12968            } else if (typeof define === "function" && define.amd) {
 12969              // AMD
 12970              define(["./core", "./x64-core"], factory);
 12971            } else {
 12972              // Global (browser)
 12973              factory(root.CryptoJS);
 12974            }
 12975          })(this, function (CryptoJS) {
 12976            (function (Math) {
 12977              // Shortcuts
 12978              var C = CryptoJS;
 12979              var C_lib = C.lib;
 12980              var WordArray = C_lib.WordArray;
 12981              var Hasher = C_lib.Hasher;
 12982              var C_x64 = C.x64;
 12983              var X64Word = C_x64.Word;
 12984              var C_algo = C.algo;
 12985  
 12986              // Constants tables
 12987              var RHO_OFFSETS = [];
 12988              var PI_INDEXES = [];
 12989              var ROUND_CONSTANTS = [];
 12990  
 12991              // Compute Constants
 12992              (function () {
 12993                // Compute rho offset constants
 12994                var x = 1,
 12995                  y = 0;
 12996                for (var t = 0; t < 24; t++) {
 12997                  RHO_OFFSETS[x + 5 * y] = (((t + 1) * (t + 2)) / 2) % 64;
 12998  
 12999                  var newX = y % 5;
 13000                  var newY = (2 * x + 3 * y) % 5;
 13001                  x = newX;
 13002                  y = newY;
 13003                }
 13004  
 13005                // Compute pi index constants
 13006                for (var x = 0; x < 5; x++) {
 13007                  for (var y = 0; y < 5; y++) {
 13008                    PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5;
 13009                  }
 13010                }
 13011  
 13012                // Compute round constants
 13013                var LFSR = 0x01;
 13014                for (var i = 0; i < 24; i++) {
 13015                  var roundConstantMsw = 0;
 13016                  var roundConstantLsw = 0;
 13017  
 13018                  for (var j = 0; j < 7; j++) {
 13019                    if (LFSR & 0x01) {
 13020                      var bitPosition = (1 << j) - 1;
 13021                      if (bitPosition < 32) {
 13022                        roundConstantLsw ^= 1 << bitPosition;
 13023                      } /* if (bitPosition >= 32) */ else {
 13024                        roundConstantMsw ^= 1 << (bitPosition - 32);
 13025                      }
 13026                    }
 13027  
 13028                    // Compute next LFSR
 13029                    if (LFSR & 0x80) {
 13030                      // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1
 13031                      LFSR = (LFSR << 1) ^ 0x71;
 13032                    } else {
 13033                      LFSR <<= 1;
 13034                    }
 13035                  }
 13036  
 13037                  ROUND_CONSTANTS[i] = X64Word.create(
 13038                    roundConstantMsw,
 13039                    roundConstantLsw
 13040                  );
 13041                }
 13042              })();
 13043  
 13044              // Reusable objects for temporary values
 13045              var T = [];
 13046              (function () {
 13047                for (var i = 0; i < 25; i++) {
 13048                  T[i] = X64Word.create();
 13049                }
 13050              })();
 13051  
 13052              /**
 13053               * SHA-3 hash algorithm.
 13054               */
 13055              var SHA3 = (C_algo.SHA3 = Hasher.extend({
 13056                /**
 13057                 * Configuration options.
 13058                 *
 13059                 * @property {number} outputLength
 13060                 *   The desired number of bits in the output hash.
 13061                 *   Only values permitted are: 224, 256, 384, 512.
 13062                 *   Default: 512
 13063                 */
 13064                cfg: Hasher.cfg.extend({
 13065                  outputLength: 512,
 13066                }),
 13067  
 13068                _doReset: function () {
 13069                  var state = (this._state = []);
 13070                  for (var i = 0; i < 25; i++) {
 13071                    state[i] = new X64Word.init();
 13072                  }
 13073  
 13074                  this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;
 13075                },
 13076  
 13077                _doProcessBlock: function (M, offset) {
 13078                  // Shortcuts
 13079                  var state = this._state;
 13080                  var nBlockSizeLanes = this.blockSize / 2;
 13081  
 13082                  // Absorb
 13083                  for (var i = 0; i < nBlockSizeLanes; i++) {
 13084                    // Shortcuts
 13085                    var M2i = M[offset + 2 * i];
 13086                    var M2i1 = M[offset + 2 * i + 1];
 13087  
 13088                    // Swap endian
 13089                    M2i =
 13090                      (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) |
 13091                      (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00);
 13092                    M2i1 =
 13093                      (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) |
 13094                      (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00);
 13095  
 13096                    // Absorb message into state
 13097                    var lane = state[i];
 13098                    lane.high ^= M2i1;
 13099                    lane.low ^= M2i;
 13100                  }
 13101  
 13102                  // Rounds
 13103                  for (var round = 0; round < 24; round++) {
 13104                    // Theta
 13105                    for (var x = 0; x < 5; x++) {
 13106                      // Mix column lanes
 13107                      var tMsw = 0,
 13108                        tLsw = 0;
 13109                      for (var y = 0; y < 5; y++) {
 13110                        var lane = state[x + 5 * y];
 13111                        tMsw ^= lane.high;
 13112                        tLsw ^= lane.low;
 13113                      }
 13114  
 13115                      // Temporary values
 13116                      var Tx = T[x];
 13117                      Tx.high = tMsw;
 13118                      Tx.low = tLsw;
 13119                    }
 13120                    for (var x = 0; x < 5; x++) {
 13121                      // Shortcuts
 13122                      var Tx4 = T[(x + 4) % 5];
 13123                      var Tx1 = T[(x + 1) % 5];
 13124                      var Tx1Msw = Tx1.high;
 13125                      var Tx1Lsw = Tx1.low;
 13126  
 13127                      // Mix surrounding columns
 13128                      var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31));
 13129                      var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31));
 13130                      for (var y = 0; y < 5; y++) {
 13131                        var lane = state[x + 5 * y];
 13132                        lane.high ^= tMsw;
 13133                        lane.low ^= tLsw;
 13134                      }
 13135                    }
 13136  
 13137                    // Rho Pi
 13138                    for (var laneIndex = 1; laneIndex < 25; laneIndex++) {
 13139                      // Shortcuts
 13140                      var lane = state[laneIndex];
 13141                      var laneMsw = lane.high;
 13142                      var laneLsw = lane.low;
 13143                      var rhoOffset = RHO_OFFSETS[laneIndex];
 13144  
 13145                      // Rotate lanes
 13146                      if (rhoOffset < 32) {
 13147                        var tMsw =
 13148                          (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset));
 13149                        var tLsw =
 13150                          (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset));
 13151                      } /* if (rhoOffset >= 32) */ else {
 13152                        var tMsw =
 13153                          (laneLsw << (rhoOffset - 32)) |
 13154                          (laneMsw >>> (64 - rhoOffset));
 13155                        var tLsw =
 13156                          (laneMsw << (rhoOffset - 32)) |
 13157                          (laneLsw >>> (64 - rhoOffset));
 13158                      }
 13159  
 13160                      // Transpose lanes
 13161                      var TPiLane = T[PI_INDEXES[laneIndex]];
 13162                      TPiLane.high = tMsw;
 13163                      TPiLane.low = tLsw;
 13164                    }
 13165  
 13166                    // Rho pi at x = y = 0
 13167                    var T0 = T[0];
 13168                    var state0 = state[0];
 13169                    T0.high = state0.high;
 13170                    T0.low = state0.low;
 13171  
 13172                    // Chi
 13173                    for (var x = 0; x < 5; x++) {
 13174                      for (var y = 0; y < 5; y++) {
 13175                        // Shortcuts
 13176                        var laneIndex = x + 5 * y;
 13177                        var lane = state[laneIndex];
 13178                        var TLane = T[laneIndex];
 13179                        var Tx1Lane = T[((x + 1) % 5) + 5 * y];
 13180                        var Tx2Lane = T[((x + 2) % 5) + 5 * y];
 13181  
 13182                        // Mix rows
 13183                        lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high);
 13184                        lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low);
 13185                      }
 13186                    }
 13187  
 13188                    // Iota
 13189                    var lane = state[0];
 13190                    var roundConstant = ROUND_CONSTANTS[round];
 13191                    lane.high ^= roundConstant.high;
 13192                    lane.low ^= roundConstant.low;
 13193                  }
 13194                },
 13195  
 13196                _doFinalize: function () {
 13197                  // Shortcuts
 13198                  var data = this._data;
 13199                  var dataWords = data.words;
 13200                  var nBitsTotal = this._nDataBytes * 8;
 13201                  var nBitsLeft = data.sigBytes * 8;
 13202                  var blockSizeBits = this.blockSize * 32;
 13203  
 13204                  // Add padding
 13205                  dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - (nBitsLeft % 32));
 13206                  dataWords[
 13207                    ((Math.ceil((nBitsLeft + 1) / blockSizeBits) *
 13208                      blockSizeBits) >>>
 13209                      5) -
 13210                      1
 13211                  ] |= 0x80;
 13212                  data.sigBytes = dataWords.length * 4;
 13213  
 13214                  // Hash final blocks
 13215                  this._process();
 13216  
 13217                  // Shortcuts
 13218                  var state = this._state;
 13219                  var outputLengthBytes = this.cfg.outputLength / 8;
 13220                  var outputLengthLanes = outputLengthBytes / 8;
 13221  
 13222                  // Squeeze
 13223                  var hashWords = [];
 13224                  for (var i = 0; i < outputLengthLanes; i++) {
 13225                    // Shortcuts
 13226                    var lane = state[i];
 13227                    var laneMsw = lane.high;
 13228                    var laneLsw = lane.low;
 13229  
 13230                    // Swap endian
 13231                    laneMsw =
 13232                      (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) |
 13233                      (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00);
 13234                    laneLsw =
 13235                      (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) |
 13236                      (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00);
 13237  
 13238                    // Squeeze state to retrieve hash
 13239                    hashWords.push(laneLsw);
 13240                    hashWords.push(laneMsw);
 13241                  }
 13242  
 13243                  // Return final computed hash
 13244                  return new WordArray.init(hashWords, outputLengthBytes);
 13245                },
 13246  
 13247                clone: function () {
 13248                  var clone = Hasher.clone.call(this);
 13249  
 13250                  var state = (clone._state = this._state.slice(0));
 13251                  for (var i = 0; i < 25; i++) {
 13252                    state[i] = state[i].clone();
 13253                  }
 13254  
 13255                  return clone;
 13256                },
 13257              }));
 13258  
 13259              /**
 13260               * Shortcut function to the hasher's object interface.
 13261               *
 13262               * @param {WordArray|string} message The message to hash.
 13263               *
 13264               * @return {WordArray} The hash.
 13265               *
 13266               * @static
 13267               *
 13268               * @example
 13269               *
 13270               *     var hash = CryptoJS.SHA3('message');
 13271               *     var hash = CryptoJS.SHA3(wordArray);
 13272               */
 13273              C.SHA3 = Hasher._createHelper(SHA3);
 13274  
 13275              /**
 13276               * Shortcut function to the HMAC's object interface.
 13277               *
 13278               * @param {WordArray|string} message The message to hash.
 13279               * @param {WordArray|string} key The secret key.
 13280               *
 13281               * @return {WordArray} The HMAC.
 13282               *
 13283               * @static
 13284               *
 13285               * @example
 13286               *
 13287               *     var hmac = CryptoJS.HmacSHA3(message, key);
 13288               */
 13289              C.HmacSHA3 = Hasher._createHmacHelper(SHA3);
 13290            })(Math);
 13291  
 13292            return CryptoJS.SHA3;
 13293          });
 13294        },
 13295        { "./core": 53, "./x64-core": 84 },
 13296      ],
 13297      81: [
 13298        function (require, module, exports) {
 13299          (function (root, factory, undef) {
 13300            if (typeof exports === "object") {
 13301              // CommonJS
 13302              module.exports = exports = factory(
 13303                require("./core"),
 13304                require("./x64-core"),
 13305                require("./sha512")
 13306              );
 13307            } else if (typeof define === "function" && define.amd) {
 13308              // AMD
 13309              define(["./core", "./x64-core", "./sha512"], factory);
 13310            } else {
 13311              // Global (browser)
 13312              factory(root.CryptoJS);
 13313            }
 13314          })(this, function (CryptoJS) {
 13315            (function () {
 13316              // Shortcuts
 13317              var C = CryptoJS;
 13318              var C_x64 = C.x64;
 13319              var X64Word = C_x64.Word;
 13320              var X64WordArray = C_x64.WordArray;
 13321              var C_algo = C.algo;
 13322              var SHA512 = C_algo.SHA512;
 13323  
 13324              /**
 13325               * SHA-384 hash algorithm.
 13326               */
 13327              var SHA384 = (C_algo.SHA384 = SHA512.extend({
 13328                _doReset: function () {
 13329                  this._hash = new X64WordArray.init([
 13330                    new X64Word.init(0xcbbb9d5d, 0xc1059ed8),
 13331                    new X64Word.init(0x629a292a, 0x367cd507),
 13332                    new X64Word.init(0x9159015a, 0x3070dd17),
 13333                    new X64Word.init(0x152fecd8, 0xf70e5939),
 13334                    new X64Word.init(0x67332667, 0xffc00b31),
 13335                    new X64Word.init(0x8eb44a87, 0x68581511),
 13336                    new X64Word.init(0xdb0c2e0d, 0x64f98fa7),
 13337                    new X64Word.init(0x47b5481d, 0xbefa4fa4),
 13338                  ]);
 13339                },
 13340  
 13341                _doFinalize: function () {
 13342                  var hash = SHA512._doFinalize.call(this);
 13343  
 13344                  hash.sigBytes -= 16;
 13345  
 13346                  return hash;
 13347                },
 13348              }));
 13349  
 13350              /**
 13351               * Shortcut function to the hasher's object interface.
 13352               *
 13353               * @param {WordArray|string} message The message to hash.
 13354               *
 13355               * @return {WordArray} The hash.
 13356               *
 13357               * @static
 13358               *
 13359               * @example
 13360               *
 13361               *     var hash = CryptoJS.SHA384('message');
 13362               *     var hash = CryptoJS.SHA384(wordArray);
 13363               */
 13364              C.SHA384 = SHA512._createHelper(SHA384);
 13365  
 13366              /**
 13367               * Shortcut function to the HMAC's object interface.
 13368               *
 13369               * @param {WordArray|string} message The message to hash.
 13370               * @param {WordArray|string} key The secret key.
 13371               *
 13372               * @return {WordArray} The HMAC.
 13373               *
 13374               * @static
 13375               *
 13376               * @example
 13377               *
 13378               *     var hmac = CryptoJS.HmacSHA384(message, key);
 13379               */
 13380              C.HmacSHA384 = SHA512._createHmacHelper(SHA384);
 13381            })();
 13382  
 13383            return CryptoJS.SHA384;
 13384          });
 13385        },
 13386        { "./core": 53, "./sha512": 82, "./x64-core": 84 },
 13387      ],
 13388      82: [
 13389        function (require, module, exports) {
 13390          (function (root, factory, undef) {
 13391            if (typeof exports === "object") {
 13392              // CommonJS
 13393              module.exports = exports = factory(
 13394                require("./core"),
 13395                require("./x64-core")
 13396              );
 13397            } else if (typeof define === "function" && define.amd) {
 13398              // AMD
 13399              define(["./core", "./x64-core"], factory);
 13400            } else {
 13401              // Global (browser)
 13402              factory(root.CryptoJS);
 13403            }
 13404          })(this, function (CryptoJS) {
 13405            (function () {
 13406              // Shortcuts
 13407              var C = CryptoJS;
 13408              var C_lib = C.lib;
 13409              var Hasher = C_lib.Hasher;
 13410              var C_x64 = C.x64;
 13411              var X64Word = C_x64.Word;
 13412              var X64WordArray = C_x64.WordArray;
 13413              var C_algo = C.algo;
 13414  
 13415              function X64Word_create() {
 13416                return X64Word.create.apply(X64Word, arguments);
 13417              }
 13418  
 13419              // Constants
 13420              var K = [
 13421                X64Word_create(0x428a2f98, 0xd728ae22),
 13422                X64Word_create(0x71374491, 0x23ef65cd),
 13423                X64Word_create(0xb5c0fbcf, 0xec4d3b2f),
 13424                X64Word_create(0xe9b5dba5, 0x8189dbbc),
 13425                X64Word_create(0x3956c25b, 0xf348b538),
 13426                X64Word_create(0x59f111f1, 0xb605d019),
 13427                X64Word_create(0x923f82a4, 0xaf194f9b),
 13428                X64Word_create(0xab1c5ed5, 0xda6d8118),
 13429                X64Word_create(0xd807aa98, 0xa3030242),
 13430                X64Word_create(0x12835b01, 0x45706fbe),
 13431                X64Word_create(0x243185be, 0x4ee4b28c),
 13432                X64Word_create(0x550c7dc3, 0xd5ffb4e2),
 13433                X64Word_create(0x72be5d74, 0xf27b896f),
 13434                X64Word_create(0x80deb1fe, 0x3b1696b1),
 13435                X64Word_create(0x9bdc06a7, 0x25c71235),
 13436                X64Word_create(0xc19bf174, 0xcf692694),
 13437                X64Word_create(0xe49b69c1, 0x9ef14ad2),
 13438                X64Word_create(0xefbe4786, 0x384f25e3),
 13439                X64Word_create(0x0fc19dc6, 0x8b8cd5b5),
 13440                X64Word_create(0x240ca1cc, 0x77ac9c65),
 13441                X64Word_create(0x2de92c6f, 0x592b0275),
 13442                X64Word_create(0x4a7484aa, 0x6ea6e483),
 13443                X64Word_create(0x5cb0a9dc, 0xbd41fbd4),
 13444                X64Word_create(0x76f988da, 0x831153b5),
 13445                X64Word_create(0x983e5152, 0xee66dfab),
 13446                X64Word_create(0xa831c66d, 0x2db43210),
 13447                X64Word_create(0xb00327c8, 0x98fb213f),
 13448                X64Word_create(0xbf597fc7, 0xbeef0ee4),
 13449                X64Word_create(0xc6e00bf3, 0x3da88fc2),
 13450                X64Word_create(0xd5a79147, 0x930aa725),
 13451                X64Word_create(0x06ca6351, 0xe003826f),
 13452                X64Word_create(0x14292967, 0x0a0e6e70),
 13453                X64Word_create(0x27b70a85, 0x46d22ffc),
 13454                X64Word_create(0x2e1b2138, 0x5c26c926),
 13455                X64Word_create(0x4d2c6dfc, 0x5ac42aed),
 13456                X64Word_create(0x53380d13, 0x9d95b3df),
 13457                X64Word_create(0x650a7354, 0x8baf63de),
 13458                X64Word_create(0x766a0abb, 0x3c77b2a8),
 13459                X64Word_create(0x81c2c92e, 0x47edaee6),
 13460                X64Word_create(0x92722c85, 0x1482353b),
 13461                X64Word_create(0xa2bfe8a1, 0x4cf10364),
 13462                X64Word_create(0xa81a664b, 0xbc423001),
 13463                X64Word_create(0xc24b8b70, 0xd0f89791),
 13464                X64Word_create(0xc76c51a3, 0x0654be30),
 13465                X64Word_create(0xd192e819, 0xd6ef5218),
 13466                X64Word_create(0xd6990624, 0x5565a910),
 13467                X64Word_create(0xf40e3585, 0x5771202a),
 13468                X64Word_create(0x106aa070, 0x32bbd1b8),
 13469                X64Word_create(0x19a4c116, 0xb8d2d0c8),
 13470                X64Word_create(0x1e376c08, 0x5141ab53),
 13471                X64Word_create(0x2748774c, 0xdf8eeb99),
 13472                X64Word_create(0x34b0bcb5, 0xe19b48a8),
 13473                X64Word_create(0x391c0cb3, 0xc5c95a63),
 13474                X64Word_create(0x4ed8aa4a, 0xe3418acb),
 13475                X64Word_create(0x5b9cca4f, 0x7763e373),
 13476                X64Word_create(0x682e6ff3, 0xd6b2b8a3),
 13477                X64Word_create(0x748f82ee, 0x5defb2fc),
 13478                X64Word_create(0x78a5636f, 0x43172f60),
 13479                X64Word_create(0x84c87814, 0xa1f0ab72),
 13480                X64Word_create(0x8cc70208, 0x1a6439ec),
 13481                X64Word_create(0x90befffa, 0x23631e28),
 13482                X64Word_create(0xa4506ceb, 0xde82bde9),
 13483                X64Word_create(0xbef9a3f7, 0xb2c67915),
 13484                X64Word_create(0xc67178f2, 0xe372532b),
 13485                X64Word_create(0xca273ece, 0xea26619c),
 13486                X64Word_create(0xd186b8c7, 0x21c0c207),
 13487                X64Word_create(0xeada7dd6, 0xcde0eb1e),
 13488                X64Word_create(0xf57d4f7f, 0xee6ed178),
 13489                X64Word_create(0x06f067aa, 0x72176fba),
 13490                X64Word_create(0x0a637dc5, 0xa2c898a6),
 13491                X64Word_create(0x113f9804, 0xbef90dae),
 13492                X64Word_create(0x1b710b35, 0x131c471b),
 13493                X64Word_create(0x28db77f5, 0x23047d84),
 13494                X64Word_create(0x32caab7b, 0x40c72493),
 13495                X64Word_create(0x3c9ebe0a, 0x15c9bebc),
 13496                X64Word_create(0x431d67c4, 0x9c100d4c),
 13497                X64Word_create(0x4cc5d4be, 0xcb3e42b6),
 13498                X64Word_create(0x597f299c, 0xfc657e2a),
 13499                X64Word_create(0x5fcb6fab, 0x3ad6faec),
 13500                X64Word_create(0x6c44198c, 0x4a475817),
 13501              ];
 13502  
 13503              // Reusable objects
 13504              var W = [];
 13505              (function () {
 13506                for (var i = 0; i < 80; i++) {
 13507                  W[i] = X64Word_create();
 13508                }
 13509              })();
 13510  
 13511              /**
 13512               * SHA-512 hash algorithm.
 13513               */
 13514              var SHA512 = (C_algo.SHA512 = Hasher.extend({
 13515                _doReset: function () {
 13516                  this._hash = new X64WordArray.init([
 13517                    new X64Word.init(0x6a09e667, 0xf3bcc908),
 13518                    new X64Word.init(0xbb67ae85, 0x84caa73b),
 13519                    new X64Word.init(0x3c6ef372, 0xfe94f82b),
 13520                    new X64Word.init(0xa54ff53a, 0x5f1d36f1),
 13521                    new X64Word.init(0x510e527f, 0xade682d1),
 13522                    new X64Word.init(0x9b05688c, 0x2b3e6c1f),
 13523                    new X64Word.init(0x1f83d9ab, 0xfb41bd6b),
 13524                    new X64Word.init(0x5be0cd19, 0x137e2179),
 13525                  ]);
 13526                },
 13527  
 13528                _doProcessBlock: function (M, offset) {
 13529                  // Shortcuts
 13530                  var H = this._hash.words;
 13531  
 13532                  var H0 = H[0];
 13533                  var H1 = H[1];
 13534                  var H2 = H[2];
 13535                  var H3 = H[3];
 13536                  var H4 = H[4];
 13537                  var H5 = H[5];
 13538                  var H6 = H[6];
 13539                  var H7 = H[7];
 13540  
 13541                  var H0h = H0.high;
 13542                  var H0l = H0.low;
 13543                  var H1h = H1.high;
 13544                  var H1l = H1.low;
 13545                  var H2h = H2.high;
 13546                  var H2l = H2.low;
 13547                  var H3h = H3.high;
 13548                  var H3l = H3.low;
 13549                  var H4h = H4.high;
 13550                  var H4l = H4.low;
 13551                  var H5h = H5.high;
 13552                  var H5l = H5.low;
 13553                  var H6h = H6.high;
 13554                  var H6l = H6.low;
 13555                  var H7h = H7.high;
 13556                  var H7l = H7.low;
 13557  
 13558                  // Working variables
 13559                  var ah = H0h;
 13560                  var al = H0l;
 13561                  var bh = H1h;
 13562                  var bl = H1l;
 13563                  var ch = H2h;
 13564                  var cl = H2l;
 13565                  var dh = H3h;
 13566                  var dl = H3l;
 13567                  var eh = H4h;
 13568                  var el = H4l;
 13569                  var fh = H5h;
 13570                  var fl = H5l;
 13571                  var gh = H6h;
 13572                  var gl = H6l;
 13573                  var hh = H7h;
 13574                  var hl = H7l;
 13575  
 13576                  // Rounds
 13577                  for (var i = 0; i < 80; i++) {
 13578                    // Shortcut
 13579                    var Wi = W[i];
 13580  
 13581                    // Extend message
 13582                    if (i < 16) {
 13583                      var Wih = (Wi.high = M[offset + i * 2] | 0);
 13584                      var Wil = (Wi.low = M[offset + i * 2 + 1] | 0);
 13585                    } else {
 13586                      // Gamma0
 13587                      var gamma0x = W[i - 15];
 13588                      var gamma0xh = gamma0x.high;
 13589                      var gamma0xl = gamma0x.low;
 13590                      var gamma0h =
 13591                        ((gamma0xh >>> 1) | (gamma0xl << 31)) ^
 13592                        ((gamma0xh >>> 8) | (gamma0xl << 24)) ^
 13593                        (gamma0xh >>> 7);
 13594                      var gamma0l =
 13595                        ((gamma0xl >>> 1) | (gamma0xh << 31)) ^
 13596                        ((gamma0xl >>> 8) | (gamma0xh << 24)) ^
 13597                        ((gamma0xl >>> 7) | (gamma0xh << 25));
 13598  
 13599                      // Gamma1
 13600                      var gamma1x = W[i - 2];
 13601                      var gamma1xh = gamma1x.high;
 13602                      var gamma1xl = gamma1x.low;
 13603                      var gamma1h =
 13604                        ((gamma1xh >>> 19) | (gamma1xl << 13)) ^
 13605                        ((gamma1xh << 3) | (gamma1xl >>> 29)) ^
 13606                        (gamma1xh >>> 6);
 13607                      var gamma1l =
 13608                        ((gamma1xl >>> 19) | (gamma1xh << 13)) ^
 13609                        ((gamma1xl << 3) | (gamma1xh >>> 29)) ^
 13610                        ((gamma1xl >>> 6) | (gamma1xh << 26));
 13611  
 13612                      // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
 13613                      var Wi7 = W[i - 7];
 13614                      var Wi7h = Wi7.high;
 13615                      var Wi7l = Wi7.low;
 13616  
 13617                      var Wi16 = W[i - 16];
 13618                      var Wi16h = Wi16.high;
 13619                      var Wi16l = Wi16.low;
 13620  
 13621                      var Wil = gamma0l + Wi7l;
 13622                      var Wih =
 13623                        gamma0h + Wi7h + (Wil >>> 0 < gamma0l >>> 0 ? 1 : 0);
 13624                      var Wil = Wil + gamma1l;
 13625                      var Wih =
 13626                        Wih + gamma1h + (Wil >>> 0 < gamma1l >>> 0 ? 1 : 0);
 13627                      var Wil = Wil + Wi16l;
 13628                      var Wih = Wih + Wi16h + (Wil >>> 0 < Wi16l >>> 0 ? 1 : 0);
 13629  
 13630                      Wi.high = Wih;
 13631                      Wi.low = Wil;
 13632                    }
 13633  
 13634                    var chh = (eh & fh) ^ (~eh & gh);
 13635                    var chl = (el & fl) ^ (~el & gl);
 13636                    var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch);
 13637                    var majl = (al & bl) ^ (al & cl) ^ (bl & cl);
 13638  
 13639                    var sigma0h =
 13640                      ((ah >>> 28) | (al << 4)) ^
 13641                      ((ah << 30) | (al >>> 2)) ^
 13642                      ((ah << 25) | (al >>> 7));
 13643                    var sigma0l =
 13644                      ((al >>> 28) | (ah << 4)) ^
 13645                      ((al << 30) | (ah >>> 2)) ^
 13646                      ((al << 25) | (ah >>> 7));
 13647                    var sigma1h =
 13648                      ((eh >>> 14) | (el << 18)) ^
 13649                      ((eh >>> 18) | (el << 14)) ^
 13650                      ((eh << 23) | (el >>> 9));
 13651                    var sigma1l =
 13652                      ((el >>> 14) | (eh << 18)) ^
 13653                      ((el >>> 18) | (eh << 14)) ^
 13654                      ((el << 23) | (eh >>> 9));
 13655  
 13656                    // t1 = h + sigma1 + ch + K[i] + W[i]
 13657                    var Ki = K[i];
 13658                    var Kih = Ki.high;
 13659                    var Kil = Ki.low;
 13660  
 13661                    var t1l = hl + sigma1l;
 13662                    var t1h = hh + sigma1h + (t1l >>> 0 < hl >>> 0 ? 1 : 0);
 13663                    var t1l = t1l + chl;
 13664                    var t1h = t1h + chh + (t1l >>> 0 < chl >>> 0 ? 1 : 0);
 13665                    var t1l = t1l + Kil;
 13666                    var t1h = t1h + Kih + (t1l >>> 0 < Kil >>> 0 ? 1 : 0);
 13667                    var t1l = t1l + Wil;
 13668                    var t1h = t1h + Wih + (t1l >>> 0 < Wil >>> 0 ? 1 : 0);
 13669  
 13670                    // t2 = sigma0 + maj
 13671                    var t2l = sigma0l + majl;
 13672                    var t2h =
 13673                      sigma0h + majh + (t2l >>> 0 < sigma0l >>> 0 ? 1 : 0);
 13674  
 13675                    // Update working variables
 13676                    hh = gh;
 13677                    hl = gl;
 13678                    gh = fh;
 13679                    gl = fl;
 13680                    fh = eh;
 13681                    fl = el;
 13682                    el = (dl + t1l) | 0;
 13683                    eh = (dh + t1h + (el >>> 0 < dl >>> 0 ? 1 : 0)) | 0;
 13684                    dh = ch;
 13685                    dl = cl;
 13686                    ch = bh;
 13687                    cl = bl;
 13688                    bh = ah;
 13689                    bl = al;
 13690                    al = (t1l + t2l) | 0;
 13691                    ah = (t1h + t2h + (al >>> 0 < t1l >>> 0 ? 1 : 0)) | 0;
 13692                  }
 13693  
 13694                  // Intermediate hash value
 13695                  H0l = H0.low = H0l + al;
 13696                  H0.high = H0h + ah + (H0l >>> 0 < al >>> 0 ? 1 : 0);
 13697                  H1l = H1.low = H1l + bl;
 13698                  H1.high = H1h + bh + (H1l >>> 0 < bl >>> 0 ? 1 : 0);
 13699                  H2l = H2.low = H2l + cl;
 13700                  H2.high = H2h + ch + (H2l >>> 0 < cl >>> 0 ? 1 : 0);
 13701                  H3l = H3.low = H3l + dl;
 13702                  H3.high = H3h + dh + (H3l >>> 0 < dl >>> 0 ? 1 : 0);
 13703                  H4l = H4.low = H4l + el;
 13704                  H4.high = H4h + eh + (H4l >>> 0 < el >>> 0 ? 1 : 0);
 13705                  H5l = H5.low = H5l + fl;
 13706                  H5.high = H5h + fh + (H5l >>> 0 < fl >>> 0 ? 1 : 0);
 13707                  H6l = H6.low = H6l + gl;
 13708                  H6.high = H6h + gh + (H6l >>> 0 < gl >>> 0 ? 1 : 0);
 13709                  H7l = H7.low = H7l + hl;
 13710                  H7.high = H7h + hh + (H7l >>> 0 < hl >>> 0 ? 1 : 0);
 13711                },
 13712  
 13713                _doFinalize: function () {
 13714                  // Shortcuts
 13715                  var data = this._data;
 13716                  var dataWords = data.words;
 13717  
 13718                  var nBitsTotal = this._nDataBytes * 8;
 13719                  var nBitsLeft = data.sigBytes * 8;
 13720  
 13721                  // Add padding
 13722                  dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - (nBitsLeft % 32));
 13723                  dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(
 13724                    nBitsTotal / 0x100000000
 13725                  );
 13726                  dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal;
 13727                  data.sigBytes = dataWords.length * 4;
 13728  
 13729                  // Hash final blocks
 13730                  this._process();
 13731  
 13732                  // Convert hash to 32-bit word array before returning
 13733                  var hash = this._hash.toX32();
 13734  
 13735                  // Return final computed hash
 13736                  return hash;
 13737                },
 13738  
 13739                clone: function () {
 13740                  var clone = Hasher.clone.call(this);
 13741                  clone._hash = this._hash.clone();
 13742  
 13743                  return clone;
 13744                },
 13745  
 13746                blockSize: 1024 / 32,
 13747              }));
 13748  
 13749              /**
 13750               * Shortcut function to the hasher's object interface.
 13751               *
 13752               * @param {WordArray|string} message The message to hash.
 13753               *
 13754               * @return {WordArray} The hash.
 13755               *
 13756               * @static
 13757               *
 13758               * @example
 13759               *
 13760               *     var hash = CryptoJS.SHA512('message');
 13761               *     var hash = CryptoJS.SHA512(wordArray);
 13762               */
 13763              C.SHA512 = Hasher._createHelper(SHA512);
 13764  
 13765              /**
 13766               * Shortcut function to the HMAC's object interface.
 13767               *
 13768               * @param {WordArray|string} message The message to hash.
 13769               * @param {WordArray|string} key The secret key.
 13770               *
 13771               * @return {WordArray} The HMAC.
 13772               *
 13773               * @static
 13774               *
 13775               * @example
 13776               *
 13777               *     var hmac = CryptoJS.HmacSHA512(message, key);
 13778               */
 13779              C.HmacSHA512 = Hasher._createHmacHelper(SHA512);
 13780            })();
 13781  
 13782            return CryptoJS.SHA512;
 13783          });
 13784        },
 13785        { "./core": 53, "./x64-core": 84 },
 13786      ],
 13787      83: [
 13788        function (require, module, exports) {
 13789          (function (root, factory, undef) {
 13790            if (typeof exports === "object") {
 13791              // CommonJS
 13792              module.exports = exports = factory(
 13793                require("./core"),
 13794                require("./enc-base64"),
 13795                require("./md5"),
 13796                require("./evpkdf"),
 13797                require("./cipher-core")
 13798              );
 13799            } else if (typeof define === "function" && define.amd) {
 13800              // AMD
 13801              define([
 13802                "./core",
 13803                "./enc-base64",
 13804                "./md5",
 13805                "./evpkdf",
 13806                "./cipher-core",
 13807              ], factory);
 13808            } else {
 13809              // Global (browser)
 13810              factory(root.CryptoJS);
 13811            }
 13812          })(this, function (CryptoJS) {
 13813            (function () {
 13814              // Shortcuts
 13815              var C = CryptoJS;
 13816              var C_lib = C.lib;
 13817              var WordArray = C_lib.WordArray;
 13818              var BlockCipher = C_lib.BlockCipher;
 13819              var C_algo = C.algo;
 13820  
 13821              // Permuted Choice 1 constants
 13822              var PC1 = [
 13823                57,
 13824                49,
 13825                41,
 13826                33,
 13827                25,
 13828                17,
 13829                9,
 13830                1,
 13831                58,
 13832                50,
 13833                42,
 13834                34,
 13835                26,
 13836                18,
 13837                10,
 13838                2,
 13839                59,
 13840                51,
 13841                43,
 13842                35,
 13843                27,
 13844                19,
 13845                11,
 13846                3,
 13847                60,
 13848                52,
 13849                44,
 13850                36,
 13851                63,
 13852                55,
 13853                47,
 13854                39,
 13855                31,
 13856                23,
 13857                15,
 13858                7,
 13859                62,
 13860                54,
 13861                46,
 13862                38,
 13863                30,
 13864                22,
 13865                14,
 13866                6,
 13867                61,
 13868                53,
 13869                45,
 13870                37,
 13871                29,
 13872                21,
 13873                13,
 13874                5,
 13875                28,
 13876                20,
 13877                12,
 13878                4,
 13879              ];
 13880  
 13881              // Permuted Choice 2 constants
 13882              var PC2 = [
 13883                14,
 13884                17,
 13885                11,
 13886                24,
 13887                1,
 13888                5,
 13889                3,
 13890                28,
 13891                15,
 13892                6,
 13893                21,
 13894                10,
 13895                23,
 13896                19,
 13897                12,
 13898                4,
 13899                26,
 13900                8,
 13901                16,
 13902                7,
 13903                27,
 13904                20,
 13905                13,
 13906                2,
 13907                41,
 13908                52,
 13909                31,
 13910                37,
 13911                47,
 13912                55,
 13913                30,
 13914                40,
 13915                51,
 13916                45,
 13917                33,
 13918                48,
 13919                44,
 13920                49,
 13921                39,
 13922                56,
 13923                34,
 13924                53,
 13925                46,
 13926                42,
 13927                50,
 13928                36,
 13929                29,
 13930                32,
 13931              ];
 13932  
 13933              // Cumulative bit shift constants
 13934              var BIT_SHIFTS = [
 13935                1,
 13936                2,
 13937                4,
 13938                6,
 13939                8,
 13940                10,
 13941                12,
 13942                14,
 13943                15,
 13944                17,
 13945                19,
 13946                21,
 13947                23,
 13948                25,
 13949                27,
 13950                28,
 13951              ];
 13952  
 13953              // SBOXes and round permutation constants
 13954              var SBOX_P = [
 13955                {
 13956                  0x0: 0x808200,
 13957                  0x10000000: 0x8000,
 13958                  0x20000000: 0x808002,
 13959                  0x30000000: 0x2,
 13960                  0x40000000: 0x200,
 13961                  0x50000000: 0x808202,
 13962                  0x60000000: 0x800202,
 13963                  0x70000000: 0x800000,
 13964                  0x80000000: 0x202,
 13965                  0x90000000: 0x800200,
 13966                  0xa0000000: 0x8200,
 13967                  0xb0000000: 0x808000,
 13968                  0xc0000000: 0x8002,
 13969                  0xd0000000: 0x800002,
 13970                  0xe0000000: 0x0,
 13971                  0xf0000000: 0x8202,
 13972                  0x8000000: 0x0,
 13973                  0x18000000: 0x808202,
 13974                  0x28000000: 0x8202,
 13975                  0x38000000: 0x8000,
 13976                  0x48000000: 0x808200,
 13977                  0x58000000: 0x200,
 13978                  0x68000000: 0x808002,
 13979                  0x78000000: 0x2,
 13980                  0x88000000: 0x800200,
 13981                  0x98000000: 0x8200,
 13982                  0xa8000000: 0x808000,
 13983                  0xb8000000: 0x800202,
 13984                  0xc8000000: 0x800002,
 13985                  0xd8000000: 0x8002,
 13986                  0xe8000000: 0x202,
 13987                  0xf8000000: 0x800000,
 13988                  0x1: 0x8000,
 13989                  0x10000001: 0x2,
 13990                  0x20000001: 0x808200,
 13991                  0x30000001: 0x800000,
 13992                  0x40000001: 0x808002,
 13993                  0x50000001: 0x8200,
 13994                  0x60000001: 0x200,
 13995                  0x70000001: 0x800202,
 13996                  0x80000001: 0x808202,
 13997                  0x90000001: 0x808000,
 13998                  0xa0000001: 0x800002,
 13999                  0xb0000001: 0x8202,
 14000                  0xc0000001: 0x202,
 14001                  0xd0000001: 0x800200,
 14002                  0xe0000001: 0x8002,
 14003                  0xf0000001: 0x0,
 14004                  0x8000001: 0x808202,
 14005                  0x18000001: 0x808000,
 14006                  0x28000001: 0x800000,
 14007                  0x38000001: 0x200,
 14008                  0x48000001: 0x8000,
 14009                  0x58000001: 0x800002,
 14010                  0x68000001: 0x2,
 14011                  0x78000001: 0x8202,
 14012                  0x88000001: 0x8002,
 14013                  0x98000001: 0x800202,
 14014                  0xa8000001: 0x202,
 14015                  0xb8000001: 0x808200,
 14016                  0xc8000001: 0x800200,
 14017                  0xd8000001: 0x0,
 14018                  0xe8000001: 0x8200,
 14019                  0xf8000001: 0x808002,
 14020                },
 14021                {
 14022                  0x0: 0x40084010,
 14023                  0x1000000: 0x4000,
 14024                  0x2000000: 0x80000,
 14025                  0x3000000: 0x40080010,
 14026                  0x4000000: 0x40000010,
 14027                  0x5000000: 0x40084000,
 14028                  0x6000000: 0x40004000,
 14029                  0x7000000: 0x10,
 14030                  0x8000000: 0x84000,
 14031                  0x9000000: 0x40004010,
 14032                  0xa000000: 0x40000000,
 14033                  0xb000000: 0x84010,
 14034                  0xc000000: 0x80010,
 14035                  0xd000000: 0x0,
 14036                  0xe000000: 0x4010,
 14037                  0xf000000: 0x40080000,
 14038                  0x800000: 0x40004000,
 14039                  0x1800000: 0x84010,
 14040                  0x2800000: 0x10,
 14041                  0x3800000: 0x40004010,
 14042                  0x4800000: 0x40084010,
 14043                  0x5800000: 0x40000000,
 14044                  0x6800000: 0x80000,
 14045                  0x7800000: 0x40080010,
 14046                  0x8800000: 0x80010,
 14047                  0x9800000: 0x0,
 14048                  0xa800000: 0x4000,
 14049                  0xb800000: 0x40080000,
 14050                  0xc800000: 0x40000010,
 14051                  0xd800000: 0x84000,
 14052                  0xe800000: 0x40084000,
 14053                  0xf800000: 0x4010,
 14054                  0x10000000: 0x0,
 14055                  0x11000000: 0x40080010,
 14056                  0x12000000: 0x40004010,
 14057                  0x13000000: 0x40084000,
 14058                  0x14000000: 0x40080000,
 14059                  0x15000000: 0x10,
 14060                  0x16000000: 0x84010,
 14061                  0x17000000: 0x4000,
 14062                  0x18000000: 0x4010,
 14063                  0x19000000: 0x80000,
 14064                  0x1a000000: 0x80010,
 14065                  0x1b000000: 0x40000010,
 14066                  0x1c000000: 0x84000,
 14067                  0x1d000000: 0x40004000,
 14068                  0x1e000000: 0x40000000,
 14069                  0x1f000000: 0x40084010,
 14070                  0x10800000: 0x84010,
 14071                  0x11800000: 0x80000,
 14072                  0x12800000: 0x40080000,
 14073                  0x13800000: 0x4000,
 14074                  0x14800000: 0x40004000,
 14075                  0x15800000: 0x40084010,
 14076                  0x16800000: 0x10,
 14077                  0x17800000: 0x40000000,
 14078                  0x18800000: 0x40084000,
 14079                  0x19800000: 0x40000010,
 14080                  0x1a800000: 0x40004010,
 14081                  0x1b800000: 0x80010,
 14082                  0x1c800000: 0x0,
 14083                  0x1d800000: 0x4010,
 14084                  0x1e800000: 0x40080010,
 14085                  0x1f800000: 0x84000,
 14086                },
 14087                {
 14088                  0x0: 0x104,
 14089                  0x100000: 0x0,
 14090                  0x200000: 0x4000100,
 14091                  0x300000: 0x10104,
 14092                  0x400000: 0x10004,
 14093                  0x500000: 0x4000004,
 14094                  0x600000: 0x4010104,
 14095                  0x700000: 0x4010000,
 14096                  0x800000: 0x4000000,
 14097                  0x900000: 0x4010100,
 14098                  0xa00000: 0x10100,
 14099                  0xb00000: 0x4010004,
 14100                  0xc00000: 0x4000104,
 14101                  0xd00000: 0x10000,
 14102                  0xe00000: 0x4,
 14103                  0xf00000: 0x100,
 14104                  0x80000: 0x4010100,
 14105                  0x180000: 0x4010004,
 14106                  0x280000: 0x0,
 14107                  0x380000: 0x4000100,
 14108                  0x480000: 0x4000004,
 14109                  0x580000: 0x10000,
 14110                  0x680000: 0x10004,
 14111                  0x780000: 0x104,
 14112                  0x880000: 0x4,
 14113                  0x980000: 0x100,
 14114                  0xa80000: 0x4010000,
 14115                  0xb80000: 0x10104,
 14116                  0xc80000: 0x10100,
 14117                  0xd80000: 0x4000104,
 14118                  0xe80000: 0x4010104,
 14119                  0xf80000: 0x4000000,
 14120                  0x1000000: 0x4010100,
 14121                  0x1100000: 0x10004,
 14122                  0x1200000: 0x10000,
 14123                  0x1300000: 0x4000100,
 14124                  0x1400000: 0x100,
 14125                  0x1500000: 0x4010104,
 14126                  0x1600000: 0x4000004,
 14127                  0x1700000: 0x0,
 14128                  0x1800000: 0x4000104,
 14129                  0x1900000: 0x4000000,
 14130                  0x1a00000: 0x4,
 14131                  0x1b00000: 0x10100,
 14132                  0x1c00000: 0x4010000,
 14133                  0x1d00000: 0x104,
 14134                  0x1e00000: 0x10104,
 14135                  0x1f00000: 0x4010004,
 14136                  0x1080000: 0x4000000,
 14137                  0x1180000: 0x104,
 14138                  0x1280000: 0x4010100,
 14139                  0x1380000: 0x0,
 14140                  0x1480000: 0x10004,
 14141                  0x1580000: 0x4000100,
 14142                  0x1680000: 0x100,
 14143                  0x1780000: 0x4010004,
 14144                  0x1880000: 0x10000,
 14145                  0x1980000: 0x4010104,
 14146                  0x1a80000: 0x10104,
 14147                  0x1b80000: 0x4000004,
 14148                  0x1c80000: 0x4000104,
 14149                  0x1d80000: 0x4010000,
 14150                  0x1e80000: 0x4,
 14151                  0x1f80000: 0x10100,
 14152                },
 14153                {
 14154                  0x0: 0x80401000,
 14155                  0x10000: 0x80001040,
 14156                  0x20000: 0x401040,
 14157                  0x30000: 0x80400000,
 14158                  0x40000: 0x0,
 14159                  0x50000: 0x401000,
 14160                  0x60000: 0x80000040,
 14161                  0x70000: 0x400040,
 14162                  0x80000: 0x80000000,
 14163                  0x90000: 0x400000,
 14164                  0xa0000: 0x40,
 14165                  0xb0000: 0x80001000,
 14166                  0xc0000: 0x80400040,
 14167                  0xd0000: 0x1040,
 14168                  0xe0000: 0x1000,
 14169                  0xf0000: 0x80401040,
 14170                  0x8000: 0x80001040,
 14171                  0x18000: 0x40,
 14172                  0x28000: 0x80400040,
 14173                  0x38000: 0x80001000,
 14174                  0x48000: 0x401000,
 14175                  0x58000: 0x80401040,
 14176                  0x68000: 0x0,
 14177                  0x78000: 0x80400000,
 14178                  0x88000: 0x1000,
 14179                  0x98000: 0x80401000,
 14180                  0xa8000: 0x400000,
 14181                  0xb8000: 0x1040,
 14182                  0xc8000: 0x80000000,
 14183                  0xd8000: 0x400040,
 14184                  0xe8000: 0x401040,
 14185                  0xf8000: 0x80000040,
 14186                  0x100000: 0x400040,
 14187                  0x110000: 0x401000,
 14188                  0x120000: 0x80000040,
 14189                  0x130000: 0x0,
 14190                  0x140000: 0x1040,
 14191                  0x150000: 0x80400040,
 14192                  0x160000: 0x80401000,
 14193                  0x170000: 0x80001040,
 14194                  0x180000: 0x80401040,
 14195                  0x190000: 0x80000000,
 14196                  0x1a0000: 0x80400000,
 14197                  0x1b0000: 0x401040,
 14198                  0x1c0000: 0x80001000,
 14199                  0x1d0000: 0x400000,
 14200                  0x1e0000: 0x40,
 14201                  0x1f0000: 0x1000,
 14202                  0x108000: 0x80400000,
 14203                  0x118000: 0x80401040,
 14204                  0x128000: 0x0,
 14205                  0x138000: 0x401000,
 14206                  0x148000: 0x400040,
 14207                  0x158000: 0x80000000,
 14208                  0x168000: 0x80001040,
 14209                  0x178000: 0x40,
 14210                  0x188000: 0x80000040,
 14211                  0x198000: 0x1000,
 14212                  0x1a8000: 0x80001000,
 14213                  0x1b8000: 0x80400040,
 14214                  0x1c8000: 0x1040,
 14215                  0x1d8000: 0x80401000,
 14216                  0x1e8000: 0x400000,
 14217                  0x1f8000: 0x401040,
 14218                },
 14219                {
 14220                  0x0: 0x80,
 14221                  0x1000: 0x1040000,
 14222                  0x2000: 0x40000,
 14223                  0x3000: 0x20000000,
 14224                  0x4000: 0x20040080,
 14225                  0x5000: 0x1000080,
 14226                  0x6000: 0x21000080,
 14227                  0x7000: 0x40080,
 14228                  0x8000: 0x1000000,
 14229                  0x9000: 0x20040000,
 14230                  0xa000: 0x20000080,
 14231                  0xb000: 0x21040080,
 14232                  0xc000: 0x21040000,
 14233                  0xd000: 0x0,
 14234                  0xe000: 0x1040080,
 14235                  0xf000: 0x21000000,
 14236                  0x800: 0x1040080,
 14237                  0x1800: 0x21000080,
 14238                  0x2800: 0x80,
 14239                  0x3800: 0x1040000,
 14240                  0x4800: 0x40000,
 14241                  0x5800: 0x20040080,
 14242                  0x6800: 0x21040000,
 14243                  0x7800: 0x20000000,
 14244                  0x8800: 0x20040000,
 14245                  0x9800: 0x0,
 14246                  0xa800: 0x21040080,
 14247                  0xb800: 0x1000080,
 14248                  0xc800: 0x20000080,
 14249                  0xd800: 0x21000000,
 14250                  0xe800: 0x1000000,
 14251                  0xf800: 0x40080,
 14252                  0x10000: 0x40000,
 14253                  0x11000: 0x80,
 14254                  0x12000: 0x20000000,
 14255                  0x13000: 0x21000080,
 14256                  0x14000: 0x1000080,
 14257                  0x15000: 0x21040000,
 14258                  0x16000: 0x20040080,
 14259                  0x17000: 0x1000000,
 14260                  0x18000: 0x21040080,
 14261                  0x19000: 0x21000000,
 14262                  0x1a000: 0x1040000,
 14263                  0x1b000: 0x20040000,
 14264                  0x1c000: 0x40080,
 14265                  0x1d000: 0x20000080,
 14266                  0x1e000: 0x0,
 14267                  0x1f000: 0x1040080,
 14268                  0x10800: 0x21000080,
 14269                  0x11800: 0x1000000,
 14270                  0x12800: 0x1040000,
 14271                  0x13800: 0x20040080,
 14272                  0x14800: 0x20000000,
 14273                  0x15800: 0x1040080,
 14274                  0x16800: 0x80,
 14275                  0x17800: 0x21040000,
 14276                  0x18800: 0x40080,
 14277                  0x19800: 0x21040080,
 14278                  0x1a800: 0x0,
 14279                  0x1b800: 0x21000000,
 14280                  0x1c800: 0x1000080,
 14281                  0x1d800: 0x40000,
 14282                  0x1e800: 0x20040000,
 14283                  0x1f800: 0x20000080,
 14284                },
 14285                {
 14286                  0x0: 0x10000008,
 14287                  0x100: 0x2000,
 14288                  0x200: 0x10200000,
 14289                  0x300: 0x10202008,
 14290                  0x400: 0x10002000,
 14291                  0x500: 0x200000,
 14292                  0x600: 0x200008,
 14293                  0x700: 0x10000000,
 14294                  0x800: 0x0,
 14295                  0x900: 0x10002008,
 14296                  0xa00: 0x202000,
 14297                  0xb00: 0x8,
 14298                  0xc00: 0x10200008,
 14299                  0xd00: 0x202008,
 14300                  0xe00: 0x2008,
 14301                  0xf00: 0x10202000,
 14302                  0x80: 0x10200000,
 14303                  0x180: 0x10202008,
 14304                  0x280: 0x8,
 14305                  0x380: 0x200000,
 14306                  0x480: 0x202008,
 14307                  0x580: 0x10000008,
 14308                  0x680: 0x10002000,
 14309                  0x780: 0x2008,
 14310                  0x880: 0x200008,
 14311                  0x980: 0x2000,
 14312                  0xa80: 0x10002008,
 14313                  0xb80: 0x10200008,
 14314                  0xc80: 0x0,
 14315                  0xd80: 0x10202000,
 14316                  0xe80: 0x202000,
 14317                  0xf80: 0x10000000,
 14318                  0x1000: 0x10002000,
 14319                  0x1100: 0x10200008,
 14320                  0x1200: 0x10202008,
 14321                  0x1300: 0x2008,
 14322                  0x1400: 0x200000,
 14323                  0x1500: 0x10000000,
 14324                  0x1600: 0x10000008,
 14325                  0x1700: 0x202000,
 14326                  0x1800: 0x202008,
 14327                  0x1900: 0x0,
 14328                  0x1a00: 0x8,
 14329                  0x1b00: 0x10200000,
 14330                  0x1c00: 0x2000,
 14331                  0x1d00: 0x10002008,
 14332                  0x1e00: 0x10202000,
 14333                  0x1f00: 0x200008,
 14334                  0x1080: 0x8,
 14335                  0x1180: 0x202000,
 14336                  0x1280: 0x200000,
 14337                  0x1380: 0x10000008,
 14338                  0x1480: 0x10002000,
 14339                  0x1580: 0x2008,
 14340                  0x1680: 0x10202008,
 14341                  0x1780: 0x10200000,
 14342                  0x1880: 0x10202000,
 14343                  0x1980: 0x10200008,
 14344                  0x1a80: 0x2000,
 14345                  0x1b80: 0x202008,
 14346                  0x1c80: 0x200008,
 14347                  0x1d80: 0x0,
 14348                  0x1e80: 0x10000000,
 14349                  0x1f80: 0x10002008,
 14350                },
 14351                {
 14352                  0x0: 0x100000,
 14353                  0x10: 0x2000401,
 14354                  0x20: 0x400,
 14355                  0x30: 0x100401,
 14356                  0x40: 0x2100401,
 14357                  0x50: 0x0,
 14358                  0x60: 0x1,
 14359                  0x70: 0x2100001,
 14360                  0x80: 0x2000400,
 14361                  0x90: 0x100001,
 14362                  0xa0: 0x2000001,
 14363                  0xb0: 0x2100400,
 14364                  0xc0: 0x2100000,
 14365                  0xd0: 0x401,
 14366                  0xe0: 0x100400,
 14367                  0xf0: 0x2000000,
 14368                  0x8: 0x2100001,
 14369                  0x18: 0x0,
 14370                  0x28: 0x2000401,
 14371                  0x38: 0x2100400,
 14372                  0x48: 0x100000,
 14373                  0x58: 0x2000001,
 14374                  0x68: 0x2000000,
 14375                  0x78: 0x401,
 14376                  0x88: 0x100401,
 14377                  0x98: 0x2000400,
 14378                  0xa8: 0x2100000,
 14379                  0xb8: 0x100001,
 14380                  0xc8: 0x400,
 14381                  0xd8: 0x2100401,
 14382                  0xe8: 0x1,
 14383                  0xf8: 0x100400,
 14384                  0x100: 0x2000000,
 14385                  0x110: 0x100000,
 14386                  0x120: 0x2000401,
 14387                  0x130: 0x2100001,
 14388                  0x140: 0x100001,
 14389                  0x150: 0x2000400,
 14390                  0x160: 0x2100400,
 14391                  0x170: 0x100401,
 14392                  0x180: 0x401,
 14393                  0x190: 0x2100401,
 14394                  0x1a0: 0x100400,
 14395                  0x1b0: 0x1,
 14396                  0x1c0: 0x0,
 14397                  0x1d0: 0x2100000,
 14398                  0x1e0: 0x2000001,
 14399                  0x1f0: 0x400,
 14400                  0x108: 0x100400,
 14401                  0x118: 0x2000401,
 14402                  0x128: 0x2100001,
 14403                  0x138: 0x1,
 14404                  0x148: 0x2000000,
 14405                  0x158: 0x100000,
 14406                  0x168: 0x401,
 14407                  0x178: 0x2100400,
 14408                  0x188: 0x2000001,
 14409                  0x198: 0x2100000,
 14410                  0x1a8: 0x0,
 14411                  0x1b8: 0x2100401,
 14412                  0x1c8: 0x100401,
 14413                  0x1d8: 0x400,
 14414                  0x1e8: 0x2000400,
 14415                  0x1f8: 0x100001,
 14416                },
 14417                {
 14418                  0x0: 0x8000820,
 14419                  0x1: 0x20000,
 14420                  0x2: 0x8000000,
 14421                  0x3: 0x20,
 14422                  0x4: 0x20020,
 14423                  0x5: 0x8020820,
 14424                  0x6: 0x8020800,
 14425                  0x7: 0x800,
 14426                  0x8: 0x8020000,
 14427                  0x9: 0x8000800,
 14428                  0xa: 0x20800,
 14429                  0xb: 0x8020020,
 14430                  0xc: 0x820,
 14431                  0xd: 0x0,
 14432                  0xe: 0x8000020,
 14433                  0xf: 0x20820,
 14434                  0x80000000: 0x800,
 14435                  0x80000001: 0x8020820,
 14436                  0x80000002: 0x8000820,
 14437                  0x80000003: 0x8000000,
 14438                  0x80000004: 0x8020000,
 14439                  0x80000005: 0x20800,
 14440                  0x80000006: 0x20820,
 14441                  0x80000007: 0x20,
 14442                  0x80000008: 0x8000020,
 14443                  0x80000009: 0x820,
 14444                  0x8000000a: 0x20020,
 14445                  0x8000000b: 0x8020800,
 14446                  0x8000000c: 0x0,
 14447                  0x8000000d: 0x8020020,
 14448                  0x8000000e: 0x8000800,
 14449                  0x8000000f: 0x20000,
 14450                  0x10: 0x20820,
 14451                  0x11: 0x8020800,
 14452                  0x12: 0x20,
 14453                  0x13: 0x800,
 14454                  0x14: 0x8000800,
 14455                  0x15: 0x8000020,
 14456                  0x16: 0x8020020,
 14457                  0x17: 0x20000,
 14458                  0x18: 0x0,
 14459                  0x19: 0x20020,
 14460                  0x1a: 0x8020000,
 14461                  0x1b: 0x8000820,
 14462                  0x1c: 0x8020820,
 14463                  0x1d: 0x20800,
 14464                  0x1e: 0x820,
 14465                  0x1f: 0x8000000,
 14466                  0x80000010: 0x20000,
 14467                  0x80000011: 0x800,
 14468                  0x80000012: 0x8020020,
 14469                  0x80000013: 0x20820,
 14470                  0x80000014: 0x20,
 14471                  0x80000015: 0x8020000,
 14472                  0x80000016: 0x8000000,
 14473                  0x80000017: 0x8000820,
 14474                  0x80000018: 0x8020820,
 14475                  0x80000019: 0x8000020,
 14476                  0x8000001a: 0x8000800,
 14477                  0x8000001b: 0x0,
 14478                  0x8000001c: 0x20800,
 14479                  0x8000001d: 0x820,
 14480                  0x8000001e: 0x20020,
 14481                  0x8000001f: 0x8020800,
 14482                },
 14483              ];
 14484  
 14485              // Masks that select the SBOX input
 14486              var SBOX_MASK = [
 14487                0xf8000001,
 14488                0x1f800000,
 14489                0x01f80000,
 14490                0x001f8000,
 14491                0x0001f800,
 14492                0x00001f80,
 14493                0x000001f8,
 14494                0x8000001f,
 14495              ];
 14496  
 14497              /**
 14498               * DES block cipher algorithm.
 14499               */
 14500              var DES = (C_algo.DES = BlockCipher.extend({
 14501                _doReset: function () {
 14502                  // Shortcuts
 14503                  var key = this._key;
 14504                  var keyWords = key.words;
 14505  
 14506                  // Select 56 bits according to PC1
 14507                  var keyBits = [];
 14508                  for (var i = 0; i < 56; i++) {
 14509                    var keyBitPos = PC1[i] - 1;
 14510                    keyBits[i] =
 14511                      (keyWords[keyBitPos >>> 5] >>> (31 - (keyBitPos % 32))) & 1;
 14512                  }
 14513  
 14514                  // Assemble 16 subkeys
 14515                  var subKeys = (this._subKeys = []);
 14516                  for (var nSubKey = 0; nSubKey < 16; nSubKey++) {
 14517                    // Create subkey
 14518                    var subKey = (subKeys[nSubKey] = []);
 14519  
 14520                    // Shortcut
 14521                    var bitShift = BIT_SHIFTS[nSubKey];
 14522  
 14523                    // Select 48 bits according to PC2
 14524                    for (var i = 0; i < 24; i++) {
 14525                      // Select from the left 28 key bits
 14526                      subKey[(i / 6) | 0] |=
 14527                        keyBits[(PC2[i] - 1 + bitShift) % 28] << (31 - (i % 6));
 14528  
 14529                      // Select from the right 28 key bits
 14530                      subKey[4 + ((i / 6) | 0)] |=
 14531                        keyBits[28 + ((PC2[i + 24] - 1 + bitShift) % 28)] <<
 14532                        (31 - (i % 6));
 14533                    }
 14534  
 14535                    // Since each subkey is applied to an expanded 32-bit input,
 14536                    // the subkey can be broken into 8 values scaled to 32-bits,
 14537                    // which allows the key to be used without expansion
 14538                    subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31);
 14539                    for (var i = 1; i < 7; i++) {
 14540                      subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3);
 14541                    }
 14542                    subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27);
 14543                  }
 14544  
 14545                  // Compute inverse subkeys
 14546                  var invSubKeys = (this._invSubKeys = []);
 14547                  for (var i = 0; i < 16; i++) {
 14548                    invSubKeys[i] = subKeys[15 - i];
 14549                  }
 14550                },
 14551  
 14552                encryptBlock: function (M, offset) {
 14553                  this._doCryptBlock(M, offset, this._subKeys);
 14554                },
 14555  
 14556                decryptBlock: function (M, offset) {
 14557                  this._doCryptBlock(M, offset, this._invSubKeys);
 14558                },
 14559  
 14560                _doCryptBlock: function (M, offset, subKeys) {
 14561                  // Get input
 14562                  this._lBlock = M[offset];
 14563                  this._rBlock = M[offset + 1];
 14564  
 14565                  // Initial permutation
 14566                  exchangeLR.call(this, 4, 0x0f0f0f0f);
 14567                  exchangeLR.call(this, 16, 0x0000ffff);
 14568                  exchangeRL.call(this, 2, 0x33333333);
 14569                  exchangeRL.call(this, 8, 0x00ff00ff);
 14570                  exchangeLR.call(this, 1, 0x55555555);
 14571  
 14572                  // Rounds
 14573                  for (var round = 0; round < 16; round++) {
 14574                    // Shortcuts
 14575                    var subKey = subKeys[round];
 14576                    var lBlock = this._lBlock;
 14577                    var rBlock = this._rBlock;
 14578  
 14579                    // Feistel function
 14580                    var f = 0;
 14581                    for (var i = 0; i < 8; i++) {
 14582                      f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0];
 14583                    }
 14584                    this._lBlock = rBlock;
 14585                    this._rBlock = lBlock ^ f;
 14586                  }
 14587  
 14588                  // Undo swap from last round
 14589                  var t = this._lBlock;
 14590                  this._lBlock = this._rBlock;
 14591                  this._rBlock = t;
 14592  
 14593                  // Final permutation
 14594                  exchangeLR.call(this, 1, 0x55555555);
 14595                  exchangeRL.call(this, 8, 0x00ff00ff);
 14596                  exchangeRL.call(this, 2, 0x33333333);
 14597                  exchangeLR.call(this, 16, 0x0000ffff);
 14598                  exchangeLR.call(this, 4, 0x0f0f0f0f);
 14599  
 14600                  // Set output
 14601                  M[offset] = this._lBlock;
 14602                  M[offset + 1] = this._rBlock;
 14603                },
 14604  
 14605                keySize: 64 / 32,
 14606  
 14607                ivSize: 64 / 32,
 14608  
 14609                blockSize: 64 / 32,
 14610              }));
 14611  
 14612              // Swap bits across the left and right words
 14613              function exchangeLR(offset, mask) {
 14614                var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask;
 14615                this._rBlock ^= t;
 14616                this._lBlock ^= t << offset;
 14617              }
 14618  
 14619              function exchangeRL(offset, mask) {
 14620                var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask;
 14621                this._lBlock ^= t;
 14622                this._rBlock ^= t << offset;
 14623              }
 14624  
 14625              /**
 14626               * Shortcut functions to the cipher's object interface.
 14627               *
 14628               * @example
 14629               *
 14630               *     var ciphertext = CryptoJS.DES.encrypt(message, key, cfg);
 14631               *     var plaintext  = CryptoJS.DES.decrypt(ciphertext, key, cfg);
 14632               */
 14633              C.DES = BlockCipher._createHelper(DES);
 14634  
 14635              /**
 14636               * Triple-DES block cipher algorithm.
 14637               */
 14638              var TripleDES = (C_algo.TripleDES = BlockCipher.extend({
 14639                _doReset: function () {
 14640                  // Shortcuts
 14641                  var key = this._key;
 14642                  var keyWords = key.words;
 14643  
 14644                  // Create DES instances
 14645                  this._des1 = DES.createEncryptor(
 14646                    WordArray.create(keyWords.slice(0, 2))
 14647                  );
 14648                  this._des2 = DES.createEncryptor(
 14649                    WordArray.create(keyWords.slice(2, 4))
 14650                  );
 14651                  this._des3 = DES.createEncryptor(
 14652                    WordArray.create(keyWords.slice(4, 6))
 14653                  );
 14654                },
 14655  
 14656                encryptBlock: function (M, offset) {
 14657                  this._des1.encryptBlock(M, offset);
 14658                  this._des2.decryptBlock(M, offset);
 14659                  this._des3.encryptBlock(M, offset);
 14660                },
 14661  
 14662                decryptBlock: function (M, offset) {
 14663                  this._des3.decryptBlock(M, offset);
 14664                  this._des2.encryptBlock(M, offset);
 14665                  this._des1.decryptBlock(M, offset);
 14666                },
 14667  
 14668                keySize: 192 / 32,
 14669  
 14670                ivSize: 64 / 32,
 14671  
 14672                blockSize: 64 / 32,
 14673              }));
 14674  
 14675              /**
 14676               * Shortcut functions to the cipher's object interface.
 14677               *
 14678               * @example
 14679               *
 14680               *     var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg);
 14681               *     var plaintext  = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);
 14682               */
 14683              C.TripleDES = BlockCipher._createHelper(TripleDES);
 14684            })();
 14685  
 14686            return CryptoJS.TripleDES;
 14687          });
 14688        },
 14689        {
 14690          "./cipher-core": 52,
 14691          "./core": 53,
 14692          "./enc-base64": 54,
 14693          "./evpkdf": 56,
 14694          "./md5": 61,
 14695        },
 14696      ],
 14697      84: [
 14698        function (require, module, exports) {
 14699          (function (root, factory) {
 14700            if (typeof exports === "object") {
 14701              // CommonJS
 14702              module.exports = exports = factory(require("./core"));
 14703            } else if (typeof define === "function" && define.amd) {
 14704              // AMD
 14705              define(["./core"], factory);
 14706            } else {
 14707              // Global (browser)
 14708              factory(root.CryptoJS);
 14709            }
 14710          })(this, function (CryptoJS) {
 14711            (function (undefined) {
 14712              // Shortcuts
 14713              var C = CryptoJS;
 14714              var C_lib = C.lib;
 14715              var Base = C_lib.Base;
 14716              var X32WordArray = C_lib.WordArray;
 14717  
 14718              /**
 14719               * x64 namespace.
 14720               */
 14721              var C_x64 = (C.x64 = {});
 14722  
 14723              /**
 14724               * A 64-bit word.
 14725               */
 14726              var X64Word = (C_x64.Word = Base.extend({
 14727                /**
 14728                 * Initializes a newly created 64-bit word.
 14729                 *
 14730                 * @param {number} high The high 32 bits.
 14731                 * @param {number} low The low 32 bits.
 14732                 *
 14733                 * @example
 14734                 *
 14735                 *     var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);
 14736                 */
 14737                init: function (high, low) {
 14738                  this.high = high;
 14739                  this.low = low;
 14740                },
 14741  
 14742                /**
 14743                 * Bitwise NOTs this word.
 14744                 *
 14745                 * @return {X64Word} A new x64-Word object after negating.
 14746                 *
 14747                 * @example
 14748                 *
 14749                 *     var negated = x64Word.not();
 14750                 */
 14751                // not: function () {
 14752                // var high = ~this.high;
 14753                // var low = ~this.low;
 14754  
 14755                // return X64Word.create(high, low);
 14756                // },
 14757  
 14758                /**
 14759                 * Bitwise ANDs this word with the passed word.
 14760                 *
 14761                 * @param {X64Word} word The x64-Word to AND with this word.
 14762                 *
 14763                 * @return {X64Word} A new x64-Word object after ANDing.
 14764                 *
 14765                 * @example
 14766                 *
 14767                 *     var anded = x64Word.and(anotherX64Word);
 14768                 */
 14769                // and: function (word) {
 14770                // var high = this.high & word.high;
 14771                // var low = this.low & word.low;
 14772  
 14773                // return X64Word.create(high, low);
 14774                // },
 14775  
 14776                /**
 14777                 * Bitwise ORs this word with the passed word.
 14778                 *
 14779                 * @param {X64Word} word The x64-Word to OR with this word.
 14780                 *
 14781                 * @return {X64Word} A new x64-Word object after ORing.
 14782                 *
 14783                 * @example
 14784                 *
 14785                 *     var ored = x64Word.or(anotherX64Word);
 14786                 */
 14787                // or: function (word) {
 14788                // var high = this.high | word.high;
 14789                // var low = this.low | word.low;
 14790  
 14791                // return X64Word.create(high, low);
 14792                // },
 14793  
 14794                /**
 14795                 * Bitwise XORs this word with the passed word.
 14796                 *
 14797                 * @param {X64Word} word The x64-Word to XOR with this word.
 14798                 *
 14799                 * @return {X64Word} A new x64-Word object after XORing.
 14800                 *
 14801                 * @example
 14802                 *
 14803                 *     var xored = x64Word.xor(anotherX64Word);
 14804                 */
 14805                // xor: function (word) {
 14806                // var high = this.high ^ word.high;
 14807                // var low = this.low ^ word.low;
 14808  
 14809                // return X64Word.create(high, low);
 14810                // },
 14811  
 14812                /**
 14813                 * Shifts this word n bits to the left.
 14814                 *
 14815                 * @param {number} n The number of bits to shift.
 14816                 *
 14817                 * @return {X64Word} A new x64-Word object after shifting.
 14818                 *
 14819                 * @example
 14820                 *
 14821                 *     var shifted = x64Word.shiftL(25);
 14822                 */
 14823                // shiftL: function (n) {
 14824                // if (n < 32) {
 14825                // var high = (this.high << n) | (this.low >>> (32 - n));
 14826                // var low = this.low << n;
 14827                // } else {
 14828                // var high = this.low << (n - 32);
 14829                // var low = 0;
 14830                // }
 14831  
 14832                // return X64Word.create(high, low);
 14833                // },
 14834  
 14835                /**
 14836                 * Shifts this word n bits to the right.
 14837                 *
 14838                 * @param {number} n The number of bits to shift.
 14839                 *
 14840                 * @return {X64Word} A new x64-Word object after shifting.
 14841                 *
 14842                 * @example
 14843                 *
 14844                 *     var shifted = x64Word.shiftR(7);
 14845                 */
 14846                // shiftR: function (n) {
 14847                // if (n < 32) {
 14848                // var low = (this.low >>> n) | (this.high << (32 - n));
 14849                // var high = this.high >>> n;
 14850                // } else {
 14851                // var low = this.high >>> (n - 32);
 14852                // var high = 0;
 14853                // }
 14854  
 14855                // return X64Word.create(high, low);
 14856                // },
 14857  
 14858                /**
 14859                 * Rotates this word n bits to the left.
 14860                 *
 14861                 * @param {number} n The number of bits to rotate.
 14862                 *
 14863                 * @return {X64Word} A new x64-Word object after rotating.
 14864                 *
 14865                 * @example
 14866                 *
 14867                 *     var rotated = x64Word.rotL(25);
 14868                 */
 14869                // rotL: function (n) {
 14870                // return this.shiftL(n).or(this.shiftR(64 - n));
 14871                // },
 14872  
 14873                /**
 14874                 * Rotates this word n bits to the right.
 14875                 *
 14876                 * @param {number} n The number of bits to rotate.
 14877                 *
 14878                 * @return {X64Word} A new x64-Word object after rotating.
 14879                 *
 14880                 * @example
 14881                 *
 14882                 *     var rotated = x64Word.rotR(7);
 14883                 */
 14884                // rotR: function (n) {
 14885                // return this.shiftR(n).or(this.shiftL(64 - n));
 14886                // },
 14887  
 14888                /**
 14889                 * Adds this word with the passed word.
 14890                 *
 14891                 * @param {X64Word} word The x64-Word to add with this word.
 14892                 *
 14893                 * @return {X64Word} A new x64-Word object after adding.
 14894                 *
 14895                 * @example
 14896                 *
 14897                 *     var added = x64Word.add(anotherX64Word);
 14898                 */
 14899                // add: function (word) {
 14900                // var low = (this.low + word.low) | 0;
 14901                // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;
 14902                // var high = (this.high + word.high + carry) | 0;
 14903  
 14904                // return X64Word.create(high, low);
 14905                // }
 14906              }));
 14907  
 14908              /**
 14909               * An array of 64-bit words.
 14910               *
 14911               * @property {Array} words The array of CryptoJS.x64.Word objects.
 14912               * @property {number} sigBytes The number of significant bytes in this word array.
 14913               */
 14914              var X64WordArray = (C_x64.WordArray = Base.extend({
 14915                /**
 14916                 * Initializes a newly created word array.
 14917                 *
 14918                 * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.
 14919                 * @param {number} sigBytes (Optional) The number of significant bytes in the words.
 14920                 *
 14921                 * @example
 14922                 *
 14923                 *     var wordArray = CryptoJS.x64.WordArray.create();
 14924                 *
 14925                 *     var wordArray = CryptoJS.x64.WordArray.create([
 14926                 *         CryptoJS.x64.Word.create(0x00010203, 0x04050607),
 14927                 *         CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
 14928                 *     ]);
 14929                 *
 14930                 *     var wordArray = CryptoJS.x64.WordArray.create([
 14931                 *         CryptoJS.x64.Word.create(0x00010203, 0x04050607),
 14932                 *         CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
 14933                 *     ], 10);
 14934                 */
 14935                init: function (words, sigBytes) {
 14936                  words = this.words = words || [];
 14937  
 14938                  if (sigBytes != undefined) {
 14939                    this.sigBytes = sigBytes;
 14940                  } else {
 14941                    this.sigBytes = words.length * 8;
 14942                  }
 14943                },
 14944  
 14945                /**
 14946                 * Converts this 64-bit word array to a 32-bit word array.
 14947                 *
 14948                 * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.
 14949                 *
 14950                 * @example
 14951                 *
 14952                 *     var x32WordArray = x64WordArray.toX32();
 14953                 */
 14954                toX32: function () {
 14955                  // Shortcuts
 14956                  var x64Words = this.words;
 14957                  var x64WordsLength = x64Words.length;
 14958  
 14959                  // Convert
 14960                  var x32Words = [];
 14961                  for (var i = 0; i < x64WordsLength; i++) {
 14962                    var x64Word = x64Words[i];
 14963                    x32Words.push(x64Word.high);
 14964                    x32Words.push(x64Word.low);
 14965                  }
 14966  
 14967                  return X32WordArray.create(x32Words, this.sigBytes);
 14968                },
 14969  
 14970                /**
 14971                 * Creates a copy of this word array.
 14972                 *
 14973                 * @return {X64WordArray} The clone.
 14974                 *
 14975                 * @example
 14976                 *
 14977                 *     var clone = x64WordArray.clone();
 14978                 */
 14979                clone: function () {
 14980                  var clone = Base.clone.call(this);
 14981  
 14982                  // Clone "words" array
 14983                  var words = (clone.words = this.words.slice(0));
 14984  
 14985                  // Clone each X64Word object
 14986                  var wordsLength = words.length;
 14987                  for (var i = 0; i < wordsLength; i++) {
 14988                    words[i] = words[i].clone();
 14989                  }
 14990  
 14991                  return clone;
 14992                },
 14993              }));
 14994            })();
 14995  
 14996            return CryptoJS;
 14997          });
 14998        },
 14999        { "./core": 53 },
 15000      ],
 15001      85: [
 15002        function (require, module, exports) {
 15003          /*! https://mths.be/utf8js v2.1.2 by @mathias */
 15004          (function (root) {
 15005            // Detect free variables `exports`
 15006            var freeExports = typeof exports == "object" && exports;
 15007  
 15008            // Detect free variable `module`
 15009            var freeModule =
 15010              typeof module == "object" &&
 15011              module &&
 15012              module.exports == freeExports &&
 15013              module;
 15014  
 15015            // Detect free variable `global`, from Node.js or Browserified code,
 15016            // and use it as `root`
 15017            var freeGlobal = typeof global == "object" && global;
 15018            if (
 15019              freeGlobal.global === freeGlobal ||
 15020              freeGlobal.window === freeGlobal
 15021            ) {
 15022              root = freeGlobal;
 15023            }
 15024  
 15025            /*--------------------------------------------------------------------------*/
 15026  
 15027            var stringFromCharCode = String.fromCharCode;
 15028  
 15029            // Taken from https://mths.be/punycode
 15030            function ucs2decode(string) {
 15031              var output = [];
 15032              var counter = 0;
 15033              var length = string.length;
 15034              var value;
 15035              var extra;
 15036              while (counter < length) {
 15037                value = string.charCodeAt(counter++);
 15038                if (value >= 0xd800 && value <= 0xdbff && counter < length) {
 15039                  // high surrogate, and there is a next character
 15040                  extra = string.charCodeAt(counter++);
 15041                  if ((extra & 0xfc00) == 0xdc00) {
 15042                    // low surrogate
 15043                    output.push(
 15044                      ((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000
 15045                    );
 15046                  } else {
 15047                    // unmatched surrogate; only append this code unit, in case the next
 15048                    // code unit is the high surrogate of a surrogate pair
 15049                    output.push(value);
 15050                    counter--;
 15051                  }
 15052                } else {
 15053                  output.push(value);
 15054                }
 15055              }
 15056              return output;
 15057            }
 15058  
 15059            // Taken from https://mths.be/punycode
 15060            function ucs2encode(array) {
 15061              var length = array.length;
 15062              var index = -1;
 15063              var value;
 15064              var output = "";
 15065              while (++index < length) {
 15066                value = array[index];
 15067                if (value > 0xffff) {
 15068                  value -= 0x10000;
 15069                  output += stringFromCharCode(((value >>> 10) & 0x3ff) | 0xd800);
 15070                  value = 0xdc00 | (value & 0x3ff);
 15071                }
 15072                output += stringFromCharCode(value);
 15073              }
 15074              return output;
 15075            }
 15076  
 15077            function checkScalarValue(codePoint) {
 15078              if (codePoint >= 0xd800 && codePoint <= 0xdfff) {
 15079                throw Error(
 15080                  "Lone surrogate U+" +
 15081                    codePoint.toString(16).toUpperCase() +
 15082                    " is not a scalar value"
 15083                );
 15084              }
 15085            }
 15086            /*--------------------------------------------------------------------------*/
 15087  
 15088            function createByte(codePoint, shift) {
 15089              return stringFromCharCode(((codePoint >> shift) & 0x3f) | 0x80);
 15090            }
 15091  
 15092            function encodeCodePoint(codePoint) {
 15093              if ((codePoint & 0xffffff80) == 0) {
 15094                // 1-byte sequence
 15095                return stringFromCharCode(codePoint);
 15096              }
 15097              var symbol = "";
 15098              if ((codePoint & 0xfffff800) == 0) {
 15099                // 2-byte sequence
 15100                symbol = stringFromCharCode(((codePoint >> 6) & 0x1f) | 0xc0);
 15101              } else if ((codePoint & 0xffff0000) == 0) {
 15102                // 3-byte sequence
 15103                checkScalarValue(codePoint);
 15104                symbol = stringFromCharCode(((codePoint >> 12) & 0x0f) | 0xe0);
 15105                symbol += createByte(codePoint, 6);
 15106              } else if ((codePoint & 0xffe00000) == 0) {
 15107                // 4-byte sequence
 15108                symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xf0);
 15109                symbol += createByte(codePoint, 12);
 15110                symbol += createByte(codePoint, 6);
 15111              }
 15112              symbol += stringFromCharCode((codePoint & 0x3f) | 0x80);
 15113              return symbol;
 15114            }
 15115  
 15116            function utf8encode(string) {
 15117              var codePoints = ucs2decode(string);
 15118              var length = codePoints.length;
 15119              var index = -1;
 15120              var codePoint;
 15121              var byteString = "";
 15122              while (++index < length) {
 15123                codePoint = codePoints[index];
 15124                byteString += encodeCodePoint(codePoint);
 15125              }
 15126              return byteString;
 15127            }
 15128  
 15129            /*--------------------------------------------------------------------------*/
 15130  
 15131            function readContinuationByte() {
 15132              if (byteIndex >= byteCount) {
 15133                throw Error("Invalid byte index");
 15134              }
 15135  
 15136              var continuationByte = byteArray[byteIndex] & 0xff;
 15137              byteIndex++;
 15138  
 15139              if ((continuationByte & 0xc0) == 0x80) {
 15140                return continuationByte & 0x3f;
 15141              }
 15142  
 15143              // If we end up here, it’s not a continuation byte
 15144              throw Error("Invalid continuation byte");
 15145            }
 15146  
 15147            function decodeSymbol() {
 15148              var byte1;
 15149              var byte2;
 15150              var byte3;
 15151              var byte4;
 15152              var codePoint;
 15153  
 15154              if (byteIndex > byteCount) {
 15155                throw Error("Invalid byte index");
 15156              }
 15157  
 15158              if (byteIndex == byteCount) {
 15159                return false;
 15160              }
 15161  
 15162              // Read first byte
 15163              byte1 = byteArray[byteIndex] & 0xff;
 15164              byteIndex++;
 15165  
 15166              // 1-byte sequence (no continuation bytes)
 15167              if ((byte1 & 0x80) == 0) {
 15168                return byte1;
 15169              }
 15170  
 15171              // 2-byte sequence
 15172              if ((byte1 & 0xe0) == 0xc0) {
 15173                byte2 = readContinuationByte();
 15174                codePoint = ((byte1 & 0x1f) << 6) | byte2;
 15175                if (codePoint >= 0x80) {
 15176                  return codePoint;
 15177                } else {
 15178                  throw Error("Invalid continuation byte");
 15179                }
 15180              }
 15181  
 15182              // 3-byte sequence (may include unpaired surrogates)
 15183              if ((byte1 & 0xf0) == 0xe0) {
 15184                byte2 = readContinuationByte();
 15185                byte3 = readContinuationByte();
 15186                codePoint = ((byte1 & 0x0f) << 12) | (byte2 << 6) | byte3;
 15187                if (codePoint >= 0x0800) {
 15188                  checkScalarValue(codePoint);
 15189                  return codePoint;
 15190                } else {
 15191                  throw Error("Invalid continuation byte");
 15192                }
 15193              }
 15194  
 15195              // 4-byte sequence
 15196              if ((byte1 & 0xf8) == 0xf0) {
 15197                byte2 = readContinuationByte();
 15198                byte3 = readContinuationByte();
 15199                byte4 = readContinuationByte();
 15200                codePoint =
 15201                  ((byte1 & 0x07) << 0x12) |
 15202                  (byte2 << 0x0c) |
 15203                  (byte3 << 0x06) |
 15204                  byte4;
 15205                if (codePoint >= 0x010000 && codePoint <= 0x10ffff) {
 15206                  return codePoint;
 15207                }
 15208              }
 15209  
 15210              throw Error("Invalid UTF-8 detected");
 15211            }
 15212  
 15213            var byteArray;
 15214            var byteCount;
 15215            var byteIndex;
 15216            function utf8decode(byteString) {
 15217              byteArray = ucs2decode(byteString);
 15218              byteCount = byteArray.length;
 15219              byteIndex = 0;
 15220              var codePoints = [];
 15221              var tmp;
 15222              while ((tmp = decodeSymbol()) !== false) {
 15223                codePoints.push(tmp);
 15224              }
 15225              return ucs2encode(codePoints);
 15226            }
 15227  
 15228            /*--------------------------------------------------------------------------*/
 15229  
 15230            var utf8 = {
 15231              version: "2.1.2",
 15232              encode: utf8encode,
 15233              decode: utf8decode,
 15234            };
 15235  
 15236            // Some AMD build optimizers, like r.js, check for specific condition patterns
 15237            // like the following:
 15238            if (
 15239              typeof define == "function" &&
 15240              typeof define.amd == "object" &&
 15241              define.amd
 15242            ) {
 15243              define(function () {
 15244                return utf8;
 15245              });
 15246            } else if (freeExports && !freeExports.nodeType) {
 15247              if (freeModule) {
 15248                // in Node.js or RingoJS v0.8.0+
 15249                freeModule.exports = utf8;
 15250              } else {
 15251                // in Narwhal or RingoJS v0.7.0-
 15252                var object = {};
 15253                var hasOwnProperty = object.hasOwnProperty;
 15254                for (var key in utf8) {
 15255                  hasOwnProperty.call(utf8, key) &&
 15256                    (freeExports[key] = utf8[key]);
 15257                }
 15258              }
 15259            } else {
 15260              // in Rhino or a web browser
 15261              root.utf8 = utf8;
 15262            }
 15263          })(this);
 15264        },
 15265        {},
 15266      ],
 15267      86: [
 15268        function (require, module, exports) {
 15269          module.exports = XMLHttpRequest;
 15270        },
 15271        {},
 15272      ],
 15273      "bignumber.js": [
 15274        function (require, module, exports) {
 15275          "use strict";
 15276  
 15277          module.exports = BigNumber; // jshint ignore:line
 15278        },
 15279        {},
 15280      ],
 15281      web3: [
 15282        function (require, module, exports) {
 15283          var Web3 = require("./lib/web3");
 15284  
 15285          // don't override global variable
 15286          if (
 15287            typeof window !== "undefined" &&
 15288            typeof window.Web3 === "undefined"
 15289          ) {
 15290            window.Web3 = Web3;
 15291          }
 15292  
 15293          module.exports = Web3;
 15294        },
 15295        { "./lib/web3": 22 },
 15296      ],
 15297    },
 15298    {},
 15299    ["web3"]
 15300  );
 15301  //# sourceMappingURL=web3-light.js.map