├── LICENSE ├── README.md ├── blockchain_interactions.js ├── contracts ├── Migrations.sol └── MindMathGame.sol ├── index.js ├── migrations ├── 1_initial_migration.js └── 2_deploy_contracts.js ├── package-lock.json ├── package.json ├── public ├── index.html ├── mindmath_token.png ├── sound_loose.wav ├── sound_win.wav └── web3.min.js ├── truffle-config.js └── truffle.js /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018, krasimir.zlatev@gmail.com 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## MindMathGame 2 | This is simple game which demonstrated how to use Ethereum, Solidy code, truffleframework, Integration with Node.js and socket.io and MetaMask browser plugin. 3 | 4 | **Instructions** 5 | The goal of the game is to accumulate 1000000 score by answering simple math questions. Player is presented with two randomly generated numbers if player guess the number within the time limit wins score reward. If player don't guess will loose reward and score will decrease. If time is over and player can't guess reward will be removed from the score and user will be present with new challenge. 6 | 7 | **User win the game if it reaches score 1000000.** 8 | 9 | **Hints:** 10 | - Accumulate score points and you can click on Power Up to buy it. This will increase reward and potential loose. When buying power up complexity of questions increases. 11 | - 0 is correct answer. 12 | 13 | 14 | **How to deploy:** 15 | ```objc 16 | - Install Node.js, https://nodejs.org/en/download/ 17 | - $ npm install -g truffle 18 | - $ npm install -g ganache-cli 19 | - Install MetaMask browser plugin, https://metamask.io/ 20 | ``` 21 | 22 | **How to start** 23 | ```objc 24 | $ npm install 25 | $ ganache-cli 26 | $ truffle compile 27 | $ truffle migrate 28 | from output get MindMathGame: 0xb3793a5f3f12d6a3d88c55346348b7cd81c8698a and store it inside blockchain_interactions.js var contractAddress = "0xb3793a5f3f12d6a3d88c55346348b7cd81c8698a"; 29 | - In the browser make sure you have MetaMask installed and connected to the ganache-cli network and your logged in into the account 30 | $ node index.js 31 | - Open browser to > http://localhost:3000, HTML page for the game to start 32 | - Start Playing 33 | ``` 34 | 35 | ## Credits 36 | 37 | Credits for this code go to [KrasimirZI](https://github.com/KrasimirZl/MindMathGame/tree/master/public). I've merely created a wrapper to get people started. 38 | -------------------------------------------------------------------------------- /blockchain_interactions.js: -------------------------------------------------------------------------------- 1 | /* Configuration variables */ 2 | var contractAddress = "0x43833c47907be9780581c0fbee97cc6e4f0a99c9"; 3 | var ABI = require("./build/contracts/MindMathGame.json").abi; 4 | var web3Host = 'http://localhost'; 5 | var web3Port = '8545'; 6 | var exports = module.exports = {}; 7 | 8 | /* web3 initialization */ 9 | var Web3 = require('web3'); 10 | var web3 = new Web3(); 11 | 12 | web3.setProvider(new web3.providers.HttpProvider(web3Host + ':' + web3Port)); 13 | if (!web3.isConnected()) { 14 | console.error("Ethereum - no connection to RPC server"); 15 | } else { 16 | console.log("Ethereum - connected to RPC server"); 17 | } 18 | 19 | // Get first default Ethereum account. This will be contract owner account. 20 | var account = web3.eth.accounts[0]; 21 | var sendDataObject = { 22 | from: account, 23 | gas: 300000, 24 | }; 25 | 26 | // creation of contract object 27 | var MindMathGameContract = web3.eth.contract(ABI); 28 | // initiate contract for an address 29 | exports.MindMathGameInstance = MindMathGameContract.at(contractAddress); // export MindMathGameInstance to be visible in other js files 30 | 31 | 32 | // Call game MindMathGameSetOwner with var account = web3.eth.accounts[0], no other account can change data inside the contract 33 | var result = exports.MindMathGameInstance.MindMathGameSetOwner.sendTransaction(sendDataObject, function (err, result) { 34 | if (err) { 35 | console.error("Ethereum contract. MindMathGameSetOwner, Transaction submission error:", err); 36 | } else { 37 | console.log("Ethereum contract. MindMathGameSetOwner success. Transaction hash:", result); 38 | } 39 | }); 40 | 41 | /* Call Ethereum contract to create new game 42 | */ 43 | exports.mmgCreateGame = function(_game_address) 44 | //function mmgCreateGame( _game_address ) 45 | { 46 | var result = exports.MindMathGameInstance.createGame.sendTransaction(_game_address, sendDataObject, function (err, result) { 47 | if (err) { 48 | console.error("Ethereum contract. createGame, Transaction submission error:", err); 49 | } else { 50 | console.log("Ethereum contract. createGame success. Transaction hash:", result); 51 | } 52 | }); 53 | } 54 | 55 | /* Call Ethereum contract to update/store the game score 56 | */ 57 | exports.mmgUpdateGameScore = function( _new_score, _game_address) 58 | { 59 | var result = exports.MindMathGameInstance.updateGameScore.sendTransaction(_new_score, _game_address, sendDataObject, function (err, result) { 60 | if (err) { 61 | console.error("Ethereum contract. updateGameScore submission error:", err); 62 | } else { 63 | console.log("Ethereum contract. updateGameScore success. Transaction hash:", result); 64 | } 65 | }); 66 | return result; 67 | } 68 | 69 | /* Call Ethereum contract to buy power up. 70 | * @return true if success, false if not score funds on the _game_address 71 | */ 72 | exports.mmgBuyPowerUp = function( _desired_power_up, _game_address ) 73 | { 74 | var result = exports.MindMathGameInstance.buyPowerUp.sendTransaction(_desired_power_up, _game_address, sendDataObject, function (err, result) { 75 | if (err) { 76 | console.error("Ethereum contract. buyPowerUp submission error:", err); 77 | } else { 78 | console.log("Ethereum contract. buyPowerUp success. Transaction hash:", result); 79 | } 80 | }); 81 | return result; 82 | } 83 | 84 | /* Get from Ethereum contract to get game_score and game_power_up 85 | */ 86 | exports.mmgGetGameDetails = function( _game_address ) 87 | { 88 | var result = exports.MindMathGameInstance.getGameDetails.sendTransaction(_game_address, sendDataObject, function (err, result) { 89 | if (err) { 90 | console.error("Ethereum contract. getGameDetails submission error:", err); 91 | } else { 92 | console.log("Ethereum contract. getGameDetails success. Transaction hash:", result); 93 | } 94 | }); 95 | } 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.17; 2 | 3 | contract Migrations { 4 | address public owner; 5 | uint public last_completed_migration; 6 | 7 | modifier restricted() { 8 | if (msg.sender == owner) _; 9 | } 10 | 11 | function Migrations() public { 12 | owner = msg.sender; 13 | } 14 | 15 | function setCompleted(uint completed) public restricted { 16 | last_completed_migration = completed; 17 | } 18 | 19 | function upgrade(address new_address) public restricted { 20 | Migrations upgraded = Migrations(new_address); 21 | upgraded.setCompleted(last_completed_migration); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /contracts/MindMathGame.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.0; 2 | 3 | contract MindMathGame 4 | { 5 | event GameCreated(int game_score, int game_power_up, address game_address ); 6 | event GameUpdated(int game_score, int game_power_up, address game_address ); 7 | 8 | struct game 9 | { 10 | int game_score; //Store game score 11 | int game_power_up; //Store game pwoer up, possible v alues 1, 10, 100, 1000, 10000, 100000 12 | } 13 | 14 | // Store fore each user account score and last PowerUp bought 15 | mapping (address => game) games; 16 | address owner; // Only owner is allowed to modify data in the contract but evryone can view it 17 | 18 | // Init contract owner. Only owner is allowed to update the values 19 | function MindMathGameSetOwner() public 20 | { 21 | owner = msg.sender; 22 | } 23 | 24 | // Create new game 25 | function createGame( address game_address ) public returns (address) 26 | { 27 | // If it is not owner, don't allow game creation 28 | if (msg.sender != owner) return; 29 | 30 | games[game_address].game_score = 0; 31 | games[game_address].game_power_up = 1; 32 | emit GameCreated(games[game_address].game_score, games[game_address].game_power_up, game_address); // Send event back to game client that game is created 33 | return game_address; 34 | } 35 | 36 | // Update game score 37 | function updateGameScore(int score_new, address game_address ) public returns (bool updated) 38 | { 39 | // If it is not owner, don't allow game creation 40 | if (msg.sender != owner) return; 41 | 42 | // Allow only positive socre to be stored here 43 | if( score_new >= 0 ) 44 | { 45 | games[game_address].game_score = score_new; 46 | emit GameUpdated(games[game_address].game_score, games[game_address].game_power_up, game_address); // Send event back to game client that game is updated 47 | return true; 48 | } 49 | return false; 50 | } 51 | 52 | // Read the game details for address 53 | function getGameDetails( address game_address ) public returns (int score) 54 | { 55 | emit GameUpdated(games[game_address].game_score, games[game_address].game_power_up, game_address); // Send event back to game client that game is updated 56 | return games[game_address].game_score; 57 | } 58 | 59 | /// Buy power up if player has enough score points in the account. 60 | function buyPowerUp(int power_up_amount, address game_address ) public returns (bool sufficient) 61 | { 62 | // If it is not owner, don't allow game creation 63 | if (msg.sender != owner) return; 64 | 65 | if( power_up_amount > 0 ) 66 | { 67 | if( games[game_address].game_score - power_up_amount < 0 ) 68 | return false; // Insuficenet Funds 69 | games[game_address].game_score = games[game_address].game_score - power_up_amount; 70 | games[game_address].game_power_up = power_up_amount; 71 | emit GameUpdated(games[game_address].game_score, games[game_address].game_power_up, game_address); // Send event back to game client that game is updated 72 | return true; // PowerUp successfully bought 73 | } 74 | return false; // Negaitve PowerUpAmmount not supported 75 | } 76 | } -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // Global variables and constants 3 | var express = require('express') 4 | var app = express() 5 | var http = require('http').Server(app); 6 | var io = require('socket.io')(http); 7 | var mmgContract = require('./blockchain_interactions'); 8 | 9 | 10 | const GAME_WIN_SCORE=1000000; // If Player accumulated 1000000 it will win the game 11 | const QUESTION_TIME_TO_ANSWER=20; // Question time to answer in seconds. 12 | const START_POWERUP = 1; 13 | var timer; // How often game client will be updated. 14 | 15 | var active_games={}; // Hold all running games for each Ethereum account 16 | 17 | 18 | ///////////////////////////////////////////////////////////////////////////////////////////////////////// 19 | // Utility functions 20 | /* 21 | * Return current time in milliseconds 22 | */ 23 | function get_time_milliseconds() 24 | { 25 | let d = new Date(); 26 | return d.getTime(); 27 | } 28 | 29 | /* 30 | * Generate random positive integer number using input to decide on number of digits 31 | */ 32 | function generate_random_number(powerup) 33 | { 34 | let decimal_points=1; 35 | if(powerup>1000 && powerup<10000 ) 36 | decimal_points=10; 37 | else if(powerup>10000 && powerup<100000000 ) 38 | decimal_points=100; 39 | 40 | return Math.trunc(Math.random()*decimal_points); 41 | } 42 | 43 | 44 | /* Change randomly item positions in array 45 | */ 46 | function shuffle_array(array) 47 | { 48 | for (let i = array.length - 1; i > 0; i--) 49 | { 50 | let j = Math.floor(Math.random() * (i + 1)); 51 | [array[i], array[j]] = [array[j], array[i]]; 52 | } 53 | } 54 | 55 | 56 | ///////////////////////////////////////////////////////////////////////////////////////////////////////// 57 | // Game related functions 58 | /* Return true if game is stared, otherwise false 59 | */ 60 | function game_is_started(account_id) 61 | { 62 | if(typeof active_games[account_id] != 'undefined' && ( 63 | active_games[account_id].game_state == "started" || 64 | active_games[account_id].game_state == "correct_answer" || 65 | active_games[account_id].game_state == "wrong_answer" ) ) 66 | return true; 67 | return false; 68 | } 69 | 70 | /* Push back to game client details for the game using ethereum account 71 | */ 72 | function game_client_update(account_id) 73 | { 74 | let question = active_games[account_id].game_first_number.toString() + " + " + active_games[account_id].game_second_number.toString(); 75 | let time_delta = (get_time_milliseconds() - active_games[account_id].game_question_time_start)/1000; // Calculate elapsed time from start convert in seconds 76 | let game_question_time_countdown = Math.trunc(QUESTION_TIME_TO_ANSWER - time_delta); // Convert from float to integer 77 | let response={"game_state":active_games[account_id].game_state, 78 | "question":question, 79 | "reward":active_games[account_id].game_reward, 80 | "score":active_games[account_id].game_score, 81 | "powerup":active_games[account_id].game_powerup, 82 | "time_to_answer":game_question_time_countdown, 83 | "response":active_games[account_id].game_response, 84 | "response_correct":active_games[account_id].response_correct, 85 | "answers":"", 86 | "account_id":account_id}; 87 | 88 | console.log("Update game client " + game_question_time_countdown) 89 | 90 | clearTimeout(timer); // Stop updating client 91 | 92 | if( game_is_started(account_id) ) 93 | { 94 | response.answers = active_games[account_id].game_answers; 95 | if( game_question_time_countdown > 0 && active_games[account_id].game_score >= 0 ) // Player still have time continue updating the game client 96 | { 97 | // Game in the sessions continue, updating the client. 98 | // Schedule next game client update every 800 milliseconds 99 | timer = setTimeout(game_client_update, 800, account_id); 100 | } 101 | else // player run out of time generate new question 102 | { 103 | active_games[account_id].game_score = active_games[account_id].game_score - active_games[account_id].game_reward; // TODO update -1 to be based on powerup level 104 | if( game_round_generate_question(account_id) == true ) 105 | timer = setTimeout(game_client_update, 800, account_id); 106 | else // Game over no more score points in the account 107 | { 108 | response.time_to_answer = 0; 109 | active_games[account_id].game_state="game_over"; 110 | response.score = active_games[account_id].game_score = 0; 111 | response.game_state = active_games[account_id].game_state; 112 | response.response = "Game Over. I am really sorry. You reached score 0. Solve AI or Die Trying!" 113 | io.emit('MESSAGE_GAME_OVER', response); // Notify player game over 114 | return; 115 | } 116 | } 117 | } 118 | 119 | if( response.time_to_answer < 0 ) // Fix for negative time. Client must see only positive time or 0. 120 | response.time_to_answer = 0; 121 | io.emit('MESSAGE_GAME_GUI_UPDATE', response); // Update game client with new data 122 | } 123 | 124 | /* Generate 2 integer numbers for the question 125 | * Generate 4 possible answer 1 of it is correct 126 | */ 127 | function game_round_generate_question_answers(account_id, powerup) 128 | { 129 | // TODO change question generation to be more realistic. 130 | active_games[account_id].game_first_number = generate_random_number(powerup); 131 | active_games[account_id].game_second_number = generate_random_number(powerup); 132 | 133 | active_games[account_id].game_answers[0] = active_games[account_id].game_first_number + active_games[account_id].game_second_number; 134 | active_games[account_id].game_answers[1] = generate_random_number(powerup); 135 | active_games[account_id].game_answers[2] = generate_random_number(powerup); 136 | active_games[account_id].game_answers[3] = generate_random_number(powerup); 137 | shuffle_array(active_games[account_id].game_answers); //randomize game array positions 138 | } 139 | 140 | /* 141 | * Generate new game question round 142 | * @param {address} account_id 143 | * @return true if successful, false if not enough funds game over event 144 | */ 145 | function game_round_generate_question(account_id) 146 | { 147 | if( game_is_started(account_id) == true ) // update existing game, player hasn't provided answer yet 148 | { 149 | if( active_games[account_id].game_score < 0 ) // Player don't have more funds game over 150 | return false; 151 | game_round_generate_question_answers(account_id, active_games[account_id].game_powerup) 152 | active_games[account_id].game_reward = active_games[account_id].game_powerup; 153 | active_games[account_id].game_question_time_start = get_time_milliseconds(); 154 | } 155 | else // Generate new game 156 | { 157 | active_games[account_id] = { 158 | game_state:"started", 159 | game_powerup:START_POWERUP, 160 | game_first_number:START_POWERUP, 161 | game_second_number:START_POWERUP, 162 | game_reward:START_POWERUP, 163 | game_question_time_start:get_time_milliseconds(), 164 | game_score:0, 165 | game_response:"", 166 | game_answers:[0,0,0,0]}; 167 | game_round_generate_question_answers(account_id, START_POWERUP); 168 | } 169 | 170 | return true; 171 | } 172 | 173 | /* Process MESSAGE_GAME_START event from client 174 | */ 175 | function game_start(msg) 176 | { 177 | let account_id = msg.account_id; 178 | console.log('game_start: ' + account_id); 179 | // Call Ethereum contract to initialize game storage structures. 180 | mmgContract.mmgCreateGame(account_id); 181 | } 182 | 183 | /* Process MESSAGE_GAME_INIT event from client 184 | * Init game state structure for first time 185 | */ 186 | function game_init(msg) 187 | { 188 | let account_id = msg.account_id; 189 | if(typeof active_games[account_id] == 'undefined') // Game account don't exists initialize 190 | { 191 | console.log('game_init: ' + account_id); 192 | // Initialize new game account 193 | active_games[account_id] = { 194 | game_state:"game_init", 195 | game_powerup:START_POWERUP, 196 | game_first_number:generate_random_number(START_POWERUP), 197 | game_second_number:generate_random_number(START_POWERUP), 198 | game_reward:START_POWERUP, 199 | game_question_time_start:get_time_milliseconds(), 200 | game_score:0, 201 | game_response:"", 202 | game_answers:[0,0,0,0]}; 203 | 204 | console.log(active_games[account_id]); 205 | } 206 | // update game client GUI 207 | game_client_update(account_id); 208 | } 209 | 210 | /* Process MESSAGE_GAME_GIVEUP event from client 211 | * Update game stated that is stopped and notify client for it 212 | */ 213 | function game_giveup(msg) 214 | { 215 | let account_id = msg.account_id; 216 | console.log('game_giveup: ' + account_id); 217 | clearTimeout(timer); // Stop updating clients 218 | if( game_is_started(account_id) == true ) // Stop only if game is started 219 | { 220 | active_games[account_id].game_state = "stopped"; 221 | active_games[account_id].game_answers = "Game give up."; 222 | // Call ethereum contract mmgUpdateGameScore to update score 223 | mmgContract.mmgUpdateGameScore(active_games[account_id].game_score, account_id); 224 | } 225 | io.emit('MESSAGE_GAME_GIVEUP_RESPONSE', {"account_id":account_id}); 226 | } 227 | 228 | /* Process MESSAGE_GAME_SEND_ANSWER event from client 229 | * Player answer the question evaluate if it is correct or not and send response back to the client 230 | */ 231 | function game_player_answer(msg) 232 | { 233 | let account_id = msg.account_id; 234 | console.log('game_player_answer: ' + account_id + " answer:" + msg.answer); 235 | let sum = active_games[account_id].game_first_number + active_games[account_id].game_second_number; 236 | 237 | if( !(!msg.answer || 0 === msg.answer.length) && Number(msg.answer) == sum ) // correct answer 238 | { 239 | // Increase game_score 240 | active_games[account_id].game_score = active_games[account_id].game_score + active_games[account_id].game_reward; 241 | // Check if player WON 242 | if( active_games[account_id].game_score >= GAME_WIN_SCORE ) 243 | { 244 | game_giveup(account_id); 245 | io.emit('MESSAGE_GAME_WIN', {"account_id":account_id}); // Send message to game client to end the game and show WIN prize :) 246 | console.log("Game WON:" + account_id ); 247 | } 248 | else 249 | { 250 | // Continue playing 251 | // Send success message back to player 252 | active_games[account_id].game_response = "Your answer " + msg.answer + " is correct! You won: " + active_games[account_id].game_reward; 253 | active_games[account_id].game_state="correct_answer"; 254 | game_round_generate_question(account_id); 255 | // update game client GUI 256 | game_client_update(account_id); 257 | // Send message to game client that answer is correct 258 | io.emit('MESSAGE_GAME_ANSWER_CORRECT', {"account_id":account_id}); 259 | } 260 | } 261 | else // Incorrect answer decrease score and try to generate new question 262 | { 263 | // Decrement player game_score 264 | active_games[account_id].game_score = active_games[account_id].game_score - active_games[account_id].game_reward; 265 | // Send wrong answer message back to player 266 | active_games[account_id].game_response = "Your answer " + msg.answer + " is WRONG! You lost: " + active_games[account_id].game_reward; 267 | active_games[account_id].game_state="wrong_answer"; 268 | let result = game_round_generate_question(account_id); 269 | // update game client GUI 270 | game_client_update(account_id); 271 | // Send message to game client that answer is wrong 272 | io.emit('MESSAGE_GAME_ANSWER_WRONG', {"account_id":account_id}); 273 | } 274 | } 275 | 276 | /* Process MESSAGE_GAME_BUY_POWERUP event from client 277 | * Player want to buy power up check if it has enough score funds 278 | */ 279 | function game_buy_powerup(msg) 280 | { 281 | let account_id = msg.account_id; 282 | let requested_power_up = msg.requested_powerup; 283 | if( game_is_started(account_id) == true ) // Buy power up only if game is started 284 | { 285 | console.log("game_buy_powerup: " + account_id + " Power Up:" + requested_power_up); 286 | // If player have sufficient funds allow buy power up. 287 | if( requested_power_up > 0 && (active_games[account_id].game_score-requested_power_up) >= 0 ) 288 | { 289 | // Call ethereum contract mmgUpdateGameScore to update score first 290 | mmgContract.mmgUpdateGameScore(active_games[account_id].game_score, account_id); 291 | // Call ethereum contract mmgBuyPowerUp to buy power u p. If successful it will emit gameUpdatedEvent 292 | mmgContract.mmgBuyPowerUp(requested_power_up, account_id); 293 | } 294 | } 295 | } 296 | 297 | 298 | ///////////////////////////////////////////////////////////////////////////////////////////////////////// 299 | // Ethereum contract emited events 300 | var gameCreatedEvent = mmgContract.MindMathGameInstance.GameCreated(); 301 | var gameUpdatedEvent = mmgContract.MindMathGameInstance.GameUpdated(); 302 | 303 | /* Process events from Ethereum call mmgCreateGame() 304 | * Event is generated once Ethereum call is processed 305 | */ 306 | gameCreatedEvent.watch(function(error, result){ 307 | if (!error) 308 | { 309 | let address = result.args.game_address.toString(10); 310 | let power_up = Number(result.args.game_power_up.toString(10)); 311 | let score = Number(result.args.game_score.toString(10)); 312 | 313 | // If game structure is already initialized update it and the client 314 | if( active_games[address] != null ) 315 | { 316 | // Generate question and reward 317 | game_round_generate_question(address); 318 | // Update game state 319 | active_games[address].game_powerup = power_up; 320 | active_games[address].game_score = score; 321 | active_games[address].game_reward = power_up; 322 | // Init game client 323 | io.emit('MESSAGE_GAME_START_RESPONSE', {"account_id":address}); // Update game client with new data 324 | // start updating game GUI 325 | game_client_update(address); 326 | } 327 | } else { 328 | console.log(error); 329 | } 330 | }); 331 | 332 | gameUpdatedEvent.watch(function(error, result){ 333 | if (!error) 334 | { 335 | let address = result.args.game_address.toString(10); 336 | let power_up = Number(result.args.game_power_up.toString(10)); 337 | let score = Number(result.args.game_score.toString(10)); 338 | 339 | // If game structure is already initialized update it and the client 340 | if( active_games[address] != null ) 341 | { 342 | active_games[address].game_powerup = power_up; 343 | active_games[address].game_score = score; 344 | active_games[address].game_reward = power_up; 345 | 346 | // update game client GUI 347 | game_client_update(address); 348 | } 349 | } else { 350 | console.log(error); 351 | } 352 | }); 353 | 354 | 355 | ///////////////////////////////////////////////////////////////////////////////////////////////////////// 356 | // Socket.io listen for incoming messages from browser client 357 | io.on('connection', function(socket){ 358 | console.log('Game client connected'); 359 | socket.on('disconnect', function(){ 360 | console.log('Game client disconnected'); 361 | }); 362 | socket.on('MESSAGE_GAME_INIT', function(msg){ 363 | game_init(msg); 364 | }); 365 | socket.on('MESSAGE_GAME_START', function(msg){ 366 | game_start(msg); 367 | }); 368 | socket.on('MESSAGE_GAME_GIVEUP', function(msg){ 369 | game_giveup(msg); 370 | }); 371 | socket.on('MESSAGE_GAME_SEND_ANSWER', function(msg){ 372 | game_player_answer(msg); 373 | }); 374 | socket.on('MESSAGE_GAME_BUY_POWERUP', function(msg){ 375 | game_buy_powerup(msg); 376 | }); 377 | }); 378 | 379 | 380 | ///////////////////////////////////////////////////////////////////////////////////////////////////////// 381 | // Server static pages from /public folder 382 | app.use(express.static('public')) 383 | 384 | http.listen(3000, function(){ 385 | console.log('http://localhost:3000'); 386 | }); -------------------------------------------------------------------------------- /migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | var Migrations = artifacts.require("./Migrations.sol"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(Migrations); 5 | }; 6 | -------------------------------------------------------------------------------- /migrations/2_deploy_contracts.js: -------------------------------------------------------------------------------- 1 | var MindMathGame = artifacts.require("./MindMathGame.sol"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(MindMathGame); 5 | }; 6 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "MindMath-game", 3 | "version": "0.0.1", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "accepts": { 8 | "version": "1.3.5", 9 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", 10 | "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", 11 | "requires": { 12 | "mime-types": "2.1.18", 13 | "negotiator": "0.6.1" 14 | } 15 | }, 16 | "after": { 17 | "version": "0.8.2", 18 | "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", 19 | "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=" 20 | }, 21 | "array-flatten": { 22 | "version": "1.1.1", 23 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 24 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" 25 | }, 26 | "arraybuffer.slice": { 27 | "version": "0.0.7", 28 | "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", 29 | "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==" 30 | }, 31 | "async-limiter": { 32 | "version": "1.0.0", 33 | "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", 34 | "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" 35 | }, 36 | "backo2": { 37 | "version": "1.0.2", 38 | "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", 39 | "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=" 40 | }, 41 | "base64-arraybuffer": { 42 | "version": "0.1.5", 43 | "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", 44 | "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=" 45 | }, 46 | "base64id": { 47 | "version": "1.0.0", 48 | "resolved": "https://registry.npmjs.org/base64id/-/base64id-1.0.0.tgz", 49 | "integrity": "sha1-R2iMuZu2gE8OBtPnY7HDLlfY5rY=" 50 | }, 51 | "better-assert": { 52 | "version": "1.0.2", 53 | "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", 54 | "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", 55 | "requires": { 56 | "callsite": "1.0.0" 57 | } 58 | }, 59 | "blob": { 60 | "version": "0.0.4", 61 | "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz", 62 | "integrity": "sha1-vPEwUspURj8w+fx+lbmkdjCpSSE=" 63 | }, 64 | "callsite": { 65 | "version": "1.0.0", 66 | "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", 67 | "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=" 68 | }, 69 | "component-bind": { 70 | "version": "1.0.0", 71 | "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", 72 | "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=" 73 | }, 74 | "component-emitter": { 75 | "version": "1.2.1", 76 | "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", 77 | "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" 78 | }, 79 | "component-inherit": { 80 | "version": "0.0.3", 81 | "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", 82 | "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=" 83 | }, 84 | "content-disposition": { 85 | "version": "0.5.2", 86 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", 87 | "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" 88 | }, 89 | "content-type": { 90 | "version": "1.0.4", 91 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", 92 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" 93 | }, 94 | "cookie": { 95 | "version": "0.3.1", 96 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", 97 | "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" 98 | }, 99 | "cookie-signature": { 100 | "version": "1.0.6", 101 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 102 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" 103 | }, 104 | "crypto-js": { 105 | "version": "3.1.8", 106 | "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.8.tgz", 107 | "integrity": "sha1-cV8HC/YBTyrpkqmLOSkli3E/CNU=" 108 | }, 109 | "debug": { 110 | "version": "2.6.1", 111 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.1.tgz", 112 | "integrity": "sha1-eYVQkLosTjEVzH2HaUkdWPBJE1E=", 113 | "requires": { 114 | "ms": "0.7.2" 115 | } 116 | }, 117 | "depd": { 118 | "version": "1.1.2", 119 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", 120 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" 121 | }, 122 | "destroy": { 123 | "version": "1.0.4", 124 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", 125 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" 126 | }, 127 | "ee-first": { 128 | "version": "1.1.1", 129 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 130 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" 131 | }, 132 | "encodeurl": { 133 | "version": "1.0.2", 134 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 135 | "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" 136 | }, 137 | "engine.io": { 138 | "version": "3.2.0", 139 | "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.2.0.tgz", 140 | "integrity": "sha512-mRbgmAtQ4GAlKwuPnnAvXXwdPhEx+jkc0OBCLrXuD/CRvwNK3AxRSnqK4FSqmAMRRHryVJP8TopOvmEaA64fKw==", 141 | "requires": { 142 | "accepts": "1.3.5", 143 | "base64id": "1.0.0", 144 | "cookie": "0.3.1", 145 | "debug": "3.1.0", 146 | "engine.io-parser": "2.1.2", 147 | "ws": "3.3.3" 148 | }, 149 | "dependencies": { 150 | "debug": { 151 | "version": "3.1.0", 152 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", 153 | "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", 154 | "requires": { 155 | "ms": "2.0.0" 156 | } 157 | }, 158 | "ms": { 159 | "version": "2.0.0", 160 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 161 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 162 | } 163 | } 164 | }, 165 | "engine.io-client": { 166 | "version": "3.2.1", 167 | "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.2.1.tgz", 168 | "integrity": "sha512-y5AbkytWeM4jQr7m/koQLc5AxpRKC1hEVUb/s1FUAWEJq5AzJJ4NLvzuKPuxtDi5Mq755WuDvZ6Iv2rXj4PTzw==", 169 | "requires": { 170 | "component-emitter": "1.2.1", 171 | "component-inherit": "0.0.3", 172 | "debug": "3.1.0", 173 | "engine.io-parser": "2.1.2", 174 | "has-cors": "1.1.0", 175 | "indexof": "0.0.1", 176 | "parseqs": "0.0.5", 177 | "parseuri": "0.0.5", 178 | "ws": "3.3.3", 179 | "xmlhttprequest-ssl": "1.5.5", 180 | "yeast": "0.1.2" 181 | }, 182 | "dependencies": { 183 | "debug": { 184 | "version": "3.1.0", 185 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", 186 | "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", 187 | "requires": { 188 | "ms": "2.0.0" 189 | } 190 | }, 191 | "ms": { 192 | "version": "2.0.0", 193 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 194 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 195 | } 196 | } 197 | }, 198 | "engine.io-parser": { 199 | "version": "2.1.2", 200 | "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.1.2.tgz", 201 | "integrity": "sha512-dInLFzr80RijZ1rGpx1+56/uFoH7/7InhH3kZt+Ms6hT8tNx3NGW/WNSA/f8As1WkOfkuyb3tnRyuXGxusclMw==", 202 | "requires": { 203 | "after": "0.8.2", 204 | "arraybuffer.slice": "0.0.7", 205 | "base64-arraybuffer": "0.1.5", 206 | "blob": "0.0.4", 207 | "has-binary2": "1.0.2" 208 | } 209 | }, 210 | "escape-html": { 211 | "version": "1.0.3", 212 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 213 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" 214 | }, 215 | "etag": { 216 | "version": "1.8.1", 217 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", 218 | "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" 219 | }, 220 | "express": { 221 | "version": "4.15.2", 222 | "resolved": "https://registry.npmjs.org/express/-/express-4.15.2.tgz", 223 | "integrity": "sha1-rxB/wUhQRFfy3Kmm8lcdcSm5ezU=", 224 | "requires": { 225 | "accepts": "1.3.5", 226 | "array-flatten": "1.1.1", 227 | "content-disposition": "0.5.2", 228 | "content-type": "1.0.4", 229 | "cookie": "0.3.1", 230 | "cookie-signature": "1.0.6", 231 | "debug": "2.6.1", 232 | "depd": "1.1.2", 233 | "encodeurl": "1.0.2", 234 | "escape-html": "1.0.3", 235 | "etag": "1.8.1", 236 | "finalhandler": "1.0.6", 237 | "fresh": "0.5.0", 238 | "merge-descriptors": "1.0.1", 239 | "methods": "1.1.2", 240 | "on-finished": "2.3.0", 241 | "parseurl": "1.3.2", 242 | "path-to-regexp": "0.1.7", 243 | "proxy-addr": "1.1.5", 244 | "qs": "6.4.0", 245 | "range-parser": "1.2.0", 246 | "send": "0.15.1", 247 | "serve-static": "1.12.1", 248 | "setprototypeof": "1.0.3", 249 | "statuses": "1.3.1", 250 | "type-is": "1.6.16", 251 | "utils-merge": "1.0.0", 252 | "vary": "1.1.2" 253 | } 254 | }, 255 | "finalhandler": { 256 | "version": "1.0.6", 257 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.0.6.tgz", 258 | "integrity": "sha1-AHrqM9Gk0+QgF/YkhIrVjSEvgU8=", 259 | "requires": { 260 | "debug": "2.6.9", 261 | "encodeurl": "1.0.2", 262 | "escape-html": "1.0.3", 263 | "on-finished": "2.3.0", 264 | "parseurl": "1.3.2", 265 | "statuses": "1.3.1", 266 | "unpipe": "1.0.0" 267 | }, 268 | "dependencies": { 269 | "debug": { 270 | "version": "2.6.9", 271 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 272 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 273 | "requires": { 274 | "ms": "2.0.0" 275 | } 276 | }, 277 | "ms": { 278 | "version": "2.0.0", 279 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 280 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 281 | } 282 | } 283 | }, 284 | "forwarded": { 285 | "version": "0.1.2", 286 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", 287 | "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" 288 | }, 289 | "fresh": { 290 | "version": "0.5.0", 291 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.0.tgz", 292 | "integrity": "sha1-9HTKXmqSRtb9jglTz6m5yAWvp44=" 293 | }, 294 | "has-binary2": { 295 | "version": "1.0.2", 296 | "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.2.tgz", 297 | "integrity": "sha1-6D26SfC5vk0CbSc2U1DZ8D9Uvpg=", 298 | "requires": { 299 | "isarray": "2.0.1" 300 | } 301 | }, 302 | "has-cors": { 303 | "version": "1.1.0", 304 | "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", 305 | "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=" 306 | }, 307 | "http-errors": { 308 | "version": "1.6.3", 309 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", 310 | "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", 311 | "requires": { 312 | "depd": "1.1.2", 313 | "inherits": "2.0.3", 314 | "setprototypeof": "1.1.0", 315 | "statuses": "1.5.0" 316 | }, 317 | "dependencies": { 318 | "setprototypeof": { 319 | "version": "1.1.0", 320 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", 321 | "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" 322 | }, 323 | "statuses": { 324 | "version": "1.5.0", 325 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", 326 | "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" 327 | } 328 | } 329 | }, 330 | "indexof": { 331 | "version": "0.0.1", 332 | "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", 333 | "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" 334 | }, 335 | "inherits": { 336 | "version": "2.0.3", 337 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 338 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 339 | }, 340 | "ipaddr.js": { 341 | "version": "1.4.0", 342 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.4.0.tgz", 343 | "integrity": "sha1-KWrKh4qCGBbluF0KKFqZvP9FgvA=" 344 | }, 345 | "isarray": { 346 | "version": "2.0.1", 347 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", 348 | "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" 349 | }, 350 | "media-typer": { 351 | "version": "0.3.0", 352 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 353 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" 354 | }, 355 | "merge-descriptors": { 356 | "version": "1.0.1", 357 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 358 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" 359 | }, 360 | "methods": { 361 | "version": "1.1.2", 362 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 363 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" 364 | }, 365 | "mime": { 366 | "version": "1.3.4", 367 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz", 368 | "integrity": "sha1-EV+eO2s9rylZmDyzjxSaLUDrXVM=" 369 | }, 370 | "mime-db": { 371 | "version": "1.33.0", 372 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", 373 | "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" 374 | }, 375 | "mime-types": { 376 | "version": "2.1.18", 377 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", 378 | "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", 379 | "requires": { 380 | "mime-db": "1.33.0" 381 | } 382 | }, 383 | "ms": { 384 | "version": "0.7.2", 385 | "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", 386 | "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=" 387 | }, 388 | "negotiator": { 389 | "version": "0.6.1", 390 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", 391 | "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" 392 | }, 393 | "object-component": { 394 | "version": "0.0.3", 395 | "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", 396 | "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=" 397 | }, 398 | "on-finished": { 399 | "version": "2.3.0", 400 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 401 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", 402 | "requires": { 403 | "ee-first": "1.1.1" 404 | } 405 | }, 406 | "parseqs": { 407 | "version": "0.0.5", 408 | "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", 409 | "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", 410 | "requires": { 411 | "better-assert": "1.0.2" 412 | } 413 | }, 414 | "parseuri": { 415 | "version": "0.0.5", 416 | "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", 417 | "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", 418 | "requires": { 419 | "better-assert": "1.0.2" 420 | } 421 | }, 422 | "parseurl": { 423 | "version": "1.3.2", 424 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", 425 | "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" 426 | }, 427 | "path-to-regexp": { 428 | "version": "0.1.7", 429 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 430 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" 431 | }, 432 | "proxy-addr": { 433 | "version": "1.1.5", 434 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-1.1.5.tgz", 435 | "integrity": "sha1-ccDuOxAt4/IC87ZPYI0XP8uhqRg=", 436 | "requires": { 437 | "forwarded": "0.1.2", 438 | "ipaddr.js": "1.4.0" 439 | } 440 | }, 441 | "qs": { 442 | "version": "6.4.0", 443 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", 444 | "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=" 445 | }, 446 | "range-parser": { 447 | "version": "1.2.0", 448 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", 449 | "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" 450 | }, 451 | "safe-buffer": { 452 | "version": "5.1.1", 453 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", 454 | "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" 455 | }, 456 | "send": { 457 | "version": "0.15.1", 458 | "resolved": "https://registry.npmjs.org/send/-/send-0.15.1.tgz", 459 | "integrity": "sha1-igI1TCbm9cynAAZfXwzeupDse18=", 460 | "requires": { 461 | "debug": "2.6.1", 462 | "depd": "1.1.2", 463 | "destroy": "1.0.4", 464 | "encodeurl": "1.0.2", 465 | "escape-html": "1.0.3", 466 | "etag": "1.8.1", 467 | "fresh": "0.5.0", 468 | "http-errors": "1.6.3", 469 | "mime": "1.3.4", 470 | "ms": "0.7.2", 471 | "on-finished": "2.3.0", 472 | "range-parser": "1.2.0", 473 | "statuses": "1.3.1" 474 | } 475 | }, 476 | "serve-static": { 477 | "version": "1.12.1", 478 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.12.1.tgz", 479 | "integrity": "sha1-dEOpZePO1kes61Y5+ga/TRu+ADk=", 480 | "requires": { 481 | "encodeurl": "1.0.2", 482 | "escape-html": "1.0.3", 483 | "parseurl": "1.3.2", 484 | "send": "0.15.1" 485 | } 486 | }, 487 | "setprototypeof": { 488 | "version": "1.0.3", 489 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", 490 | "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" 491 | }, 492 | "socket.io": { 493 | "version": "2.1.0", 494 | "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.1.0.tgz", 495 | "integrity": "sha512-KS+3CNWWNtLbVN5j0/B+1hjxRzey+oTK6ejpAOoxMZis6aXeB8cUtfuvjHl97tuZx+t/qD/VyqFMjuzu2Js6uQ==", 496 | "requires": { 497 | "debug": "3.1.0", 498 | "engine.io": "3.2.0", 499 | "has-binary2": "1.0.2", 500 | "socket.io-adapter": "1.1.1", 501 | "socket.io-client": "2.1.0", 502 | "socket.io-parser": "3.2.0" 503 | }, 504 | "dependencies": { 505 | "debug": { 506 | "version": "3.1.0", 507 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", 508 | "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", 509 | "requires": { 510 | "ms": "2.0.0" 511 | } 512 | }, 513 | "ms": { 514 | "version": "2.0.0", 515 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 516 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 517 | } 518 | } 519 | }, 520 | "socket.io-adapter": { 521 | "version": "1.1.1", 522 | "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-1.1.1.tgz", 523 | "integrity": "sha1-KoBeihTWNyEk3ZFZrUUC+MsH8Gs=" 524 | }, 525 | "socket.io-client": { 526 | "version": "2.1.0", 527 | "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.1.0.tgz", 528 | "integrity": "sha512-TvKPpL0cBON5LduQfR8Rxrr+ktj70bLXGvqHCL3er5avBXruB3gpnbaud5ikFYVfANH1gCABAvo0qN8Axpg2ew==", 529 | "requires": { 530 | "backo2": "1.0.2", 531 | "base64-arraybuffer": "0.1.5", 532 | "component-bind": "1.0.0", 533 | "component-emitter": "1.2.1", 534 | "debug": "3.1.0", 535 | "engine.io-client": "3.2.1", 536 | "has-binary2": "1.0.2", 537 | "has-cors": "1.1.0", 538 | "indexof": "0.0.1", 539 | "object-component": "0.0.3", 540 | "parseqs": "0.0.5", 541 | "parseuri": "0.0.5", 542 | "socket.io-parser": "3.2.0", 543 | "to-array": "0.1.4" 544 | }, 545 | "dependencies": { 546 | "debug": { 547 | "version": "3.1.0", 548 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", 549 | "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", 550 | "requires": { 551 | "ms": "2.0.0" 552 | } 553 | }, 554 | "ms": { 555 | "version": "2.0.0", 556 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 557 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 558 | } 559 | } 560 | }, 561 | "socket.io-parser": { 562 | "version": "3.2.0", 563 | "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.2.0.tgz", 564 | "integrity": "sha512-FYiBx7rc/KORMJlgsXysflWx/RIvtqZbyGLlHZvjfmPTPeuD/I8MaW7cfFrj5tRltICJdgwflhfZ3NVVbVLFQA==", 565 | "requires": { 566 | "component-emitter": "1.2.1", 567 | "debug": "3.1.0", 568 | "isarray": "2.0.1" 569 | }, 570 | "dependencies": { 571 | "debug": { 572 | "version": "3.1.0", 573 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", 574 | "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", 575 | "requires": { 576 | "ms": "2.0.0" 577 | } 578 | }, 579 | "ms": { 580 | "version": "2.0.0", 581 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 582 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 583 | } 584 | } 585 | }, 586 | "statuses": { 587 | "version": "1.3.1", 588 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", 589 | "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" 590 | }, 591 | "to-array": { 592 | "version": "0.1.4", 593 | "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", 594 | "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=" 595 | }, 596 | "type-is": { 597 | "version": "1.6.16", 598 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", 599 | "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", 600 | "requires": { 601 | "media-typer": "0.3.0", 602 | "mime-types": "2.1.18" 603 | } 604 | }, 605 | "ultron": { 606 | "version": "1.1.1", 607 | "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", 608 | "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" 609 | }, 610 | "unpipe": { 611 | "version": "1.0.0", 612 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 613 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" 614 | }, 615 | "utf8": { 616 | "version": "2.1.2", 617 | "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.2.tgz", 618 | "integrity": "sha1-H6DZJw6b6FDZsFAn9jUZv0ZFfZY=" 619 | }, 620 | "utils-merge": { 621 | "version": "1.0.0", 622 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz", 623 | "integrity": "sha1-ApT7kiu5N1FTVBxPcJYjHyh8ivg=" 624 | }, 625 | "vary": { 626 | "version": "1.1.2", 627 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 628 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" 629 | }, 630 | "web3": { 631 | "version": "0.20.1", 632 | "resolved": "https://registry.npmjs.org/web3/-/web3-0.20.1.tgz", 633 | "integrity": "sha1-+yYumtcVUhZ6avAS/dQg3gFwMvA=", 634 | "requires": { 635 | "bignumber.js": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934", 636 | "crypto-js": "3.1.8", 637 | "utf8": "2.1.2", 638 | "xhr2": "0.1.4", 639 | "xmlhttprequest": "1.8.0" 640 | }, 641 | "dependencies": { 642 | "bignumber.js": { 643 | "version": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934" 644 | } 645 | } 646 | }, 647 | "ws": { 648 | "version": "3.3.3", 649 | "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", 650 | "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", 651 | "requires": { 652 | "async-limiter": "1.0.0", 653 | "safe-buffer": "5.1.1", 654 | "ultron": "1.1.1" 655 | } 656 | }, 657 | "xhr2": { 658 | "version": "0.1.4", 659 | "resolved": "https://registry.npmjs.org/xhr2/-/xhr2-0.1.4.tgz", 660 | "integrity": "sha1-f4dliEdxbbUCYyOBL4GMras4el8=" 661 | }, 662 | "xmlhttprequest": { 663 | "version": "1.8.0", 664 | "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", 665 | "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=" 666 | }, 667 | "xmlhttprequest-ssl": { 668 | "version": "1.5.5", 669 | "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", 670 | "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=" 671 | }, 672 | "yeast": { 673 | "version": "0.1.2", 674 | "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", 675 | "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=" 676 | } 677 | } 678 | } 679 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "MindMath-game", 3 | "version": "0.0.1", 4 | "description": "MindMath game using etherium contracts", 5 | "dependencies": { 6 | "express": "^4.15.2", 7 | "socket.io": "^2.1.0", 8 | "web3": "^0.20.1" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 38 | 39 | 40 | 41 |
42 |

Mind Math game, lets 'Solve AI or Die Trying!'

43 | 44 |

Instructions: The goal of the game is to accumulate 1000000 score by answering simple math questions. 45 | Player is presented with two randomly generated numbers if player guess the number within the time limit wins score reward. If player don't guess will loose reward and score will decrease. 46 | If time is over and player can't guess reward will be removed from the score and user will be present with new challenge. 47 |
User win the game if it reaches score 1000000. 48 |

49 | PowerUps - Accumulate score points and you can click on Power Up to buy it. This will increase reward and potential loose. 50 | When buying power up complexity of questions increases. 51 | 52 |
Hint - 0 is correct answer. 53 |

54 | 55 | 56 | 57 | 58 |
59 |
Time: 12s
60 | 63 |
64 |
65 |
Prize: 1 66 |
What is the sum of 67 |
1+3= 68 |
69 | 70 | 71 | 72 | 73 |
74 |
75 |
76 |
Power Up 77 |
Mind Math token1xMind Math token 78 |
Mind Math token10xMind Math token 79 |
Mind Math token100xMind Math token 80 |
Mind Math token1000xMind Math token 81 |
Mind Math token10000xMind Math token 82 |
Mind Math token100000xMind Math token 83 |
84 |
85 |
86 | 343 | 344 | -------------------------------------------------------------------------------- /public/mindmath_token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llSourcell/MindMathGame/0acabde219569ae083c8ccb2df9297c7cb415ee3/public/mindmath_token.png -------------------------------------------------------------------------------- /public/sound_loose.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llSourcell/MindMathGame/0acabde219569ae083c8ccb2df9297c7cb415ee3/public/sound_loose.wav -------------------------------------------------------------------------------- /public/sound_win.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llSourcell/MindMathGame/0acabde219569ae083c8ccb2df9297c7cb415ee3/public/sound_win.wav -------------------------------------------------------------------------------- /public/web3.min.js: -------------------------------------------------------------------------------- 1 | require=function t(e,n,r){function o(a,s){if(!n[a]){if(!e[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var f=n[a]={exports:{}};e[a][0].call(f.exports,function(t){var n=e[a][1][t];return o(n||t)},f,f.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a2&&"0x"===t.substr(0,2)&&(t=t.substr(2)),t=r.enc.Hex.parse(t)),o(t,{outputLength:256}).toString()}},{"crypto-js":58,"crypto-js/sha3":79}],20:[function(t,e,n){var r=t("bignumber.js"),o=t("./sha3.js"),i=t("utf8"),a={noether:"0",wei:"1",kwei:"1000",Kwei:"1000",babbage:"1000",femtoether:"1000",mwei:"1000000",Mwei:"1000000",lovelace:"1000000",picoether:"1000000",gwei:"1000000000",Gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"},s=function(t,e,n){return new Array(e-t.length+1).join(n||"0")+t},c=function(t){t=i.encode(t);for(var e="",n=0;n7&&t[n].toUpperCase()!==t[n]||parseInt(e[n],16)<=7&&t[n].toLowerCase()!==t[n])return!1;return!0},y=function(t){return t instanceof r||t&&t.constructor&&"BigNumber"===t.constructor.name},g=function(t){return"string"==typeof t||t&&t.constructor&&"String"===t.constructor.name},v=function(t){return"boolean"==typeof t};e.exports={padLeft:s,padRight:function(t,e,n){return t+new Array(e-t.length+1).join(n||"0")},toHex:l,toDecimal:function(t){return h(t).toNumber()},fromDecimal:f,toUtf8:function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);n7?n+=t[r].toUpperCase():n+=t[r];return n},isFunction:function(t){return"function"==typeof t},isString:g,isObject:function(t){return null!==t&&!(t instanceof Array)&&"object"==typeof t},isBoolean:v,isArray:function(t){return t instanceof Array},isJson:function(t){try{return!!JSON.parse(t)}catch(t){return!1}},isBloom:function(t){return!(!/^(0x)?[0-9a-f]{512}$/i.test(t)||!/^(0x)?[0-9a-f]{512}$/.test(t)&&!/^(0x)?[0-9A-F]{512}$/.test(t))},isTopic:function(t){return!(!/^(0x)?[0-9a-f]{64}$/i.test(t)||!/^(0x)?[0-9a-f]{64}$/.test(t)&&!/^(0x)?[0-9A-F]{64}$/.test(t))}}},{"./sha3.js":19,"bignumber.js":"bignumber.js",utf8:84}],21:[function(t,e,n){e.exports={version:"0.20.1"}},{}],22:[function(t,e,n){function r(t){this._requestManager=new o(t),this.currentProvider=t,this.eth=new a(this),this.db=new s(this),this.shh=new c(this),this.net=new u(this),this.personal=new f(this),this.bzz=new l(this),this.settings=new p,this.version={api:h.version},this.providers={HttpProvider:b,IpcProvider:_},this._extend=y(this),this._extend({properties:x()})}var o=t("./web3/requestmanager"),i=t("./web3/iban"),a=t("./web3/methods/eth"),s=t("./web3/methods/db"),c=t("./web3/methods/shh"),u=t("./web3/methods/net"),f=t("./web3/methods/personal"),l=t("./web3/methods/swarm"),p=t("./web3/settings"),h=t("./version.json"),d=t("./utils/utils"),m=t("./utils/sha3"),y=t("./web3/extend"),g=t("./web3/batch"),v=t("./web3/property"),b=t("./web3/httpprovider"),_=t("./web3/ipcprovider"),w=t("bignumber.js");r.providers={HttpProvider:b,IpcProvider:_},r.prototype.setProvider=function(t){this._requestManager.setProvider(t),this.currentProvider=t},r.prototype.reset=function(t){this._requestManager.reset(t),this.settings=new p},r.prototype.BigNumber=w,r.prototype.toHex=d.toHex,r.prototype.toAscii=d.toAscii,r.prototype.toUtf8=d.toUtf8,r.prototype.fromAscii=d.fromAscii,r.prototype.fromUtf8=d.fromUtf8,r.prototype.toDecimal=d.toDecimal,r.prototype.fromDecimal=d.fromDecimal,r.prototype.toBigNumber=d.toBigNumber,r.prototype.toWei=d.toWei,r.prototype.fromWei=d.fromWei,r.prototype.isAddress=d.isAddress,r.prototype.isChecksumAddress=d.isChecksumAddress,r.prototype.toChecksumAddress=d.toChecksumAddress,r.prototype.isIBAN=d.isIBAN,r.prototype.padLeft=d.padLeft,r.prototype.padRight=d.padRight,r.prototype.sha3=function(t,e){return"0x"+m(t,e)},r.prototype.fromICAP=function(t){return new i(t).address()};var x=function(){return[new v({name:"version.node",getter:"web3_clientVersion"}),new v({name:"version.network",getter:"net_version",inputFormatter:d.toDecimal}),new v({name:"version.ethereum",getter:"eth_protocolVersion",inputFormatter:d.toDecimal}),new v({name:"version.whisper",getter:"shh_version",inputFormatter:d.toDecimal})]};r.prototype.isConnected=function(){return this.currentProvider&&this.currentProvider.isConnected()},r.prototype.createBatch=function(){return new g(this)},e.exports=r},{"./utils/sha3":19,"./utils/utils":20,"./version.json":21,"./web3/batch":24,"./web3/extend":28,"./web3/httpprovider":32,"./web3/iban":33,"./web3/ipcprovider":34,"./web3/methods/db":37,"./web3/methods/eth":38,"./web3/methods/net":39,"./web3/methods/personal":40,"./web3/methods/shh":41,"./web3/methods/swarm":42,"./web3/property":45,"./web3/requestmanager":46,"./web3/settings":47,"bignumber.js":"bignumber.js"}],23:[function(t,e,n){var r=t("../utils/sha3"),o=t("./event"),i=t("./formatters"),a=t("../utils/utils"),s=t("./filter"),c=t("./methods/watches"),u=function(t,e,n){this._requestManager=t,this._json=e,this._address=n};u.prototype.encode=function(t){t=t||{};var e={};return["fromBlock","toBlock"].filter(function(e){return void 0!==t[e]}).forEach(function(n){e[n]=i.inputBlockNumberFormatter(t[n])}),e.address=this._address,e},u.prototype.decode=function(t){t.data=t.data||"",t.topics=t.topics||[];var e=t.topics[0].slice(2),n=this._json.filter(function(t){return e===r(a.transformToFullName(t))})[0];return n?new o(this._requestManager,n,this._address).decode(t):(console.warn("cannot find event for log"),t)},u.prototype.execute=function(t,e){a.isFunction(arguments[arguments.length-1])&&(e=arguments[arguments.length-1],1===arguments.length&&(t=null));var n=this.encode(t),r=this.decode.bind(this);return new s(n,"eth",this._requestManager,c.eth(),r,e)},u.prototype.attachToContract=function(t){var e=this.execute.bind(this);t.allEvents=e},e.exports=u},{"../utils/sha3":19,"../utils/utils":20,"./event":27,"./filter":29,"./formatters":30,"./methods/watches":43}],24:[function(t,e,n){var r=t("./jsonrpc"),o=t("./errors"),i=function(t){this.requestManager=t._requestManager,this.requests=[]};i.prototype.add=function(t){this.requests.push(t)},i.prototype.execute=function(){var t=this.requests;this.requestManager.sendBatch(t,function(e,n){n=n||[],t.map(function(t,e){return n[e]||{}}).forEach(function(e,n){if(t[n].callback){if(!r.isValidResponse(e))return t[n].callback(o.InvalidResponse(e));t[n].callback(null,t[n].format?t[n].format(e.result):e.result)}})})},e.exports=i},{"./errors":26,"./jsonrpc":35}],25:[function(t,e,n){var r=t("../utils/utils"),o=t("../solidity/coder"),i=t("./event"),a=t("./function"),s=t("./allevents"),c=function(t,e){return t.filter(function(t){return"constructor"===t.type&&t.inputs.length===e.length}).map(function(t){return t.inputs.map(function(t){return t.type})}).map(function(t){return o.encodeParams(t,e)})[0]||""},u=function(t){t.abi.filter(function(t){return"function"===t.type}).map(function(e){return new a(t._eth,e,t.address)}).forEach(function(e){e.attachToContract(t)})},f=function(t){var e=t.abi.filter(function(t){return"event"===t.type});new s(t._eth._requestManager,e,t.address).attachToContract(t),e.map(function(e){return new i(t._eth._requestManager,e,t.address)}).forEach(function(e){e.attachToContract(t)})},l=function(t,e){var n=0,r=!1,o=t._eth.filter("latest",function(i){if(!i&&!r)if(++n>50){if(o.stopWatching(function(){}),r=!0,!e)throw new Error("Contract transaction couldn't be found after 50 blocks");e(new Error("Contract transaction couldn't be found after 50 blocks"))}else t._eth.getTransactionReceipt(t.transactionHash,function(n,i){i&&!r&&t._eth.getCode(i.contractAddress,function(n,a){if(!r&&a)if(o.stopWatching(function(){}),r=!0,a.length>3)t.address=i.contractAddress,u(t),f(t),e&&e(null,t);else{if(!e)throw new Error("The contract code couldn't be stored, please check your gas amount.");e(new Error("The contract code couldn't be stored, please check your gas amount."))}})})})},p=function(t,e){this.eth=t,this.abi=e,this.new=function(){var t,n=new h(this.eth,this.abi),o={},i=Array.prototype.slice.call(arguments);r.isFunction(i[i.length-1])&&(t=i.pop());var a=i[i.length-1];if(r.isObject(a)&&!r.isArray(a)&&(o=i.pop()),o.value>0&&!(e.filter(function(t){return"constructor"===t.type&&t.inputs.length===i.length})[0]||{}).payable)throw new Error("Cannot send value to non-payable constructor");var s=c(this.abi,i);if(o.data+=s,t)this.eth.sendTransaction(o,function(e,r){e?t(e):(n.transactionHash=r,t(null,n),l(n,t))});else{var u=this.eth.sendTransaction(o);n.transactionHash=u,l(n)}return n},this.new.getData=this.getData.bind(this)};p.prototype.at=function(t,e){var n=new h(this.eth,this.abi,t);return u(n),f(n),e&&e(null,n),n},p.prototype.getData=function(){var t={},e=Array.prototype.slice.call(arguments),n=e[e.length-1];r.isObject(n)&&!r.isArray(n)&&(t=e.pop());var o=c(this.abi,e);return t.data+=o,t.data};var h=function(t,e,n){this._eth=t,this.transactionHash=null,this.address=n,this.abi=e};e.exports=p},{"../solidity/coder":7,"../utils/utils":20,"./allevents":23,"./event":27,"./function":31}],26:[function(t,e,n){e.exports={InvalidNumberOfSolidityArgs:function(){return new Error("Invalid number of arguments to Solidity function")},InvalidNumberOfRPCParams:function(){return new Error("Invalid number of input parameters to RPC method")},InvalidConnection:function(t){return new Error("CONNECTION ERROR: Couldn't connect to node "+t+".")},InvalidProvider:function(){return new Error("Provider not set or invalid")},InvalidResponse:function(t){var e=t&&t.error&&t.error.message?t.error.message:"Invalid JSON RPC response: "+JSON.stringify(t);return new Error(e)},ConnectionTimeout:function(t){return new Error("CONNECTION TIMEOUT: timeout of "+t+" ms achived")}}},{}],27:[function(t,e,n){var r=t("../utils/utils"),o=t("../solidity/coder"),i=t("./formatters"),a=t("../utils/sha3"),s=t("./filter"),c=t("./methods/watches"),u=function(t,e,n){this._requestManager=t,this._params=e.inputs,this._name=r.transformToFullName(e),this._address=n,this._anonymous=e.anonymous};u.prototype.types=function(t){return this._params.filter(function(e){return e.indexed===t}).map(function(t){return t.type})},u.prototype.displayName=function(){return r.extractDisplayName(this._name)},u.prototype.typeName=function(){return r.extractTypeName(this._name)},u.prototype.signature=function(){return a(this._name)},u.prototype.encode=function(t,e){t=t||{},e=e||{};var n={};["fromBlock","toBlock"].filter(function(t){return void 0!==e[t]}).forEach(function(t){n[t]=i.inputBlockNumberFormatter(e[t])}),n.topics=[],n.address=this._address,this._anonymous||n.topics.push("0x"+this.signature());var a=this._params.filter(function(t){return!0===t.indexed}).map(function(e){var n=t[e.name];return void 0===n||null===n?null:r.isArray(n)?n.map(function(t){return"0x"+o.encodeParam(e.type,t)}):"0x"+o.encodeParam(e.type,n)});return n.topics=n.topics.concat(a),n},u.prototype.decode=function(t){t.data=t.data||"",t.topics=t.topics||[];var e=(this._anonymous?t.topics:t.topics.slice(1)).map(function(t){return t.slice(2)}).join(""),n=o.decodeParams(this.types(!0),e),r=t.data.slice(2),a=o.decodeParams(this.types(!1),r),s=i.outputLogFormatter(t);return s.event=this.displayName(),s.address=t.address,s.args=this._params.reduce(function(t,e){return t[e.name]=e.indexed?n.shift():a.shift(),t},{}),delete s.data,delete s.topics,s},u.prototype.execute=function(t,e,n){r.isFunction(arguments[arguments.length-1])&&(n=arguments[arguments.length-1],2===arguments.length&&(e=null),1===arguments.length&&(e=null,t={}));var o=this.encode(t,e),i=this.decode.bind(this);return new s(o,"eth",this._requestManager,c.eth(),i,n)},u.prototype.attachToContract=function(t){var e=this.execute.bind(this),n=this.displayName();t[n]||(t[n]=e),t[n][this.typeName()]=this.execute.bind(this,t)},e.exports=u},{"../solidity/coder":7,"../utils/sha3":19,"../utils/utils":20,"./filter":29,"./formatters":30,"./methods/watches":43}],28:[function(t,e,n){var r=t("./formatters"),o=t("./../utils/utils"),i=t("./method"),a=t("./property");e.exports=function(t){var e=function(e){var n;e.property?(t[e.property]||(t[e.property]={}),n=t[e.property]):n=t,e.methods&&e.methods.forEach(function(e){e.attachToObject(n),e.setRequestManager(t._requestManager)}),e.properties&&e.properties.forEach(function(e){e.attachToObject(n),e.setRequestManager(t._requestManager)})};return e.formatters=r,e.utils=o,e.Method=i,e.Property=a,e}},{"./../utils/utils":20,"./formatters":30,"./method":36,"./property":45}],29:[function(t,e,n){var r=t("./formatters"),o=t("../utils/utils"),i=function(t){return null===t||void 0===t?null:0===(t=String(t)).indexOf("0x")?t:o.fromUtf8(t)},a=function(t,e){if(o.isString(t))return t;switch(t=t||{},e){case"eth":return t.topics=t.topics||[],t.topics=t.topics.map(function(t){return o.isArray(t)?t.map(i):i(t)}),{topics:t.topics,from:t.from,to:t.to,address:t.address,fromBlock:r.inputBlockNumberFormatter(t.fromBlock),toBlock:r.inputBlockNumberFormatter(t.toBlock)};case"shh":return t}},s=function(t,e){o.isString(t.options)||t.get(function(t,n){t&&e(t),o.isArray(n)&&n.forEach(function(t){e(null,t)})})},c=function(t){t.requestManager.startPolling({method:t.implementation.poll.call,params:[t.filterId]},t.filterId,function(e,n){if(e)return t.callbacks.forEach(function(t){t(e)});o.isArray(n)&&n.forEach(function(e){e=t.formatter?t.formatter(e):e,t.callbacks.forEach(function(t){t(null,e)})})},t.stopWatching.bind(t))},u=function(t,e,n,r,o,i,u){var f=this,l={};return r.forEach(function(t){t.setRequestManager(n),t.attachToObject(l)}),this.requestManager=n,this.options=a(t,e),this.implementation=l,this.filterId=null,this.callbacks=[],this.getLogsCallbacks=[],this.pollFilters=[],this.formatter=o,this.implementation.newFilter(this.options,function(t,e){if(t)f.callbacks.forEach(function(e){e(t)}),"function"==typeof u&&u(t);else if(f.filterId=e,f.getLogsCallbacks.forEach(function(t){f.get(t)}),f.getLogsCallbacks=[],f.callbacks.forEach(function(t){s(f,t)}),f.callbacks.length>0&&c(f),"function"==typeof i)return f.watch(i)}),this};u.prototype.watch=function(t){return this.callbacks.push(t),this.filterId&&(s(this,t),c(this)),this},u.prototype.stopWatching=function(t){if(this.requestManager.stopPolling(this.filterId),this.callbacks=[],!t)return this.implementation.uninstallFilter(this.filterId);this.implementation.uninstallFilter(this.filterId,t)},u.prototype.get=function(t){var e=this;if(!o.isFunction(t)){if(null===this.filterId)throw new Error("Filter ID Error: filter().get() can't be chained synchronous, please provide a callback for the get() method.");return this.implementation.getLogs(this.filterId).map(function(t){return e.formatter?e.formatter(t):t})}return null===this.filterId?this.getLogsCallbacks.push(t):this.implementation.getLogs(this.filterId,function(n,r){n?t(n):t(null,r.map(function(t){return e.formatter?e.formatter(t):t}))}),this},e.exports=u},{"../utils/utils":20,"./formatters":30}],30:[function(t,e,n){"use strict";var r=t("../utils/utils"),o=t("../utils/config"),i=t("./iban"),a=function(t){return"latest"===t||"pending"===t||"earliest"===t},s=function(t){if(void 0!==t)return a(t)?t:r.toHex(t)},c=function(t){return null!==t.blockNumber&&(t.blockNumber=r.toDecimal(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=r.toDecimal(t.transactionIndex)),t.nonce=r.toDecimal(t.nonce),t.gas=r.toDecimal(t.gas),t.gasPrice=r.toBigNumber(t.gasPrice),t.value=r.toBigNumber(t.value),t},u=function(t){return t.blockNumber&&(t.blockNumber=r.toDecimal(t.blockNumber)),t.transactionIndex&&(t.transactionIndex=r.toDecimal(t.transactionIndex)),t.logIndex&&(t.logIndex=r.toDecimal(t.logIndex)),t},f=function(t){var e=new i(t);if(e.isValid()&&e.isDirect())return"0x"+e.address();if(r.isStrictAddress(t))return t;if(r.isAddress(t))return"0x"+t;throw new Error("invalid address")};e.exports={inputDefaultBlockNumberFormatter:function(t){return void 0===t?o.defaultBlock:s(t)},inputBlockNumberFormatter:s,inputCallFormatter:function(t){return t.from=t.from||o.defaultAccount,t.from&&(t.from=f(t.from)),t.to&&(t.to=f(t.to)),["gasPrice","gas","value","nonce"].filter(function(e){return void 0!==t[e]}).forEach(function(e){t[e]=r.fromDecimal(t[e])}),t},inputTransactionFormatter:function(t){return t.from=t.from||o.defaultAccount,t.from=f(t.from),t.to&&(t.to=f(t.to)),["gasPrice","gas","value","nonce"].filter(function(e){return void 0!==t[e]}).forEach(function(e){t[e]=r.fromDecimal(t[e])}),t},inputAddressFormatter:f,inputPostFormatter:function(t){return t.ttl=r.fromDecimal(t.ttl),t.workToProve=r.fromDecimal(t.workToProve),t.priority=r.fromDecimal(t.priority),r.isArray(t.topics)||(t.topics=t.topics?[t.topics]:[]),t.topics=t.topics.map(function(t){return 0===t.indexOf("0x")?t:r.fromUtf8(t)}),t},outputBigNumberFormatter:function(t){return r.toBigNumber(t)},outputTransactionFormatter:c,outputTransactionReceiptFormatter:function(t){return null!==t.blockNumber&&(t.blockNumber=r.toDecimal(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=r.toDecimal(t.transactionIndex)),t.cumulativeGasUsed=r.toDecimal(t.cumulativeGasUsed),t.gasUsed=r.toDecimal(t.gasUsed),r.isArray(t.logs)&&(t.logs=t.logs.map(function(t){return u(t)})),t},outputBlockFormatter:function(t){return t.gasLimit=r.toDecimal(t.gasLimit),t.gasUsed=r.toDecimal(t.gasUsed),t.size=r.toDecimal(t.size),t.timestamp=r.toDecimal(t.timestamp),null!==t.number&&(t.number=r.toDecimal(t.number)),t.difficulty=r.toBigNumber(t.difficulty),t.totalDifficulty=r.toBigNumber(t.totalDifficulty),r.isArray(t.transactions)&&t.transactions.forEach(function(t){if(!r.isString(t))return c(t)}),t},outputLogFormatter:u,outputPostFormatter:function(t){return t.expiry=r.toDecimal(t.expiry),t.sent=r.toDecimal(t.sent),t.ttl=r.toDecimal(t.ttl),t.workProved=r.toDecimal(t.workProved),t.topics||(t.topics=[]),t.topics=t.topics.map(function(t){return r.toAscii(t)}),t},outputSyncingFormatter:function(t){return t?(t.startingBlock=r.toDecimal(t.startingBlock),t.currentBlock=r.toDecimal(t.currentBlock),t.highestBlock=r.toDecimal(t.highestBlock),t.knownStates&&(t.knownStates=r.toDecimal(t.knownStates),t.pulledStates=r.toDecimal(t.pulledStates)),t):t}}},{"../utils/config":18,"../utils/utils":20,"./iban":33}],31:[function(t,e,n){var r=t("../solidity/coder"),o=t("../utils/utils"),i=t("./errors"),a=t("./formatters"),s=t("../utils/sha3"),c=function(t,e,n){this._eth=t,this._inputTypes=e.inputs.map(function(t){return t.type}),this._outputTypes=e.outputs.map(function(t){return t.type}),this._constant=e.constant,this._payable=e.payable,this._name=o.transformToFullName(e),this._address=n};c.prototype.extractCallback=function(t){if(o.isFunction(t[t.length-1]))return t.pop()},c.prototype.extractDefaultBlock=function(t){if(t.length>this._inputTypes.length&&!o.isObject(t[t.length-1]))return a.inputDefaultBlockNumberFormatter(t.pop())},c.prototype.validateArgs=function(t){if(t.filter(function(t){return!(!0===o.isObject(t)&&!1===o.isArray(t)&&!1===o.isBigNumber(t))}).length!==this._inputTypes.length)throw i.InvalidNumberOfSolidityArgs()},c.prototype.toPayload=function(t){var e={};return t.length>this._inputTypes.length&&o.isObject(t[t.length-1])&&(e=t[t.length-1]),this.validateArgs(t),e.to=this._address,e.data="0x"+this.signature()+r.encodeParams(this._inputTypes,t),e},c.prototype.signature=function(){return s(this._name).slice(0,8)},c.prototype.unpackOutput=function(t){if(t){t=t.length>=2?t.slice(2):t;var e=r.decodeParams(this._outputTypes,t);return 1===e.length?e[0]:e}},c.prototype.call=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.extractDefaultBlock(t),r=this.toPayload(t);if(!e){var o=this._eth.call(r,n);return this.unpackOutput(o)}var i=this;this._eth.call(r,n,function(t,n){if(t)return e(t,null);var r=null;try{r=i.unpackOutput(n)}catch(e){t=e}e(t,r)})},c.prototype.sendTransaction=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.toPayload(t);if(n.value>0&&!this._payable)throw new Error("Cannot send value to non-payable function");if(!e)return this._eth.sendTransaction(n);this._eth.sendTransaction(n,e)},c.prototype.estimateGas=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t);if(!e)return this._eth.estimateGas(n);this._eth.estimateGas(n,e)},c.prototype.getData=function(){var t=Array.prototype.slice.call(arguments);return this.toPayload(t).data},c.prototype.displayName=function(){return o.extractDisplayName(this._name)},c.prototype.typeName=function(){return o.extractTypeName(this._name)},c.prototype.request=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t),r=this.unpackOutput.bind(this);return{method:this._constant?"eth_call":"eth_sendTransaction",callback:e,params:[n],format:r}},c.prototype.execute=function(){return!this._constant?this.sendTransaction.apply(this,Array.prototype.slice.call(arguments)):this.call.apply(this,Array.prototype.slice.call(arguments))},c.prototype.attachToContract=function(t){var e=this.execute.bind(this);e.request=this.request.bind(this),e.call=this.call.bind(this),e.sendTransaction=this.sendTransaction.bind(this),e.estimateGas=this.estimateGas.bind(this),e.getData=this.getData.bind(this);var n=this.displayName();t[n]||(t[n]=e),t[n][this.typeName()]=e},e.exports=c},{"../solidity/coder":7,"../utils/sha3":19,"../utils/utils":20,"./errors":26,"./formatters":30}],32:[function(t,e,n){var r=t("./errors");"undefined"!=typeof window&&window.XMLHttpRequest?XMLHttpRequest=window.XMLHttpRequest:XMLHttpRequest=t("xmlhttprequest").XMLHttpRequest;var o=t("xhr2"),i=function(t,e,n,r){this.host=t||"http://localhost:8545",this.timeout=e||0,this.user=n,this.password=r};i.prototype.prepareRequest=function(t){var e;if(t?(e=new o).timeout=this.timeout:e=new XMLHttpRequest,e.open("POST",this.host,t),this.user&&this.password){var n="Basic "+new Buffer(this.user+":"+this.password).toString("base64");e.setRequestHeader("Authorization",n)}return e.setRequestHeader("Content-Type","application/json"),e},i.prototype.send=function(t){var e=this.prepareRequest(!1);try{e.send(JSON.stringify(t))}catch(t){throw r.InvalidConnection(this.host)}var n=e.responseText;try{n=JSON.parse(n)}catch(t){throw r.InvalidResponse(e.responseText)}return n},i.prototype.sendAsync=function(t,e){var n=this.prepareRequest(!0);n.onreadystatechange=function(){if(4===n.readyState&&1!==n.timeout){var t=n.responseText,o=null;try{t=JSON.parse(t)}catch(t){o=r.InvalidResponse(n.responseText)}e(o,t)}},n.ontimeout=function(){e(r.ConnectionTimeout(this.timeout))};try{n.send(JSON.stringify(t))}catch(t){e(r.InvalidConnection(this.host))}},i.prototype.isConnected=function(){try{return this.send({id:9999999999,jsonrpc:"2.0",method:"net_listening",params:[]}),!0}catch(t){return!1}},e.exports=i},{"./errors":26,xhr2:85,xmlhttprequest:17}],33:[function(t,e,n){var r=t("bignumber.js"),o=function(t,e){for(var n=t;n.length<2*e;)n="0"+n;return n},i=function(t){var e="A".charCodeAt(0),n="Z".charCodeAt(0);return t=t.toUpperCase(),(t=t.substr(4)+t.substr(0,4)).split("").map(function(t){var r=t.charCodeAt(0);return r>=e&&r<=n?r-e+10:t}).join("")},a=function(t){for(var e,n=t;n.length>2;)e=n.slice(0,9),n=parseInt(e,10)%97+n.slice(e.length);return parseInt(n,10)%97},s=function(t){this._iban=t};s.fromAddress=function(t){var e=new r(t,16).toString(36),n=o(e,15);return s.fromBban(n.toUpperCase())},s.fromBban=function(t){var e=("0"+(98-a(i("XE00"+t)))).slice(-2);return new s("XE"+e+t)},s.createIndirect=function(t){return s.fromBban("ETH"+t.institution+t.identifier)},s.isValid=function(t){return new s(t).isValid()},s.prototype.isValid=function(){return/^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(this._iban)&&1===a(i(this._iban))},s.prototype.isDirect=function(){return 34===this._iban.length||35===this._iban.length},s.prototype.isIndirect=function(){return 20===this._iban.length},s.prototype.checksum=function(){return this._iban.substr(2,2)},s.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},s.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},s.prototype.address=function(){if(this.isDirect()){var t=this._iban.substr(4),e=new r(t,36);return o(e.toString(16),20)}return""},s.prototype.toString=function(){return this._iban},e.exports=s},{"bignumber.js":"bignumber.js"}],34:[function(t,e,n){"use strict";var r=t("../utils/utils"),o=t("./errors"),i=function(t,e){var n=this;this.responseCallbacks={},this.path=t,this.connection=e.connect({path:this.path}),this.connection.on("error",function(t){console.error("IPC Connection Error",t),n._timeout()}),this.connection.on("end",function(){n._timeout()}),this.connection.on("data",function(t){n._parseResponse(t.toString()).forEach(function(t){var e=null;r.isArray(t)?t.forEach(function(t){n.responseCallbacks[t.id]&&(e=t.id)}):e=t.id,n.responseCallbacks[e]&&(n.responseCallbacks[e](null,t),delete n.responseCallbacks[e])})})};i.prototype._parseResponse=function(t){var e=this,n=[];return t.replace(/\}[\n\r]?\{/g,"}|--|{").replace(/\}\][\n\r]?\[\{/g,"}]|--|[{").replace(/\}[\n\r]?\[\{/g,"}|--|[{").replace(/\}\][\n\r]?\{/g,"}]|--|{").split("|--|").forEach(function(t){e.lastChunk&&(t=e.lastChunk+t);var r=null;try{r=JSON.parse(t)}catch(n){return e.lastChunk=t,clearTimeout(e.lastChunkTimeout),void(e.lastChunkTimeout=setTimeout(function(){throw e._timeout(),o.InvalidResponse(t)},15e3))}clearTimeout(e.lastChunkTimeout),e.lastChunk=null,r&&n.push(r)}),n},i.prototype._addResponseCallback=function(t,e){var n=t.id||t[0].id,r=t.method||t[0].method;this.responseCallbacks[n]=e,this.responseCallbacks[n].method=r},i.prototype._timeout=function(){for(var t in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(t)&&(this.responseCallbacks[t](o.InvalidConnection("on IPC")),delete this.responseCallbacks[t])},i.prototype.isConnected=function(){var t=this;return t.connection.writable||t.connection.connect({path:t.path}),!!this.connection.writable},i.prototype.send=function(t){if(this.connection.writeSync){var e;this.connection.writable||this.connection.connect({path:this.path});var n=this.connection.writeSync(JSON.stringify(t));try{e=JSON.parse(n)}catch(t){throw o.InvalidResponse(n)}return e}throw new Error('You tried to send "'+t.method+'" synchronously. Synchronous requests are not supported by the IPC provider.')},i.prototype.sendAsync=function(t,e){this.connection.writable||this.connection.connect({path:this.path}),this.connection.write(JSON.stringify(t)),this._addResponseCallback(t,e)},e.exports=i},{"../utils/utils":20,"./errors":26}],35:[function(t,e,n){var r={messageId:0};r.toPayload=function(t,e){return t||console.error("jsonrpc method should be specified!"),r.messageId++,{jsonrpc:"2.0",id:r.messageId,method:t,params:e||[]}},r.isValidResponse=function(t){function e(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeof t.id&&void 0!==t.result}return Array.isArray(t)?t.every(e):e(t)},r.toBatchPayload=function(t){return t.map(function(t){return r.toPayload(t.method,t.params)})},e.exports=r},{}],36:[function(t,e,n){var r=t("../utils/utils"),o=t("./errors"),i=function(t){this.name=t.name,this.call=t.call,this.params=t.params||0,this.inputFormatter=t.inputFormatter,this.outputFormatter=t.outputFormatter,this.requestManager=null};i.prototype.setRequestManager=function(t){this.requestManager=t},i.prototype.getCall=function(t){return r.isFunction(this.call)?this.call(t):this.call},i.prototype.extractCallback=function(t){if(r.isFunction(t[t.length-1]))return t.pop()},i.prototype.validateArgs=function(t){if(t.length!==this.params)throw o.InvalidNumberOfRPCParams()},i.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter.map(function(e,n){return e?e(t[n]):t[n]}):t},i.prototype.formatOutput=function(t){return this.outputFormatter&&t?this.outputFormatter(t):t},i.prototype.toPayload=function(t){var e=this.getCall(t),n=this.extractCallback(t),r=this.formatInput(t);return this.validateArgs(r),{method:e,params:r,callback:n}},i.prototype.attachToObject=function(t){var e=this.buildCall();e.call=this.call;var n=this.name.split(".");n.length>1?(t[n[0]]=t[n[0]]||{},t[n[0]][n[1]]=e):t[n[0]]=e},i.prototype.buildCall=function(){var t=this,e=function(){var e=t.toPayload(Array.prototype.slice.call(arguments));return e.callback?t.requestManager.sendAsync(e,function(n,r){e.callback(n,t.formatOutput(r))}):t.formatOutput(t.requestManager.send(e))};return e.request=this.request.bind(this),e},i.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},e.exports=i},{"../utils/utils":20,"./errors":26}],37:[function(t,e,n){var r=t("../method"),o=function(){return[new r({name:"putString",call:"db_putString",params:3}),new r({name:"getString",call:"db_getString",params:2}),new r({name:"putHex",call:"db_putHex",params:3}),new r({name:"getHex",call:"db_getHex",params:2})]};e.exports=function(t){this._requestManager=t._requestManager;var e=this;o().forEach(function(n){n.attachToObject(e),n.setRequestManager(t._requestManager)})}},{"../method":36}],38:[function(t,e,n){"use strict";function r(t){this._requestManager=t._requestManager;var e=this;w().forEach(function(t){t.attachToObject(e),t.setRequestManager(e._requestManager)}),x().forEach(function(t){t.attachToObject(e),t.setRequestManager(e._requestManager)}),this.iban=d,this.sendIBANTransaction=m.bind(null,this)}var o=t("../formatters"),i=t("../../utils/utils"),a=t("../method"),s=t("../property"),c=t("../../utils/config"),u=t("../contract"),f=t("./watches"),l=t("../filter"),p=t("../syncing"),h=t("../namereg"),d=t("../iban"),m=t("../transfer"),y=function(t){return i.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getBlockByHash":"eth_getBlockByNumber"},g=function(t){return i.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getTransactionByBlockHashAndIndex":"eth_getTransactionByBlockNumberAndIndex"},v=function(t){return i.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getUncleByBlockHashAndIndex":"eth_getUncleByBlockNumberAndIndex"},b=function(t){return i.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getBlockTransactionCountByHash":"eth_getBlockTransactionCountByNumber"},_=function(t){return i.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getUncleCountByBlockHash":"eth_getUncleCountByBlockNumber"};Object.defineProperty(r.prototype,"defaultBlock",{get:function(){return c.defaultBlock},set:function(t){return c.defaultBlock=t,t}}),Object.defineProperty(r.prototype,"defaultAccount",{get:function(){return c.defaultAccount},set:function(t){return c.defaultAccount=t,t}});var w=function(){var t=new a({name:"getBalance",call:"eth_getBalance",params:2,inputFormatter:[o.inputAddressFormatter,o.inputDefaultBlockNumberFormatter],outputFormatter:o.outputBigNumberFormatter}),e=new a({name:"getStorageAt",call:"eth_getStorageAt",params:3,inputFormatter:[null,i.toHex,o.inputDefaultBlockNumberFormatter]}),n=new a({name:"getCode",call:"eth_getCode",params:2,inputFormatter:[o.inputAddressFormatter,o.inputDefaultBlockNumberFormatter]}),r=new a({name:"getBlock",call:y,params:2,inputFormatter:[o.inputBlockNumberFormatter,function(t){return!!t}],outputFormatter:o.outputBlockFormatter}),s=new a({name:"getUncle",call:v,params:2,inputFormatter:[o.inputBlockNumberFormatter,i.toHex],outputFormatter:o.outputBlockFormatter}),c=new a({name:"getCompilers",call:"eth_getCompilers",params:0}),u=new a({name:"getBlockTransactionCount",call:b,params:1,inputFormatter:[o.inputBlockNumberFormatter],outputFormatter:i.toDecimal}),f=new a({name:"getBlockUncleCount",call:_,params:1,inputFormatter:[o.inputBlockNumberFormatter],outputFormatter:i.toDecimal}),l=new a({name:"getTransaction",call:"eth_getTransactionByHash",params:1,outputFormatter:o.outputTransactionFormatter}),p=new a({name:"getTransactionFromBlock",call:g,params:2,inputFormatter:[o.inputBlockNumberFormatter,i.toHex],outputFormatter:o.outputTransactionFormatter}),h=new a({name:"getTransactionReceipt",call:"eth_getTransactionReceipt",params:1,outputFormatter:o.outputTransactionReceiptFormatter}),d=new a({name:"getTransactionCount",call:"eth_getTransactionCount",params:2,inputFormatter:[null,o.inputDefaultBlockNumberFormatter],outputFormatter:i.toDecimal}),m=new a({name:"sendRawTransaction",call:"eth_sendRawTransaction",params:1,inputFormatter:[null]}),w=new a({name:"sendTransaction",call:"eth_sendTransaction",params:1,inputFormatter:[o.inputTransactionFormatter]}),x=new a({name:"signTransaction",call:"eth_signTransaction",params:1,inputFormatter:[o.inputTransactionFormatter]}),k=new a({name:"sign",call:"eth_sign",params:2,inputFormatter:[o.inputAddressFormatter,null]});return[t,e,n,r,s,c,u,f,l,p,h,d,new a({name:"call",call:"eth_call",params:2,inputFormatter:[o.inputCallFormatter,o.inputDefaultBlockNumberFormatter]}),new a({name:"estimateGas",call:"eth_estimateGas",params:1,inputFormatter:[o.inputCallFormatter],outputFormatter:i.toDecimal}),m,x,w,k,new a({name:"compile.solidity",call:"eth_compileSolidity",params:1}),new a({name:"compile.lll",call:"eth_compileLLL",params:1}),new a({name:"compile.serpent",call:"eth_compileSerpent",params:1}),new a({name:"submitWork",call:"eth_submitWork",params:3}),new a({name:"getWork",call:"eth_getWork",params:0})]},x=function(){return[new s({name:"coinbase",getter:"eth_coinbase"}),new s({name:"mining",getter:"eth_mining"}),new s({name:"hashrate",getter:"eth_hashrate",outputFormatter:i.toDecimal}),new s({name:"syncing",getter:"eth_syncing",outputFormatter:o.outputSyncingFormatter}),new s({name:"gasPrice",getter:"eth_gasPrice",outputFormatter:o.outputBigNumberFormatter}),new s({name:"accounts",getter:"eth_accounts"}),new s({name:"blockNumber",getter:"eth_blockNumber",outputFormatter:i.toDecimal}),new s({name:"protocolVersion",getter:"eth_protocolVersion"})]};r.prototype.contract=function(t){return new u(this,t)},r.prototype.filter=function(t,e,n){return new l(t,"eth",this._requestManager,f.eth(),o.outputLogFormatter,e,n)},r.prototype.namereg=function(){return this.contract(h.global.abi).at(h.global.address)},r.prototype.icapNamereg=function(){return this.contract(h.icap.abi).at(h.icap.address)},r.prototype.isSyncing=function(t){return new p(this._requestManager,t)},e.exports=r},{"../../utils/config":18,"../../utils/utils":20,"../contract":25,"../filter":29,"../formatters":30,"../iban":33,"../method":36,"../namereg":44,"../property":45,"../syncing":48,"../transfer":49,"./watches":43}],39:[function(t,e,n){var r=t("../../utils/utils"),o=t("../property"),i=function(){return[new o({name:"listening",getter:"net_listening"}),new o({name:"peerCount",getter:"net_peerCount",outputFormatter:r.toDecimal})]};e.exports=function(t){this._requestManager=t._requestManager;var e=this;i().forEach(function(n){n.attachToObject(e),n.setRequestManager(t._requestManager)})}},{"../../utils/utils":20,"../property":45}],40:[function(t,e,n){"use strict";var r=t("../method"),o=t("../property"),i=t("../formatters"),a=function(){var t=new r({name:"newAccount",call:"personal_newAccount",params:1,inputFormatter:[null]}),e=new r({name:"importRawKey",call:"personal_importRawKey",params:2}),n=new r({name:"sign",call:"personal_sign",params:3,inputFormatter:[null,i.inputAddressFormatter,null]}),o=new r({name:"ecRecover",call:"personal_ecRecover",params:2});return[t,e,new r({name:"unlockAccount",call:"personal_unlockAccount",params:3,inputFormatter:[i.inputAddressFormatter,null,null]}),o,n,new r({name:"sendTransaction",call:"personal_sendTransaction",params:2,inputFormatter:[i.inputTransactionFormatter,null]}),new r({name:"lockAccount",call:"personal_lockAccount",params:1,inputFormatter:[i.inputAddressFormatter]})]},s=function(){return[new o({name:"listAccounts",getter:"personal_listAccounts"})]};e.exports=function(t){this._requestManager=t._requestManager;var e=this;a().forEach(function(t){t.attachToObject(e),t.setRequestManager(e._requestManager)}),s().forEach(function(t){t.attachToObject(e),t.setRequestManager(e._requestManager)})}},{"../formatters":30,"../method":36,"../property":45}],41:[function(t,e,n){var r=t("../method"),o=t("../filter"),i=t("./watches"),a=function(t){this._requestManager=t._requestManager;var e=this;s().forEach(function(t){t.attachToObject(e),t.setRequestManager(e._requestManager)})};a.prototype.newMessageFilter=function(t,e,n){return new o(t,"shh",this._requestManager,i.shh(),null,e,n)};var s=function(){return[new r({name:"version",call:"shh_version",params:0}),new r({name:"info",call:"shh_info",params:0}),new r({name:"setMaxMessageSize",call:"shh_setMaxMessageSize",params:1}),new r({name:"setMinPoW",call:"shh_setMinPoW",params:1}),new r({name:"markTrustedPeer",call:"shh_markTrustedPeer",params:1}),new r({name:"newKeyPair",call:"shh_newKeyPair",params:0}),new r({name:"addPrivateKey",call:"shh_addPrivateKey",params:1}),new r({name:"deleteKeyPair",call:"shh_deleteKeyPair",params:1}),new r({name:"hasKeyPair",call:"shh_hasKeyPair",params:1}),new r({name:"getPublicKey",call:"shh_getPublicKey",params:1}),new r({name:"getPrivateKey",call:"shh_getPrivateKey",params:1}),new r({name:"newSymKey",call:"shh_newSymKey",params:0}),new r({name:"addSymKey",call:"shh_addSymKey",params:1}),new r({name:"generateSymKeyFromPassword",call:"shh_generateSymKeyFromPassword",params:1}),new r({name:"hasSymKey",call:"shh_hasSymKey",params:1}),new r({name:"getSymKey",call:"shh_getSymKey",params:1}),new r({name:"deleteSymKey",call:"shh_deleteSymKey",params:1}),new r({name:"post",call:"shh_post",params:1,inputFormatter:[null]})]};e.exports=a},{"../filter":29,"../method":36,"./watches":43}],42:[function(t,e,n){"use strict";var r=t("../method"),o=t("../property"),i=function(){return[new r({name:"blockNetworkRead",call:"bzz_blockNetworkRead",params:1,inputFormatter:[null]}),new r({name:"syncEnabled",call:"bzz_syncEnabled",params:1,inputFormatter:[null]}),new r({name:"swapEnabled",call:"bzz_swapEnabled",params:1,inputFormatter:[null]}),new r({name:"download",call:"bzz_download",params:2,inputFormatter:[null,null]}),new r({name:"upload",call:"bzz_upload",params:2,inputFormatter:[null,null]}),new r({name:"retrieve",call:"bzz_retrieve",params:1,inputFormatter:[null]}),new r({name:"store",call:"bzz_store",params:2,inputFormatter:[null,null]}),new r({name:"get",call:"bzz_get",params:1,inputFormatter:[null]}),new r({name:"put",call:"bzz_put",params:2,inputFormatter:[null,null]}),new r({name:"modify",call:"bzz_modify",params:4,inputFormatter:[null,null,null,null]})]},a=function(){return[new o({name:"hive",getter:"bzz_hive"}),new o({name:"info",getter:"bzz_info"})]};e.exports=function(t){this._requestManager=t._requestManager;var e=this;i().forEach(function(t){t.attachToObject(e),t.setRequestManager(e._requestManager)}),a().forEach(function(t){t.attachToObject(e),t.setRequestManager(e._requestManager)})}},{"../method":36,"../property":45}],43:[function(t,e,n){var r=t("../method");e.exports={eth:function(){return[new r({name:"newFilter",call:function(t){switch(t[0]){case"latest":return t.shift(),this.params=0,"eth_newBlockFilter";case"pending":return t.shift(),this.params=0,"eth_newPendingTransactionFilter";default:return"eth_newFilter"}},params:1}),new r({name:"uninstallFilter",call:"eth_uninstallFilter",params:1}),new r({name:"getLogs",call:"eth_getFilterLogs",params:1}),new r({name:"poll",call:"eth_getFilterChanges",params:1})]},shh:function(){return[new r({name:"newFilter",call:"shh_newMessageFilter",params:1}),new r({name:"uninstallFilter",call:"shh_deleteMessageFilter",params:1}),new r({name:"getLogs",call:"shh_getFilterMessages",params:1}),new r({name:"poll",call:"shh_getFilterMessages",params:1})]}}},{"../method":36}],44:[function(t,e,n){var r=t("../contracts/GlobalRegistrar.json"),o=t("../contracts/ICAPRegistrar.json");e.exports={global:{abi:r,address:"0xc6d9d2cd449a754c494264e1809c50e34d64562b"},icap:{abi:o,address:"0xa1a111bc074c9cfa781f0c38e63bd51c91b8af00"}}},{"../contracts/GlobalRegistrar.json":1,"../contracts/ICAPRegistrar.json":2}],45:[function(t,e,n){var r=t("../utils/utils"),o=function(t){this.name=t.name,this.getter=t.getter,this.setter=t.setter,this.outputFormatter=t.outputFormatter,this.inputFormatter=t.inputFormatter,this.requestManager=null};o.prototype.setRequestManager=function(t){this.requestManager=t},o.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter(t):t},o.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t&&void 0!==t?this.outputFormatter(t):t},o.prototype.extractCallback=function(t){if(r.isFunction(t[t.length-1]))return t.pop()},o.prototype.attachToObject=function(t){var e={get:this.buildGet(),enumerable:!0},n=this.name.split("."),r=n[0];n.length>1&&(t[n[0]]=t[n[0]]||{},t=t[n[0]],r=n[1]),Object.defineProperty(t,r,e),t[i(r)]=this.buildAsyncGet()};var i=function(t){return"get"+t.charAt(0).toUpperCase()+t.slice(1)};o.prototype.buildGet=function(){var t=this;return function(){return t.formatOutput(t.requestManager.send({method:t.getter}))}},o.prototype.buildAsyncGet=function(){var t=this,e=function(e){t.requestManager.sendAsync({method:t.getter},function(n,r){e(n,t.formatOutput(r))})};return e.request=this.request.bind(this),e},o.prototype.request=function(){var t={method:this.getter,params:[],callback:this.extractCallback(Array.prototype.slice.call(arguments))};return t.format=this.formatOutput.bind(this),t},e.exports=o},{"../utils/utils":20}],46:[function(t,e,n){var r=t("./jsonrpc"),o=t("../utils/utils"),i=t("../utils/config"),a=t("./errors"),s=function(t){this.provider=t,this.polls={},this.timeout=null};s.prototype.send=function(t){if(!this.provider)return console.error(a.InvalidProvider()),null;var e=r.toPayload(t.method,t.params),n=this.provider.send(e);if(!r.isValidResponse(n))throw a.InvalidResponse(n);return n.result},s.prototype.sendAsync=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.toPayload(t.method,t.params);this.provider.sendAsync(n,function(t,n){return t?e(t):r.isValidResponse(n)?void e(null,n.result):e(a.InvalidResponse(n))})},s.prototype.sendBatch=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.toBatchPayload(t);this.provider.sendAsync(n,function(t,n){return t?e(t):o.isArray(n)?void e(t,n):e(a.InvalidResponse(n))})},s.prototype.setProvider=function(t){this.provider=t},s.prototype.startPolling=function(t,e,n,r){this.polls[e]={data:t,id:e,callback:n,uninstall:r},this.timeout||this.poll()},s.prototype.stopPolling=function(t){delete this.polls[t],0===Object.keys(this.polls).length&&this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},s.prototype.reset=function(t){for(var e in this.polls)t&&-1!==e.indexOf("syncPoll_")||(this.polls[e].uninstall(),delete this.polls[e]);0===Object.keys(this.polls).length&&this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},s.prototype.poll=function(){if(this.timeout=setTimeout(this.poll.bind(this),i.ETH_POLLING_TIMEOUT),0!==Object.keys(this.polls).length)if(this.provider){var t=[],e=[];for(var n in this.polls)t.push(this.polls[n].data),e.push(n);if(0!==t.length){var s=r.toBatchPayload(t),c={};s.forEach(function(t,n){c[t.id]=e[n]});var u=this;this.provider.sendAsync(s,function(t,e){if(!t){if(!o.isArray(e))throw a.InvalidResponse(e);e.map(function(t){var e=c[t.id];return!!u.polls[e]&&(t.callback=u.polls[e].callback,t)}).filter(function(t){return!!t}).filter(function(t){var e=r.isValidResponse(t);return e||t.callback(a.InvalidResponse(t)),e}).forEach(function(t){t.callback(null,t.result)})}})}}else console.error(a.InvalidProvider())},e.exports=s},{"../utils/config":18,"../utils/utils":20,"./errors":26,"./jsonrpc":35}],47:[function(t,e,n){e.exports=function(){this.defaultBlock="latest",this.defaultAccount=void 0}},{}],48:[function(t,e,n){var r=t("./formatters"),o=t("../utils/utils"),i=1,a=function(t){t.requestManager.startPolling({method:"eth_syncing",params:[]},t.pollId,function(e,n){if(e)return t.callbacks.forEach(function(t){t(e)});o.isObject(n)&&n.startingBlock&&(n=r.outputSyncingFormatter(n)),t.callbacks.forEach(function(e){t.lastSyncState!==n&&(!t.lastSyncState&&o.isObject(n)&&e(null,!0),setTimeout(function(){e(null,n)},0),t.lastSyncState=n)})},t.stopWatching.bind(t))},s=function(t,e){return this.requestManager=t,this.pollId="syncPoll_"+i++,this.callbacks=[],this.addCallback(e),this.lastSyncState=!1,a(this),this};s.prototype.addCallback=function(t){return t&&this.callbacks.push(t),this},s.prototype.stopWatching=function(){this.requestManager.stopPolling(this.pollId),this.callbacks=[]},e.exports=s},{"../utils/utils":20,"./formatters":30}],49:[function(t,e,n){var r=t("./iban"),o=t("../contracts/SmartExchange.json"),i=function(t,e,n,r,o){return t.sendTransaction({address:n,from:e,value:r},o)},a=function(t,e,n,r,i,a){var s=o;return t.contract(s).at(n).deposit(i,{from:e,value:r},a)};e.exports=function(t,e,n,o,s){var c=new r(n);if(!c.isValid())throw new Error("invalid iban address");if(c.isDirect())return i(t,e,c.address(),o,s);if(!s){var u=t.icapNamereg().addr(c.institution());return a(t,e,u,o,c.client())}t.icapNamereg().addr(c.institution(),function(n,r){return a(t,e,r,o,c.client(),s)})}},{"../contracts/SmartExchange.json":3,"./iban":33}],50:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./enc-base64"),t("./md5"),t("./evpkdf"),t("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],o):o(r.CryptoJS)}(this,function(t){return function(){var e=t,n=e.lib.BlockCipher,r=e.algo,o=[],i=[],a=[],s=[],c=[],u=[],f=[],l=[],p=[],h=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var n=0,r=0,e=0;e<256;e++){var d=r^r<<1^r<<2^r<<3^r<<4;d=d>>>8^255&d^99,o[n]=d,i[d]=n;var m=t[n],y=t[m],g=t[y],v=257*t[d]^16843008*d;a[n]=v<<24|v>>>8,s[n]=v<<16|v>>>16,c[n]=v<<8|v>>>24,u[n]=v;v=16843009*g^65537*y^257*m^16843008*n;f[d]=v<<24|v>>>8,l[d]=v<<16|v>>>16,p[d]=v<<8|v>>>24,h[d]=v,n?(n=m^t[t[t[g^m]]],r^=t[t[r]]):n=r=1}}();var d=[0,1,2,4,8,16,32,64,128,27,54],m=r.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,n=t.sigBytes/4,r=4*((this._nRounds=n+6)+1),i=this._keySchedule=[],a=0;a6&&a%n==4&&(u=o[u>>>24]<<24|o[u>>>16&255]<<16|o[u>>>8&255]<<8|o[255&u]):(u=o[(u=u<<8|u>>>24)>>>24]<<24|o[u>>>16&255]<<16|o[u>>>8&255]<<8|o[255&u],u^=d[a/n|0]<<24),i[a]=i[a-n]^u}for(var s=this._invKeySchedule=[],c=0;c>>24]]^l[o[u>>>16&255]]^p[o[u>>>8&255]]^h[o[255&u]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,a,s,c,u,o)},decryptBlock:function(t,e){n=t[e+1];t[e+1]=t[e+3],t[e+3]=n,this._doCryptBlock(t,e,this._invKeySchedule,f,l,p,h,i);var n=t[e+1];t[e+1]=t[e+3],t[e+3]=n},_doCryptBlock:function(t,e,n,r,o,i,a,s){for(var c=this._nRounds,u=t[e]^n[0],f=t[e+1]^n[1],l=t[e+2]^n[2],p=t[e+3]^n[3],h=4,d=1;d>>24]^o[f>>>16&255]^i[l>>>8&255]^a[255&p]^n[h++],y=r[f>>>24]^o[l>>>16&255]^i[p>>>8&255]^a[255&u]^n[h++],g=r[l>>>24]^o[p>>>16&255]^i[u>>>8&255]^a[255&f]^n[h++],v=r[p>>>24]^o[u>>>16&255]^i[f>>>8&255]^a[255&l]^n[h++];u=m,f=y,l=g,p=v}var m=(s[u>>>24]<<24|s[f>>>16&255]<<16|s[l>>>8&255]<<8|s[255&p])^n[h++],y=(s[f>>>24]<<24|s[l>>>16&255]<<16|s[p>>>8&255]<<8|s[255&u])^n[h++],g=(s[l>>>24]<<24|s[p>>>16&255]<<16|s[u>>>8&255]<<8|s[255&f])^n[h++],v=(s[p>>>24]<<24|s[u>>>16&255]<<16|s[f>>>8&255]<<8|s[255&l])^n[h++];t[e]=m,t[e+1]=y,t[e+2]=g,t[e+3]=v},keySize:8});e.AES=n._createHelper(m)}(),t.AES})},{"./cipher-core":51,"./core":52,"./enc-base64":53,"./evpkdf":55,"./md5":60}],51:[function(t,e,n){!function(r,o){"object"==typeof n?e.exports=n=o(t("./core")):"function"==typeof define&&define.amd?define(["./core"],o):o(r.CryptoJS)}(this,function(t){t.lib.Cipher||function(e){var n=t,r=n.lib,o=r.Base,i=r.WordArray,a=r.BufferedBlockAlgorithm,s=n.enc,c=(s.Utf8,s.Base64),u=n.algo.EvpKDF,f=r.Cipher=a.extend({cfg:o.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,n){this.cfg=this.cfg.extend(n),this._xformMode=t,this._key=e,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?b:g}return function(e){return{encrypt:function(n,r,o){return t(r).encrypt(e,n,r,o)},decrypt:function(n,r,o){return t(r).decrypt(e,n,r,o)}}}}()}),l=(r.StreamCipher=f.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),n.mode={}),p=r.BlockCipherMode=o.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),h=l.CBC=function(){function t(t,n,r){var o=this._iv;if(o){i=o;this._iv=e}else var i=this._prevBlock;for(var a=0;a>>2];t.sigBytes-=e}},m=(r.BlockCipher=f.extend({cfg:f.cfg.extend({mode:h,padding:d}),reset:function(){f.reset.call(this);var t=this.cfg,e=t.iv,n=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)r=n.createEncryptor;else{var r=n.createDecryptor;this._minBufferSize=1}this._mode=r.call(n,this,e&&e.words)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);e=this._process(!0)}else{var e=this._process(!0);t.unpad(e)}return e},blockSize:4}),r.CipherParams=o.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}})),y=(n.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,n=t.salt;if(n)r=i.create([1398893684,1701076831]).concat(n).concat(e);else var r=e;return r.toString(c)},parse:function(t){var e=c.parse(t),n=e.words;if(1398893684==n[0]&&1701076831==n[1]){var r=i.create(n.slice(2,4));n.splice(0,4),e.sigBytes-=16}return m.create({ciphertext:e,salt:r})}},g=r.SerializableCipher=o.extend({cfg:o.extend({format:y}),encrypt:function(t,e,n,r){r=this.cfg.extend(r);var o=t.createEncryptor(n,r),i=o.finalize(e),a=o.cfg;return m.create({ciphertext:i,key:n,iv:a.iv,algorithm:t,mode:a.mode,padding:a.padding,blockSize:t.blockSize,formatter:r.format})},decrypt:function(t,e,n,r){return r=this.cfg.extend(r),e=this._parse(e,r.format),t.createDecryptor(n,r).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),v=(n.kdf={}).OpenSSL={execute:function(t,e,n,r){r||(r=i.random(8));var o=u.create({keySize:e+n}).compute(t,r),a=i.create(o.words.slice(e),4*n);return o.sigBytes=4*e,m.create({key:o,iv:a,salt:r})}},b=r.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:v}),encrypt:function(t,e,n,r){var o=(r=this.cfg.extend(r)).kdf.execute(n,t.keySize,t.ivSize);r.iv=o.iv;var i=g.encrypt.call(this,t,e,o.key,r);return i.mixIn(o),i},decrypt:function(t,e,n,r){r=this.cfg.extend(r),e=this._parse(e,r.format);var o=r.kdf.execute(n,t.keySize,t.ivSize,e.salt);return r.iv=o.iv,g.decrypt.call(this,t,e,o.key,r)}})}()})},{"./core":52}],52:[function(t,e,n){!function(t,r){"object"==typeof n?e.exports=n=r():"function"==typeof define&&define.amd?define([],r):t.CryptoJS=r()}(this,function(){var t=t||function(t,e){var n=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),r={},o=r.lib={},i=o.Base={extend:function(t){var e=n(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},a=o.WordArray=i.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=void 0!=e?e:4*t.length},toString:function(t){return(t||c).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(a=0;a>>2]>>>24-a%4*8&255;e[r+a>>>2]|=i<<24-(r+a)%4*8}else for(var a=0;a>>2]=n[a>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=i.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],o=0;o>16)&r)<<16)+(e=18e3*(65535&e)+(e>>16)&r)&r;return o/=4294967296,(o+=.5)*(t.random()>.5?1:-1)}}(4294967296*(n||t.random()));n=987654071*i(),r.push(4294967296*i()|0)}return new a.init(r,e)}}),s=r.enc={},c=s.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new a.init(n,e/2)}},u=s.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new a.init(n,e)}},f=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},l=o.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=f.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,o=n.sigBytes,i=this.blockSize,s=o/(4*i),c=(s=e?t.ceil(s):t.max((0|s)-this._minBufferSize,0))*i,u=t.min(4*c,o);if(c){for(var f=0;f>>6-a%4*2;o[i>>>2]|=(s|c)<<24-i%4*8,i++}return r.create(o,i)}var n=t,r=n.lib.WordArray;n.enc.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,r=this._map;t.clamp();for(var o=[],i=0;i>>2]>>>24-i%4*8&255)<<16|(e[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|e[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;s<4&&i+.75*s>>6*(3-s)&63));var c=r.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(t){var n=t.length,r=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var i=0;i>>8&16711935}var n=t,r=n.lib.WordArray,o=n.enc;o.Utf16=o.Utf16BE={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o>>2]>>>16-o%4*8&65535;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var e=t.length,n=[],o=0;o>>1]|=t.charCodeAt(o)<<16-o%2*16;return r.create(n,2*e)}};o.Utf16LE={stringify:function(t){for(var n=t.words,r=t.sigBytes,o=[],i=0;i>>2]>>>16-i%4*8&65535);o.push(String.fromCharCode(a))}return o.join("")},parse:function(t){for(var n=t.length,o=[],i=0;i>>1]|=e(t.charCodeAt(i)<<16-i%2*16);return r.create(o,2*n)}}}(),t.enc.Utf16})},{"./core":52}],55:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./sha1"),t("./hmac")):"function"==typeof define&&define.amd?define(["./core","./sha1","./hmac"],o):o(r.CryptoJS)}(this,function(t){return function(){var e=t,n=e.lib,r=n.Base,o=n.WordArray,i=e.algo,a=i.MD5,s=i.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:a,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n=this.cfg,r=n.hasher.create(),i=o.create(),a=i.words,s=n.keySize,c=n.iterations;a.lengtho&&(e=t.finalize(e)),e.clamp();for(var i=this._oKey=e.clone(),a=this._iKey=e.clone(),s=i.words,c=a.words,u=0;u>>2]|=t[o]<<24-o%4*8;n.call(this,r,e)}else n.apply(this,arguments)}).prototype=e}}(),t.lib.WordArray})},{"./core":52}],60:[function(t,e,n){!function(r,o){"object"==typeof n?e.exports=n=o(t("./core")):"function"==typeof define&&define.amd?define(["./core"],o):o(r.CryptoJS)}(this,function(t){return function(e){function n(t,e,n,r,o,i,a){var s=t+(e&n|~e&r)+o+a;return(s<>>32-i)+e}function r(t,e,n,r,o,i,a){var s=t+(e&r|n&~r)+o+a;return(s<>>32-i)+e}function o(t,e,n,r,o,i,a){var s=t+(e^n^r)+o+a;return(s<>>32-i)+e}function i(t,e,n,r,o,i,a){var s=t+(n^(e|~r))+o+a;return(s<>>32-i)+e}var a=t,s=a.lib,c=s.WordArray,u=s.Hasher,f=a.algo,l=[];!function(){for(var t=0;t<64;t++)l[t]=4294967296*e.abs(e.sin(t+1))|0}();var p=f.MD5=u.extend({_doReset:function(){this._hash=new c.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var a=0;a<16;a++){var s=e+a,c=t[s];t[s]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}var u=this._hash.words,f=t[e+0],p=t[e+1],h=t[e+2],d=t[e+3],m=t[e+4],y=t[e+5],g=t[e+6],v=t[e+7],b=t[e+8],_=t[e+9],w=t[e+10],x=t[e+11],k=t[e+12],B=t[e+13],S=t[e+14],C=t[e+15],A=u[0],F=u[1],O=u[2],I=u[3];F=i(F=i(F=i(F=i(F=o(F=o(F=o(F=o(F=r(F=r(F=r(F=r(F=n(F=n(F=n(F=n(F,O=n(O,I=n(I,A=n(A,F,O,I,f,7,l[0]),F,O,p,12,l[1]),A,F,h,17,l[2]),I,A,d,22,l[3]),O=n(O,I=n(I,A=n(A,F,O,I,m,7,l[4]),F,O,y,12,l[5]),A,F,g,17,l[6]),I,A,v,22,l[7]),O=n(O,I=n(I,A=n(A,F,O,I,b,7,l[8]),F,O,_,12,l[9]),A,F,w,17,l[10]),I,A,x,22,l[11]),O=n(O,I=n(I,A=n(A,F,O,I,k,7,l[12]),F,O,B,12,l[13]),A,F,S,17,l[14]),I,A,C,22,l[15]),O=r(O,I=r(I,A=r(A,F,O,I,p,5,l[16]),F,O,g,9,l[17]),A,F,x,14,l[18]),I,A,f,20,l[19]),O=r(O,I=r(I,A=r(A,F,O,I,y,5,l[20]),F,O,w,9,l[21]),A,F,C,14,l[22]),I,A,m,20,l[23]),O=r(O,I=r(I,A=r(A,F,O,I,_,5,l[24]),F,O,S,9,l[25]),A,F,d,14,l[26]),I,A,b,20,l[27]),O=r(O,I=r(I,A=r(A,F,O,I,B,5,l[28]),F,O,h,9,l[29]),A,F,v,14,l[30]),I,A,k,20,l[31]),O=o(O,I=o(I,A=o(A,F,O,I,y,4,l[32]),F,O,b,11,l[33]),A,F,x,16,l[34]),I,A,S,23,l[35]),O=o(O,I=o(I,A=o(A,F,O,I,p,4,l[36]),F,O,m,11,l[37]),A,F,v,16,l[38]),I,A,w,23,l[39]),O=o(O,I=o(I,A=o(A,F,O,I,B,4,l[40]),F,O,f,11,l[41]),A,F,d,16,l[42]),I,A,g,23,l[43]),O=o(O,I=o(I,A=o(A,F,O,I,_,4,l[44]),F,O,k,11,l[45]),A,F,C,16,l[46]),I,A,h,23,l[47]),O=i(O,I=i(I,A=i(A,F,O,I,f,6,l[48]),F,O,v,10,l[49]),A,F,S,15,l[50]),I,A,y,21,l[51]),O=i(O,I=i(I,A=i(A,F,O,I,k,6,l[52]),F,O,d,10,l[53]),A,F,w,15,l[54]),I,A,p,21,l[55]),O=i(O,I=i(I,A=i(A,F,O,I,b,6,l[56]),F,O,C,10,l[57]),A,F,g,15,l[58]),I,A,B,21,l[59]),O=i(O,I=i(I,A=i(A,F,O,I,m,6,l[60]),F,O,x,10,l[61]),A,F,h,15,l[62]),I,A,_,21,l[63]),u[0]=u[0]+A|0,u[1]=u[1]+F|0,u[2]=u[2]+O|0,u[3]=u[3]+I|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,o=8*t.sigBytes;n[o>>>5]|=128<<24-o%32;var i=e.floor(r/4294967296),a=r;n[15+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),n[14+(o+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(n.length+1),this._process();for(var s=this._hash,c=s.words,u=0;u<4;u++){var f=c[u];c[u]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8)}return s},clone:function(){var t=u.clone.call(this);return t._hash=this._hash.clone(),t}});a.MD5=u._createHelper(p),a.HmacMD5=u._createHmacHelper(p)}(Math),t.MD5})},{"./core":52}],61:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],o):o(r.CryptoJS)}(this,function(t){return t.mode.CFB=function(){function e(t,e,n,r){var o=this._iv;if(o){i=o.slice(0);this._iv=void 0}else var i=this._prevBlock;r.encryptBlock(i,0);for(var a=0;a>24&255)){var e=t>>16&255,n=t>>8&255,r=255&t;255===e?(e=0,255===n?(n=0,255===r?r=0:++r):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=r}else t+=1<<24;return t}function n(t){return 0===(t[0]=e(t[0]))&&(t[1]=e(t[1])),t}var r=t.lib.BlockCipherMode.extend(),o=r.Encryptor=r.extend({processBlock:function(t,e){var r=this._cipher,o=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0),n(a);var s=a.slice(0);r.encryptBlock(s,0);for(var c=0;c>>2]|=o<<24-i%4*8,t.sigBytes+=o},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Ansix923})},{"./cipher-core":51,"./core":52}],67:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],o):o(r.CryptoJS)}(this,function(t){return t.pad.Iso10126={pad:function(e,n){var r=4*n,o=r-e.sigBytes%r;e.concat(t.lib.WordArray.random(o-1)).concat(t.lib.WordArray.create([o<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Iso10126})},{"./cipher-core":51,"./core":52}],68:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],o):o(r.CryptoJS)}(this,function(t){return t.pad.Iso97971={pad:function(e,n){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,n)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971})},{"./cipher-core":51,"./core":52}],69:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],o):o(r.CryptoJS)}(this,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})},{"./cipher-core":51,"./core":52}],70:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],o):o(r.CryptoJS)}(this,function(t){return t.pad.ZeroPadding={pad:function(t,e){var n=4*e;t.clamp(),t.sigBytes+=n-(t.sigBytes%n||n)},unpad:function(t){for(var e=t.words,n=t.sigBytes-1;!(e[n>>>2]>>>24-n%4*8&255);)n--;t.sigBytes=n+1}},t.pad.ZeroPadding})},{"./cipher-core":51,"./core":52}],71:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./sha1"),t("./hmac")):"function"==typeof define&&define.amd?define(["./core","./sha1","./hmac"],o):o(r.CryptoJS)}(this,function(t){return function(){var e=t,n=e.lib,r=n.Base,o=n.WordArray,i=e.algo,a=i.SHA1,s=i.HMAC,c=i.PBKDF2=r.extend({cfg:r.extend({keySize:4,hasher:a,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n=this.cfg,r=s.create(n.hasher,t),i=o.create(),a=o.create([1]),c=i.words,u=a.words,f=n.keySize,l=n.iterations;c.length>>0>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0>>0?1:0)|0,this._b=e[7]>>>0>>0?1:0;for(n=0;n<8;n++){var r=t[n]+e[n],o=65535&r,s=r>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,u=((4294901760&r)*r|0)+((65535&r)*r|0);a[n]=c^u}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}var n=t,r=n.lib.StreamCipher,o=[],i=[],a=[],s=n.algo.RabbitLegacy=r.extend({_doReset:function(){var t=this._key.words,n=this.cfg.iv,r=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],o=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(p=0;p<4;p++)e.call(this);for(p=0;p<8;p++)o[p]^=r[p+4&7];if(n){var i=n.words,a=i[0],s=i[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),f=c>>>16|4294901760&u,l=u<<16|65535&c;o[0]^=c,o[1]^=f,o[2]^=u,o[3]^=l,o[4]^=c,o[5]^=f,o[6]^=u,o[7]^=l;for(var p=0;p<4;p++)e.call(this)}},_doProcessBlock:function(t,n){var r=this._X;e.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)o[i]=16711935&(o[i]<<8|o[i]>>>24)|4278255360&(o[i]<<24|o[i]>>>8),t[n+i]^=o[i]},blockSize:4,ivSize:2});n.RabbitLegacy=r._createHelper(s)}(),t.RabbitLegacy})},{"./cipher-core":51,"./core":52,"./enc-base64":53,"./evpkdf":55,"./md5":60}],73:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./enc-base64"),t("./md5"),t("./evpkdf"),t("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],o):o(r.CryptoJS)}(this,function(t){return function(){function e(){for(var t=this._X,e=this._C,n=0;n<8;n++)i[n]=e[n];e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0>>0?1:0)|0,this._b=e[7]>>>0>>0?1:0;for(n=0;n<8;n++){var r=t[n]+e[n],o=65535&r,s=r>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,u=((4294901760&r)*r|0)+((65535&r)*r|0);a[n]=c^u}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}var n=t,r=n.lib.StreamCipher,o=[],i=[],a=[],s=n.algo.Rabbit=r.extend({_doReset:function(){for(var t=this._key.words,n=this.cfg.iv,r=0;r<4;r++)t[r]=16711935&(t[r]<<8|t[r]>>>24)|4278255360&(t[r]<<24|t[r]>>>8);var o=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(r=0;r<4;r++)e.call(this);for(r=0;r<8;r++)i[r]^=o[r+4&7];if(n){var a=n.words,s=a[0],c=a[1],u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),f=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),l=u>>>16|4294901760&f,p=f<<16|65535&u;i[0]^=u,i[1]^=l,i[2]^=f,i[3]^=p,i[4]^=u,i[5]^=l,i[6]^=f,i[7]^=p;for(r=0;r<4;r++)e.call(this)}},_doProcessBlock:function(t,n){var r=this._X;e.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)o[i]=16711935&(o[i]<<8|o[i]>>>24)|4278255360&(o[i]<<24|o[i]>>>8),t[n+i]^=o[i]},blockSize:4,ivSize:2});n.Rabbit=r._createHelper(s)}(),t.Rabbit})},{"./cipher-core":51,"./core":52,"./enc-base64":53,"./evpkdf":55,"./md5":60}],74:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./enc-base64"),t("./md5"),t("./evpkdf"),t("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],o):o(r.CryptoJS)}(this,function(t){return function(){function e(){for(var t=this._S,e=this._i,n=this._j,r=0,o=0;o<4;o++){n=(n+t[e=(e+1)%256])%256;var i=t[e];t[e]=t[n],t[n]=i,r|=t[(t[e]+t[n])%256]<<24-8*o}return this._i=e,this._j=n,r}var n=t,r=n.lib.StreamCipher,o=n.algo,i=o.RC4=r.extend({_doReset:function(){for(var t=this._key,e=t.words,n=t.sigBytes,r=this._S=[],o=0;o<256;o++)r[o]=o;for(var o=0,i=0;o<256;o++){var a=o%n,s=e[a>>>2]>>>24-a%4*8&255;i=(i+r[o]+s)%256;var c=r[o];r[o]=r[i],r[i]=c}this._i=this._j=0},_doProcessBlock:function(t,n){t[n]^=e.call(this)},keySize:8,ivSize:0});n.RC4=r._createHelper(i);var a=o.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)e.call(this)}});n.RC4Drop=r._createHelper(a)}(),t.RC4})},{"./cipher-core":51,"./core":52,"./enc-base64":53,"./evpkdf":55,"./md5":60}],75:[function(t,e,n){!function(r,o){"object"==typeof n?e.exports=n=o(t("./core")):"function"==typeof define&&define.amd?define(["./core"],o):o(r.CryptoJS)}(this,function(t){return function(e){function n(t,e,n){return t^e^n}function r(t,e,n){return t&e|~t&n}function o(t,e,n){return(t|~e)^n}function i(t,e,n){return t&n|e&~n}function a(t,e,n){return t^(e|~n)}function s(t,e){return t<>>32-e}var c=t,u=c.lib,f=u.WordArray,l=u.Hasher,p=c.algo,h=f.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=f.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),m=f.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),y=f.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),g=f.create([0,1518500249,1859775393,2400959708,2840853838]),v=f.create([1352829926,1548603684,1836072691,2053994217,0]),b=p.RIPEMD160=l.extend({_doReset:function(){this._hash=f.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(D=0;D<16;D++){var c=e+D,u=t[c];t[c]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}var f,l,p,b,_,w,x,k,B,S,C=this._hash.words,A=g.words,F=v.words,O=h.words,I=d.words,N=m.words,T=y.words;w=f=C[0],x=l=C[1],k=p=C[2],B=b=C[3],S=_=C[4];for(var P,D=0;D<80;D+=1)P=f+t[e+O[D]]|0,P+=D<16?n(l,p,b)+A[0]:D<32?r(l,p,b)+A[1]:D<48?o(l,p,b)+A[2]:D<64?i(l,p,b)+A[3]:a(l,p,b)+A[4],P=(P=s(P|=0,N[D]))+_|0,f=_,_=b,b=s(p,10),p=l,l=P,P=w+t[e+I[D]]|0,P+=D<16?a(x,k,B)+F[0]:D<32?i(x,k,B)+F[1]:D<48?o(x,k,B)+F[2]:D<64?r(x,k,B)+F[3]:n(x,k,B)+F[4],P=(P=s(P|=0,T[D]))+S|0,w=S,S=B,B=s(k,10),k=x,x=P;P=C[1]+p+B|0,C[1]=C[2]+b+S|0,C[2]=C[3]+_+w|0,C[3]=C[4]+f+x|0,C[4]=C[0]+l+k|0,C[0]=P},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;e[r>>>5]|=128<<24-r%32,e[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(e.length+1),this._process();for(var o=this._hash,i=o.words,a=0;a<5;a++){var s=i[a];i[a]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return o},clone:function(){var t=l.clone.call(this);return t._hash=this._hash.clone(),t}});c.RIPEMD160=l._createHelper(b),c.HmacRIPEMD160=l._createHmacHelper(b)}(Math),t.RIPEMD160})},{"./core":52}],76:[function(t,e,n){!function(r,o){"object"==typeof n?e.exports=n=o(t("./core")):"function"==typeof define&&define.amd?define(["./core"],o):o(r.CryptoJS)}(this,function(t){return function(){var e=t,n=e.lib,r=n.WordArray,o=n.Hasher,i=[],a=e.algo.SHA1=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],o=n[1],a=n[2],s=n[3],c=n[4],u=0;u<80;u++){if(u<16)i[u]=0|t[e+u];else{var f=i[u-3]^i[u-8]^i[u-14]^i[u-16];i[u]=f<<1|f>>>31}var l=(r<<5|r>>>27)+c+i[u];l+=u<20?1518500249+(o&a|~o&s):u<40?1859775393+(o^a^s):u<60?(o&a|o&s|a&s)-1894007588:(o^a^s)-899497514,c=s,s=a,a=o<<30|o>>>2,o=r,r=l}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+s|0,n[4]=n[4]+c|0},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return e[r>>>5]|=128<<24-r%32,e[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),e[15+(r+64>>>9<<4)]=n,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA1=o._createHelper(a),e.HmacSHA1=o._createHmacHelper(a)}(),t.SHA1})},{"./core":52}],77:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./sha256")):"function"==typeof define&&define.amd?define(["./core","./sha256"],o):o(r.CryptoJS)}(this,function(t){return function(){var e=t,n=e.lib.WordArray,r=e.algo,o=r.SHA256,i=r.SHA224=o.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=o._doFinalize.call(this);return t.sigBytes-=4,t}});e.SHA224=o._createHelper(i),e.HmacSHA224=o._createHmacHelper(i)}(),t.SHA224})},{"./core":52,"./sha256":78}],78:[function(t,e,n){!function(r,o){"object"==typeof n?e.exports=n=o(t("./core")):"function"==typeof define&&define.amd?define(["./core"],o):o(r.CryptoJS)}(this,function(t){return function(e){var n=t,r=n.lib,o=r.WordArray,i=r.Hasher,a=n.algo,s=[],c=[];!function(){function t(t){return 4294967296*(t-(0|t))|0}for(var n=2,r=0;r<64;)(function(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0})(n)&&(r<8&&(s[r]=t(e.pow(n,.5))),c[r]=t(e.pow(n,1/3)),r++),n++}();var u=[],f=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],a=n[3],s=n[4],f=n[5],l=n[6],p=n[7],h=0;h<64;h++){if(h<16)u[h]=0|t[e+h];else{var d=u[h-15],m=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,y=u[h-2],g=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;u[h]=m+u[h-7]+g+u[h-16]}var v=r&o^r&i^o&i,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),_=p+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&f^~s&l)+c[h]+u[h];p=l,l=f,f=s,s=a+_|0,a=i,i=o,o=r,r=_+(b+v)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+a|0,n[4]=n[4]+s|0,n[5]=n[5]+f|0,n[6]=n[6]+l|0,n[7]=n[7]+p|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,o=8*t.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=e.floor(r/4294967296),n[15+(o+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});n.SHA256=i._createHelper(f),n.HmacSHA256=i._createHmacHelper(f)}(Math),t.SHA256})},{"./core":52}],79:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],o):o(r.CryptoJS)}(this,function(t){return function(e){var n=t,r=n.lib,o=r.WordArray,i=r.Hasher,a=n.x64.Word,s=n.algo,c=[],u=[],f=[];!function(){for(var t=1,e=0,n=0;n<24;n++){c[t+5*e]=(n+1)*(n+2)/2%64;var r=(2*t+3*e)%5;t=e%5,e=r}for(t=0;t<5;t++)for(e=0;e<5;e++)u[t+5*e]=e+(2*t+3*e)%5*5;for(var o=1,i=0;i<24;i++){for(var s=0,l=0,p=0;p<7;p++){if(1&o){var h=(1<>>24)|4278255360&(i<<24|i>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(F=n[o]).high^=a,F.low^=i}for(var s=0;s<24;s++){for(A=0;A<5;A++){for(var p=0,h=0,d=0;d<5;d++)p^=(F=n[A+5*d]).high,h^=F.low;var m=l[A];m.high=p,m.low=h}for(A=0;A<5;A++)for(var y=l[(A+4)%5],g=l[(A+1)%5],v=g.high,b=g.low,p=y.high^(v<<1|b>>>31),h=y.low^(b<<1|v>>>31),d=0;d<5;d++)(F=n[A+5*d]).high^=p,F.low^=h;for(var _=1;_<25;_++){var w=(F=n[_]).high,x=F.low,k=c[_];if(k<32)var p=w<>>32-k,h=x<>>32-k;else var p=x<>>64-k,h=w<>>64-k;var B=l[u[_]];B.high=p,B.low=h}var S=l[0],C=n[0];S.high=C.high,S.low=C.low;for(var A=0;A<5;A++)for(d=0;d<5;d++){var F=n[_=A+5*d],O=l[_],I=l[(A+1)%5+5*d],N=l[(A+2)%5+5*d];F.high=O.high^~I.high&N.high,F.low=O.low^~I.low&N.low}var F=n[0],T=f[s];F.high^=T.high,F.low^=T.low}},_doFinalize:function(){var t=this._data,n=t.words,r=(this._nDataBytes,8*t.sigBytes),i=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(e.ceil((r+1)/i)*i>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,c=s/8,u=[],f=0;f>>24)|4278255360&(p<<24|p>>>8),h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),u.push(h),u.push(p)}return new o.init(u,s)},clone:function(){for(var t=i.clone.call(this),e=t._state=this._state.slice(0),n=0;n<25;n++)e[n]=e[n].clone();return t}});n.SHA3=i._createHelper(p),n.HmacSHA3=i._createHmacHelper(p)}(Math),t.SHA3})},{"./core":52,"./x64-core":83}],80:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./x64-core"),t("./sha512")):"function"==typeof define&&define.amd?define(["./core","./x64-core","./sha512"],o):o(r.CryptoJS)}(this,function(t){return function(){var e=t,n=e.x64,r=n.Word,o=n.WordArray,i=e.algo,a=i.SHA512,s=i.SHA384=a.extend({_doReset:function(){this._hash=new o.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var t=a._doFinalize.call(this);return t.sigBytes-=16,t}});e.SHA384=a._createHelper(s),e.HmacSHA384=a._createHmacHelper(s)}(),t.SHA384})},{"./core":52,"./sha512":81,"./x64-core":83}],81:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],o):o(r.CryptoJS)}(this,function(t){return function(){function e(){return i.create.apply(i,arguments)}var n=t,r=n.lib.Hasher,o=n.x64,i=o.Word,a=o.WordArray,s=n.algo,c=[e(1116352408,3609767458),e(1899447441,602891725),e(3049323471,3964484399),e(3921009573,2173295548),e(961987163,4081628472),e(1508970993,3053834265),e(2453635748,2937671579),e(2870763221,3664609560),e(3624381080,2734883394),e(310598401,1164996542),e(607225278,1323610764),e(1426881987,3590304994),e(1925078388,4068182383),e(2162078206,991336113),e(2614888103,633803317),e(3248222580,3479774868),e(3835390401,2666613458),e(4022224774,944711139),e(264347078,2341262773),e(604807628,2007800933),e(770255983,1495990901),e(1249150122,1856431235),e(1555081692,3175218132),e(1996064986,2198950837),e(2554220882,3999719339),e(2821834349,766784016),e(2952996808,2566594879),e(3210313671,3203337956),e(3336571891,1034457026),e(3584528711,2466948901),e(113926993,3758326383),e(338241895,168717936),e(666307205,1188179964),e(773529912,1546045734),e(1294757372,1522805485),e(1396182291,2643833823),e(1695183700,2343527390),e(1986661051,1014477480),e(2177026350,1206759142),e(2456956037,344077627),e(2730485921,1290863460),e(2820302411,3158454273),e(3259730800,3505952657),e(3345764771,106217008),e(3516065817,3606008344),e(3600352804,1432725776),e(4094571909,1467031594),e(275423344,851169720),e(430227734,3100823752),e(506948616,1363258195),e(659060556,3750685593),e(883997877,3785050280),e(958139571,3318307427),e(1322822218,3812723403),e(1537002063,2003034995),e(1747873779,3602036899),e(1955562222,1575990012),e(2024104815,1125592928),e(2227730452,2716904306),e(2361852424,442776044),e(2428436474,593698344),e(2756734187,3733110249),e(3204031479,2999351573),e(3329325298,3815920427),e(3391569614,3928383900),e(3515267271,566280711),e(3940187606,3454069534),e(4118630271,4000239992),e(116418474,1914138554),e(174292421,2731055270),e(289380356,3203993006),e(460393269,320620315),e(685471733,587496836),e(852142971,1086792851),e(1017036298,365543100),e(1126000580,2618297676),e(1288033470,3409855158),e(1501505948,4234509866),e(1607167915,987167468),e(1816402316,1246189591)],u=[];!function(){for(var t=0;t<80;t++)u[t]=e()}();var f=s.SHA512=r.extend({_doReset:function(){this._hash=new a.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],a=n[3],s=n[4],f=n[5],l=n[6],p=n[7],h=r.high,d=r.low,m=o.high,y=o.low,g=i.high,v=i.low,b=a.high,_=a.low,w=s.high,x=s.low,k=f.high,B=f.low,S=l.high,C=l.low,A=p.high,F=p.low,O=h,I=d,N=m,T=y,P=g,D=v,R=b,E=_,M=w,H=x,j=k,q=B,z=S,L=C,U=A,W=F,J=0;J<80;J++){var K=u[J];if(J<16)var G=K.high=0|t[e+2*J],X=K.low=0|t[e+2*J+1];else{var $=u[J-15],V=$.high,Z=$.low,Y=(V>>>1|Z<<31)^(V>>>8|Z<<24)^V>>>7,Q=(Z>>>1|V<<31)^(Z>>>8|V<<24)^(Z>>>7|V<<25),tt=u[J-2],et=tt.high,nt=tt.low,rt=(et>>>19|nt<<13)^(et<<3|nt>>>29)^et>>>6,ot=(nt>>>19|et<<13)^(nt<<3|et>>>29)^(nt>>>6|et<<26),it=u[J-7],at=it.high,st=it.low,ct=u[J-16],ut=ct.high,ft=ct.low,G=(G=(G=Y+at+((X=Q+st)>>>0>>0?1:0))+rt+((X=X+ot)>>>0>>0?1:0))+ut+((X=X+ft)>>>0>>0?1:0);K.high=G,K.low=X}var lt=M&j^~M&z,pt=H&q^~H&L,ht=O&N^O&P^N&P,dt=I&T^I&D^T&D,mt=(O>>>28|I<<4)^(O<<30|I>>>2)^(O<<25|I>>>7),yt=(I>>>28|O<<4)^(I<<30|O>>>2)^(I<<25|O>>>7),gt=(M>>>14|H<<18)^(M>>>18|H<<14)^(M<<23|H>>>9),vt=(H>>>14|M<<18)^(H>>>18|M<<14)^(H<<23|M>>>9),bt=c[J],_t=bt.high,wt=bt.low,xt=W+vt,kt=(kt=(kt=(kt=U+gt+(xt>>>0>>0?1:0))+lt+((xt=xt+pt)>>>0>>0?1:0))+_t+((xt=xt+wt)>>>0>>0?1:0))+G+((xt=xt+X)>>>0>>0?1:0),Bt=yt+dt,St=mt+ht+(Bt>>>0>>0?1:0);U=z,W=L,z=j,L=q,j=M,q=H,M=R+kt+((H=E+xt|0)>>>0>>0?1:0)|0,R=P,E=D,P=N,D=T,N=O,T=I,O=kt+St+((I=xt+Bt|0)>>>0>>0?1:0)|0}d=r.low=d+I,r.high=h+O+(d>>>0>>0?1:0),y=o.low=y+T,o.high=m+N+(y>>>0>>0?1:0),v=i.low=v+D,i.high=g+P+(v>>>0>>0?1:0),_=a.low=_+E,a.high=b+R+(_>>>0>>0?1:0),x=s.low=x+H,s.high=w+M+(x>>>0>>0?1:0),B=f.low=B+q,f.high=k+j+(B>>>0>>0?1:0),C=l.low=C+L,l.high=S+z+(C>>>0>>0?1:0),F=p.low=F+W,p.high=A+U+(F>>>0>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return e[r>>>5]|=128<<24-r%32,e[30+(r+128>>>10<<5)]=Math.floor(n/4294967296),e[31+(r+128>>>10<<5)]=n,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});n.SHA512=r._createHelper(f),n.HmacSHA512=r._createHmacHelper(f)}(),t.SHA512})},{"./core":52,"./x64-core":83}],82:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./enc-base64"),t("./md5"),t("./evpkdf"),t("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],o):o(r.CryptoJS)}(this,function(t){return function(){function e(t,e){var n=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=n,this._lBlock^=n<>>t^this._lBlock)&e;this._lBlock^=n,this._rBlock^=n<>>5]>>>31-r%32&1}for(var o=this._subKeys=[],i=0;i<16;i++){for(var a=o[i]=[],s=f[i],n=0;n<24;n++)a[n/6|0]|=e[(u[n]-1+s)%28]<<31-n%6,a[4+(n/6|0)]|=e[28+(u[n+24]-1+s)%28]<<31-n%6;a[0]=a[0]<<1|a[0]>>>31;for(n=1;n<7;n++)a[n]=a[n]>>>4*(n-1)+3;a[7]=a[7]<<5|a[7]>>>27}for(var l=this._invSubKeys=[],n=0;n<16;n++)l[n]=o[15-n]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,r,o){this._lBlock=t[r],this._rBlock=t[r+1],e.call(this,4,252645135),e.call(this,16,65535),n.call(this,2,858993459),n.call(this,8,16711935),e.call(this,1,1431655765);for(var i=0;i<16;i++){for(var a=o[i],s=this._lBlock,c=this._rBlock,u=0,f=0;f<8;f++)u|=l[f][((c^a[f])&p[f])>>>0];this._lBlock=c,this._rBlock=s^u}var h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,e.call(this,1,1431655765),n.call(this,8,16711935),n.call(this,2,858993459),e.call(this,16,65535),e.call(this,4,252645135),t[r]=this._lBlock,t[r+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});r.DES=a._createHelper(h);var d=s.TripleDES=a.extend({_doReset:function(){var t=this._key.words;this._des1=h.createEncryptor(i.create(t.slice(0,2))),this._des2=h.createEncryptor(i.create(t.slice(2,4))),this._des3=h.createEncryptor(i.create(t.slice(4,6)))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});r.TripleDES=a._createHelper(d)}(),t.TripleDES})},{"./cipher-core":51,"./core":52,"./enc-base64":53,"./evpkdf":55,"./md5":60}],83:[function(t,e,n){!function(r,o){"object"==typeof n?e.exports=n=o(t("./core")):"function"==typeof define&&define.amd?define(["./core"],o):o(r.CryptoJS)}(this,function(t){return function(e){var n=t,r=n.lib,o=r.Base,i=r.WordArray,a=n.x64={};a.Word=o.extend({init:function(t,e){this.high=t,this.low=e}}),a.WordArray=o.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=void 0!=e?e:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],r=0;r=55296&&e<=56319&&o65535&&(o+=y((e-=65536)>>>10&1023|55296),e=56320|1023&e),o+=y(e);return o}function i(t){if(t>=55296&&t<=57343)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value")}function a(t,e){return y(t>>e&63|128)}function s(t){if(0==(4294967168&t))return y(t);var e="";return 0==(4294965248&t)?e=y(t>>6&31|192):0==(4294901760&t)?(i(t),e=y(t>>12&15|224),e+=a(t,6)):0==(4292870144&t)&&(e=y(t>>18&7|240),e+=a(t,12),e+=a(t,6)),e+=y(63&t|128)}function c(){if(m>=d)throw Error("Invalid byte index");var t=255&h[m];if(m++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function u(){var t,e,n,r,o;if(m>d)throw Error("Invalid byte index");if(m==d)return!1;if(t=255&h[m],m++,0==(128&t))return t;if(192==(224&t)){if(e=c(),(o=(31&t)<<6|e)>=128)return o;throw Error("Invalid continuation byte")}if(224==(240&t)){if(e=c(),n=c(),(o=(15&t)<<12|e<<6|n)>=2048)return i(o),o;throw Error("Invalid continuation byte")}if(240==(248&t)&&(e=c(),n=c(),r=c(),(o=(7&t)<<18|e<<12|n<<6|r)>=65536&&o<=1114111))return o;throw Error("Invalid UTF-8 detected")}var f="object"==typeof n&&n,l="object"==typeof e&&e&&e.exports==f&&e,p="object"==typeof global&&global;p.global!==p&&p.window!==p||(t=p);var h,d,m,y=String.fromCharCode,g={version:"2.1.2",encode:function(t){for(var e=r(t),n=e.length,o=-1,i="";++o15&&I(D,v,t),a=!1):u.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1,c=p(c,10,n,u.s)}else{if(t instanceof e)return u.s=t.s,u.e=t.e,u.c=(t=t.c)?t.slice():t,void(D=0);if((a="number"==typeof t)&&0*t==0){if(u.s=1/t<0?(t=-t,-1):1,t===~~t){for(o=0,i=t;i>=10;i/=10,o++);return u.e=o,u.c=[t],void(D=0)}c=t+""}else{if(!h.test(c=t+""))return P(u,c,a);u.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1}}for((o=c.indexOf("."))>-1&&(c=c.replace(".","")),(i=c.search(/e/i))>0?(o<0&&(o=i),o+=+c.slice(i+1),c=c.substring(0,i)):o<0&&(o=c.length),i=0;48===c.charCodeAt(i);i++);for(s=c.length;48===c.charCodeAt(--s););if(c=c.slice(i,s+1))if(s=c.length,a&&U&&s>15&&(t>x||t!==m(t))&&I(D,v,u.s*t),(o=o-i-1)>L)u.c=u.e=null;else if(o=0&&(u=G,G=0,t=t.replace(".",""),p=(d=new e(r)).pow(t.length-m),G=u,d.c=c(f(o(p.c),p.e),10,n),d.e=d.c.length),s=u=(h=c(t,r,n)).length;0==h[--u];h.pop());if(!h[0])return"0";if(m<0?--s:(p.c=h,p.e=s,p.s=i,h=(p=T(p,d,y,g,n)).c,l=p.r,s=p.e),a=s+y+1,m=h[a],u=n/2,l=l||a<0||null!=h[a+1],l=g<4?(null!=m||l)&&(0==g||g==(p.s<0?3:2)):m>u||m==u&&(4==g||l||6==g&&1&h[a-1]||g==(p.s<0?8:7)),a<1||!h[0])t=l?f("1",-y):"0";else{if(h.length=a,l)for(--n;++h[--a]>n;)h[a]=0,a||(++s,h.unshift(1));for(u=h.length;!h[--u];);for(m=0,t="";m<=u;t+=b.charAt(h[m++]));t=f(t,s)}return t}function C(t,n,r,i){var a,s,c,l,p;if(r=null!=r&&W(r,0,8,i,g)?0|r:H,!t.c)return t.toString();if(a=t.c[0],c=t.e,null==n)p=o(t.c),p=19==i||24==i&&c<=j?u(p,c):f(p,c);else if(t=N(new e(t),n,r),s=t.e,p=o(t.c),l=p.length,19==i||24==i&&(n<=s||s<=j)){for(;ll){if(--n>0)for(p+=".";n--;p+="0");}else if((n+=s-l)>0)for(s+1==l&&(p+=".");n--;p+="0");return t.s<0&&a?"-"+p:p}function A(t,n){var r,o,i=0;for(s(t[0])&&(t=t[0]),r=new e(t[0]);++in||t!=l(t))&&I(r,(o||"decimal places")+(tn?" out of range":" not an integer"),t),!0}function O(t,e,n){for(var r=1,o=e.length;!e[--o];e.pop());for(o=e[0];o>=10;o/=10,r++);return(n=r+n*w-1)>L?t.c=t.e=null:n=10;s/=10,o++);if((i=e-o)<0)i+=w,a=e,f=(c=l[u=0])/p[o-a-1]%10|0;else if((u=d((i+1)/w))>=l.length){if(!r)break t;for(;l.length<=u;l.push(0));c=f=0,o=1,a=(i%=w)-w+1}else{for(c=s=l[u],o=1;s>=10;s/=10,o++);f=(a=(i%=w)-w+o)<0?0:c/p[o-a-1]%10|0}if(r=r||e<0||null!=l[u+1]||(a<0?c:c%p[o-a-1]),r=n<4?(f||r)&&(0==n||n==(t.s<0?3:2)):f>5||5==f&&(4==n||r||6==n&&(i>0?a>0?c/p[o-a]:0:l[u-1])%10&1||n==(t.s<0?8:7)),e<1||!l[0])return l.length=0,r?(e-=t.e+1,l[0]=p[(w-e%w)%w],t.e=-e||0):l[0]=t.e=0,t;if(0==i?(l.length=u,s=1,u--):(l.length=u+1,s=p[w-i],l[u]=a>0?m(c/p[o-a]%p[a])*s:0),r)for(;;){if(0==u){for(i=1,a=l[0];a>=10;a/=10,i++);for(a=l[0]+=s,s=1;a>=10;a/=10,s++);i!=s&&(t.e++,l[0]==_&&(l[0]=1));break}if(l[u]+=s,l[u]!=_)break;l[u--]=0,s=1}for(i=l.length;0===l[--i];l.pop());}t.e>L?t.c=t.e=null:t.en)return null!=(t=o[n++])};return c(e="DECIMAL_PLACES")&&W(t,0,S,2,e)&&(M=0|t),r[e]=M,c(e="ROUNDING_MODE")&&W(t,0,8,2,e)&&(H=0|t),r[e]=H,c(e="EXPONENTIAL_AT")&&(s(t)?W(t[0],-S,0,2,e)&&W(t[1],0,S,2,e)&&(j=0|t[0],q=0|t[1]):W(t,-S,S,2,e)&&(j=-(q=0|(t<0?-t:t)))),r[e]=[j,q],c(e="RANGE")&&(s(t)?W(t[0],-S,-1,2,e)&&W(t[1],1,S,2,e)&&(z=0|t[0],L=0|t[1]):W(t,-S,S,2,e)&&(0|t?z=-(L=0|(t<0?-t:t)):U&&I(2,e+" cannot be zero",t))),r[e]=[z,L],c(e="ERRORS")&&(t===!!t||1===t||0===t?(D=0,W=(U=!!t)?F:a):U&&I(2,e+y,t)),r[e]=U,c(e="CRYPTO")&&(!0===t||!1===t||1===t||0===t?t?!(t="undefined"==typeof crypto)&&crypto&&(crypto.getRandomValues||crypto.randomBytes)?J=!0:U?I(2,"crypto unavailable",t?void 0:crypto):J=!1:J=!1:U&&I(2,e+y,t)),r[e]=J,c(e="MODULO_MODE")&&W(t,0,9,2,e)&&(K=0|t),r[e]=K,c(e="POW_PRECISION")&&W(t,0,S,2,e)&&(G=0|t),r[e]=G,c(e="FORMAT")&&("object"==typeof t?X=t:U&&I(2,e+" not an object",t)),r[e]=X,r},e.max=function(){return A(arguments,R.lt)},e.min=function(){return A(arguments,R.gt)},e.random=function(){var t=9007199254740992*Math.random()&2097151?function(){return m(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(n){var r,o,i,a,s,c=0,u=[],f=new e(E);if(n=null!=n&&W(n,0,S,14)?0|n:M,a=d(n/w),J)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(a*=2));c>>11))>=9e15?(o=crypto.getRandomValues(new Uint32Array(2)),r[c]=o[0],r[c+1]=o[1]):(u.push(s%1e14),c+=2);c=a/2}else if(crypto.randomBytes){for(r=crypto.randomBytes(a*=7);c=9e15?crypto.randomBytes(7).copy(r,c):(u.push(s%1e14),c+=7);c=a/7}else J=!1,U&&I(14,"crypto unavailable",crypto);if(!J)for(;c=10;s/=10,c++);cr?1:-1;else for(o=i=0;oe[o]?1:-1;break}return i}function o(t,e,n,r){for(var o=0;n--;)t[n]-=o,o=t[n]1;t.shift());}return function(i,a,s,c,u){var f,l,p,h,d,y,g,v,b,x,k,B,S,C,A,F,O,I=i.s==a.s?1:-1,T=i.c,P=a.c;if(!(T&&T[0]&&P&&P[0]))return new e(i.s&&a.s&&(T?!P||T[0]!=P[0]:P)?T&&0==T[0]||!P?0*I:I/0:NaN);for(b=(v=new e(I)).c=[],I=s+(l=i.e-a.e)+1,u||(u=_,l=r(i.e/w)-r(a.e/w),I=I/w|0),p=0;P[p]==(T[p]||0);p++);if(P[p]>(T[p]||0)&&l--,I<0)b.push(1),h=!0;else{for(C=T.length,F=P.length,p=0,I+=2,(d=m(u/(P[0]+1)))>1&&(P=t(P,d,u),T=t(T,d,u),F=P.length,C=T.length),S=F,k=(x=T.slice(0,F)).length;k=u/2&&A++;do{if(d=0,(f=n(P,x,F,k))<0){if(B=x[0],F!=k&&(B=B*u+(x[1]||0)),(d=m(B/A))>1)for(d>=u&&(d=u-1),g=(y=t(P,d,u)).length,k=x.length;1==n(y,x,g,k);)d--,o(y,F=10;I/=10,p++);N(v,s+(v.e=p+l*w-1)+1,c,h)}else v.e=l,v.r=+h;return v}}(),P=function(){var t=/^(-?)0([xbo])(?=\w[\w.]*$)/i,n=/^([^.]+)\.$/,r=/^\.([^.]+)$/,o=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(a,s,c,u){var f,l=c?s:s.replace(i,"");if(o.test(l))a.s=isNaN(l)?null:l<0?-1:1;else{if(!c&&(l=l.replace(t,function(t,e,n){return f="x"==(n=n.toLowerCase())?16:"b"==n?2:8,u&&u!=f?t:e}),u&&(f=u,l=l.replace(n,"$1").replace(r,"0.$1")),s!=l))return new e(l,f);U&&I(D,"not a"+(u?" base "+u:"")+" number",s),a.s=null}a.c=a.e=null,D=0}}(),R.absoluteValue=R.abs=function(){var t=new e(this);return t.s<0&&(t.s=1),t},R.ceil=function(){return N(new e(this),this.e+1,2)},R.comparedTo=R.cmp=function(t,n){return D=1,i(this,new e(t,n))},R.decimalPlaces=R.dp=function(){var t,e,n=this.c;if(!n)return null;if(t=((e=n.length-1)-r(this.e/w))*w,e=n[e])for(;e%10==0;e/=10,t--);return t<0&&(t=0),t},R.dividedBy=R.div=function(t,n){return D=3,T(this,new e(t,n),M,H)},R.dividedToIntegerBy=R.divToInt=function(t,n){return D=4,T(this,new e(t,n),0,1)},R.equals=R.eq=function(t,n){return D=5,0===i(this,new e(t,n))},R.floor=function(){return N(new e(this),this.e+1,3)},R.greaterThan=R.gt=function(t,n){return D=6,i(this,new e(t,n))>0},R.greaterThanOrEqualTo=R.gte=function(t,n){return D=7,1===(n=i(this,new e(t,n)))||0===n},R.isFinite=function(){return!!this.c},R.isInteger=R.isInt=function(){return!!this.c&&r(this.e/w)>this.c.length-2},R.isNaN=function(){return!this.s},R.isNegative=R.isNeg=function(){return this.s<0},R.isZero=function(){return!!this.c&&0==this.c[0]},R.lessThan=R.lt=function(t,n){return D=8,i(this,new e(t,n))<0},R.lessThanOrEqualTo=R.lte=function(t,n){return D=9,-1===(n=i(this,new e(t,n)))||0===n},R.minus=R.sub=function(t,n){var o,i,a,s,c=this,u=c.s;if(D=10,t=new e(t,n),n=t.s,!u||!n)return new e(NaN);if(u!=n)return t.s=-n,c.plus(t);var f=c.e/w,l=t.e/w,p=c.c,h=t.c;if(!f||!l){if(!p||!h)return p?(t.s=-n,t):new e(h?c:NaN);if(!p[0]||!h[0])return h[0]?(t.s=-n,t):new e(p[0]?c:3==H?-0:0)}if(f=r(f),l=r(l),p=p.slice(),u=f-l){for((s=u<0)?(u=-u,a=p):(l=f,a=h),a.reverse(),n=u;n--;a.push(0));a.reverse()}else for(i=(s=(u=p.length)<(n=h.length))?u:n,u=n=0;n0)for(;n--;p[o++]=0);for(n=_-1;i>u;){if(p[--i]0?(c=s,o=f):(a=-a,o=u),o.reverse();a--;o.push(0));o.reverse()}for((a=u.length)-(n=f.length)<0&&(o=f,f=u,u=o,n=a),a=0;n;)a=(u[--n]=u[n]+f[n]+a)/_|0,u[n]=_===u[n]?0:u[n]%_;return a&&(u.unshift(a),++c),O(t,u,c)},R.precision=R.sd=function(t){var e,n,r=this,o=r.c;if(null!=t&&t!==!!t&&1!==t&&0!==t&&(U&&I(13,"argument"+y,t),t!=!!t&&(t=null)),!o)return null;if(n=o.length-1,e=n*w+1,n=o[n]){for(;n%10==0;n/=10,e--);for(n=o[0];n>=10;n/=10,e++);}return t&&r.e+1>e&&(e=r.e+1),e},R.round=function(t,n){var r=new e(this);return(null==t||W(t,0,S,15))&&N(r,~~t+this.e+1,null!=n&&W(n,0,8,15,g)?0|n:H),r},R.shift=function(t){var n=this;return W(t,-x,x,16,"argument")?n.times("1e"+l(t)):new e(n.c&&n.c[0]&&(t<-x||t>x)?n.s*(t<0?0:1/0):n)},R.squareRoot=R.sqrt=function(){var t,n,i,a,s,c=this,u=c.c,f=c.s,l=c.e,p=M+4,h=new e("0.5");if(1!==f||!u||!u[0])return new e(!f||f<0&&(!u||u[0])?NaN:u?c:1/0);if(0==(f=Math.sqrt(+c))||f==1/0?(((n=o(u)).length+l)%2==0&&(n+="0"),f=Math.sqrt(n),l=r((l+1)/2)-(l<0||l%2),i=new e(n=f==1/0?"1e"+l:(n=f.toExponential()).slice(0,n.indexOf("e")+1)+l)):i=new e(f+""),i.c[0])for((f=(l=i.e)+p)<3&&(f=0);;)if(s=i,i=h.times(s.plus(T(c,s,p,1))),o(s.c).slice(0,f)===(n=o(i.c)).slice(0,f)){if(i.e=0;){for(o=0,d=k[a]%v,m=k[a]/v|0,s=a+(c=f);s>a;)o=((l=d*(l=x[--c]%v)+(u=m*l+(p=x[c]/v|0)*d)%v*v+y[s]+o)/g|0)+(u/v|0)+m*p,y[s--]=l%g;y[s]=o}return o?++i:y.shift(),O(t,y,i)},R.toDigits=function(t,n){var r=new e(this);return t=null!=t&&W(t,1,S,18,"precision")?0|t:null,n=null!=n&&W(n,0,8,18,g)?0|n:H,t?N(r,t,n):r},R.toExponential=function(t,e){return C(this,null!=t&&W(t,0,S,19)?1+~~t:null,e,19)},R.toFixed=function(t,e){return C(this,null!=t&&W(t,0,S,20)?~~t+this.e+1:null,e,20)},R.toFormat=function(t,e){var n=C(this,null!=t&&W(t,0,S,21)?~~t+this.e+1:null,e,21);if(this.c){var r,o=n.split("."),i=+X.groupSize,a=+X.secondaryGroupSize,s=X.groupSeparator,c=o[0],u=o[1],f=this.s<0,l=f?c.slice(1):c,p=l.length;if(a&&(r=i,i=a,a=r,p-=r),i>0&&p>0){for(r=p%i||i,c=l.substr(0,r);r0&&(c+=s+l.slice(r)),f&&(c="-"+c)}n=u?c+X.decimalSeparator+((a=+X.fractionGroupSize)?u.replace(new RegExp("\\d{"+a+"}\\B","g"),"$&"+X.fractionGroupSeparator):u):c}return n},R.toFraction=function(t){var n,r,i,a,s,c,u,f,l,p=U,h=this,d=h.c,m=new e(E),y=r=new e(E),g=u=new e(E);if(null!=t&&(U=!1,c=new e(t),U=p,(p=c.isInt())&&!c.lt(E)||(U&&I(22,"max denominator "+(p?"out of range":"not an integer"),t),t=!p&&c.c&&N(c,c.e+1,1).gte(E)?c:null)),!d)return h.toString();for(l=o(d),a=m.e=l.length-h.e-1,m.c[0]=k[(s=a%w)<0?w+s:s],t=!t||c.cmp(m)>0?a>0?m:y:c,s=L,L=1/0,c=new e(l),u.c[0]=0;f=T(c,m,0,1),1!=(i=r.plus(f.times(g))).cmp(t);)r=g,g=i,y=u.plus(f.times(i=y)),u=i,m=c.minus(f.times(i=m)),c=i;return i=T(t.minus(r),g,0,1),u=u.plus(i.times(y)),r=r.plus(i.times(g)),u.s=y.s=h.s,a*=2,n=T(y,g,a,H).minus(h).abs().cmp(T(u,r,a,H).minus(h).abs())<1?[y.toString(),g.toString()]:[u.toString(),r.toString()],L=s,n},R.toNumber=function(){return+this},R.toPower=R.pow=function(t,n){var r,o,i,a=m(t<0?-t:+t),s=this;if(null!=n&&(D=23,n=new e(n)),!W(t,-x,x,23,"exponent")&&(!isFinite(t)||a>x&&(t/=0)||parseFloat(t)!=t&&!(t=NaN))||0==t)return r=Math.pow(+s,t),new e(n?r%n:r);for(n?t>1&&s.gt(E)&&s.isInt()&&n.gt(E)&&n.isInt()?s=s.mod(n):(i=n,n=null):G&&(r=d(G/w+2)),o=new e(E);;){if(a%2){if(!(o=o.times(s)).c)break;r?o.c.length>r&&(o.c.length=r):n&&(o=o.mod(n))}if(!(a=m(a/2)))break;s=s.times(s),r?s.c&&s.c.length>r&&(s.c.length=r):n&&(s=s.mod(n))}return n?o:(t<0&&(o=E.div(o)),i?o.mod(i):r?N(o,G,H):o)},R.toPrecision=function(t,e){return C(this,null!=t&&W(t,1,S,24,"precision")?0|t:null,e,24)},R.toString=function(t){var e,n=this,r=n.s,i=n.e;return null===i?r?(e="Infinity",r<0&&(e="-"+e)):e="NaN":(e=o(n.c),e=null!=t&&W(t,2,64,25,"base")?p(f(e,i),0|t,10,r):i<=j||i>=q?u(e,i):f(e,i),r<0&&n.c[0]&&(e="-"+e)),e},R.truncated=R.trunc=function(){return N(new e(this),this.e+1,1)},R.valueOf=R.toJSON=function(){var t,e=this,n=e.e;return null===n?e.toString():(t=o(e.c),t=n<=j||n>=q?u(t,n):f(t,n),e.s<0?"-"+t:t)},R.isBigNumber=!0,null!=t&&e.config(t),e}function r(t){var e=0|t;return t>0||t===e?e:e-1}function o(t){for(var e,n,r=1,o=t.length,i=t[0]+"";ru^n?1:-1;for(s=(c=o.length)<(u=i.length)?c:u,a=0;ai[a]^n?1:-1;return c==u?0:c>u^n?1:-1}function a(t,e,n){return(t=l(t))>=e&&t<=n}function s(t){return"[object Array]"==Object.prototype.toString.call(t)}function c(t,e,n){for(var r,o,i=[0],a=0,s=t.length;an-1&&(null==i[r+1]&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function u(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function f(t,e){var n,r;if(e<0){for(r="0.";++e;r+="0");t=r+t}else if(n=t.length,++e>n){for(r="0",e-=n;--e;r+="0");t+=r}else e 3 | // to customize your Truffle configuration! 4 | }; -------------------------------------------------------------------------------- /truffle.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // See 3 | networks: { 4 | development: { 5 | host: "127.0.0.1", 6 | port: 8545, 7 | network_id: "*" // Match any network id 8 | } 9 | } 10 | }; --------------------------------------------------------------------------------