From af8bff8569c5f77a595f3aa99fb53166e7585cd5 Mon Sep 17 00:00:00 2001 From: cesardeazevedo Date: Wed, 26 Oct 2016 15:17:38 -0200 Subject: [PATCH] Compile to release 0.0.1 --- dist/blinktrade.js | 558 ++++++++++++++++++------------------- dist/blinktrade.js.map | 2 +- dist/blinktrade.min.js | 4 +- dist/blinktrade.min.js.map | 2 +- 4 files changed, 278 insertions(+), 288 deletions(-) diff --git a/dist/blinktrade.js b/dist/blinktrade.js index a389f71..b8f3394 100644 --- a/dist/blinktrade.js +++ b/dist/blinktrade.js @@ -123,23 +123,23 @@ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - var _requests = __webpack_require__(3); + var _lodash = __webpack_require__(3); - var _requests2 = _interopRequireDefault(_requests); + var _lodash2 = _interopRequireDefault(_lodash); - var _wsTransport = __webpack_require__(4); + var _eventemitter = __webpack_require__(4); - var _wsTransport2 = _interopRequireDefault(_wsTransport); + var _listener = __webpack_require__(5); - var _lodash = __webpack_require__(9); + var _actionTypes = __webpack_require__(7); - var _lodash2 = _interopRequireDefault(_lodash); + var _requests = __webpack_require__(8); - var _eventemitter = __webpack_require__(13); + var _requests2 = _interopRequireDefault(_requests); - var _listener = __webpack_require__(10); + var _wsTransport = __webpack_require__(9); - var _actionTypes = __webpack_require__(24); + var _wsTransport2 = _interopRequireDefault(_wsTransport); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -573,6 +573,224 @@ /***/ }, /* 3 */ +/***/ function(module, exports) { + + module.exports = require("lodash"); + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + module.exports = require("eventemitter2"); + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /** + * BlinkTradeJS SDK + * (c) 2016-present BlinkTrade, Inc. + * + * This file is part of BlinkTradeJS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + */ + + exports.getListeners = getListeners; + exports.generateRequestId = generateRequestId; + exports.getListener = getListener; + exports.getRequest = getRequest; + exports.registerRequest = registerRequest; + exports.registerEventEmitter = registerEventEmitter; + exports.registerListener = registerListener; + exports.deleteRequest = deleteRequest; + + var _lodash = __webpack_require__(3); + + var _lodash2 = _interopRequireDefault(_lodash); + + var _requestTypes = __webpack_require__(6); + + var RequestTypes = _interopRequireWildcard(_requestTypes); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var requests = {}; + var listeners = {}; + + function getListeners() { + return requests; + } + + function generateRequestId() { + return parseInt(String(1e7 * Math.random()), 10); + } + + function getListener(msgType) { + return listeners[msgType]; + } + + function getRequest(message) { + var result = void 0; + _lodash2.default.mapKeys(RequestTypes, function (key) { + if (_lodash2.default.has(message, key)) { + result = _lodash2.default.find(requests[key], { ReqId: String(message[key]) }); + } + }); + + return result; + } + + function registerRequest(message, promise) { + _lodash2.default.mapKeys(RequestTypes, function (key) { + if (_lodash2.default.has(message, key)) { + requests[key] = requests[key] || []; + requests[key].push(_extends({ ReqId: String(message[key]) }, promise)); + } + }); + + return requests; + } + + function registerEventEmitter(message, callback) { + _lodash2.default.mapKeys(RequestTypes, function (key) { + if (_lodash2.default.has(message, key)) { + if (requests[key] !== []) { + var index = _lodash2.default.findIndex(requests[key], { ReqId: String(message[key]) }); + requests[key][index] = _extends({}, requests[key][index], { + resolve: null, + reject: null, + callback: callback + }); + } + } + }); + + return requests; + } + + function registerListener(msgType, callback) { + listeners[msgType] = listeners[msgType] || []; + listeners[msgType] = callback; + } + + function deleteRequest(key) { + requests = _lodash2.default.omit(requests, [key]); + return requests; + } + +/***/ }, +/* 6 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + var SOCKET_ID = exports.SOCKET_ID = 'SocketID'; + var REQUEST_ID = exports.REQUEST_ID = 'ReqID'; + var TEST_REQUEST_ID = exports.TEST_REQUEST_ID = 'TestReqID'; + var USER_REQUEST_ID = exports.USER_REQUEST_ID = 'UserReqID'; + var SECURITY_REQUEST_ID = exports.SECURITY_REQUEST_ID = 'SecurityReqID'; + var RESET_PASSWORD_REQUEST_ID = exports.RESET_PASSWORD_REQUEST_ID = 'ResetPasswordReqID'; + var DEPOSIT_REQUEST_ID = exports.DEPOSIT_REQUEST_ID = 'DepositReqID'; + var WITHDRAW_REQUEST_ID = exports.WITHDRAW_REQUEST_ID = 'WithdrawReqID'; + var BALANCE_REQUEST_ID = exports.BALANCE_REQUEST_ID = 'BalanceReqID'; + var ORDERS_REQUEST_ID = exports.ORDERS_REQUEST_ID = 'OrdersReqID'; + var ENABLE_TWO_FACTOR_REQUEST_ID = exports.ENABLE_TWO_FACTOR_REQUEST_ID = 'EnableTwoFactorReqID'; + var DEPOSIT_METHOD_REQUEST_ID = exports.DEPOSIT_METHOD_REQUEST_ID = 'DepositMethodReqID'; + var WITHDRAW_LIST_REQUEST_ID = exports.WITHDRAW_LIST_REQUEST_ID = 'WithdrawListReqID'; + var BROKER_LIST_REQUEST_ID = exports.BROKER_LIST_REQUEST_ID = 'BrokerListReqID'; + var DEPOSIT_LIST_REQUEST_ID = exports.DEPOSIT_LIST_REQUEST_ID = 'DepositListReqID'; + var TRADE_HISTORY_REQUEST_ID = exports.TRADE_HISTORY_REQUEST_ID = 'TradeHistoryReqID'; + var LEDGER_LIST_REQUEST_ID = exports.LEDGER_LIST_REQUEST_ID = 'LedgerListReqID'; + var TRADERS_RANK_REQUEST_ID = exports.TRADERS_RANK_REQUEST_ID = 'TradersRankReqID'; + var UPDATE_REQUEST_ID = exports.UPDATE_REQUEST_ID = 'UpdateReqID'; + var POSITION_REQUEST_ID = exports.POSITION_REQUEST_ID = 'PositionReqID'; + var SECURITY_STATUS_REQUEST_ID = exports.SECURITY_STATUS_REQUEST_ID = 'SecurityStatusReqID'; + var API_KEY_LIST_REQUEST_ID = exports.API_KEY_LIST_REQUEST_ID = 'APIKeyListReqID'; + var API_KEY_CREATE_REQUEST_ID = exports.API_KEY_CREATE_REQUEST_ID = 'APIKeyCreateReqID'; + var API_KEY_REVOKE_REQUEST_ID = exports.API_KEY_REVOKE_REQUEST_ID = 'APIKeyRevokeReqID'; + var PROCESS_DEPOSIT_REQUEST_ID = exports.PROCESS_DEPOSIT_REQUEST_ID = 'ProcessDepositReqID'; + var CUSTOMER_LIST_REQUEST_ID = exports.CUSTOMER_LIST_REQUEST_ID = 'CustomerListReqID'; + var CUSTOMER_REQUEST_ID = exports.CUSTOMER_REQUEST_ID = 'CustomerReqID'; + var PROCESS_WITHDRAW_REQUEST_ID = exports.PROCESS_WITHDRAW_REQUEST_ID = 'ProcessWithdrawReqID'; + var VERIFY_CUSTOMER_REQUEST_ID = exports.VERIFY_CUSTOMER_REQUEST_ID = 'VerifyCustomerReqID'; + var MD_REQUEST_ID = exports.MD_REQUEST_ID = 'MDReqID'; + var CLIENT_ORDER_ID = exports.CLIENT_ORDER_ID = 'ClOrdID'; + +/***/ }, +/* 7 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + var BALANCE = exports.BALANCE = 'BALANCE'; + + var ORDER_BOOK = exports.ORDER_BOOK = 'OB'; + var ORDER_BOOK_TRADE_NEW = exports.ORDER_BOOK_TRADE_NEW = 'TRADE_NEW'; + var ORDER_BOOK_NEW_ORDER = exports.ORDER_BOOK_NEW_ORDER = 'NEW_ORDER'; + var ORDER_BOOK_UPDATE_ORDER = exports.ORDER_BOOK_UPDATE_ORDER = 'UPDATE_ORDER'; + var ORDER_BOOK_DELETE_ORDER = exports.ORDER_BOOK_DELETE_ORDER = 'DELETE_ORDER'; + var ORDER_BOOK_DELETE_ORDERS_THRU = exports.ORDER_BOOK_DELETE_ORDERS_THRU = 'DELETE_ORDERS_THRU'; + + var EXECUTION_REPORT = exports.EXECUTION_REPORT = 'EXECUTION_REPORT'; + var EXECUTION_REPORT_NEW = exports.EXECUTION_REPORT_NEW = 'NEW'; + var EXECUTION_REPORT_PARTIAL = exports.EXECUTION_REPORT_PARTIAL = 'PARTIAL'; + var EXECUTION_REPORT_EXECUTION = exports.EXECUTION_REPORT_EXECUTION = 'EXECUTION'; + var EXECUTION_REPORT_CANCELED = exports.EXECUTION_REPORT_CANCELED = 'CANCELED'; + var EXECUTION_REPORT_REJECTED = exports.EXECUTION_REPORT_REJECTED = 'REJECTED'; + + var DEPOSIT_REFRESH = exports.DEPOSIT_REFRESH = 'DEPOSIT_REFRESH'; + var WITHDRAW_REFRESH = exports.WITHDRAW_REFRESH = 'WITHDRAW_REFRESH'; + + /* eslint-disable quote-props */ + var EVENTS = exports.EVENTS = { + ORDERBOOK: { + '0': ORDER_BOOK_NEW_ORDER, + '1': ORDER_BOOK_UPDATE_ORDER, + '2': ORDER_BOOK_DELETE_ORDER, + '3': ORDER_BOOK_DELETE_ORDERS_THRU + }, + TRADES: { + '0': ORDER_BOOK_TRADE_NEW + }, + EXECUTION_REPORT: { + '0': EXECUTION_REPORT_NEW, + '1': EXECUTION_REPORT_PARTIAL, + '2': EXECUTION_REPORT_EXECUTION, + '4': EXECUTION_REPORT_CANCELED, + '8': EXECUTION_REPORT_REJECTED + } + }; + +/***/ }, +/* 8 */ /***/ function(module, exports) { 'use strict'; @@ -611,7 +829,7 @@ }; /***/ }, -/* 4 */ +/* 9 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -622,21 +840,21 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - var _baseTransport = __webpack_require__(5); + var _baseTransport = __webpack_require__(10); var _baseTransport2 = _interopRequireDefault(_baseTransport); - var _fingerprintjs = __webpack_require__(11); + var _fingerprintjs = __webpack_require__(13); var _fingerprintjs2 = _interopRequireDefault(_fingerprintjs); - var _nodeify = __webpack_require__(12); + var _nodeify = __webpack_require__(14); var _nodeify2 = _interopRequireDefault(_nodeify); - var _eventemitter = __webpack_require__(13); + var _eventemitter = __webpack_require__(4); - var _listener = __webpack_require__(10); + var _listener = __webpack_require__(5); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -716,7 +934,7 @@ return _nodeify2.default.extend(new Promise(function (resolve, reject) { _this2.request = { resolve: resolve, reject: reject }; - var WebSocket = _this2.isNode ? __webpack_require__(14) : window.WebSocket; + var WebSocket = _this2.isNode ? __webpack_require__(15) : window.WebSocket; _this2.socket = new WebSocket(_this2.endpoint); _this2.socket.onopen = _this2.onOpen.bind(_this2); @@ -845,7 +1063,7 @@ var _this5 = this; if (this.isNode) { - return __webpack_require__(15).getMac(function (macAddress) { + return __webpack_require__(16).getMac(function (macAddress) { _this5.fingerPrint = macAddress; }); } @@ -859,7 +1077,7 @@ var _this6 = this; if (this.isNode) { - __webpack_require__(17).getStun(function (data) { + __webpack_require__(18).getStun(function (data) { _this6.stun = data; }); } @@ -872,7 +1090,7 @@ exports.default = WebSocketTransport; /***/ }, -/* 5 */ +/* 10 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -885,23 +1103,23 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - var _base = __webpack_require__(6); + var _lodash = __webpack_require__(3); + + var _lodash2 = _interopRequireDefault(_lodash); + + var _base = __webpack_require__(11); var _base2 = _interopRequireDefault(_base); - var _requests = __webpack_require__(3); + var _requests = __webpack_require__(8); var _requests2 = _interopRequireDefault(_requests); - var _requestTypes = __webpack_require__(8); + var _requestTypes = __webpack_require__(6); var RequestTypes = _interopRequireWildcard(_requestTypes); - var _lodash = __webpack_require__(9); - - var _lodash2 = _interopRequireDefault(_lodash); - - var _listener = __webpack_require__(10); + var _listener = __webpack_require__(5); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } @@ -1199,7 +1417,7 @@ return resolve(_extends({}, depositData, { DepositListGrp: DepositListGrp })); - }); + }).catch(reject); }); } }, { @@ -1247,7 +1465,7 @@ exports.default = BaseTransport; /***/ }, -/* 6 */ +/* 11 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -1256,7 +1474,7 @@ value: true }); - var _common = __webpack_require__(7); + var _common = __webpack_require__(12); var _common2 = _interopRequireDefault(_common); @@ -1317,7 +1535,7 @@ exports.default = Base; /***/ }, -/* 7 */ +/* 12 */ /***/ function(module, exports) { 'use strict'; @@ -1337,195 +1555,25 @@ }; /***/ }, -/* 8 */ -/***/ function(module, exports) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - var SOCKET_ID = exports.SOCKET_ID = 'SocketID'; - var REQUEST_ID = exports.REQUEST_ID = 'ReqID'; - var TEST_REQUEST_ID = exports.TEST_REQUEST_ID = 'TestReqID'; - var USER_REQUEST_ID = exports.USER_REQUEST_ID = 'UserReqID'; - var SECURITY_REQUEST_ID = exports.SECURITY_REQUEST_ID = 'SecurityReqID'; - var RESET_PASSWORD_REQUEST_ID = exports.RESET_PASSWORD_REQUEST_ID = 'ResetPasswordReqID'; - var DEPOSIT_REQUEST_ID = exports.DEPOSIT_REQUEST_ID = 'DepositReqID'; - var WITHDRAW_REQUEST_ID = exports.WITHDRAW_REQUEST_ID = 'WithdrawReqID'; - var BALANCE_REQUEST_ID = exports.BALANCE_REQUEST_ID = 'BalanceReqID'; - var ORDERS_REQUEST_ID = exports.ORDERS_REQUEST_ID = 'OrdersReqID'; - var ENABLE_TWO_FACTOR_REQUEST_ID = exports.ENABLE_TWO_FACTOR_REQUEST_ID = 'EnableTwoFactorReqID'; - var DEPOSIT_METHOD_REQUEST_ID = exports.DEPOSIT_METHOD_REQUEST_ID = 'DepositMethodReqID'; - var WITHDRAW_LIST_REQUEST_ID = exports.WITHDRAW_LIST_REQUEST_ID = 'WithdrawListReqID'; - var BROKER_LIST_REQUEST_ID = exports.BROKER_LIST_REQUEST_ID = 'BrokerListReqID'; - var DEPOSIT_LIST_REQUEST_ID = exports.DEPOSIT_LIST_REQUEST_ID = 'DepositListReqID'; - var TRADE_HISTORY_REQUEST_ID = exports.TRADE_HISTORY_REQUEST_ID = 'TradeHistoryReqID'; - var LEDGER_LIST_REQUEST_ID = exports.LEDGER_LIST_REQUEST_ID = 'LedgerListReqID'; - var TRADERS_RANK_REQUEST_ID = exports.TRADERS_RANK_REQUEST_ID = 'TradersRankReqID'; - var UPDATE_REQUEST_ID = exports.UPDATE_REQUEST_ID = 'UpdateReqID'; - var POSITION_REQUEST_ID = exports.POSITION_REQUEST_ID = 'PositionReqID'; - var SECURITY_STATUS_REQUEST_ID = exports.SECURITY_STATUS_REQUEST_ID = 'SecurityStatusReqID'; - var API_KEY_LIST_REQUEST_ID = exports.API_KEY_LIST_REQUEST_ID = 'APIKeyListReqID'; - var API_KEY_CREATE_REQUEST_ID = exports.API_KEY_CREATE_REQUEST_ID = 'APIKeyCreateReqID'; - var API_KEY_REVOKE_REQUEST_ID = exports.API_KEY_REVOKE_REQUEST_ID = 'APIKeyRevokeReqID'; - var PROCESS_DEPOSIT_REQUEST_ID = exports.PROCESS_DEPOSIT_REQUEST_ID = 'ProcessDepositReqID'; - var CUSTOMER_LIST_REQUEST_ID = exports.CUSTOMER_LIST_REQUEST_ID = 'CustomerListReqID'; - var CUSTOMER_REQUEST_ID = exports.CUSTOMER_REQUEST_ID = 'CustomerReqID'; - var PROCESS_WITHDRAW_REQUEST_ID = exports.PROCESS_WITHDRAW_REQUEST_ID = 'ProcessWithdrawReqID'; - var VERIFY_CUSTOMER_REQUEST_ID = exports.VERIFY_CUSTOMER_REQUEST_ID = 'VerifyCustomerReqID'; - var MD_REQUEST_ID = exports.MD_REQUEST_ID = 'MDReqID'; - var CLIENT_ORDER_ID = exports.CLIENT_ORDER_ID = 'ClOrdID'; - -/***/ }, -/* 9 */ -/***/ function(module, exports) { - - module.exports = require("lodash"); - -/***/ }, -/* 10 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /** - * BlinkTradeJS SDK - * (c) 2016-present BlinkTrade, Inc. - * - * This file is part of BlinkTradeJS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * - */ - - exports.getListeners = getListeners; - exports.generateRequestId = generateRequestId; - exports.getListener = getListener; - exports.getRequest = getRequest; - exports.registerRequest = registerRequest; - exports.registerEventEmitter = registerEventEmitter; - exports.registerListener = registerListener; - exports.deleteRequest = deleteRequest; - - var _lodash = __webpack_require__(9); - - var _lodash2 = _interopRequireDefault(_lodash); - - var _requestTypes = __webpack_require__(8); - - var RequestTypes = _interopRequireWildcard(_requestTypes); - - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - var requests = {}; - var listeners = {}; - - function getListeners() { - return requests; - } - - function generateRequestId() { - return parseInt(String(1e7 * Math.random()), 10); - } - - function getListener(msgType) { - return listeners[msgType]; - } - - function getRequest(message) { - var result = void 0; - _lodash2.default.mapKeys(RequestTypes, function (key) { - if (_lodash2.default.has(message, key)) { - result = _lodash2.default.find(requests[key], { ReqId: String(message[key]) }); - } - }); - - return result; - } - - function registerRequest(message, promise) { - _lodash2.default.mapKeys(RequestTypes, function (key) { - if (_lodash2.default.has(message, key)) { - requests[key] = requests[key] || []; - requests[key].push(_extends({ ReqId: String(message[key]) }, promise)); - } - }); - - return requests; - } - - function registerEventEmitter(message, callback) { - _lodash2.default.mapKeys(RequestTypes, function (key) { - if (_lodash2.default.has(message, key)) { - if (requests[key] !== []) { - var index = _lodash2.default.findIndex(requests[key], { ReqId: String(message[key]) }); - requests[key][index] = _extends({}, requests[key][index], { - resolve: null, - reject: null, - callback: callback - }); - } - } - }); - - return requests; - } - - function registerListener(msgType, callback) { - listeners[msgType] = listeners[msgType] || []; - listeners[msgType] = callback; - } - - function deleteRequest(key) { - requests = _lodash2.default.omit(requests, [key]); - return requests; - } - -/***/ }, -/* 11 */ +/* 13 */ /***/ function(module, exports) { module.exports = require("fingerprintjs2"); /***/ }, -/* 12 */ +/* 14 */ /***/ function(module, exports) { module.exports = require("nodeify"); /***/ }, -/* 13 */ -/***/ function(module, exports) { - - module.exports = require("eventemitter2"); - -/***/ }, -/* 14 */ +/* 15 */ /***/ function(module, exports) { module.exports = require("ws"); /***/ }, -/* 15 */ +/* 16 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -1535,7 +1583,7 @@ }); exports.getMac = getMac; - var _macaddress = __webpack_require__(16); + var _macaddress = __webpack_require__(17); var _macaddress2 = _interopRequireDefault(_macaddress); @@ -1588,13 +1636,13 @@ */ /***/ }, -/* 16 */ +/* 17 */ /***/ function(module, exports) { module.exports = require("macaddress"); /***/ }, -/* 17 */ +/* 18 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer) {'use strict'; @@ -1627,11 +1675,11 @@ exports.getStun = getStun; - var _ip = __webpack_require__(22); + var _ip = __webpack_require__(23); var _ip2 = _interopRequireDefault(_ip); - var _dgram = __webpack_require__(23); + var _dgram = __webpack_require__(24); var _dgram2 = _interopRequireDefault(_dgram); @@ -1751,10 +1799,10 @@ return socket.send(stunRequest, 0, stunRequest.length, port, host); }); } - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18).Buffer)) + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(19).Buffer)) /***/ }, -/* 18 */ +/* 19 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer, global) {/*! @@ -1767,9 +1815,9 @@ 'use strict' - var base64 = __webpack_require__(19) - var ieee754 = __webpack_require__(20) - var isArray = __webpack_require__(21) + var base64 = __webpack_require__(20) + var ieee754 = __webpack_require__(21) + var isArray = __webpack_require__(22) exports.Buffer = Buffer exports.SlowBuffer = SlowBuffer @@ -3547,85 +3595,37 @@ return val !== val // eslint-disable-line no-self-compare } - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18).Buffer, (function() { return this; }()))) - -/***/ }, -/* 19 */ -/***/ function(module, exports) { - - module.exports = require("base64-js"); + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(19).Buffer, (function() { return this; }()))) /***/ }, /* 20 */ /***/ function(module, exports) { - module.exports = require("ieee754"); + module.exports = require("base64-js"); /***/ }, /* 21 */ /***/ function(module, exports) { - module.exports = require("isarray"); + module.exports = require("ieee754"); /***/ }, /* 22 */ /***/ function(module, exports) { - module.exports = require("ip"); + module.exports = require("isarray"); /***/ }, /* 23 */ /***/ function(module, exports) { - + module.exports = require("ip"); /***/ }, /* 24 */ /***/ function(module, exports) { - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - var BALANCE = exports.BALANCE = 'BALANCE'; - - var ORDER_BOOK = exports.ORDER_BOOK = 'OB'; - var ORDER_BOOK_TRADE_NEW = exports.ORDER_BOOK_TRADE_NEW = 'TRADE_NEW'; - var ORDER_BOOK_NEW_ORDER = exports.ORDER_BOOK_NEW_ORDER = 'NEW_ORDER'; - var ORDER_BOOK_UPDATE_ORDER = exports.ORDER_BOOK_UPDATE_ORDER = 'UPDATE_ORDER'; - var ORDER_BOOK_DELETE_ORDER = exports.ORDER_BOOK_DELETE_ORDER = 'DELETE_ORDER'; - var ORDER_BOOK_DELETE_ORDERS_THRU = exports.ORDER_BOOK_DELETE_ORDERS_THRU = 'DELETE_ORDERS_THRU'; - - var EXECUTION_REPORT = exports.EXECUTION_REPORT = 'EXECUTION_REPORT'; - var EXECUTION_REPORT_NEW = exports.EXECUTION_REPORT_NEW = 'NEW'; - var EXECUTION_REPORT_PARTIAL = exports.EXECUTION_REPORT_PARTIAL = 'PARTIAL'; - var EXECUTION_REPORT_EXECUTION = exports.EXECUTION_REPORT_EXECUTION = 'EXECUTION'; - var EXECUTION_REPORT_CANCELED = exports.EXECUTION_REPORT_CANCELED = 'CANCELED'; - var EXECUTION_REPORT_REJECTED = exports.EXECUTION_REPORT_REJECTED = 'REJECTED'; - - var DEPOSIT_REFRESH = exports.DEPOSIT_REFRESH = 'DEPOSIT_REFRESH'; - var WITHDRAW_REFRESH = exports.WITHDRAW_REFRESH = 'WITHDRAW_REFRESH'; - - /* eslint-disable quote-props */ - var EVENTS = exports.EVENTS = { - ORDERBOOK: { - '0': ORDER_BOOK_NEW_ORDER, - '1': ORDER_BOOK_UPDATE_ORDER, - '2': ORDER_BOOK_DELETE_ORDER, - '3': ORDER_BOOK_DELETE_ORDERS_THRU - }, - TRADES: { - '0': ORDER_BOOK_TRADE_NEW - }, - EXECUTION_REPORT: { - '0': EXECUTION_REPORT_NEW, - '1': EXECUTION_REPORT_PARTIAL, - '2': EXECUTION_REPORT_EXECUTION, - '4': EXECUTION_REPORT_CANCELED, - '8': EXECUTION_REPORT_REJECTED - } - }; + /***/ }, /* 25 */ @@ -3692,16 +3692,10 @@ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - var _requests = __webpack_require__(3); - - var _requests2 = _interopRequireDefault(_requests); - var _restTransport = __webpack_require__(27); var _restTransport2 = _interopRequireDefault(_restTransport); - var _listener = __webpack_require__(10); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -3781,19 +3775,11 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - var _base = __webpack_require__(6); - - var _base2 = _interopRequireDefault(_base); - - var _baseTransport = __webpack_require__(5); - - var _baseTransport2 = _interopRequireDefault(_baseTransport); - var _sjcl = __webpack_require__(28); var _sjcl2 = _interopRequireDefault(_sjcl); - var _nodeify = __webpack_require__(12); + var _nodeify = __webpack_require__(14); var _nodeify2 = _interopRequireDefault(_nodeify); @@ -3805,6 +3791,10 @@ var _path2 = _interopRequireDefault(_path); + var _baseTransport = __webpack_require__(10); + + var _baseTransport2 = _interopRequireDefault(_baseTransport); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } diff --git a/dist/blinktrade.js.map b/dist/blinktrade.js.map index dc500bd..70decde 100644 --- a/dist/blinktrade.js.map +++ b/dist/blinktrade.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap d25e4a63c317cba82bf2","webpack:///./src/index.js","webpack:///./src/constants/brokers.js","webpack:///./src/ws.js","webpack:///./src/constants/requests.js","webpack:///./src/wsTransport.js","webpack:///./src/baseTransport.js","webpack:///./src/base.js","webpack:///./src/constants/common.js","webpack:///./src/constants/requestTypes.js","webpack:///external \"lodash\"","webpack:///./src/listener.js","webpack:///external \"fingerprintjs2\"","webpack:///external \"nodeify\"","webpack:///external \"eventemitter2\"","webpack:///external \"ws\"","webpack:///./src/util/macaddress.js","webpack:///external \"macaddress\"","webpack:///./src/util/stun.js","webpack:///./~/buffer/index.js","webpack:///external \"base64-js\"","webpack:///external \"ieee754\"","webpack:///external \"isarray\"","webpack:///external \"ip\"","webpack:///./src/constants/actionTypes.js","webpack:///./~/os-browserify/browser.js","webpack:///./src/rest.js","webpack:///./src/restTransport.js","webpack:///external \"sjcl\"","webpack:///external \"url\"","webpack:///./~/path-browserify/index.js","webpack:///./~/process/browser.js","webpack:///external \"isomorphic-fetch\"","webpack:///external \"fetch-jsonp\""],"names":["Brokers","BlinkTradeWS","BlinkTradeRest","SURBITCOIN","VBTC","FOXBIT","TESTNET","URDUBIT","CHILEBIT","params","session","callback","d","Date","msg","MsgType","HEARTBEAT","TestReqID","getTime","SendTime","Promise","resolve","reject","then","data","Latency","now","catch","username","password","secondFactor","userAgent","isNode","UserAgent","window","navigator","UserAgentLanguage","language","UserAgentPlatform","platform","UserAgentTimezoneOffset","getTimezoneOffset","os","require","type","release","arch","LOGIN","UserReqID","BrokerID","brokerId","Username","Password","UserReqTyp","SecondFactor","UserStatus","LOGOUT","Profile","VerificationData","profile","balance","eventEmitter","emit","symbols","SECURITY_STATUS","SecurityStatusReqID","SubscriptionRequestType","Instruments","formatTicker","SellVolume","LowPx","LastPx","BestAsk","HighPx","BuyVolume","BestBid","ticker","Symbol","MARKET_DATA_FULL_REFRESH","MDReqID","MarketDepth","MDUpdateType","MDEntryTypes","subscribeEvent","MDBkTyp","MDIncGrp","map","dataOrder","index","order","MDEntryPositionNo","price","MDEntryPx","size","MDEntrySize","side","MDEntryType","userId","UserID","orderId","OrderID","symbol","time","MDEntryDate","MDEntryTime","toString","orderbookEvent","ORDERBOOK","MDUpdateAction","tradeEvent","TRADES","MDFullGrp","filter","reduce","prev","push","bids","asks","err","MARKET_DATA_UNSUBSCRIBE","event","EXECUTION_REPORT","ExecType","since","page","Page","pageSize","PageSize","TRADE_HISTORY","TradeHistoryReqID","length","Filter","Since","Columns","trades","TradeHistory","groupBy","TradeHistoryGrp","zipObject","trade","Market","currency","value","depositMethodId","deposit","amount","method","withdraw","CHANGE_PASSWORD","ORDER_SEND","ORDER_CANCEL","SECURITY_LIST","BALANCE","ORDER_LIST","BROKER_LIST","PROFILE_UPDATE","REQUEST_DEPOSIT","REQUEST_DEPOSIT_LIST","REQUEST_DEPOSIT_METHODS","REQUEST_WITHDRAW","REQUEST_WITHDRAW_LIST","CONFIRM_WITHDRAW","CANCEL_WITHDRAW","WebSocketTransport","stun","local","public","getStun","getFingerPrint","wildcard","delimiter","extend","request","WebSocket","socket","endpoint","onopen","onOpen","bind","onclose","onClose","onerror","onError","onmessage","onMessage","nodeify","close","connected","readyState","STUNTIP","FingerPrint","fingerPrint","send","JSON","stringify","promise","sendMessage","parse","Error","Detail","Description","listener","dispatchPromise","dispatchListeners","on","onAny","offAny","once","many","times","removeListener","removeAllListeners","events","getMac","macAddress","get","RequestTypes","BaseTransport","env","sendMessageAsPromise","fetchTrade","BalanceReqID","Available","balances","Object","keys","includes","OrdersReqID","orders","OrdListGrp","ClOrdID","Side","OrdType","Price","OrderQty","CLIENT_ORDER_ID","param","clientId","statusList","StatusList","WithdrawListReqID","withdrawData","WithdrawListGrp","reqId","WithdrawReqID","Method","Amount","Currency","Data","WithdrawID","withdrawId","confirmationToken","ConfirmationToken","WithdrawCancelReqID","status","DepositListReqID","depositData","DepositListGrp","DepositReqID","DepositMethodID","Value","DepositMethodReqID","Base","url","prod","testnet","ws","rest","SOCKET_ID","REQUEST_ID","TEST_REQUEST_ID","USER_REQUEST_ID","SECURITY_REQUEST_ID","RESET_PASSWORD_REQUEST_ID","DEPOSIT_REQUEST_ID","WITHDRAW_REQUEST_ID","BALANCE_REQUEST_ID","ORDERS_REQUEST_ID","ENABLE_TWO_FACTOR_REQUEST_ID","DEPOSIT_METHOD_REQUEST_ID","WITHDRAW_LIST_REQUEST_ID","BROKER_LIST_REQUEST_ID","DEPOSIT_LIST_REQUEST_ID","TRADE_HISTORY_REQUEST_ID","LEDGER_LIST_REQUEST_ID","TRADERS_RANK_REQUEST_ID","UPDATE_REQUEST_ID","POSITION_REQUEST_ID","SECURITY_STATUS_REQUEST_ID","API_KEY_LIST_REQUEST_ID","API_KEY_CREATE_REQUEST_ID","API_KEY_REVOKE_REQUEST_ID","PROCESS_DEPOSIT_REQUEST_ID","CUSTOMER_LIST_REQUEST_ID","CUSTOMER_REQUEST_ID","PROCESS_WITHDRAW_REQUEST_ID","VERIFY_CUSTOMER_REQUEST_ID","MD_REQUEST_ID","getListeners","generateRequestId","getListener","getRequest","registerRequest","registerEventEmitter","registerListener","deleteRequest","requests","listeners","parseInt","String","Math","random","msgType","message","result","mapKeys","key","has","find","ReqId","findIndex","omit","all","hashCode","str","hash","i","charCodeAt","macAddresses","forEach","iface","mac","stunIp","addIPAddress","ipAddress","match","indexOf","createSocket","STUN_HEADER_LENGTH","stunRequest","Buffer","STUN_METHOD_REQUEST","STUN_BINDING_CLASS","STUN_MAGIC_COOKIE","STUN_TID_MAX","pow","STUN_ATTR_MAPPED_ADDRESS","STUN_ATTR_XOR_MAPPED_ADDRESS","STUN_ATTR_XOR_MAPPED_ADDRESS_ALT","stunTxId","stunServers","writeUInt16BE","writeUInt32BE","xor","a","b","tmp","len","block","readUInt8","bit1","bit2","msgHeader","slice","msgAttrs","offset","attrType","readUInt16BE","attrBuffLength","blockOut","family","address","magic","tid","xaddr","addr","concat","port","host","ORDER_BOOK","ORDER_BOOK_TRADE_NEW","ORDER_BOOK_NEW_ORDER","ORDER_BOOK_UPDATE_ORDER","ORDER_BOOK_DELETE_ORDER","ORDER_BOOK_DELETE_ORDERS_THRU","EXECUTION_REPORT_NEW","EXECUTION_REPORT_PARTIAL","EXECUTION_REPORT_EXECUTION","EXECUTION_REPORT_CANCELED","EXECUTION_REPORT_REJECTED","DEPOSIT_REFRESH","WITHDRAW_REFRESH","EVENTS","limit","RestTransport","secret","fetchRequest","body","timeStamp","hexKey","codec","utf8String","toBits","hmac","misc","sha256","Signature","hex","fromBits","encrypt","headers","Nonce","APIKey","api","response","json","fetch","join","Status","Responses"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;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WAAW,CAAX,GAAeE,KAAf,GAAuBtO,MAAM0O,MAAN,CAAa,CAACJ,KAAD,EAAQC,GAAR,CAAb,CAAlC,CAAb;AACAF,qBAAU,aAAG1Q,QAAH,CAAY8Q,IAAZ,EAAkB,CAAlB,EAAqBL,MAArB,CAAV;AACArC,wBAAasC,OAAb;AACA;AACF;AAjBF;AAmBD;;AAEDxW,cAASiU,MAAT;AACD,IAlED;;AAoEAkB,eAAYxQ,GAAZ,CAAgB;AAAA;;AAAA,SAAEmS,IAAF;AAAA,SAAQC,IAAR;AAAA,YAAkB5M,OAAOkB,IAAP,CAAYmJ,WAAZ,EAAyB,CAAzB,EAA4BA,YAAYjN,MAAxC,EAAgDuP,IAAhD,EAAsDC,IAAtD,CAAlB;AAAA,IAAhB;AACD,E;;;;;;;ACjJD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAqB,mDAAmD;AACxE;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAmB,UAAU;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kBAAiB,YAAY;AAC7B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA0B;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,wCAAuC,SAAS;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;AACA,cAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAiB,SAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iDAAgD,EAAE;AAClD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0CAAyC;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,yBAAwB,eAAe;AACvC;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA,IAAG;AACH;AACA,yBAAwB,QAAQ;AAChC;AACA,sBAAqB,eAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,sBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA,oBAAmB,cAAc;AACjC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wDAAuD,OAAO;AAC9D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA,wDAAuD,OAAO;AAC9D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,sBAAqB,QAAQ;AAC7B;AACA;AACA,IAAG;AACH;AACA,gBAAe,SAAS;AACxB;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,oBAAmB,SAAS;AAC5B;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA,gBAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;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ACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAU,oBAAoB;AAC9B;AACA;;AAEA;AACA,WAAU,UAAU;AACpB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA,gCAA+B,sBAAsB;AACrD;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAmB,eAAe;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA,mCAAkC;AAClC;AACA;AACA;AACA;AACA;;;;;;;;AC/NA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,4BAA2B;AAC3B;AACA;AACA;AACA,6BAA4B,UAAU;;;;;;;AC/JtC,8C;;;;;;ACAA,yC","file":"blinktrade.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap d25e4a63c317cba82bf2\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport Brokers from './constants/brokers';\nimport BlinkTradeWS from './ws';\nimport BlinkTradeRest from './rest';\n\nexport {\n Brokers,\n BlinkTradeWS,\n BlinkTradeRest,\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/index.js\n **/","export default {\n SURBITCOIN: 1,\n VBTC: 3,\n FOXBIT: 4,\n TESTNET: 5,\n URDUBIT: 8,\n CHILEBIT: 9,\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/brokers.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport MsgTypes from './constants/requests';\n\nimport WebSocketTransport from './wsTransport';\nimport _ from 'lodash';\nimport { EventEmitter2 as EventEmitter } from 'eventemitter2';\nimport {\n registerListener,\n generateRequestId,\n registerEventEmitter,\n} from './listener';\n\nimport {\n EVENTS,\n BALANCE,\n ORDER_BOOK,\n DEPOSIT_REFRESH,\n WITHDRAW_REFRESH,\n EXECUTION_REPORT,\n} from './constants/actionTypes';\n\nclass BlinkTradeWS extends WebSocketTransport {\n\n /**\n * Session to store login information\n */\n session: Object;\n\n constructor(params?: BlinkTradeBase) {\n super(params);\n\n this.session = {};\n }\n\n heartbeat(callback?: Function): Promise {\n const d = new Date();\n const msg: Object = {\n MsgType: MsgTypes.HEARTBEAT,\n TestReqID: d.getTime(),\n SendTime: d.getTime(),\n };\n\n return new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then((data) => {\n return resolve({\n ...data,\n Latency: new Date(Date.now()) - data.SendTime,\n });\n }).catch(reject);\n });\n }\n\n login({ username, password, secondFactor }: {\n username: string;\n password: string;\n secondFactor?: string;\n }, callback?: Function): Promise {\n let userAgent;\n if (!this.isNode) {\n userAgent = {\n UserAgent: window.navigator.userAgent,\n UserAgentLanguage: window.navigator.language,\n UserAgentPlatform: window.navigator.platform,\n UserAgentTimezoneOffset: new Date().getTimezoneOffset(),\n };\n } else {\n const os = require('os');\n userAgent = {\n UserAgent: `${os.type()} ${os.release()}`,\n UserAgentLanguage: 'en_US',\n UserAgentPlatform: `${os.platform()} (${os.arch()})`,\n UserAgentTimezoneOffset: new Date().getTimezoneOffset(),\n };\n }\n\n const msg: Object = {\n MsgType: MsgTypes.LOGIN,\n UserReqID: generateRequestId(),\n BrokerID: this.brokerId,\n Username: username,\n Password: password,\n UserReqTyp: '1',\n ...userAgent,\n };\n\n if (secondFactor) {\n msg.SecondFactor = secondFactor;\n }\n\n return new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then(data => {\n if (data.UserStatus === 1) {\n this.session = data;\n return resolve(data);\n }\n\n return reject(data);\n }).catch(reject);\n });\n }\n\n logout(callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.LOGOUT,\n BrokerID: this.brokerId,\n UserReqID: generateRequestId(),\n Username: this.session.Username,\n UserReqTyp: '2',\n };\n\n return super.sendMessageAsPromise(msg, callback);\n }\n\n profile(callback?: Function): Promise {\n const { VerificationData, ...profile } = this.session.Profile;\n return callback ? callback(profile) : Promise.resolve(profile);\n }\n\n balance(callback?: Function): Promise {\n registerListener('U3', (balance) => {\n callback && callback(null, balance);\n return this.eventEmitter.emit(BALANCE, balance);\n });\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.balance(callback).then(resolve).catch(reject);\n }));\n }\n\n subscribeTicker(symbols: Array, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.SECURITY_STATUS,\n SecurityStatusReqID: generateRequestId(),\n SubscriptionRequestType: '1',\n Instruments: symbols,\n };\n\n const formatTicker = (data) => {\n return {\n ...data,\n SellVolume: data.SellVolume / 1e8,\n LowPx: data.LowPx / 1e8,\n LastPx: data.LastPx / 1e8,\n BestAsk: data.BestAsk / 1e8,\n HighPx: data.HighPx / 1e8,\n BuyVolume: data.BuyVolume / 1e8,\n BestBid: data.BestBid / 1e8,\n };\n };\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then(data => {\n resolve(formatTicker(data));\n registerEventEmitter({ SecurityStatusReqID: data.SecurityStatusReqID }, (ticker) => {\n callback && callback(null, formatTicker(ticker));\n return this.eventEmitter.emit(`BLINK:${ticker.Symbol}`, formatTicker(ticker));\n });\n }).catch(reject);\n }));\n }\n\n unSubscribeTicker(SecurityStatusReqID: number): number {\n const msg = {\n MsgType: MsgTypes.SECURITY_STATUS,\n SecurityStatusReqID,\n SubscriptionRequestType: '2',\n };\n\n super.sendMessage(msg);\n return SecurityStatusReqID;\n }\n\n subscribeOrderbook(symbols: Array, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.MARKET_DATA_FULL_REFRESH,\n MDReqID: generateRequestId(),\n SubscriptionRequestType: '1',\n MarketDepth: 0,\n MDUpdateType: '1', // Incremental refresh\n MDEntryTypes: ['0', '1', '2'],\n Instruments: symbols,\n };\n\n const subscribeEvent = (data) => {\n if (data.MDBkTyp === '3') {\n data.MDIncGrp.map(order => {\n const dataOrder = {\n index: order.MDEntryPositionNo,\n price: order.MDEntryPx / 1e8,\n size: order.MDEntrySize / 1e8,\n side: order.MDEntryType === '0' ? 'buy' : 'sell',\n userId: order.UserID,\n orderId: order.OrderID,\n symbol: order.Symbol,\n time: new Date(`${order.MDEntryDate} ${order.MDEntryTime}`).toString(),\n };\n\n callback && callback(null, dataOrder);\n\n switch (order.MDEntryType) {\n case '0':\n case '1':\n const orderbookEvent = ORDER_BOOK + ':' + EVENTS.ORDERBOOK[order.MDUpdateAction];\n return this.eventEmitter.emit(orderbookEvent, {\n ...dataOrder,\n type: orderbookEvent,\n });\n case '2':\n const tradeEvent = ORDER_BOOK + ':' + EVENTS.TRADES[order.MDUpdateAction];\n return this.eventEmitter.emit(tradeEvent, {\n ...dataOrder,\n type: tradeEvent,\n });\n case '4':\n break;\n default:\n return null;\n }\n return null;\n });\n }\n };\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then(data => {\n if (data.MsgType === 'W') {\n // Split orders in bids and asks\n /* eslint-disable no-param-reassign */\n const { bids, asks } = data.MDFullGrp\n .filter(order => order.MDEntryType === '0' || order.MDEntryType === '1')\n .reduce((prev, order) => {\n const side = order.MDEntryType === '0' ? 'bids' : 'asks';\n (prev[side] || (prev[side] = [])).push([\n order.MDEntryPx / 1e8,\n order.MDEntrySize / 1e8,\n order.UserID,\n ]);\n return prev;\n }, []);\n /* eslint-enable no-param-reassign */\n\n registerEventEmitter({ MDReqID: data.MDReqID }, subscribeEvent);\n\n return resolve({\n ...data,\n MDFullGrp: {\n [data.Symbol]: {\n bids,\n asks,\n },\n },\n });\n }\n }).catch(err => reject(err));\n }));\n }\n\n unSubscribeOrderbook(MDReqID: number): number {\n const msg = {\n MsgType: MsgTypes.MARKET_DATA_UNSUBSCRIBE,\n MDReqID,\n MarketDepth: 0,\n SubscriptionRequestType: '2',\n };\n\n super.sendMessage(msg);\n return MDReqID;\n }\n\n executionReport(callback?: Function): EventEmitter {\n registerListener('8', (data) => {\n callback && callback(data);\n const event = EVENTS.EXECUTION_REPORT[data.ExecType];\n return this.eventEmitter.emit(`${EXECUTION_REPORT}:${event}`, data);\n });\n\n return this.eventEmitter;\n }\n\n tradeHistory({ since, filter, page: Page = 0, pageSize: PageSize = 80 }: {\n since?: string;\n filter?: Array;\n page?: number;\n pageSize?: number;\n } = {}, callback?: Function): Promise {\n const msg: Object = {\n MsgType: MsgTypes.TRADE_HISTORY,\n TradeHistoryReqID: generateRequestId(),\n Page,\n PageSize,\n };\n\n if (filter && filter.length > 0) {\n msg.Filter = filter;\n }\n\n if (since && typeof since === 'number') {\n msg.Since = since;\n }\n\n return new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then(data => {\n const { Columns, ...trades } = data;\n const TradeHistory = _.groupBy(_.map(data.TradeHistoryGrp, trade => _.zipObject(Columns, trade)), trade => trade.Market);\n return resolve({\n ...trades,\n TradeHistoryGrp: TradeHistory,\n });\n }).catch(reject);\n });\n }\n\n requestDeposit({ currency = 'BTC', value, depositMethodId }: {\n value?: number;\n currency?: string;\n depositMethodId?: number;\n } = {}, callback?: Function): Promise {\n registerListener('U23', (deposit) => {\n callback && callback(null, deposit);\n return this.eventEmitter.emit(DEPOSIT_REFRESH, deposit);\n });\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.requestDeposit({ currency, value, depositMethodId }, callback)\n .then(resolve)\n .catch(reject);\n }));\n }\n\n onDepositRefresh(callback: Function): Promise {\n return new Promise((resolve) => {\n registerListener('U23', (deposit) => {\n callback && callback(deposit);\n return resolve(deposit);\n });\n });\n }\n\n requestWithdraw({ amount, data, currency = 'BTC', method = 'bitcoin' }: {\n data: Object,\n amount: number;\n method?: string;\n currency?: string;\n }, callback: Function): Promise {\n registerListener('U9', (withdraw) => {\n callback && callback(null, withdraw);\n return this.eventEmitter.emit(WITHDRAW_REFRESH, withdraw);\n });\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.requestWithdraw({ amount, data, currency, method }, callback)\n .then(resolve)\n .catch(reject);\n }));\n }\n\n onWithdrawRefresh(callback: Function): Promise {\n return new Promise((resolve) => {\n registerListener('U9', (withdraw) => {\n callback && callback(withdraw);\n return resolve(withdraw);\n });\n });\n }\n}\n\nexport default BlinkTradeWS;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/ws.js\n **/","export default {\n HEARTBEAT: '1',\n LOGIN: 'BE',\n LOGOUT: 'BE',\n CHANGE_PASSWORD: 'BE',\n\n MARKET_DATA_FULL_REFRESH: 'V',\n MARKET_DATA_UNSUBSCRIBE: 'V',\n\n ORDER_SEND: 'D',\n ORDER_CANCEL: 'F',\n\n SECURITY_LIST: 'x',\n SECURITY_STATUS: 'e',\n BALANCE: 'U2',\n ORDER_LIST: 'U4',\n BROKER_LIST: 'U28',\n TRADE_HISTORY: 'U32',\n PROFILE_UPDATE: 'U38',\n\n REQUEST_DEPOSIT: 'U18',\n REQUEST_DEPOSIT_LIST: 'U30',\n REQUEST_DEPOSIT_METHODS: 'U20',\n REQUEST_WITHDRAW: 'U6',\n REQUEST_WITHDRAW_LIST: 'U26',\n\n CONFIRM_WITHDRAW: 'U24',\n CANCEL_WITHDRAW: 'U70',\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/requests.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport BaseTransport from './baseTransport';\nimport Fingerprint2 from 'fingerprintjs2';\nimport nodeify from 'nodeify';\nimport { EventEmitter2 as EventEmitter } from 'eventemitter2';\n\nimport {\n getRequest,\n getListener,\n registerRequest,\n} from './listener';\n\n/* eslint-disable global-require */\n\nclass WebSocketTransport extends BaseTransport {\n\n /*\n * WebSocket Instance\n */\n socket: WebSocket;\n\n /*\n * FingerPrint\n */\n fingerPrint: string;\n\n /*\n * Stun object\n */\n stun: Stun;\n\n /*\n * Transport Promise\n */\n request: Request;\n\n /*\n * Event emitter to dispatch websocket updates\n */\n eventEmitter: EventEmitter;\n\n constructor(params?: BlinkTradeBase) {\n super(params, 'ws');\n\n this.stun = { local: null, public: [] };\n\n this.getStun();\n this.getFingerPrint();\n\n this.eventEmitter = new EventEmitter({ wildcard: true, delimiter: ':' });\n }\n\n connect(callback?: Function): Promise {\n return nodeify.extend(new Promise((resolve, reject) => {\n this.request = { resolve, reject };\n\n const WebSocket = this.isNode ? require('ws') : window.WebSocket;\n\n this.socket = new WebSocket(this.endpoint);\n this.socket.onopen = this.onOpen.bind(this);\n this.socket.onclose = this.onClose.bind(this);\n this.socket.onerror = this.onError.bind(this);\n this.socket.onmessage = this.onMessage.bind(this);\n })).nodeify(callback);\n }\n\n disconnect(): void {\n this.socket.close();\n }\n\n onOpen(): void {\n this.request.resolve({ connected: true });\n }\n\n onClose(): void {\n }\n\n onError(): void {\n this.request.reject();\n }\n\n sendMessage(msg: Object): void {\n if (this.socket.readyState === 1) {\n const data = msg;\n\n data.STUNTIP = this.stun;\n data.FingerPrint = this.fingerPrint;\n\n this.socket.send(JSON.stringify(data));\n }\n }\n\n sendMessageAsPromise(msg: Object, callback?: Function): Promise {\n return nodeify.extend(new Promise((resolve, reject) => {\n const promise = { resolve, reject };\n\n if (!msg) {\n return reject('Missing Message');\n }\n\n registerRequest(msg, promise);\n\n // Send promise to sendMessage to we can mock it.\n this.sendMessage(msg, promise);\n })).nodeify(callback);\n }\n\n onMessage(msg: Object): void {\n const data = JSON.parse(msg.data);\n if (data.MsgType === 'ERROR') {\n throw new Error(`Error: ${data.Detail} ${data.Description}`);\n }\n\n const request = getRequest(data);\n const listener = getListener(data.MsgType);\n this.dispatchPromise(request, data);\n this.dispatchListeners(listener, data);\n }\n\n dispatchPromise(request: ?Request, data: Object): any {\n if (request) {\n return request.resolve ? request.resolve(data)\n : request.callback ? request.callback(data)\n : null;\n }\n }\n\n dispatchListeners(listener: Function, data: Object): void {\n return listener && listener(data);\n }\n\n /* eslint-disable no-param-reassign */\n emitterPromise(promise: Promise): Promise {\n promise.on = (event: string, listener: Function) => {\n this.eventEmitter.on(event, listener);\n return promise;\n };\n promise.onAny = (listener: Function) => {\n this.eventEmitter.onAny(listener);\n return promise;\n };\n promise.offAny = (listener: Function) => {\n this.eventEmitter.offAny(listener);\n return promise;\n };\n promise.once = (event: string, listener: Function) => {\n this.eventEmitter.once(event, listener);\n return promise;\n };\n promise.many = (event: string, times: number, listener: Function) => {\n this.eventEmitter.many(event, times, listener);\n return promise;\n };\n promise.removeListener = (event: string, listener: Function) => {\n this.eventEmitter.removeListener(event, listener);\n return promise;\n };\n promise.removeAllListeners = (events: Array) => {\n this.eventEmitter.removeAllListeners(events);\n return promise;\n };\n\n return promise;\n }\n /* eslint-enable no-param-reassign */\n\n getFingerPrint(): void {\n if (this.isNode) {\n return require('./util/macaddress').getMac(macAddress => {\n this.fingerPrint = macAddress;\n });\n }\n return new Fingerprint2().get(fingerPrint => {\n this.fingerPrint = fingerPrint;\n });\n }\n\n getStun(): void {\n if (this.isNode) {\n require('./util/stun').getStun(data => {\n this.stun = data;\n });\n }\n }\n}\n\nexport default WebSocketTransport;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/wsTransport.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport Base from './base';\nimport MsgTypes from './constants/requests';\nimport * as RequestTypes from './constants/requestTypes';\nimport _ from 'lodash';\nimport {\n deleteRequest,\n generateRequestId,\n} from './listener';\n\ntype StatusList = '1' | '2' | '4' | '8';\n\nclass BaseTransport extends Base {\n\n env: BlinkTradeEnv;\n\n send: Function;\n\n fetchTrade: Function;\n\n sendMessageAsPromise: Function;\n\n constructor(params?: BlinkTradeBase, env: BlinkTradeEnv) {\n super(params, env);\n\n this.send = env === 'ws' ? this.sendMessageAsPromise : this.fetchTrade;\n }\n\n balance(callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.BALANCE,\n BalanceReqID: generateRequestId(),\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n const Available = {};\n const balances = data[this.brokerId];\n Object.keys(balances).map(currency => {\n if (!currency.includes('locked')) {\n Available[currency] = balances[currency] - balances[`${currency}_locked`];\n }\n return Available;\n });\n\n return resolve({ ...data, Available });\n }).catch(reject);\n });\n }\n\n myOrders({ page: Page = 0, pageSize: PageSize = 40 }: {\n page?: number;\n pageSize?: number;\n } = {}, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.ORDER_LIST,\n OrdersReqID: generateRequestId(),\n Page,\n PageSize,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n const { Columns, ...orders } = data;\n const OrdListGrp = _.map(data.OrdListGrp, order => _.zipObject(Columns, order));\n return resolve({\n ...orders,\n OrdListGrp,\n });\n }).catch(reject);\n });\n }\n\n sendOrder({ side, amount, price, symbol }: {\n side: '1' | '2';\n price: number;\n amount: number;\n symbol: string;\n }, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.ORDER_SEND,\n ClOrdID: generateRequestId(),\n Symbol: symbol,\n Side: side,\n OrdType: '2',\n Price: price,\n OrderQty: amount,\n BrokerID: this.brokerId,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n deleteRequest(RequestTypes.CLIENT_ORDER_ID);\n resolve(data);\n }).catch(reject);\n });\n }\n\n cancelOrder(param: number | {\n orderId: number;\n clientId?: number;\n }, callback?: Function): Promise {\n const orderId = param.orderId ? param.orderId : param;\n const msg: Object = {\n MsgType: MsgTypes.ORDER_CANCEL,\n OrderID: orderId,\n };\n\n if (param.clientId) {\n msg.ClOrdID = param.clientId;\n }\n\n return this.send(msg, callback);\n }\n\n /**\n * statusList: 1-Pending, 2-In Progress, 4-Completed, 8-Cancelled\n */\n requestWithdrawList({\n page: Page = 0,\n pageSize: PageSize = 20,\n statusList: StatusList = ['1', '2', '4', '8'],\n }: {\n page?: number;\n pageSize?: number;\n statusList?: Array;\n } = {}, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.REQUEST_WITHDRAW_LIST,\n WithdrawListReqID: generateRequestId(),\n Page,\n PageSize,\n StatusList,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n const { Columns, ...withdrawData } = data;\n const WithdrawListGrp = _.map(data.WithdrawListGrp, withdraw => _.zipObject(Columns, withdraw));\n return resolve({\n ...withdrawData,\n WithdrawListGrp,\n });\n }).catch(reject);\n });\n }\n\n requestWithdraw({ amount, data, currency = 'BTC', method = 'bitcoin' }: {\n data: Object,\n amount: number;\n method?: string;\n currency?: string;\n }, callback: Function): Promise {\n const reqId = generateRequestId();\n const msg = {\n MsgType: MsgTypes.REQUEST_WITHDRAW,\n WithdrawReqID: reqId,\n ClOrdID: reqId,\n Method: method,\n Amount: amount,\n Currency: currency,\n Data: data,\n };\n\n return this.send(msg, callback);\n }\n\n confirmWithdraw({ withdrawId: WithdrawID, confirmationToken, secondFactor }: {\n withdrawId: string;\n confirmationToken?: string;\n secondFactor?: string;\n }, callback: Function): Promise {\n const msg: Object = {\n MsgType: MsgTypes.CONFIRM_WITHDRAW,\n WithdrawReqID: generateRequestId(),\n WithdrawID,\n };\n\n if (confirmationToken) {\n msg.ConfirmationToken = confirmationToken;\n }\n\n if (secondFactor) {\n msg.SecondFactor = secondFactor;\n }\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n return resolve({\n ...data,\n });\n }).catch(reject);\n });\n }\n\n cancelWithdraw(withdrawId: string, callback: Function): Promise {\n const reqId = generateRequestId();\n const msg = {\n MsgType: MsgTypes.CANCEL_WITHDRAW,\n WithdrawCancelReqID: reqId,\n ClOrdID: reqId,\n WithdrawID: withdrawId,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n return resolve({\n ...data,\n });\n }).catch(reject);\n });\n }\n\n requestDepositList({\n page: Page = 0,\n pageSize: PageSize = 20,\n status: StatusList = ['1', '2', '4', '8']\n }: {\n page: number;\n pageSize: number;\n status: Array;\n } = {}, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.REQUEST_DEPOSIT_LIST,\n DepositListReqID: generateRequestId(),\n Page,\n PageSize,\n StatusList,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n const { Columns, ...depositData } = data;\n const DepositListGrp = _.map(data.DepositListGrp, deposit => _.zipObject(Columns, deposit));\n return resolve({\n ...depositData,\n DepositListGrp,\n });\n });\n });\n }\n\n requestDeposit({ currency = 'BTC', value, depositMethodId }: {\n value?: number;\n currency?: string;\n depositMethodId?: number;\n } = {}, callback?: Function): Promise {\n const reqId = generateRequestId();\n const msg: Object = {\n MsgType: MsgTypes.REQUEST_DEPOSIT,\n DepositReqID: reqId,\n ClOrdID: reqId,\n Currency: currency,\n BrokerID: this.brokerId,\n };\n\n if (currency !== 'BTC') {\n msg.DepositMethodID = depositMethodId;\n msg.Value = value;\n }\n\n return this.send(msg, callback);\n }\n\n requestDepositMethods(callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.REQUEST_DEPOSIT_METHODS,\n DepositMethodReqID: generateRequestId(),\n };\n\n return this.send(msg, callback);\n }\n}\n\nexport default BaseTransport;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/baseTransport.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport common from './constants/common';\n\nclass Base {\n\n /*\n * url endpoint.\n */\n endpoint: string;\n\n /*\n * Broker id\n */\n brokerId: number;\n\n /*\n * Is node.js environment.\n */\n isNode: boolean;\n\n constructor(params: BlinkTradeBase = {}, env: BlinkTradeEnv) {\n const endpoint =\n params.url ? params.url\n : params.prod ? common.prod[env]\n : common.testnet[env];\n\n this.brokerId = params.brokerId || 5;\n\n this.endpoint = endpoint;\n\n this.isNode = typeof window === 'undefined';\n }\n}\n\nexport default Base;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/base.js\n **/","export default {\n prod: {\n ws: 'wss://api.blinktrade.com/trade/',\n rest: 'https://api.blinktrade.com/',\n },\n testnet: {\n ws: 'wss://api.testnet.blinktrade.com/trade/',\n rest: 'https://api.testnet.blinktrade.com/',\n },\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/common.js\n **/","export const SOCKET_ID = 'SocketID';\nexport const REQUEST_ID = 'ReqID';\nexport const TEST_REQUEST_ID = 'TestReqID';\nexport const USER_REQUEST_ID = 'UserReqID';\nexport const SECURITY_REQUEST_ID = 'SecurityReqID';\nexport const RESET_PASSWORD_REQUEST_ID = 'ResetPasswordReqID';\nexport const DEPOSIT_REQUEST_ID = 'DepositReqID';\nexport const WITHDRAW_REQUEST_ID = 'WithdrawReqID';\nexport const BALANCE_REQUEST_ID = 'BalanceReqID';\nexport const ORDERS_REQUEST_ID = 'OrdersReqID';\nexport const ENABLE_TWO_FACTOR_REQUEST_ID = 'EnableTwoFactorReqID';\nexport const DEPOSIT_METHOD_REQUEST_ID = 'DepositMethodReqID';\nexport const WITHDRAW_LIST_REQUEST_ID = 'WithdrawListReqID';\nexport const BROKER_LIST_REQUEST_ID = 'BrokerListReqID';\nexport const DEPOSIT_LIST_REQUEST_ID = 'DepositListReqID';\nexport const TRADE_HISTORY_REQUEST_ID = 'TradeHistoryReqID';\nexport const LEDGER_LIST_REQUEST_ID = 'LedgerListReqID';\nexport const TRADERS_RANK_REQUEST_ID = 'TradersRankReqID';\nexport const UPDATE_REQUEST_ID = 'UpdateReqID';\nexport const POSITION_REQUEST_ID = 'PositionReqID';\nexport const SECURITY_STATUS_REQUEST_ID = 'SecurityStatusReqID';\nexport const API_KEY_LIST_REQUEST_ID = 'APIKeyListReqID';\nexport const API_KEY_CREATE_REQUEST_ID = 'APIKeyCreateReqID';\nexport const API_KEY_REVOKE_REQUEST_ID = 'APIKeyRevokeReqID';\nexport const PROCESS_DEPOSIT_REQUEST_ID = 'ProcessDepositReqID';\nexport const CUSTOMER_LIST_REQUEST_ID = 'CustomerListReqID';\nexport const CUSTOMER_REQUEST_ID = 'CustomerReqID';\nexport const PROCESS_WITHDRAW_REQUEST_ID = 'ProcessWithdrawReqID';\nexport const VERIFY_CUSTOMER_REQUEST_ID = 'VerifyCustomerReqID';\nexport const MD_REQUEST_ID = 'MDReqID';\nexport const CLIENT_ORDER_ID = 'ClOrdID';\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/requestTypes.js\n **/","module.exports = require(\"lodash\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"lodash\"\n ** module id = 9\n ** module chunks = 0\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport lodash from 'lodash';\nimport * as RequestTypes from './constants/requestTypes';\n\nlet requests: Object = {};\nconst listeners: Object = {};\n\nexport function getListeners() {\n return requests;\n}\n\nexport function generateRequestId(): number {\n return parseInt(String(1e7 * Math.random()), 10);\n}\n\nexport function getListener(msgType: string): Function {\n return listeners[msgType];\n}\n\nexport function getRequest(message: Object): ?Request {\n let result;\n lodash.mapKeys(RequestTypes, (key) => {\n if (lodash.has(message, key)) {\n result = lodash.find(requests[key], { ReqId: String(message[key]) });\n }\n });\n\n return result;\n}\n\nexport function registerRequest(message: Object, promise: Request): Object {\n lodash.mapKeys(RequestTypes, (key) => {\n if (lodash.has(message, key)) {\n requests[key] = requests[key] || [];\n requests[key].push({ ReqId: String(message[key]), ...promise });\n }\n });\n\n return requests;\n}\n\nexport function registerEventEmitter(message: Object, callback: Function): Object {\n lodash.mapKeys(RequestTypes, (key) => {\n if (lodash.has(message, key)) {\n if (requests[key] !== []) {\n const index = lodash.findIndex(requests[key], { ReqId: String(message[key]) });\n requests[key][index] = {\n ...requests[key][index],\n resolve: null,\n reject: null,\n callback,\n };\n }\n }\n });\n\n return requests;\n}\n\nexport function registerListener(msgType: string, callback: Function): void {\n listeners[msgType] = listeners[msgType] || [];\n listeners[msgType] = callback;\n}\n\nexport function deleteRequest(key: string): Object {\n requests = lodash.omit(requests, [key]);\n return requests;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/listener.js\n **/","module.exports = require(\"fingerprintjs2\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"fingerprintjs2\"\n ** module id = 11\n ** module chunks = 0\n **/","module.exports = require(\"nodeify\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"nodeify\"\n ** module id = 12\n ** module chunks = 0\n **/","module.exports = require(\"eventemitter2\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"eventemitter2\"\n ** module id = 13\n ** module chunks = 0\n **/","module.exports = require(\"ws\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"ws\"\n ** module id = 14\n ** module chunks = 0\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport macaddress from 'macaddress';\n\nexport function getMac(callback: Function): void {\n macaddress.all((err, all) => {\n const hashCode = (str) => {\n let hash = 0;\n if (str.length === 0) return hash;\n for (let i = 0; i < str.length; i++) {\n hash = ((hash << 5) - hash) + str.charCodeAt(i);\n hash = hash & hash; // Convert to 32bit integer\n }\n return hash;\n };\n\n let macAddresses = '';\n Object.keys(all).forEach(iface => {\n macAddresses += all[iface].mac;\n });\n\n let fingerPrint = hashCode(macAddresses);\n if (fingerPrint < 0) {\n fingerPrint *= -1;\n }\n\n callback(fingerPrint);\n });\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/macaddress.js\n **/","module.exports = require(\"macaddress\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"macaddress\"\n ** module id = 16\n ** module chunks = 0\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n/* eslint-disable no-param-reassign */\n\nimport ip from 'ip';\nimport dgram from 'dgram';\n\nconst stunIp = { local: null, public: [] };\n\nfunction addIPAddress(ipAddress) {\n if (ipAddress.match(/^(192\\.168\\.|169\\.254\\.|10\\.|172\\.(1[6-9]|2\\d|3[01]))/)) {\n stunIp.local = ipAddress;\n } else {\n if (stunIp.public.indexOf(ipAddress) === -1) {\n stunIp.public.push(ipAddress);\n }\n }\n}\n\nexport function getStun(callback: Function) {\n const socket = dgram.createSocket('udp4');\n\n const STUN_HEADER_LENGTH = 20;\n const stunRequest = new Buffer(STUN_HEADER_LENGTH);\n\n const STUN_METHOD_REQUEST = 0x000;\n const STUN_BINDING_CLASS = 0x0001;\n const STUN_MAGIC_COOKIE = 0x2112A442;\n const STUN_TID_MAX = Math.pow(2, 32);\n\n const STUN_ATTR_MAPPED_ADDRESS = 0x0001;\n const STUN_ATTR_XOR_MAPPED_ADDRESS = 0x8020;\n const STUN_ATTR_XOR_MAPPED_ADDRESS_ALT = 0x0020;\n\n const stunTxId = (Math.random() * STUN_TID_MAX);\n\n const stunServers = [\n [3478, 'stun.services.mozilla.com'],\n [19302, 'stun.l.google.com'],\n [3478, 'stun.stunprotocol.org'],\n [3478, 'stun.softjoys.com'],\n [3478, 'stun.samsungsmartcam.com'],\n [3478, 'stun.sonetel.com'],\n [3478, 'stun.tagan.ru'],\n [3478, 'stun.voipgain.com'],\n [3478, 'stunserver.org'],\n [3478, 'stun.advfn.com'],\n [3478, 'stun.annatel.net'],\n [3478, 'stun.freevoipdeal.com'],\n ];\n\n stunRequest.writeUInt16BE(((STUN_BINDING_CLASS | STUN_METHOD_REQUEST) & 0x3fff), 0);\n stunRequest.writeUInt16BE(0, 2);\n stunRequest.writeUInt32BE(STUN_MAGIC_COOKIE, 4);\n stunRequest.writeUInt32BE(0, 8);\n stunRequest.writeUInt32BE(0, 12);\n stunRequest.writeUInt32BE(stunTxId, 16);\n\n socket.on('message', (msg) => {\n const xor = (a, b) => {\n const data = [];\n if (b.length > a.length) {\n const tmp = a;\n a = b;\n b = tmp;\n }\n for (let i = 0, len = a.length; i < len; i++) {\n data.push(a[i] ^ b[i]);\n }\n\n return new Buffer(data);\n };\n\n const block = msg.readUInt8(0);\n const bit1 = block & 0x80;\n const bit2 = block & 0x40;\n\n if (!(bit1 === 0 && bit2 === 0)) {\n return;\n }\n\n const msgHeader = msg.slice(0, STUN_HEADER_LENGTH);\n const msgAttrs = msg.slice(STUN_HEADER_LENGTH, msg.length);\n\n let offset = 0;\n\n while (offset < msgAttrs.length) {\n const attrType = msgAttrs.readUInt16BE(offset);\n offset += 2;\n\n let attrBuffLength = msgAttrs.readUInt16BE(offset);\n const blockOut = attrBuffLength % 4;\n if (blockOut > 0) {\n attrBuffLength += 4 - blockOut;\n }\n offset += 2;\n\n const value = msgAttrs.slice(offset, offset + attrBuffLength);\n offset += attrBuffLength;\n\n let family;\n let address;\n switch (attrType) {\n case STUN_ATTR_MAPPED_ADDRESS:\n family = (value.readUInt16BE(0) === 0x02) ? 6 : 4;\n address = ip.toString(value, 4, family);\n addIPAddress(address);\n break;\n\n case STUN_ATTR_XOR_MAPPED_ADDRESS:\n case STUN_ATTR_XOR_MAPPED_ADDRESS_ALT:\n family = (value.readUInt16BE(0) === 0x02) ? 6 : 4;\n const magic = msgHeader.slice(4, 8);\n const tid = msgHeader.slice(8, 20);\n const xaddr = value.slice(4, family === 4 ? 8 : 20);\n const addr = xor(xaddr, family === 4 ? magic : value.concat([magic, tid]));\n address = ip.toString(addr, 0, family);\n addIPAddress(address);\n break;\n default:\n }\n }\n\n callback(stunIp);\n });\n\n stunServers.map(([port, host]) => socket.send(stunRequest, 0, stunRequest.length, port, host));\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/stun.js\n **/","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/buffer/index.js\n ** module id = 18\n ** module chunks = 0\n **/","module.exports = require(\"base64-js\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"base64-js\"\n ** module id = 19\n ** module chunks = 0\n **/","module.exports = require(\"ieee754\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"ieee754\"\n ** module id = 20\n ** module chunks = 0\n **/","module.exports = require(\"isarray\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"isarray\"\n ** module id = 21\n ** module chunks = 0\n **/","module.exports = require(\"ip\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"ip\"\n ** module id = 22\n ** module chunks = 0\n **/","export const BALANCE = 'BALANCE';\n\nexport const ORDER_BOOK = 'OB';\nexport const ORDER_BOOK_TRADE_NEW = 'TRADE_NEW';\nexport const ORDER_BOOK_NEW_ORDER = 'NEW_ORDER';\nexport const ORDER_BOOK_UPDATE_ORDER = 'UPDATE_ORDER';\nexport const ORDER_BOOK_DELETE_ORDER = 'DELETE_ORDER';\nexport const ORDER_BOOK_DELETE_ORDERS_THRU = 'DELETE_ORDERS_THRU';\n\nexport const EXECUTION_REPORT = 'EXECUTION_REPORT';\nexport const EXECUTION_REPORT_NEW = 'NEW';\nexport const EXECUTION_REPORT_PARTIAL = 'PARTIAL';\nexport const EXECUTION_REPORT_EXECUTION = 'EXECUTION';\nexport const EXECUTION_REPORT_CANCELED = 'CANCELED';\nexport const EXECUTION_REPORT_REJECTED = 'REJECTED';\n\nexport const DEPOSIT_REFRESH = 'DEPOSIT_REFRESH';\nexport const WITHDRAW_REFRESH = 'WITHDRAW_REFRESH';\n\n/* eslint-disable quote-props */\nexport const EVENTS = {\n ORDERBOOK: {\n '0': ORDER_BOOK_NEW_ORDER,\n '1': ORDER_BOOK_UPDATE_ORDER,\n '2': ORDER_BOOK_DELETE_ORDER,\n '3': ORDER_BOOK_DELETE_ORDERS_THRU,\n },\n TRADES: {\n '0': ORDER_BOOK_TRADE_NEW,\n },\n EXECUTION_REPORT: {\n '0': EXECUTION_REPORT_NEW,\n '1': EXECUTION_REPORT_PARTIAL,\n '2': EXECUTION_REPORT_EXECUTION,\n '4': EXECUTION_REPORT_CANCELED,\n '8': EXECUTION_REPORT_REJECTED,\n },\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/actionTypes.js\n **/","exports.endianness = function () { return 'LE' };\n\nexports.hostname = function () {\n if (typeof location !== 'undefined') {\n return location.hostname\n }\n else return '';\n};\n\nexports.loadavg = function () { return [] };\n\nexports.uptime = function () { return 0 };\n\nexports.freemem = function () {\n return Number.MAX_VALUE;\n};\n\nexports.totalmem = function () {\n return Number.MAX_VALUE;\n};\n\nexports.cpus = function () { return [] };\n\nexports.type = function () { return 'Browser' };\n\nexports.release = function () {\n if (typeof navigator !== 'undefined') {\n return navigator.appVersion;\n }\n return '';\n};\n\nexports.networkInterfaces\n= exports.getNetworkInterfaces\n= function () { return {} };\n\nexports.arch = function () { return 'javascript' };\n\nexports.platform = function () { return 'browser' };\n\nexports.tmpdir = exports.tmpDir = function () {\n return '/tmp';\n};\n\nexports.EOL = '\\n';\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/os-browserify/browser.js\n ** module id = 25\n ** module chunks = 0\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport MsgTypes from './constants/requests';\nimport RestTransport from './restTransport';\nimport { generateRequestId } from './listener';\n\nclass BlinkTradeRest extends RestTransport {\n ticker(callback?: Function): Promise {\n return super.fetchPublic('ticker', callback);\n }\n\n trades({ limit = 1000, since = '0' }: {\n limit: number;\n since: string;\n } = {}, callback?: Function): Promise {\n return super.fetchPublic(`trades?limit=${limit}&since=${since}`, callback);\n }\n\n orderbook(callback?: Function): Promise {\n return super.fetchPublic('orderbook', callback);\n }\n}\n\nexport default BlinkTradeRest;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/rest.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport Base from './base';\nimport BaseTransport from './baseTransport'\nimport sjcl from 'sjcl';\nimport nodeify from 'nodeify';\nimport url from 'url';\nimport path from 'path';\n\nclass RestTransport extends BaseTransport {\n\n /**\n * APIKey\n */\n key: string;\n\n /**\n * APISecret\n */\n secret: string;\n\n /**\n * Exchanges currencies available.\n */\n currency: 'USD' | 'BRL' | 'VEF' | 'CLP' | 'VND' | 'PKR';\n\n /**\n * Fetch rest API\n */\n fetchRequest: Function\n\n constructor(params: BlinkTradeRest) {\n super(params, 'rest');\n\n this.key = params.key;\n this.secret = params.secret;\n this.currency = params.currency || 'USD';\n\n this.fetchRequest = this.isNode ? require('isomorphic-fetch') : require('fetch-jsonp');\n }\n\n headers(method: string, body: Object): Object {\n const timeStamp = Date.now().toString();\n const hexKey = sjcl.codec.utf8String.toBits(this.secret);\n const hmac = new sjcl.misc.hmac(hexKey, sjcl.hash.sha256);\n const Signature = sjcl.codec.hex.fromBits(hmac.encrypt(timeStamp));\n return {\n method,\n headers: {\n 'Content-Type': 'application/json',\n Nonce: timeStamp,\n APIKey: this.key,\n Signature\n },\n body: JSON.stringify(body),\n };\n }\n\n fetch(msg: Object, api: string, headers?: Object = {}): Promise {\n return this.fetchRequest(url.resolve(this.endpoint, api), headers)\n .then(response => response.json())\n }\n\n fetchPublic(api: string, callback?: Function): Promise {\n return nodeify(this.fetch({}, path.join('api/v1', this.currency, api)), callback);\n }\n\n fetchTrade(msg: Object, callback?: Function): Promise {\n const headers = this.headers('POST', msg);\n return nodeify(this.fetch(msg, 'tapi/v1/message', headers, callback)\n .then(response => response.Status === 500 ? Promise.reject(response) : response.Responses)\n .then(response => response.length === 1 ? response[0] : response)\n , callback);\n }\n}\n\nexport default RestTransport;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/restTransport.js\n **/","module.exports = require(\"sjcl\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"sjcl\"\n ** module id = 28\n ** module chunks = 0\n **/","module.exports = require(\"url\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"url\"\n ** module id = 29\n ** module chunks = 0\n **/","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nvar splitPathRe =\n /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\nvar splitPath = function(filename) {\n return splitPathRe.exec(filename).slice(1);\n};\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n var isAbsolute = exports.isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isAbsolute).join('/');\n\n if (!path && !isAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return exports.normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n from = exports.resolve(from).substr(1);\n to = exports.resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function(path) {\n var result = splitPath(path),\n root = result[0],\n dir = result[1];\n\n if (!root && !dir) {\n // No dirname whatsoever\n return '.';\n }\n\n if (dir) {\n // It has a dirname, strip trailing slash\n dir = dir.substr(0, dir.length - 1);\n }\n\n return root + dir;\n};\n\n\nexports.basename = function(path, ext) {\n var f = splitPath(path)[2];\n // TODO: make this comparison case-insensitive on windows?\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n};\n\n\nexports.extname = function(path) {\n return splitPath(path)[3];\n};\n\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n ? function (str, start, len) { return str.substr(start, len) }\n : function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/path-browserify/index.js\n ** module id = 30\n ** module chunks = 0\n **/","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\n(function () {\n try {\n cachedSetTimeout = setTimeout;\n } catch (e) {\n cachedSetTimeout = function () {\n throw new Error('setTimeout is not defined');\n }\n }\n try {\n cachedClearTimeout = clearTimeout;\n } catch (e) {\n cachedClearTimeout = function () {\n throw new Error('clearTimeout is not defined');\n }\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/process/browser.js\n ** module id = 31\n ** module chunks = 0\n **/","module.exports = require(\"isomorphic-fetch\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"isomorphic-fetch\"\n ** module id = 32\n ** module chunks = 0\n **/","module.exports = require(\"fetch-jsonp\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"fetch-jsonp\"\n ** module id = 33\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 82055816672afd7afbc7","webpack:///./src/index.js","webpack:///./src/constants/brokers.js","webpack:///./src/ws.js","webpack:///external \"lodash\"","webpack:///external \"eventemitter2\"","webpack:///./src/listener.js","webpack:///./src/constants/requestTypes.js","webpack:///./src/constants/actionTypes.js","webpack:///./src/constants/requests.js","webpack:///./src/wsTransport.js","webpack:///./src/baseTransport.js","webpack:///./src/base.js","webpack:///./src/constants/common.js","webpack:///external \"fingerprintjs2\"","webpack:///external \"nodeify\"","webpack:///external \"ws\"","webpack:///./src/util/macaddress.js","webpack:///external \"macaddress\"","webpack:///./src/util/stun.js","webpack:///./~/buffer/index.js","webpack:///external \"base64-js\"","webpack:///external \"ieee754\"","webpack:///external \"isarray\"","webpack:///external \"ip\"","webpack:///./~/os-browserify/browser.js","webpack:///./src/rest.js","webpack:///./src/restTransport.js","webpack:///external \"sjcl\"","webpack:///external \"url\"","webpack:///./~/path-browserify/index.js","webpack:///./~/process/browser.js","webpack:///external \"isomorphic-fetch\"","webpack:///external \"fetch-jsonp\""],"names":["Brokers","BlinkTradeWS","BlinkTradeRest","SURBITCOIN","VBTC","FOXBIT","TESTNET","URDUBIT","CHILEBIT","params","session","callback","d","Date","msg","MsgType","HEARTBEAT","TestReqID","getTime","SendTime","Promise","resolve","reject","then","data","Latency","now","catch","username","password","secondFactor","userAgent","isNode","UserAgent","window","navigator","UserAgentLanguage","language","UserAgentPlatform","platform","UserAgentTimezoneOffset","getTimezoneOffset","os","require","type","release","arch","LOGIN","UserReqID","BrokerID","brokerId","Username","Password","UserReqTyp","SecondFactor","UserStatus","LOGOUT","Profile","VerificationData","profile","balance","eventEmitter","emit","symbols","SECURITY_STATUS","SecurityStatusReqID","SubscriptionRequestType","Instruments","formatTicker","SellVolume","LowPx","LastPx","BestAsk","HighPx","BuyVolume","BestBid","ticker","Symbol","MARKET_DATA_FULL_REFRESH","MDReqID","MarketDepth","MDUpdateType","MDEntryTypes","subscribeEvent","MDBkTyp","MDIncGrp","map","dataOrder","index","order","MDEntryPositionNo","price","MDEntryPx","size","MDEntrySize","side","MDEntryType","userId","UserID","orderId","OrderID","symbol","time","MDEntryDate","MDEntryTime","toString","orderbookEvent","ORDERBOOK","MDUpdateAction","tradeEvent","TRADES","MDFullGrp","filter","reduce","prev","push","bids","asks","err","MARKET_DATA_UNSUBSCRIBE","event","EXECUTION_REPORT","ExecType","since","page","Page","pageSize","PageSize","TRADE_HISTORY","TradeHistoryReqID","length","Filter","Since","Columns","trades","TradeHistory","groupBy","TradeHistoryGrp","zipObject","trade","Market","currency","value","depositMethodId","deposit","amount","method","withdraw","getListeners","generateRequestId","getListener","getRequest","registerRequest","registerEventEmitter","registerListener","deleteRequest","RequestTypes","requests","listeners","parseInt","String","Math","random","msgType","message","result","mapKeys","key","has","find","ReqId","promise","findIndex","omit","SOCKET_ID","REQUEST_ID","TEST_REQUEST_ID","USER_REQUEST_ID","SECURITY_REQUEST_ID","RESET_PASSWORD_REQUEST_ID","DEPOSIT_REQUEST_ID","WITHDRAW_REQUEST_ID","BALANCE_REQUEST_ID","ORDERS_REQUEST_ID","ENABLE_TWO_FACTOR_REQUEST_ID","DEPOSIT_METHOD_REQUEST_ID","WITHDRAW_LIST_REQUEST_ID","BROKER_LIST_REQUEST_ID","DEPOSIT_LIST_REQUEST_ID","TRADE_HISTORY_REQUEST_ID","LEDGER_LIST_REQUEST_ID","TRADERS_RANK_REQUEST_ID","UPDATE_REQUEST_ID","POSITION_REQUEST_ID","SECURITY_STATUS_REQUEST_ID","API_KEY_LIST_REQUEST_ID","API_KEY_CREATE_REQUEST_ID","API_KEY_REVOKE_REQUEST_ID","PROCESS_DEPOSIT_REQUEST_ID","CUSTOMER_LIST_REQUEST_ID","CUSTOMER_REQUEST_ID","PROCESS_WITHDRAW_REQUEST_ID","VERIFY_CUSTOMER_REQUEST_ID","MD_REQUEST_ID","CLIENT_ORDER_ID","BALANCE","ORDER_BOOK","ORDER_BOOK_TRADE_NEW","ORDER_BOOK_NEW_ORDER","ORDER_BOOK_UPDATE_ORDER","ORDER_BOOK_DELETE_ORDER","ORDER_BOOK_DELETE_ORDERS_THRU","EXECUTION_REPORT_NEW","EXECUTION_REPORT_PARTIAL","EXECUTION_REPORT_EXECUTION","EXECUTION_REPORT_CANCELED","EXECUTION_REPORT_REJECTED","DEPOSIT_REFRESH","WITHDRAW_REFRESH","EVENTS","CHANGE_PASSWORD","ORDER_SEND","ORDER_CANCEL","SECURITY_LIST","ORDER_LIST","BROKER_LIST","PROFILE_UPDATE","REQUEST_DEPOSIT","REQUEST_DEPOSIT_LIST","REQUEST_DEPOSIT_METHODS","REQUEST_WITHDRAW","REQUEST_WITHDRAW_LIST","CONFIRM_WITHDRAW","CANCEL_WITHDRAW","WebSocketTransport","stun","local","public","getStun","getFingerPrint","wildcard","delimiter","extend","request","WebSocket","socket","endpoint","onopen","onOpen","bind","onclose","onClose","onerror","onError","onmessage","onMessage","nodeify","close","connected","readyState","STUNTIP","FingerPrint","fingerPrint","send","JSON","stringify","sendMessage","parse","Error","Detail","Description","listener","dispatchPromise","dispatchListeners","on","onAny","offAny","once","many","times","removeListener","removeAllListeners","events","getMac","macAddress","get","BaseTransport","env","sendMessageAsPromise","fetchTrade","BalanceReqID","Available","balances","Object","keys","includes","OrdersReqID","orders","OrdListGrp","ClOrdID","Side","OrdType","Price","OrderQty","param","clientId","statusList","StatusList","WithdrawListReqID","withdrawData","WithdrawListGrp","reqId","WithdrawReqID","Method","Amount","Currency","Data","WithdrawID","withdrawId","confirmationToken","ConfirmationToken","WithdrawCancelReqID","status","DepositListReqID","depositData","DepositListGrp","DepositReqID","DepositMethodID","Value","DepositMethodReqID","Base","url","prod","testnet","ws","rest","all","hashCode","str","hash","i","charCodeAt","macAddresses","forEach","iface","mac","stunIp","addIPAddress","ipAddress","match","indexOf","createSocket","STUN_HEADER_LENGTH","stunRequest","Buffer","STUN_METHOD_REQUEST","STUN_BINDING_CLASS","STUN_MAGIC_COOKIE","STUN_TID_MAX","pow","STUN_ATTR_MAPPED_ADDRESS","STUN_ATTR_XOR_MAPPED_ADDRESS","STUN_ATTR_XOR_MAPPED_ADDRESS_ALT","stunTxId","stunServers","writeUInt16BE","writeUInt32BE","xor","a","b","tmp","len","block","readUInt8","bit1","bit2","msgHeader","slice","msgAttrs","offset","attrType","readUInt16BE","attrBuffLength","blockOut","family","address","magic","tid","xaddr","addr","concat","port","host","limit","RestTransport","secret","fetchRequest","body","timeStamp","hexKey","codec","utf8String","toBits","hmac","misc","sha256","Signature","hex","fromBits","encrypt","headers","Nonce","APIKey","api","response","json","fetch","join","Status","Responses"],"mappings":";AAAA;AACA;;AAEA;AACA;;AA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/N,MAAxC,EAAgDqQ,IAAhD,EAAsDC,IAAtD,CAAlB;AAAA,IAAhB;AACD,E;;;;;;;ACjJD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAqB,mDAAmD;AACxE;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAmB,UAAU;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kBAAiB,YAAY;AAC7B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA0B;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,wCAAuC,SAAS;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;AACA,cAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAiB,SAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iDAAgD,EAAE;AAClD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0CAAyC;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,yBAAwB,eAAe;AACvC;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA,IAAG;AACH;AACA,yBAAwB,QAAQ;AAChC;AACA,sBAAqB,eAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,sBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA,oBAAmB,cAAc;AACjC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wDAAuD,OAAO;AAC9D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA,wDAAuD,OAAO;AAC9D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,sBAAqB,QAAQ;AAC7B;AACA;AACA,IAAG;AACH;AACA,gBAAe,SAAS;AACxB;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,oBAAmB,SAAS;AAC5B;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA,gBAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAiB,YAAY;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MA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;AACA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAU,oBAAoB;AAC9B;AACA;;AAEA;AACA,WAAU,UAAU;AACpB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA,gCAA+B,sBAAsB;AACrD;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAmB,eAAe;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA,mCAAkC;AAClC;AACA;AACA;AACA;AACA;;;;;;;;AC/NA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,4BAA2B;AAC3B;AACA;AACA;AACA,6BAA4B,UAAU;;;;;;;AC/JtC,8C;;;;;;ACAA,yC","file":"blinktrade.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 82055816672afd7afbc7\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport Brokers from './constants/brokers';\nimport BlinkTradeWS from './ws';\nimport BlinkTradeRest from './rest';\n\nexport {\n Brokers,\n BlinkTradeWS,\n BlinkTradeRest,\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/index.js\n **/","export default {\n SURBITCOIN: 1,\n VBTC: 3,\n FOXBIT: 4,\n TESTNET: 5,\n URDUBIT: 8,\n CHILEBIT: 9,\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/brokers.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport _ from 'lodash';\nimport { EventEmitter2 as EventEmitter } from 'eventemitter2';\nimport {\n registerListener,\n generateRequestId,\n registerEventEmitter,\n} from './listener';\n\nimport {\n EVENTS,\n BALANCE,\n ORDER_BOOK,\n DEPOSIT_REFRESH,\n WITHDRAW_REFRESH,\n EXECUTION_REPORT,\n} from './constants/actionTypes';\n\nimport MsgTypes from './constants/requests';\nimport WebSocketTransport from './wsTransport';\n\nclass BlinkTradeWS extends WebSocketTransport {\n\n /**\n * Session to store login information\n */\n session: Object;\n\n constructor(params?: BlinkTradeBase) {\n super(params);\n\n this.session = {};\n }\n\n heartbeat(callback?: Function): Promise {\n const d = new Date();\n const msg: Object = {\n MsgType: MsgTypes.HEARTBEAT,\n TestReqID: d.getTime(),\n SendTime: d.getTime(),\n };\n\n return new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then((data) => {\n return resolve({\n ...data,\n Latency: new Date(Date.now()) - data.SendTime,\n });\n }).catch(reject);\n });\n }\n\n login({ username, password, secondFactor }: {\n username: string;\n password: string;\n secondFactor?: string;\n }, callback?: Function): Promise {\n let userAgent;\n if (!this.isNode) {\n userAgent = {\n UserAgent: window.navigator.userAgent,\n UserAgentLanguage: window.navigator.language,\n UserAgentPlatform: window.navigator.platform,\n UserAgentTimezoneOffset: new Date().getTimezoneOffset(),\n };\n } else {\n const os = require('os');\n userAgent = {\n UserAgent: `${os.type()} ${os.release()}`,\n UserAgentLanguage: 'en_US',\n UserAgentPlatform: `${os.platform()} (${os.arch()})`,\n UserAgentTimezoneOffset: new Date().getTimezoneOffset(),\n };\n }\n\n const msg: Object = {\n MsgType: MsgTypes.LOGIN,\n UserReqID: generateRequestId(),\n BrokerID: this.brokerId,\n Username: username,\n Password: password,\n UserReqTyp: '1',\n ...userAgent,\n };\n\n if (secondFactor) {\n msg.SecondFactor = secondFactor;\n }\n\n return new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then(data => {\n if (data.UserStatus === 1) {\n this.session = data;\n return resolve(data);\n }\n\n return reject(data);\n }).catch(reject);\n });\n }\n\n logout(callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.LOGOUT,\n BrokerID: this.brokerId,\n UserReqID: generateRequestId(),\n Username: this.session.Username,\n UserReqTyp: '2',\n };\n\n return super.sendMessageAsPromise(msg, callback);\n }\n\n profile(callback?: Function): Promise {\n const { VerificationData, ...profile } = this.session.Profile;\n return callback ? callback(profile) : Promise.resolve(profile);\n }\n\n balance(callback?: Function): Promise {\n registerListener('U3', (balance) => {\n callback && callback(null, balance);\n return this.eventEmitter.emit(BALANCE, balance);\n });\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.balance(callback).then(resolve).catch(reject);\n }));\n }\n\n subscribeTicker(symbols: Array, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.SECURITY_STATUS,\n SecurityStatusReqID: generateRequestId(),\n SubscriptionRequestType: '1',\n Instruments: symbols,\n };\n\n const formatTicker = (data) => {\n return {\n ...data,\n SellVolume: data.SellVolume / 1e8,\n LowPx: data.LowPx / 1e8,\n LastPx: data.LastPx / 1e8,\n BestAsk: data.BestAsk / 1e8,\n HighPx: data.HighPx / 1e8,\n BuyVolume: data.BuyVolume / 1e8,\n BestBid: data.BestBid / 1e8,\n };\n };\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then(data => {\n resolve(formatTicker(data));\n registerEventEmitter({ SecurityStatusReqID: data.SecurityStatusReqID }, (ticker) => {\n callback && callback(null, formatTicker(ticker));\n return this.eventEmitter.emit(`BLINK:${ticker.Symbol}`, formatTicker(ticker));\n });\n }).catch(reject);\n }));\n }\n\n unSubscribeTicker(SecurityStatusReqID: number): number {\n const msg = {\n MsgType: MsgTypes.SECURITY_STATUS,\n SecurityStatusReqID,\n SubscriptionRequestType: '2',\n };\n\n super.sendMessage(msg);\n return SecurityStatusReqID;\n }\n\n subscribeOrderbook(symbols: Array, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.MARKET_DATA_FULL_REFRESH,\n MDReqID: generateRequestId(),\n SubscriptionRequestType: '1',\n MarketDepth: 0,\n MDUpdateType: '1', // Incremental refresh\n MDEntryTypes: ['0', '1', '2'],\n Instruments: symbols,\n };\n\n const subscribeEvent = (data) => {\n if (data.MDBkTyp === '3') {\n data.MDIncGrp.map(order => {\n const dataOrder = {\n index: order.MDEntryPositionNo,\n price: order.MDEntryPx / 1e8,\n size: order.MDEntrySize / 1e8,\n side: order.MDEntryType === '0' ? 'buy' : 'sell',\n userId: order.UserID,\n orderId: order.OrderID,\n symbol: order.Symbol,\n time: new Date(`${order.MDEntryDate} ${order.MDEntryTime}`).toString(),\n };\n\n callback && callback(null, dataOrder);\n\n switch (order.MDEntryType) {\n case '0':\n case '1':\n const orderbookEvent = `${ORDER_BOOK}:${EVENTS.ORDERBOOK[order.MDUpdateAction]}`;\n return this.eventEmitter.emit(orderbookEvent, {\n ...dataOrder,\n type: orderbookEvent,\n });\n case '2':\n const tradeEvent = `${ORDER_BOOK}:${EVENTS.TRADES[order.MDUpdateAction]}`;\n return this.eventEmitter.emit(tradeEvent, {\n ...dataOrder,\n type: tradeEvent,\n });\n case '4':\n break;\n default:\n return null;\n }\n return null;\n });\n }\n };\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then(data => {\n if (data.MsgType === 'W') {\n // Split orders in bids and asks\n /* eslint-disable no-param-reassign */\n const { bids, asks } = data.MDFullGrp\n .filter(order => order.MDEntryType === '0' || order.MDEntryType === '1')\n .reduce((prev, order) => {\n const side = order.MDEntryType === '0' ? 'bids' : 'asks';\n (prev[side] || (prev[side] = [])).push([\n order.MDEntryPx / 1e8,\n order.MDEntrySize / 1e8,\n order.UserID,\n ]);\n return prev;\n }, []);\n /* eslint-enable no-param-reassign */\n\n registerEventEmitter({ MDReqID: data.MDReqID }, subscribeEvent);\n\n return resolve({\n ...data,\n MDFullGrp: {\n [data.Symbol]: {\n bids,\n asks,\n },\n },\n });\n }\n }).catch(err => reject(err));\n }));\n }\n\n unSubscribeOrderbook(MDReqID: number): number {\n const msg = {\n MsgType: MsgTypes.MARKET_DATA_UNSUBSCRIBE,\n MDReqID,\n MarketDepth: 0,\n SubscriptionRequestType: '2',\n };\n\n super.sendMessage(msg);\n return MDReqID;\n }\n\n executionReport(callback?: Function): EventEmitter {\n registerListener('8', (data) => {\n callback && callback(data);\n const event = EVENTS.EXECUTION_REPORT[data.ExecType];\n return this.eventEmitter.emit(`${EXECUTION_REPORT}:${event}`, data);\n });\n\n return this.eventEmitter;\n }\n\n tradeHistory({ since, filter, page: Page = 0, pageSize: PageSize = 80 }: {\n since?: string;\n filter?: Array;\n page?: number;\n pageSize?: number;\n } = {}, callback?: Function): Promise {\n const msg: Object = {\n MsgType: MsgTypes.TRADE_HISTORY,\n TradeHistoryReqID: generateRequestId(),\n Page,\n PageSize,\n };\n\n if (filter && filter.length > 0) {\n msg.Filter = filter;\n }\n\n if (since && typeof since === 'number') {\n msg.Since = since;\n }\n\n return new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then(data => {\n const { Columns, ...trades } = data;\n const TradeHistory = _.groupBy(_.map(data.TradeHistoryGrp, trade => _.zipObject(Columns, trade)), trade => trade.Market);\n return resolve({\n ...trades,\n TradeHistoryGrp: TradeHistory,\n });\n }).catch(reject);\n });\n }\n\n requestDeposit({ currency = 'BTC', value, depositMethodId }: {\n value?: number;\n currency?: string;\n depositMethodId?: number;\n } = {}, callback?: Function): Promise {\n registerListener('U23', (deposit) => {\n callback && callback(null, deposit);\n return this.eventEmitter.emit(DEPOSIT_REFRESH, deposit);\n });\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.requestDeposit({ currency, value, depositMethodId }, callback)\n .then(resolve)\n .catch(reject);\n }));\n }\n\n onDepositRefresh(callback: Function): Promise {\n return new Promise((resolve) => {\n registerListener('U23', (deposit) => {\n callback && callback(deposit);\n return resolve(deposit);\n });\n });\n }\n\n requestWithdraw({ amount, data, currency = 'BTC', method = 'bitcoin' }: {\n data: Object,\n amount: number;\n method?: string;\n currency?: string;\n }, callback: Function): Promise {\n registerListener('U9', (withdraw) => {\n callback && callback(null, withdraw);\n return this.eventEmitter.emit(WITHDRAW_REFRESH, withdraw);\n });\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.requestWithdraw({ amount, data, currency, method }, callback)\n .then(resolve)\n .catch(reject);\n }));\n }\n\n onWithdrawRefresh(callback: Function): Promise {\n return new Promise((resolve) => {\n registerListener('U9', (withdraw) => {\n callback && callback(withdraw);\n return resolve(withdraw);\n });\n });\n }\n}\n\nexport default BlinkTradeWS;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/ws.js\n **/","module.exports = require(\"lodash\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"lodash\"\n ** module id = 3\n ** module chunks = 0\n **/","module.exports = require(\"eventemitter2\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"eventemitter2\"\n ** module id = 4\n ** module chunks = 0\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport lodash from 'lodash';\nimport * as RequestTypes from './constants/requestTypes';\n\nlet requests: Object = {};\nconst listeners: Object = {};\n\nexport function getListeners() {\n return requests;\n}\n\nexport function generateRequestId(): number {\n return parseInt(String(1e7 * Math.random()), 10);\n}\n\nexport function getListener(msgType: string): Function {\n return listeners[msgType];\n}\n\nexport function getRequest(message: Object): ?Request {\n let result;\n lodash.mapKeys(RequestTypes, (key) => {\n if (lodash.has(message, key)) {\n result = lodash.find(requests[key], { ReqId: String(message[key]) });\n }\n });\n\n return result;\n}\n\nexport function registerRequest(message: Object, promise: Request): Object {\n lodash.mapKeys(RequestTypes, (key) => {\n if (lodash.has(message, key)) {\n requests[key] = requests[key] || [];\n requests[key].push({ ReqId: String(message[key]), ...promise });\n }\n });\n\n return requests;\n}\n\nexport function registerEventEmitter(message: Object, callback: Function): Object {\n lodash.mapKeys(RequestTypes, (key) => {\n if (lodash.has(message, key)) {\n if (requests[key] !== []) {\n const index = lodash.findIndex(requests[key], { ReqId: String(message[key]) });\n requests[key][index] = {\n ...requests[key][index],\n resolve: null,\n reject: null,\n callback,\n };\n }\n }\n });\n\n return requests;\n}\n\nexport function registerListener(msgType: string, callback: Function): void {\n listeners[msgType] = listeners[msgType] || [];\n listeners[msgType] = callback;\n}\n\nexport function deleteRequest(key: string): Object {\n requests = lodash.omit(requests, [key]);\n return requests;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/listener.js\n **/","export const SOCKET_ID = 'SocketID';\nexport const REQUEST_ID = 'ReqID';\nexport const TEST_REQUEST_ID = 'TestReqID';\nexport const USER_REQUEST_ID = 'UserReqID';\nexport const SECURITY_REQUEST_ID = 'SecurityReqID';\nexport const RESET_PASSWORD_REQUEST_ID = 'ResetPasswordReqID';\nexport const DEPOSIT_REQUEST_ID = 'DepositReqID';\nexport const WITHDRAW_REQUEST_ID = 'WithdrawReqID';\nexport const BALANCE_REQUEST_ID = 'BalanceReqID';\nexport const ORDERS_REQUEST_ID = 'OrdersReqID';\nexport const ENABLE_TWO_FACTOR_REQUEST_ID = 'EnableTwoFactorReqID';\nexport const DEPOSIT_METHOD_REQUEST_ID = 'DepositMethodReqID';\nexport const WITHDRAW_LIST_REQUEST_ID = 'WithdrawListReqID';\nexport const BROKER_LIST_REQUEST_ID = 'BrokerListReqID';\nexport const DEPOSIT_LIST_REQUEST_ID = 'DepositListReqID';\nexport const TRADE_HISTORY_REQUEST_ID = 'TradeHistoryReqID';\nexport const LEDGER_LIST_REQUEST_ID = 'LedgerListReqID';\nexport const TRADERS_RANK_REQUEST_ID = 'TradersRankReqID';\nexport const UPDATE_REQUEST_ID = 'UpdateReqID';\nexport const POSITION_REQUEST_ID = 'PositionReqID';\nexport const SECURITY_STATUS_REQUEST_ID = 'SecurityStatusReqID';\nexport const API_KEY_LIST_REQUEST_ID = 'APIKeyListReqID';\nexport const API_KEY_CREATE_REQUEST_ID = 'APIKeyCreateReqID';\nexport const API_KEY_REVOKE_REQUEST_ID = 'APIKeyRevokeReqID';\nexport const PROCESS_DEPOSIT_REQUEST_ID = 'ProcessDepositReqID';\nexport const CUSTOMER_LIST_REQUEST_ID = 'CustomerListReqID';\nexport const CUSTOMER_REQUEST_ID = 'CustomerReqID';\nexport const PROCESS_WITHDRAW_REQUEST_ID = 'ProcessWithdrawReqID';\nexport const VERIFY_CUSTOMER_REQUEST_ID = 'VerifyCustomerReqID';\nexport const MD_REQUEST_ID = 'MDReqID';\nexport const CLIENT_ORDER_ID = 'ClOrdID';\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/requestTypes.js\n **/","export const BALANCE = 'BALANCE';\n\nexport const ORDER_BOOK = 'OB';\nexport const ORDER_BOOK_TRADE_NEW = 'TRADE_NEW';\nexport const ORDER_BOOK_NEW_ORDER = 'NEW_ORDER';\nexport const ORDER_BOOK_UPDATE_ORDER = 'UPDATE_ORDER';\nexport const ORDER_BOOK_DELETE_ORDER = 'DELETE_ORDER';\nexport const ORDER_BOOK_DELETE_ORDERS_THRU = 'DELETE_ORDERS_THRU';\n\nexport const EXECUTION_REPORT = 'EXECUTION_REPORT';\nexport const EXECUTION_REPORT_NEW = 'NEW';\nexport const EXECUTION_REPORT_PARTIAL = 'PARTIAL';\nexport const EXECUTION_REPORT_EXECUTION = 'EXECUTION';\nexport const EXECUTION_REPORT_CANCELED = 'CANCELED';\nexport const EXECUTION_REPORT_REJECTED = 'REJECTED';\n\nexport const DEPOSIT_REFRESH = 'DEPOSIT_REFRESH';\nexport const WITHDRAW_REFRESH = 'WITHDRAW_REFRESH';\n\n/* eslint-disable quote-props */\nexport const EVENTS = {\n ORDERBOOK: {\n '0': ORDER_BOOK_NEW_ORDER,\n '1': ORDER_BOOK_UPDATE_ORDER,\n '2': ORDER_BOOK_DELETE_ORDER,\n '3': ORDER_BOOK_DELETE_ORDERS_THRU,\n },\n TRADES: {\n '0': ORDER_BOOK_TRADE_NEW,\n },\n EXECUTION_REPORT: {\n '0': EXECUTION_REPORT_NEW,\n '1': EXECUTION_REPORT_PARTIAL,\n '2': EXECUTION_REPORT_EXECUTION,\n '4': EXECUTION_REPORT_CANCELED,\n '8': EXECUTION_REPORT_REJECTED,\n },\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/actionTypes.js\n **/","export default {\n HEARTBEAT: '1',\n LOGIN: 'BE',\n LOGOUT: 'BE',\n CHANGE_PASSWORD: 'BE',\n\n MARKET_DATA_FULL_REFRESH: 'V',\n MARKET_DATA_UNSUBSCRIBE: 'V',\n\n ORDER_SEND: 'D',\n ORDER_CANCEL: 'F',\n\n SECURITY_LIST: 'x',\n SECURITY_STATUS: 'e',\n BALANCE: 'U2',\n ORDER_LIST: 'U4',\n BROKER_LIST: 'U28',\n TRADE_HISTORY: 'U32',\n PROFILE_UPDATE: 'U38',\n\n REQUEST_DEPOSIT: 'U18',\n REQUEST_DEPOSIT_LIST: 'U30',\n REQUEST_DEPOSIT_METHODS: 'U20',\n REQUEST_WITHDRAW: 'U6',\n REQUEST_WITHDRAW_LIST: 'U26',\n\n CONFIRM_WITHDRAW: 'U24',\n CANCEL_WITHDRAW: 'U70',\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/requests.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport BaseTransport from './baseTransport';\nimport Fingerprint2 from 'fingerprintjs2';\nimport nodeify from 'nodeify';\nimport { EventEmitter2 as EventEmitter } from 'eventemitter2';\n\nimport {\n getRequest,\n getListener,\n registerRequest,\n} from './listener';\n\n/* eslint-disable global-require */\n\nclass WebSocketTransport extends BaseTransport {\n\n /*\n * WebSocket Instance\n */\n socket: WebSocket;\n\n /*\n * FingerPrint\n */\n fingerPrint: string;\n\n /*\n * Stun object\n */\n stun: Stun;\n\n /*\n * Transport Promise\n */\n request: Request;\n\n /*\n * Event emitter to dispatch websocket updates\n */\n eventEmitter: EventEmitter;\n\n constructor(params?: BlinkTradeBase) {\n super(params, 'ws');\n\n this.stun = { local: null, public: [] };\n\n this.getStun();\n this.getFingerPrint();\n\n this.eventEmitter = new EventEmitter({ wildcard: true, delimiter: ':' });\n }\n\n connect(callback?: Function): Promise {\n return nodeify.extend(new Promise((resolve, reject) => {\n this.request = { resolve, reject };\n\n const WebSocket = this.isNode ? require('ws') : window.WebSocket;\n\n this.socket = new WebSocket(this.endpoint);\n this.socket.onopen = this.onOpen.bind(this);\n this.socket.onclose = this.onClose.bind(this);\n this.socket.onerror = this.onError.bind(this);\n this.socket.onmessage = this.onMessage.bind(this);\n })).nodeify(callback);\n }\n\n disconnect(): void {\n this.socket.close();\n }\n\n onOpen(): void {\n this.request.resolve({ connected: true });\n }\n\n onClose(): void {\n }\n\n onError(): void {\n this.request.reject();\n }\n\n sendMessage(msg: Object): void {\n if (this.socket.readyState === 1) {\n const data = msg;\n\n data.STUNTIP = this.stun;\n data.FingerPrint = this.fingerPrint;\n\n this.socket.send(JSON.stringify(data));\n }\n }\n\n sendMessageAsPromise(msg: Object, callback?: Function): Promise {\n return nodeify.extend(new Promise((resolve, reject) => {\n const promise = { resolve, reject };\n\n if (!msg) {\n return reject('Missing Message');\n }\n\n registerRequest(msg, promise);\n\n // Send promise to sendMessage to we can mock it.\n this.sendMessage(msg, promise);\n })).nodeify(callback);\n }\n\n onMessage(msg: Object): void {\n const data = JSON.parse(msg.data);\n if (data.MsgType === 'ERROR') {\n throw new Error(`Error: ${data.Detail} ${data.Description}`);\n }\n\n const request = getRequest(data);\n const listener = getListener(data.MsgType);\n this.dispatchPromise(request, data);\n this.dispatchListeners(listener, data);\n }\n\n dispatchPromise(request: ?Request, data: Object): any {\n if (request) {\n return request.resolve ? request.resolve(data)\n : request.callback ? request.callback(data)\n : null;\n }\n }\n\n dispatchListeners(listener: Function, data: Object): void {\n return listener && listener(data);\n }\n\n /* eslint-disable no-param-reassign */\n emitterPromise(promise: Promise): Promise {\n promise.on = (event: string, listener: Function) => {\n this.eventEmitter.on(event, listener);\n return promise;\n };\n promise.onAny = (listener: Function) => {\n this.eventEmitter.onAny(listener);\n return promise;\n };\n promise.offAny = (listener: Function) => {\n this.eventEmitter.offAny(listener);\n return promise;\n };\n promise.once = (event: string, listener: Function) => {\n this.eventEmitter.once(event, listener);\n return promise;\n };\n promise.many = (event: string, times: number, listener: Function) => {\n this.eventEmitter.many(event, times, listener);\n return promise;\n };\n promise.removeListener = (event: string, listener: Function) => {\n this.eventEmitter.removeListener(event, listener);\n return promise;\n };\n promise.removeAllListeners = (events: Array) => {\n this.eventEmitter.removeAllListeners(events);\n return promise;\n };\n\n return promise;\n }\n /* eslint-enable no-param-reassign */\n\n getFingerPrint(): void {\n if (this.isNode) {\n return require('./util/macaddress').getMac(macAddress => {\n this.fingerPrint = macAddress;\n });\n }\n return new Fingerprint2().get(fingerPrint => {\n this.fingerPrint = fingerPrint;\n });\n }\n\n getStun(): void {\n if (this.isNode) {\n require('./util/stun').getStun(data => {\n this.stun = data;\n });\n }\n }\n}\n\nexport default WebSocketTransport;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/wsTransport.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport _ from 'lodash';\nimport Base from './base';\nimport MsgTypes from './constants/requests';\nimport * as RequestTypes from './constants/requestTypes';\nimport {\n deleteRequest,\n generateRequestId,\n} from './listener';\n\ntype StatusListType = '1' | '2' | '4' | '8';\n\nclass BaseTransport extends Base {\n\n env: BlinkTradeEnv;\n\n send: Function;\n\n fetchTrade: Function;\n\n sendMessageAsPromise: Function;\n\n constructor(params?: BlinkTradeBase, env: BlinkTradeEnv) {\n super(params, env);\n\n this.send = env === 'ws' ? this.sendMessageAsPromise : this.fetchTrade;\n }\n\n balance(callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.BALANCE,\n BalanceReqID: generateRequestId(),\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n const Available = {};\n const balances = data[this.brokerId];\n Object.keys(balances).map(currency => {\n if (!currency.includes('locked')) {\n Available[currency] = balances[currency] - balances[`${currency}_locked`];\n }\n return Available;\n });\n\n return resolve({ ...data, Available });\n }).catch(reject);\n });\n }\n\n myOrders({ page: Page = 0, pageSize: PageSize = 40 }: {\n page?: number;\n pageSize?: number;\n } = {}, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.ORDER_LIST,\n OrdersReqID: generateRequestId(),\n Page,\n PageSize,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n const { Columns, ...orders } = data;\n const OrdListGrp = _.map(data.OrdListGrp, order => _.zipObject(Columns, order));\n return resolve({\n ...orders,\n OrdListGrp,\n });\n }).catch(reject);\n });\n }\n\n sendOrder({ side, amount, price, symbol }: {\n side: '1' | '2';\n price: number;\n amount: number;\n symbol: string;\n }, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.ORDER_SEND,\n ClOrdID: generateRequestId(),\n Symbol: symbol,\n Side: side,\n OrdType: '2',\n Price: price,\n OrderQty: amount,\n BrokerID: this.brokerId,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n deleteRequest(RequestTypes.CLIENT_ORDER_ID);\n resolve(data);\n }).catch(reject);\n });\n }\n\n cancelOrder(param: number | {\n orderId: number;\n clientId?: number;\n }, callback?: Function): Promise {\n const orderId = param.orderId ? param.orderId : param;\n const msg: Object = {\n MsgType: MsgTypes.ORDER_CANCEL,\n OrderID: orderId,\n };\n\n if (param.clientId) {\n msg.ClOrdID = param.clientId;\n }\n\n return this.send(msg, callback);\n }\n\n /**\n * statusList: 1-Pending, 2-In Progress, 4-Completed, 8-Cancelled\n */\n requestWithdrawList({\n page: Page = 0,\n pageSize: PageSize = 20,\n statusList: StatusList = ['1', '2', '4', '8'],\n }: {\n page?: number;\n pageSize?: number;\n statusList?: Array;\n } = {}, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.REQUEST_WITHDRAW_LIST,\n WithdrawListReqID: generateRequestId(),\n Page,\n PageSize,\n StatusList,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n const { Columns, ...withdrawData } = data;\n const WithdrawListGrp = _.map(data.WithdrawListGrp, withdraw => _.zipObject(Columns, withdraw));\n return resolve({\n ...withdrawData,\n WithdrawListGrp,\n });\n }).catch(reject);\n });\n }\n\n requestWithdraw({ amount, data, currency = 'BTC', method = 'bitcoin' }: {\n data: Object,\n amount: number;\n method?: string;\n currency?: string;\n }, callback: Function): Promise {\n const reqId = generateRequestId();\n const msg = {\n MsgType: MsgTypes.REQUEST_WITHDRAW,\n WithdrawReqID: reqId,\n ClOrdID: reqId,\n Method: method,\n Amount: amount,\n Currency: currency,\n Data: data,\n };\n\n return this.send(msg, callback);\n }\n\n confirmWithdraw({ withdrawId: WithdrawID, confirmationToken, secondFactor }: {\n withdrawId: string;\n confirmationToken?: string;\n secondFactor?: string;\n }, callback: Function): Promise {\n const msg: Object = {\n MsgType: MsgTypes.CONFIRM_WITHDRAW,\n WithdrawReqID: generateRequestId(),\n WithdrawID,\n };\n\n if (confirmationToken) {\n msg.ConfirmationToken = confirmationToken;\n }\n\n if (secondFactor) {\n msg.SecondFactor = secondFactor;\n }\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n return resolve({\n ...data,\n });\n }).catch(reject);\n });\n }\n\n cancelWithdraw(withdrawId: string, callback: Function): Promise {\n const reqId = generateRequestId();\n const msg = {\n MsgType: MsgTypes.CANCEL_WITHDRAW,\n WithdrawCancelReqID: reqId,\n ClOrdID: reqId,\n WithdrawID: withdrawId,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n return resolve({\n ...data,\n });\n }).catch(reject);\n });\n }\n\n requestDepositList({\n page: Page = 0,\n pageSize: PageSize = 20,\n status: StatusList = ['1', '2', '4', '8'],\n }: {\n page: number;\n pageSize: number;\n status: Array;\n } = {}, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.REQUEST_DEPOSIT_LIST,\n DepositListReqID: generateRequestId(),\n Page,\n PageSize,\n StatusList,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n const { Columns, ...depositData } = data;\n const DepositListGrp = _.map(data.DepositListGrp, deposit => _.zipObject(Columns, deposit));\n return resolve({\n ...depositData,\n DepositListGrp,\n });\n }).catch(reject);\n });\n }\n\n requestDeposit({ currency = 'BTC', value, depositMethodId }: {\n value?: number;\n currency?: string;\n depositMethodId?: number;\n } = {}, callback?: Function): Promise {\n const reqId = generateRequestId();\n const msg: Object = {\n MsgType: MsgTypes.REQUEST_DEPOSIT,\n DepositReqID: reqId,\n ClOrdID: reqId,\n Currency: currency,\n BrokerID: this.brokerId,\n };\n\n if (currency !== 'BTC') {\n msg.DepositMethodID = depositMethodId;\n msg.Value = value;\n }\n\n return this.send(msg, callback);\n }\n\n requestDepositMethods(callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.REQUEST_DEPOSIT_METHODS,\n DepositMethodReqID: generateRequestId(),\n };\n\n return this.send(msg, callback);\n }\n}\n\nexport default BaseTransport;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/baseTransport.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport common from './constants/common';\n\nclass Base {\n\n /*\n * url endpoint.\n */\n endpoint: string;\n\n /*\n * Broker id\n */\n brokerId: number;\n\n /*\n * Is node.js environment.\n */\n isNode: boolean;\n\n constructor(params: BlinkTradeBase = {}, env: BlinkTradeEnv) {\n const endpoint =\n params.url ? params.url\n : params.prod ? common.prod[env]\n : common.testnet[env];\n\n this.brokerId = params.brokerId || 5;\n\n this.endpoint = endpoint;\n\n this.isNode = typeof window === 'undefined';\n }\n}\n\nexport default Base;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/base.js\n **/","export default {\n prod: {\n ws: 'wss://api.blinktrade.com/trade/',\n rest: 'https://api.blinktrade.com/',\n },\n testnet: {\n ws: 'wss://api.testnet.blinktrade.com/trade/',\n rest: 'https://api.testnet.blinktrade.com/',\n },\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/common.js\n **/","module.exports = require(\"fingerprintjs2\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"fingerprintjs2\"\n ** module id = 13\n ** module chunks = 0\n **/","module.exports = require(\"nodeify\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"nodeify\"\n ** module id = 14\n ** module chunks = 0\n **/","module.exports = require(\"ws\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"ws\"\n ** module id = 15\n ** module chunks = 0\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport macaddress from 'macaddress';\n\nexport function getMac(callback: Function): void {\n macaddress.all((err, all) => {\n const hashCode = (str) => {\n let hash = 0;\n if (str.length === 0) return hash;\n for (let i = 0; i < str.length; i++) {\n hash = ((hash << 5) - hash) + str.charCodeAt(i);\n hash = hash & hash; // Convert to 32bit integer\n }\n return hash;\n };\n\n let macAddresses = '';\n Object.keys(all).forEach(iface => {\n macAddresses += all[iface].mac;\n });\n\n let fingerPrint = hashCode(macAddresses);\n if (fingerPrint < 0) {\n fingerPrint *= -1;\n }\n\n callback(fingerPrint);\n });\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/macaddress.js\n **/","module.exports = require(\"macaddress\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"macaddress\"\n ** module id = 17\n ** module chunks = 0\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n/* eslint-disable no-param-reassign */\n\nimport ip from 'ip';\nimport dgram from 'dgram';\n\nconst stunIp = { local: null, public: [] };\n\nfunction addIPAddress(ipAddress) {\n if (ipAddress.match(/^(192\\.168\\.|169\\.254\\.|10\\.|172\\.(1[6-9]|2\\d|3[01]))/)) {\n stunIp.local = ipAddress;\n } else {\n if (stunIp.public.indexOf(ipAddress) === -1) {\n stunIp.public.push(ipAddress);\n }\n }\n}\n\nexport function getStun(callback: Function) {\n const socket = dgram.createSocket('udp4');\n\n const STUN_HEADER_LENGTH = 20;\n const stunRequest = new Buffer(STUN_HEADER_LENGTH);\n\n const STUN_METHOD_REQUEST = 0x000;\n const STUN_BINDING_CLASS = 0x0001;\n const STUN_MAGIC_COOKIE = 0x2112A442;\n const STUN_TID_MAX = Math.pow(2, 32);\n\n const STUN_ATTR_MAPPED_ADDRESS = 0x0001;\n const STUN_ATTR_XOR_MAPPED_ADDRESS = 0x8020;\n const STUN_ATTR_XOR_MAPPED_ADDRESS_ALT = 0x0020;\n\n const stunTxId = (Math.random() * STUN_TID_MAX);\n\n const stunServers = [\n [3478, 'stun.services.mozilla.com'],\n [19302, 'stun.l.google.com'],\n [3478, 'stun.stunprotocol.org'],\n [3478, 'stun.softjoys.com'],\n [3478, 'stun.samsungsmartcam.com'],\n [3478, 'stun.sonetel.com'],\n [3478, 'stun.tagan.ru'],\n [3478, 'stun.voipgain.com'],\n [3478, 'stunserver.org'],\n [3478, 'stun.advfn.com'],\n [3478, 'stun.annatel.net'],\n [3478, 'stun.freevoipdeal.com'],\n ];\n\n stunRequest.writeUInt16BE(((STUN_BINDING_CLASS | STUN_METHOD_REQUEST) & 0x3fff), 0);\n stunRequest.writeUInt16BE(0, 2);\n stunRequest.writeUInt32BE(STUN_MAGIC_COOKIE, 4);\n stunRequest.writeUInt32BE(0, 8);\n stunRequest.writeUInt32BE(0, 12);\n stunRequest.writeUInt32BE(stunTxId, 16);\n\n socket.on('message', (msg) => {\n const xor = (a, b) => {\n const data = [];\n if (b.length > a.length) {\n const tmp = a;\n a = b;\n b = tmp;\n }\n for (let i = 0, len = a.length; i < len; i++) {\n data.push(a[i] ^ b[i]);\n }\n\n return new Buffer(data);\n };\n\n const block = msg.readUInt8(0);\n const bit1 = block & 0x80;\n const bit2 = block & 0x40;\n\n if (!(bit1 === 0 && bit2 === 0)) {\n return;\n }\n\n const msgHeader = msg.slice(0, STUN_HEADER_LENGTH);\n const msgAttrs = msg.slice(STUN_HEADER_LENGTH, msg.length);\n\n let offset = 0;\n\n while (offset < msgAttrs.length) {\n const attrType = msgAttrs.readUInt16BE(offset);\n offset += 2;\n\n let attrBuffLength = msgAttrs.readUInt16BE(offset);\n const blockOut = attrBuffLength % 4;\n if (blockOut > 0) {\n attrBuffLength += 4 - blockOut;\n }\n offset += 2;\n\n const value = msgAttrs.slice(offset, offset + attrBuffLength);\n offset += attrBuffLength;\n\n let family;\n let address;\n switch (attrType) {\n case STUN_ATTR_MAPPED_ADDRESS:\n family = (value.readUInt16BE(0) === 0x02) ? 6 : 4;\n address = ip.toString(value, 4, family);\n addIPAddress(address);\n break;\n\n case STUN_ATTR_XOR_MAPPED_ADDRESS:\n case STUN_ATTR_XOR_MAPPED_ADDRESS_ALT:\n family = (value.readUInt16BE(0) === 0x02) ? 6 : 4;\n const magic = msgHeader.slice(4, 8);\n const tid = msgHeader.slice(8, 20);\n const xaddr = value.slice(4, family === 4 ? 8 : 20);\n const addr = xor(xaddr, family === 4 ? magic : value.concat([magic, tid]));\n address = ip.toString(addr, 0, family);\n addIPAddress(address);\n break;\n default:\n }\n }\n\n callback(stunIp);\n });\n\n stunServers.map(([port, host]) => socket.send(stunRequest, 0, stunRequest.length, port, host));\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/stun.js\n **/","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/buffer/index.js\n ** module id = 19\n ** module chunks = 0\n **/","module.exports = require(\"base64-js\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"base64-js\"\n ** module id = 20\n ** module chunks = 0\n **/","module.exports = require(\"ieee754\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"ieee754\"\n ** module id = 21\n ** module chunks = 0\n **/","module.exports = require(\"isarray\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"isarray\"\n ** module id = 22\n ** module chunks = 0\n **/","module.exports = require(\"ip\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"ip\"\n ** module id = 23\n ** module chunks = 0\n **/","exports.endianness = function () { return 'LE' };\n\nexports.hostname = function () {\n if (typeof location !== 'undefined') {\n return location.hostname\n }\n else return '';\n};\n\nexports.loadavg = function () { return [] };\n\nexports.uptime = function () { return 0 };\n\nexports.freemem = function () {\n return Number.MAX_VALUE;\n};\n\nexports.totalmem = function () {\n return Number.MAX_VALUE;\n};\n\nexports.cpus = function () { return [] };\n\nexports.type = function () { return 'Browser' };\n\nexports.release = function () {\n if (typeof navigator !== 'undefined') {\n return navigator.appVersion;\n }\n return '';\n};\n\nexports.networkInterfaces\n= exports.getNetworkInterfaces\n= function () { return {} };\n\nexports.arch = function () { return 'javascript' };\n\nexports.platform = function () { return 'browser' };\n\nexports.tmpdir = exports.tmpDir = function () {\n return '/tmp';\n};\n\nexports.EOL = '\\n';\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/os-browserify/browser.js\n ** module id = 25\n ** module chunks = 0\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport RestTransport from './restTransport';\n\nclass BlinkTradeRest extends RestTransport {\n ticker(callback?: Function): Promise {\n return super.fetchPublic('ticker', callback);\n }\n\n trades({ limit = 1000, since = '0' }: {\n limit: number;\n since: string;\n } = {}, callback?: Function): Promise {\n return super.fetchPublic(`trades?limit=${limit}&since=${since}`, callback);\n }\n\n orderbook(callback?: Function): Promise {\n return super.fetchPublic('orderbook', callback);\n }\n}\n\nexport default BlinkTradeRest;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/rest.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport sjcl from 'sjcl';\nimport nodeify from 'nodeify';\nimport url from 'url';\nimport path from 'path';\nimport BaseTransport from './baseTransport';\n\nclass RestTransport extends BaseTransport {\n\n /**\n * APIKey\n */\n key: string;\n\n /**\n * APISecret\n */\n secret: string;\n\n /**\n * Exchanges currencies available.\n */\n currency: 'USD' | 'BRL' | 'VEF' | 'CLP' | 'VND' | 'PKR';\n\n /**\n * Fetch rest API\n */\n fetchRequest: Function\n\n constructor(params: BlinkTradeRest) {\n super(params, 'rest');\n\n this.key = params.key;\n this.secret = params.secret;\n this.currency = params.currency || 'USD';\n\n this.fetchRequest = this.isNode ? require('isomorphic-fetch') : require('fetch-jsonp');\n }\n\n headers(method: string, body: Object): Object {\n const timeStamp = Date.now().toString();\n const hexKey = sjcl.codec.utf8String.toBits(this.secret);\n const hmac = new sjcl.misc.hmac(hexKey, sjcl.hash.sha256);\n const Signature = sjcl.codec.hex.fromBits(hmac.encrypt(timeStamp));\n return {\n method,\n headers: {\n 'Content-Type': 'application/json',\n Nonce: timeStamp,\n APIKey: this.key,\n Signature,\n },\n body: JSON.stringify(body),\n };\n }\n\n fetch(msg: Object, api: string, headers?: Object = {}): Promise {\n return this.fetchRequest(url.resolve(this.endpoint, api), headers)\n .then(response => response.json());\n }\n\n fetchPublic(api: string, callback?: Function): Promise {\n return nodeify(this.fetch({}, path.join('api/v1', this.currency, api)), callback);\n }\n\n fetchTrade(msg: Object, callback?: Function): Promise {\n const headers = this.headers('POST', msg);\n return nodeify(this.fetch(msg, 'tapi/v1/message', headers, callback)\n .then(response => (response.Status === 500 ? Promise.reject(response) : response.Responses))\n .then(response => (response.length === 1 ? response[0] : response))\n , callback);\n }\n}\n\nexport default RestTransport;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/restTransport.js\n **/","module.exports = require(\"sjcl\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"sjcl\"\n ** module id = 28\n ** module chunks = 0\n **/","module.exports = require(\"url\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"url\"\n ** module id = 29\n ** module chunks = 0\n **/","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nvar splitPathRe =\n /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\nvar splitPath = function(filename) {\n return splitPathRe.exec(filename).slice(1);\n};\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n var isAbsolute = exports.isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isAbsolute).join('/');\n\n if (!path && !isAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return exports.normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n from = exports.resolve(from).substr(1);\n to = exports.resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function(path) {\n var result = splitPath(path),\n root = result[0],\n dir = result[1];\n\n if (!root && !dir) {\n // No dirname whatsoever\n return '.';\n }\n\n if (dir) {\n // It has a dirname, strip trailing slash\n dir = dir.substr(0, dir.length - 1);\n }\n\n return root + dir;\n};\n\n\nexports.basename = function(path, ext) {\n var f = splitPath(path)[2];\n // TODO: make this comparison case-insensitive on windows?\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n};\n\n\nexports.extname = function(path) {\n return splitPath(path)[3];\n};\n\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n ? function (str, start, len) { return str.substr(start, len) }\n : function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/path-browserify/index.js\n ** module id = 30\n ** module chunks = 0\n **/","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\n(function () {\n try {\n cachedSetTimeout = setTimeout;\n } catch (e) {\n cachedSetTimeout = function () {\n throw new Error('setTimeout is not defined');\n }\n }\n try {\n cachedClearTimeout = clearTimeout;\n } catch (e) {\n cachedClearTimeout = function () {\n throw new Error('clearTimeout is not defined');\n }\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/process/browser.js\n ** module id = 31\n ** module chunks = 0\n **/","module.exports = require(\"isomorphic-fetch\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"isomorphic-fetch\"\n ** module id = 32\n ** module chunks = 0\n **/","module.exports = require(\"fetch-jsonp\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"fetch-jsonp\"\n ** module id = 33\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/blinktrade.min.js b/dist/blinktrade.min.js index ca00191..5fca8fa 100644 --- a/dist/blinktrade.min.js +++ b/dist/blinktrade.min.js @@ -1,8 +1,8 @@ -!function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.BlinkTradeRest=t.BlinkTradeWS=t.Brokers=void 0;var o=r(1),i=n(o),u=r(2),s=n(u),a=r(26),f=n(a);t.Brokers=i["default"],t.BlinkTradeWS=s["default"],t.BlinkTradeRest=f["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={SURBITCOIN:1,VBTC:3,FOXBIT:4,TESTNET:5,URDUBIT:8,CHILEBIT:9}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r={};for(var n in e)t.indexOf(n)<0&&Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var f=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(){function e(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),l=function T(e,t,r){null===e&&(e=Function.prototype);var n=Object.getOwnPropertyDescriptor(e,t);if(void 0===n){var o=Object.getPrototypeOf(e);return null===o?void 0:T(o,t,r)}if("value"in n)return n.value;var i=n.get;if(void 0!==i)return i.call(r)},h=r(3),p=n(h),d=r(4),y=n(d),E=r(9),g=n(E),v=(r(13),r(10)),_=r(24),R=function(e){function t(e){u(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.session={},r}return a(t,e),c(t,[{key:"heartbeat",value:function(e){var r=this,n=new Date,o={MsgType:p["default"].HEARTBEAT,TestReqID:n.getTime(),SendTime:n.getTime()};return new Promise(function(n,i){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"sendMessageAsPromise",r).call(r,o,e).then(function(e){return n(f({},e,{Latency:new Date(Date.now())-e.SendTime}))})["catch"](i)})}},{key:"login",value:function(e,n){var o=this,i=e.username,u=e.password,s=e.secondFactor,a=void 0;if(this.isNode){var c=r(25);a={UserAgent:c.type()+" "+c.release(),UserAgentLanguage:"en_US",UserAgentPlatform:c.platform()+" ("+c.arch()+")",UserAgentTimezoneOffset:(new Date).getTimezoneOffset()}}else a={UserAgent:window.navigator.userAgent,UserAgentLanguage:window.navigator.language,UserAgentPlatform:window.navigator.platform,UserAgentTimezoneOffset:(new Date).getTimezoneOffset()};var h=f({MsgType:p["default"].LOGIN,UserReqID:(0,v.generateRequestId)(),BrokerID:this.brokerId,Username:i,Password:u,UserReqTyp:"1"},a);return s&&(h.SecondFactor=s),new Promise(function(e,r){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"sendMessageAsPromise",o).call(o,h,n).then(function(t){return 1===t.UserStatus?(o.session=t,e(t)):r(t)})["catch"](r)})}},{key:"logout",value:function(e){var r={MsgType:p["default"].LOGOUT,BrokerID:this.brokerId,UserReqID:(0,v.generateRequestId)(),Username:this.session.Username,UserReqTyp:"2"};return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"sendMessageAsPromise",this).call(this,r,e)}},{key:"profile",value:function n(e){var t=this.session.Profile,n=i(t,["VerificationData"]);return e?e(n):Promise.resolve(n)}},{key:"balance",value:function(e){var r=this;return(0,v.registerListener)("U3",function(t){return e&&e(null,t),r.eventEmitter.emit(_.BALANCE,t)}),l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emitterPromise",this).call(this,new Promise(function(n,o){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"balance",r).call(r,e).then(n)["catch"](o)}))}},{key:"subscribeTicker",value:function(e,r){var n=this,o={MsgType:p["default"].SECURITY_STATUS,SecurityStatusReqID:(0,v.generateRequestId)(),SubscriptionRequestType:"1",Instruments:e},i=function(e){return f({},e,{SellVolume:e.SellVolume/1e8,LowPx:e.LowPx/1e8,LastPx:e.LastPx/1e8,BestAsk:e.BestAsk/1e8,HighPx:e.HighPx/1e8,BuyVolume:e.BuyVolume/1e8,BestBid:e.BestBid/1e8})};return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emitterPromise",this).call(this,new Promise(function(e,u){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"sendMessageAsPromise",n).call(n,o,r).then(function(t){e(i(t)),(0,v.registerEventEmitter)({SecurityStatusReqID:t.SecurityStatusReqID},function(e){return r&&r(null,i(e)),n.eventEmitter.emit("BLINK:"+e.Symbol,i(e))})})["catch"](u)}))}},{key:"unSubscribeTicker",value:function(e){var r={MsgType:p["default"].SECURITY_STATUS,SecurityStatusReqID:e,SubscriptionRequestType:"2"};return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"sendMessage",this).call(this,r),e}},{key:"subscribeOrderbook",value:function(e,r){var n=this,i={MsgType:p["default"].MARKET_DATA_FULL_REFRESH,MDReqID:(0,v.generateRequestId)(),SubscriptionRequestType:"1",MarketDepth:0,MDUpdateType:"1",MDEntryTypes:["0","1","2"],Instruments:e},u=function(e){"3"===e.MDBkTyp&&e.MDIncGrp.map(function(e){var t={index:e.MDEntryPositionNo,price:e.MDEntryPx/1e8,size:e.MDEntrySize/1e8,side:"0"===e.MDEntryType?"buy":"sell",userId:e.UserID,orderId:e.OrderID,symbol:e.Symbol,time:""+new Date(e.MDEntryDate+" "+e.MDEntryTime)};switch(r&&r(null,t),e.MDEntryType){case"0":case"1":var o=_.ORDER_BOOK+":"+_.EVENTS.ORDERBOOK[e.MDUpdateAction];return n.eventEmitter.emit(o,f({},t,{type:o}));case"2":var i=_.ORDER_BOOK+":"+_.EVENTS.TRADES[e.MDUpdateAction];return n.eventEmitter.emit(i,f({},t,{type:i}));case"4":break;default:return null}return null})};return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emitterPromise",this).call(this,new Promise(function(e,s){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"sendMessageAsPromise",n).call(n,i,r).then(function(t){if("W"===t.MsgType){var r=t.MDFullGrp.filter(function(e){return"0"===e.MDEntryType||"1"===e.MDEntryType}).reduce(function(e,t){var r="0"===t.MDEntryType?"bids":"asks";return(e[r]||(e[r]=[])).push([t.MDEntryPx/1e8,t.MDEntrySize/1e8,t.UserID]),e},[]),n=r.bids,i=r.asks;return(0,v.registerEventEmitter)({MDReqID:t.MDReqID},u),e(f({},t,{MDFullGrp:o({},t.Symbol,{bids:n,asks:i})}))}})["catch"](function(e){return s(e)})}))}},{key:"unSubscribeOrderbook",value:function(e){var r={MsgType:p["default"].MARKET_DATA_UNSUBSCRIBE,MDReqID:e,MarketDepth:0,SubscriptionRequestType:"2"};return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"sendMessage",this).call(this,r),e}},{key:"executionReport",value:function(e){var t=this;return(0,v.registerListener)("8",function(r){e&&e(r);var n=_.EVENTS.EXECUTION_REPORT[r.ExecType];return t.eventEmitter.emit(_.EXECUTION_REPORT+":"+n,r)}),this.eventEmitter}},{key:"tradeHistory",value:function(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.since,o=r.filter,u=r.page,s=void 0===u?0:u,a=r.pageSize,c=void 0===a?80:a,h=arguments[1],d={MsgType:p["default"].TRADE_HISTORY,TradeHistoryReqID:(0,v.generateRequestId)(),Page:s,PageSize:c};return o&&o.length>0&&(d.Filter=o),n&&"number"==typeof n&&(d.Since=n),new Promise(function(r,n){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"sendMessageAsPromise",e).call(e,d,h).then(function(e){var t=e.Columns,n=i(e,["Columns"]),o=g["default"].groupBy(g["default"].map(e.TradeHistoryGrp,function(e){return g["default"].zipObject(t,e)}),function(e){return e.Market});return r(f({},n,{TradeHistoryGrp:o}))})["catch"](n)})}},{key:"requestDeposit",value:function(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.currency,o=void 0===n?"BTC":n,i=r.value,u=r.depositMethodId,s=arguments[1];return(0,v.registerListener)("U23",function(t){return s&&s(null,t),e.eventEmitter.emit(_.DEPOSIT_REFRESH,t)}),l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emitterPromise",this).call(this,new Promise(function(r,n){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"requestDeposit",e).call(e,{currency:o,value:i,depositMethodId:u},s).then(r)["catch"](n)}))}},{key:"onDepositRefresh",value:function(e){return new Promise(function(t){(0,v.registerListener)("U23",function(r){return e&&e(r),t(r)})})}},{key:"requestWithdraw",value:function(e,r){var n=this,o=e.amount,i=e.data,u=e.currency,s=void 0===u?"BTC":u,a=e.method,f=void 0===a?"bitcoin":a;return(0,v.registerListener)("U9",function(e){return r&&r(null,e),n.eventEmitter.emit(_.WITHDRAW_REFRESH,e)}),l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emitterPromise",this).call(this,new Promise(function(e,u){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"requestWithdraw",n).call(n,{amount:o,data:i,currency:s,method:f},r).then(e)["catch"](u)}))}},{key:"onWithdrawRefresh",value:function(e){return new Promise(function(t){(0,v.registerListener)("U9",function(r){return e&&e(r),t(r)})})}}]),t}(y["default"]);t["default"]=R},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={HEARTBEAT:"1",LOGIN:"BE",LOGOUT:"BE",CHANGE_PASSWORD:"BE",MARKET_DATA_FULL_REFRESH:"V",MARKET_DATA_UNSUBSCRIBE:"V",ORDER_SEND:"D",ORDER_CANCEL:"F",SECURITY_LIST:"x",SECURITY_STATUS:"e",BALANCE:"U2",ORDER_LIST:"U4",BROKER_LIST:"U28",TRADE_HISTORY:"U32",PROFILE_UPDATE:"U38",REQUEST_DEPOSIT:"U18",REQUEST_DEPOSIT_LIST:"U30",REQUEST_DEPOSIT_METHODS:"U20",REQUEST_WITHDRAW:"U6",REQUEST_WITHDRAW_LIST:"U26",CONFIRM_WITHDRAW:"U24",CANCEL_WITHDRAW:"U70"}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(5),f=n(a),c=r(11),l=n(c),h=r(12),p=n(h),d=r(13),y=r(10),E=function(e){function t(e){o(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"ws"));return r.stun={local:null,"public":[]},r.getStun(),r.getFingerPrint(),r.eventEmitter=new d.EventEmitter2({wildcard:!0,delimiter:":"}),r}return u(t,e),s(t,[{key:"connect",value:function(e){var t=this;return p["default"].extend(new Promise(function(e,n){t.request={resolve:e,reject:n};var o=t.isNode?r(14):window.WebSocket;t.socket=new o(t.endpoint),t.socket.onopen=t.onOpen.bind(t),t.socket.onclose=t.onClose.bind(t),t.socket.onerror=t.onError.bind(t),t.socket.onmessage=t.onMessage.bind(t)})).nodeify(e)}},{key:"disconnect",value:function(){this.socket.close()}},{key:"onOpen",value:function(){this.request.resolve({connected:!0})}},{key:"onClose",value:function(){}},{key:"onError",value:function(){this.request.reject()}},{key:"sendMessage",value:function(e){if(1===this.socket.readyState){var t=e;t.STUNTIP=this.stun,t.FingerPrint=this.fingerPrint,this.socket.send(JSON.stringify(t))}}},{key:"sendMessageAsPromise",value:function(e,t){var r=this;return p["default"].extend(new Promise(function(t,n){var o={resolve:t,reject:n};return e?((0,y.registerRequest)(e,o),void r.sendMessage(e,o)):n("Missing Message")})).nodeify(t)}},{key:"onMessage",value:function(e){var t=JSON.parse(e.data);if("ERROR"===t.MsgType)throw Error("Error: "+t.Detail+" "+t.Description);var r=(0,y.getRequest)(t),n=(0,y.getListener)(t.MsgType);this.dispatchPromise(r,t),this.dispatchListeners(n,t)}},{key:"dispatchPromise",value:function(e,t){if(e)return e.resolve?e.resolve(t):e.callback?e.callback(t):null}},{key:"dispatchListeners",value:function(e,t){return e&&e(t)}},{key:"emitterPromise",value:function(e){var t=this;return e.on=function(r,n){return t.eventEmitter.on(r,n),e},e.onAny=function(r){return t.eventEmitter.onAny(r),e},e.offAny=function(r){return t.eventEmitter.offAny(r),e},e.once=function(r,n){return t.eventEmitter.once(r,n),e},e.many=function(r,n,o){return t.eventEmitter.many(r,n,o),e},e.removeListener=function(r,n){return t.eventEmitter.removeListener(r,n),e},e.removeAllListeners=function(r){return t.eventEmitter.removeAllListeners(r),e},e}},{key:"getFingerPrint",value:function(){var e=this;return this.isNode?r(15).getMac(function(t){e.fingerPrint=t}):(new l["default"]).get(function(t){e.fingerPrint=t})}},{key:"getStun",value:function(){var e=this;this.isNode&&r(17).getStun(function(t){e.stun=t})}}]),t}(f["default"]);t["default"]=E},function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){var r={};for(var n in e)t.indexOf(n)<0&&Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var f=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(){function e(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),l=r(6),h=o(l),p=r(3),d=o(p),y=r(8),E=n(y),g=r(9),v=o(g),_=r(10),R=function(e){function t(e,r){u(this,t);var n=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.send="ws"===r?n.sendMessageAsPromise:n.fetchTrade,n}return a(t,e),c(t,[{key:"balance",value:function(e){var t=this,r={MsgType:d["default"].BALANCE,BalanceReqID:(0,_.generateRequestId)()};return new Promise(function(n,o){return t.send(r,e).then(function(e){var r={},o=e[t.brokerId];return Object.keys(o).map(function(e){return e.includes("locked")||(r[e]=o[e]-o[e+"_locked"]),r}),n(f({},e,{Available:r}))})["catch"](o)})}},{key:"myOrders",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.page,n=void 0===r?0:r,o=t.pageSize,u=void 0===o?40:o,s=arguments[1],a={MsgType:d["default"].ORDER_LIST,OrdersReqID:(0,_.generateRequestId)(),Page:n,PageSize:u};return new Promise(function(t,r){return e.send(a,s).then(function(e){var r=e.Columns,n=i(e,["Columns"]),o=v["default"].map(e.OrdListGrp,function(e){return v["default"].zipObject(r,e)});return t(f({},n,{OrdListGrp:o}))})["catch"](r)})}},{key:"sendOrder",value:function(e,t){var r=this,n=e.side,o=e.amount,i=e.price,u=e.symbol,s={MsgType:d["default"].ORDER_SEND,ClOrdID:(0,_.generateRequestId)(),Symbol:u,Side:n,OrdType:"2",Price:i,OrderQty:o,BrokerID:this.brokerId};return new Promise(function(e,n){return r.send(s,t).then(function(t){(0,_.deleteRequest)(E.CLIENT_ORDER_ID),e(t)})["catch"](n)})}},{key:"cancelOrder",value:function(e,t){var r=e.orderId?e.orderId:e,n={MsgType:d["default"].ORDER_CANCEL,OrderID:r};return e.clientId&&(n.ClOrdID=e.clientId),this.send(n,t)}},{key:"requestWithdrawList",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.page,n=void 0===r?0:r,o=t.pageSize,u=void 0===o?20:o,s=t.statusList,a=void 0===s?["1","2","4","8"]:s,c=arguments[1],l={MsgType:d["default"].REQUEST_WITHDRAW_LIST,WithdrawListReqID:(0,_.generateRequestId)(),Page:n,PageSize:u,StatusList:a};return new Promise(function(t,r){return e.send(l,c).then(function(e){var r=e.Columns,n=i(e,["Columns"]),o=v["default"].map(e.WithdrawListGrp,function(e){return v["default"].zipObject(r,e)});return t(f({},n,{WithdrawListGrp:o}))})["catch"](r)})}},{key:"requestWithdraw",value:function(e,t){var r=e.amount,n=e.data,o=e.currency,i=void 0===o?"BTC":o,u=e.method,s=void 0===u?"bitcoin":u,a=(0,_.generateRequestId)(),f={MsgType:d["default"].REQUEST_WITHDRAW,WithdrawReqID:a,ClOrdID:a,Method:s,Amount:r,Currency:i,Data:n};return this.send(f,t)}},{key:"confirmWithdraw",value:function(e,t){var r=this,n=e.withdrawId,o=e.confirmationToken,i=e.secondFactor,u={MsgType:d["default"].CONFIRM_WITHDRAW,WithdrawReqID:(0,_.generateRequestId)(),WithdrawID:n};return o&&(u.ConfirmationToken=o),i&&(u.SecondFactor=i),new Promise(function(e,n){return r.send(u,t).then(function(t){return e(f({},t))})["catch"](n)})}},{key:"cancelWithdraw",value:function(e,t){var r=this,n=(0,_.generateRequestId)(),o={MsgType:d["default"].CANCEL_WITHDRAW,WithdrawCancelReqID:n,ClOrdID:n,WithdrawID:e};return new Promise(function(e,n){return r.send(o,t).then(function(t){return e(f({},t))})["catch"](n)})}},{key:"requestDepositList",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.page,n=void 0===r?0:r,o=t.pageSize,u=void 0===o?20:o,s=t.status,a=void 0===s?["1","2","4","8"]:s,c=arguments[1],l={MsgType:d["default"].REQUEST_DEPOSIT_LIST,DepositListReqID:(0,_.generateRequestId)(),Page:n,PageSize:u,StatusList:a};return new Promise(function(t,r){return e.send(l,c).then(function(e){var r=e.Columns,n=i(e,["Columns"]),o=v["default"].map(e.DepositListGrp,function(e){return v["default"].zipObject(r,e)});return t(f({},n,{DepositListGrp:o}))})})}},{key:"requestDeposit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.currency,r=void 0===t?"BTC":t,n=e.value,o=e.depositMethodId,i=arguments[1],u=(0,_.generateRequestId)(),s={MsgType:d["default"].REQUEST_DEPOSIT,DepositReqID:u,ClOrdID:u,Currency:r,BrokerID:this.brokerId};return"BTC"!==r&&(s.DepositMethodID=o,s.Value=n),this.send(s,i)}},{key:"requestDepositMethods",value:function(e){var t={MsgType:d["default"].REQUEST_DEPOSIT_METHODS,DepositMethodReqID:(0,_.generateRequestId)()};return this.send(t,e)}}]),t}(h["default"]);t["default"]=R},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=r(7),u=n(i),s=function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];o(this,a);var r=e.url?e.url:e.prod?u["default"].prod[t]:u["default"].testnet[t];this.brokerId=e.brokerId||5,this.endpoint=r,this.isNode="undefined"==typeof window};t["default"]=s},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={prod:{ws:"wss://api.blinktrade.com/trade/",rest:"https://api.blinktrade.com/"},testnet:{ws:"wss://api.testnet.blinktrade.com/trade/",rest:"https://api.testnet.blinktrade.com/"}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.SOCKET_ID="SocketID",t.REQUEST_ID="ReqID",t.TEST_REQUEST_ID="TestReqID",t.USER_REQUEST_ID="UserReqID",t.SECURITY_REQUEST_ID="SecurityReqID",t.RESET_PASSWORD_REQUEST_ID="ResetPasswordReqID",t.DEPOSIT_REQUEST_ID="DepositReqID",t.WITHDRAW_REQUEST_ID="WithdrawReqID",t.BALANCE_REQUEST_ID="BalanceReqID",t.ORDERS_REQUEST_ID="OrdersReqID",t.ENABLE_TWO_FACTOR_REQUEST_ID="EnableTwoFactorReqID",t.DEPOSIT_METHOD_REQUEST_ID="DepositMethodReqID",t.WITHDRAW_LIST_REQUEST_ID="WithdrawListReqID",t.BROKER_LIST_REQUEST_ID="BrokerListReqID",t.DEPOSIT_LIST_REQUEST_ID="DepositListReqID",t.TRADE_HISTORY_REQUEST_ID="TradeHistoryReqID",t.LEDGER_LIST_REQUEST_ID="LedgerListReqID",t.TRADERS_RANK_REQUEST_ID="TradersRankReqID",t.UPDATE_REQUEST_ID="UpdateReqID",t.POSITION_REQUEST_ID="PositionReqID",t.SECURITY_STATUS_REQUEST_ID="SecurityStatusReqID",t.API_KEY_LIST_REQUEST_ID="APIKeyListReqID",t.API_KEY_CREATE_REQUEST_ID="APIKeyCreateReqID",t.API_KEY_REVOKE_REQUEST_ID="APIKeyRevokeReqID",t.PROCESS_DEPOSIT_REQUEST_ID="ProcessDepositReqID",t.CUSTOMER_LIST_REQUEST_ID="CustomerListReqID",t.CUSTOMER_REQUEST_ID="CustomerReqID",t.PROCESS_WITHDRAW_REQUEST_ID="ProcessWithdrawReqID",t.VERIFY_CUSTOMER_REQUEST_ID="VerifyCustomerReqID",t.MD_REQUEST_ID="MDReqID",t.CLIENT_ORDER_ID="ClOrdID"},function(e,t){e.exports=require("lodash")},function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}function i(){return v}function u(){return parseInt(1e7*Math.random()+"",10)}function s(e){return _[e]}function a(e){var t=void 0;return y["default"].mapKeys(g,function(r){y["default"].has(e,r)&&(t=y["default"].find(v[r],{ReqId:e[r]+""}))}),t}function f(e,t){return y["default"].mapKeys(g,function(r){y["default"].has(e,r)&&(v[r]=v[r]||[],v[r].push(p({ReqId:e[r]+""},t)))}),v}function c(e,t){return y["default"].mapKeys(g,function(r){if(y["default"].has(e,r)&&v[r]!==[]){var n=y["default"].findIndex(v[r],{ReqId:e[r]+""});v[r][n]=p({},v[r][n],{resolve:null,reject:null,callback:t})}}),v}function l(e,t){_[e]=_[e]||[],_[e]=t}function h(e){return v=y["default"].omit(v,[e])}Object.defineProperty(t,"__esModule",{value:!0});var p=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.getListeners=i,t.generateRequestId=u,t.getListener=s,t.getRequest=a,t.registerRequest=f,t.registerEventEmitter=c,t.registerListener=l,t.deleteRequest=h;var d=r(9),y=o(d),E=r(8),g=n(E),v={},_={}},function(e,t){e.exports=require("fingerprintjs2")},function(e,t){e.exports=require("nodeify")},function(e,t){e.exports=require("eventemitter2")},function(e,t){e.exports=require("ws")},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){u["default"].all(function(t,r){var n=function(e){var t=0;if(0===e.length)return t;for(var r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return t},o="";Object.keys(r).forEach(function(e){o+=r[e].mac});var i=n(o);0>i&&(i*=-1),e(i)})}Object.defineProperty(t,"__esModule",{value:!0}),t.getMac=o;var i=r(16),u=n(i)},function(e,t){e.exports=require("macaddress")},function(e,t,r){(function(e){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){e.match(/^(192\.168\.|169\.254\.|10\.|172\.(1[6-9]|2\d|3[01]))/)?l.local=e:l["public"].indexOf(e)===-1&&l["public"].push(e)}function i(t){var r=c["default"].createSocket("udp4"),n=20,i=new e(n),s=0,f=1,h=554869826,p=Math.pow(2,32),d=1,y=32800,E=32,g=Math.random()*p,v=[[3478,"stun.services.mozilla.com"],[19302,"stun.l.google.com"],[3478,"stun.stunprotocol.org"],[3478,"stun.softjoys.com"],[3478,"stun.samsungsmartcam.com"],[3478,"stun.sonetel.com"],[3478,"stun.tagan.ru"],[3478,"stun.voipgain.com"],[3478,"stunserver.org"],[3478,"stun.advfn.com"],[3478,"stun.annatel.net"],[3478,"stun.freevoipdeal.com"]];i.writeUInt16BE(16383&(f|s),0),i.writeUInt16BE(0,2),i.writeUInt32BE(h,4),i.writeUInt32BE(0,8),i.writeUInt32BE(0,12),i.writeUInt32BE(g,16),r.on("message",function(r){var i=function(t,r){var n=[];if(r.length>t.length){var o=t;t=r,r=o}for(var i=0,u=t.length;u>i;i++)n.push(t[i]^r[i]);return new e(n)},u=r.readUInt8(0),s=128&u,f=64&u;if(0===s&&0===f){for(var c=r.slice(0,n),h=r.slice(n,r.length),p=0;h.length>p;){var g=h.readUInt16BE(p);p+=2;var v=h.readUInt16BE(p),_=v%4;_>0&&(v+=4-_),p+=2;var R=h.slice(p,p+v);p+=v;var T=void 0,b=void 0;switch(g){case d:T=2===R.readUInt16BE(0)?6:4,b=a["default"].toString(R,4,T),o(b);break;case y:case E:T=2===R.readUInt16BE(0)?6:4;var m=c.slice(4,8),O=c.slice(8,20),w=R.slice(4,4===T?8:20),I=i(w,4===T?m:R.concat([m,O]));b=a["default"].toString(I,0,T),o(b)}}t(l)}}),v.map(function(e){var t=u(e,2),n=t[0],o=t[1];return r.send(i,0,i.length,n,o)})}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var u,s=e[Symbol.iterator]();!(n=(u=s.next()).done)&&(r.push(u.value),!t||r.length!==t);n=!0);}catch(a){o=!0,i=a}finally{try{!n&&s["return"]&&s["return"]()}finally{if(o)throw i}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.getStun=i;var s=r(22),a=n(s),f=r(23),c=n(f),l={local:null,"public":[]}}).call(t,r(18).Buffer)},function(e,t,r){(function(e,n){/*! +!function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.BlinkTradeRest=t.BlinkTradeWS=t.Brokers=void 0;var o=r(1),i=n(o),u=r(2),s=n(u),a=r(26),f=n(a);t.Brokers=i["default"],t.BlinkTradeWS=s["default"],t.BlinkTradeRest=f["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={SURBITCOIN:1,VBTC:3,FOXBIT:4,TESTNET:5,URDUBIT:8,CHILEBIT:9}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r={};for(var n in e)t.indexOf(n)<0&&Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var f=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(){function e(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),l=function T(e,t,r){null===e&&(e=Function.prototype);var n=Object.getOwnPropertyDescriptor(e,t);if(void 0===n){var o=Object.getPrototypeOf(e);return null===o?void 0:T(o,t,r)}if("value"in n)return n.value;var i=n.get;if(void 0!==i)return i.call(r)},h=r(3),p=n(h),d=(r(4),r(5)),y=r(7),E=r(8),g=n(E),v=r(9),_=n(v),R=function(e){function t(e){u(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.session={},r}return a(t,e),c(t,[{key:"heartbeat",value:function(e){var r=this,n=new Date,o={MsgType:g["default"].HEARTBEAT,TestReqID:n.getTime(),SendTime:n.getTime()};return new Promise(function(n,i){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"sendMessageAsPromise",r).call(r,o,e).then(function(e){return n(f({},e,{Latency:new Date(Date.now())-e.SendTime}))})["catch"](i)})}},{key:"login",value:function(e,n){var o=this,i=e.username,u=e.password,s=e.secondFactor,a=void 0;if(this.isNode){var c=r(25);a={UserAgent:c.type()+" "+c.release(),UserAgentLanguage:"en_US",UserAgentPlatform:c.platform()+" ("+c.arch()+")",UserAgentTimezoneOffset:(new Date).getTimezoneOffset()}}else a={UserAgent:window.navigator.userAgent,UserAgentLanguage:window.navigator.language,UserAgentPlatform:window.navigator.platform,UserAgentTimezoneOffset:(new Date).getTimezoneOffset()};var h=f({MsgType:g["default"].LOGIN,UserReqID:(0,d.generateRequestId)(),BrokerID:this.brokerId,Username:i,Password:u,UserReqTyp:"1"},a);return s&&(h.SecondFactor=s),new Promise(function(e,r){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"sendMessageAsPromise",o).call(o,h,n).then(function(t){return 1===t.UserStatus?(o.session=t,e(t)):r(t)})["catch"](r)})}},{key:"logout",value:function(e){var r={MsgType:g["default"].LOGOUT,BrokerID:this.brokerId,UserReqID:(0,d.generateRequestId)(),Username:this.session.Username,UserReqTyp:"2"};return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"sendMessageAsPromise",this).call(this,r,e)}},{key:"profile",value:function n(e){var t=this.session.Profile,n=i(t,["VerificationData"]);return e?e(n):Promise.resolve(n)}},{key:"balance",value:function(e){var r=this;return(0,d.registerListener)("U3",function(t){return e&&e(null,t),r.eventEmitter.emit(y.BALANCE,t)}),l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emitterPromise",this).call(this,new Promise(function(n,o){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"balance",r).call(r,e).then(n)["catch"](o)}))}},{key:"subscribeTicker",value:function(e,r){var n=this,o={MsgType:g["default"].SECURITY_STATUS,SecurityStatusReqID:(0,d.generateRequestId)(),SubscriptionRequestType:"1",Instruments:e},i=function(e){return f({},e,{SellVolume:e.SellVolume/1e8,LowPx:e.LowPx/1e8,LastPx:e.LastPx/1e8,BestAsk:e.BestAsk/1e8,HighPx:e.HighPx/1e8,BuyVolume:e.BuyVolume/1e8,BestBid:e.BestBid/1e8})};return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emitterPromise",this).call(this,new Promise(function(e,u){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"sendMessageAsPromise",n).call(n,o,r).then(function(t){e(i(t)),(0,d.registerEventEmitter)({SecurityStatusReqID:t.SecurityStatusReqID},function(e){return r&&r(null,i(e)),n.eventEmitter.emit("BLINK:"+e.Symbol,i(e))})})["catch"](u)}))}},{key:"unSubscribeTicker",value:function(e){var r={MsgType:g["default"].SECURITY_STATUS,SecurityStatusReqID:e,SubscriptionRequestType:"2"};return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"sendMessage",this).call(this,r),e}},{key:"subscribeOrderbook",value:function(e,r){var n=this,i={MsgType:g["default"].MARKET_DATA_FULL_REFRESH,MDReqID:(0,d.generateRequestId)(),SubscriptionRequestType:"1",MarketDepth:0,MDUpdateType:"1",MDEntryTypes:["0","1","2"],Instruments:e},u=function(e){"3"===e.MDBkTyp&&e.MDIncGrp.map(function(e){var t={index:e.MDEntryPositionNo,price:e.MDEntryPx/1e8,size:e.MDEntrySize/1e8,side:"0"===e.MDEntryType?"buy":"sell",userId:e.UserID,orderId:e.OrderID,symbol:e.Symbol,time:""+new Date(e.MDEntryDate+" "+e.MDEntryTime)};switch(r&&r(null,t),e.MDEntryType){case"0":case"1":var o=y.ORDER_BOOK+":"+y.EVENTS.ORDERBOOK[e.MDUpdateAction];return n.eventEmitter.emit(o,f({},t,{type:o}));case"2":var i=y.ORDER_BOOK+":"+y.EVENTS.TRADES[e.MDUpdateAction];return n.eventEmitter.emit(i,f({},t,{type:i}));case"4":break;default:return null}return null})};return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emitterPromise",this).call(this,new Promise(function(e,s){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"sendMessageAsPromise",n).call(n,i,r).then(function(t){if("W"===t.MsgType){var r=t.MDFullGrp.filter(function(e){return"0"===e.MDEntryType||"1"===e.MDEntryType}).reduce(function(e,t){var r="0"===t.MDEntryType?"bids":"asks";return(e[r]||(e[r]=[])).push([t.MDEntryPx/1e8,t.MDEntrySize/1e8,t.UserID]),e},[]),n=r.bids,i=r.asks;return(0,d.registerEventEmitter)({MDReqID:t.MDReqID},u),e(f({},t,{MDFullGrp:o({},t.Symbol,{bids:n,asks:i})}))}})["catch"](function(e){return s(e)})}))}},{key:"unSubscribeOrderbook",value:function(e){var r={MsgType:g["default"].MARKET_DATA_UNSUBSCRIBE,MDReqID:e,MarketDepth:0,SubscriptionRequestType:"2"};return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"sendMessage",this).call(this,r),e}},{key:"executionReport",value:function(e){var t=this;return(0,d.registerListener)("8",function(r){e&&e(r);var n=y.EVENTS.EXECUTION_REPORT[r.ExecType];return t.eventEmitter.emit(y.EXECUTION_REPORT+":"+n,r)}),this.eventEmitter}},{key:"tradeHistory",value:function(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.since,o=r.filter,u=r.page,s=void 0===u?0:u,a=r.pageSize,c=void 0===a?80:a,h=arguments[1],y={MsgType:g["default"].TRADE_HISTORY,TradeHistoryReqID:(0,d.generateRequestId)(),Page:s,PageSize:c};return o&&o.length>0&&(y.Filter=o),n&&"number"==typeof n&&(y.Since=n),new Promise(function(r,n){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"sendMessageAsPromise",e).call(e,y,h).then(function(e){var t=e.Columns,n=i(e,["Columns"]),o=p["default"].groupBy(p["default"].map(e.TradeHistoryGrp,function(e){return p["default"].zipObject(t,e)}),function(e){return e.Market});return r(f({},n,{TradeHistoryGrp:o}))})["catch"](n)})}},{key:"requestDeposit",value:function(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.currency,o=void 0===n?"BTC":n,i=r.value,u=r.depositMethodId,s=arguments[1];return(0,d.registerListener)("U23",function(t){return s&&s(null,t),e.eventEmitter.emit(y.DEPOSIT_REFRESH,t)}),l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emitterPromise",this).call(this,new Promise(function(r,n){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"requestDeposit",e).call(e,{currency:o,value:i,depositMethodId:u},s).then(r)["catch"](n)}))}},{key:"onDepositRefresh",value:function(e){return new Promise(function(t){(0,d.registerListener)("U23",function(r){return e&&e(r),t(r)})})}},{key:"requestWithdraw",value:function(e,r){var n=this,o=e.amount,i=e.data,u=e.currency,s=void 0===u?"BTC":u,a=e.method,f=void 0===a?"bitcoin":a;return(0,d.registerListener)("U9",function(e){return r&&r(null,e),n.eventEmitter.emit(y.WITHDRAW_REFRESH,e)}),l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emitterPromise",this).call(this,new Promise(function(e,u){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"requestWithdraw",n).call(n,{amount:o,data:i,currency:s,method:f},r).then(e)["catch"](u)}))}},{key:"onWithdrawRefresh",value:function(e){return new Promise(function(t){(0,d.registerListener)("U9",function(r){return e&&e(r),t(r)})})}}]),t}(_["default"]);t["default"]=R},function(e,t){e.exports=require("lodash")},function(e,t){e.exports=require("eventemitter2")},function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}function i(){return v}function u(){return parseInt(1e7*Math.random()+"",10)}function s(e){return _[e]}function a(e){var t=void 0;return y["default"].mapKeys(g,function(r){y["default"].has(e,r)&&(t=y["default"].find(v[r],{ReqId:e[r]+""}))}),t}function f(e,t){return y["default"].mapKeys(g,function(r){y["default"].has(e,r)&&(v[r]=v[r]||[],v[r].push(p({ReqId:e[r]+""},t)))}),v}function c(e,t){return y["default"].mapKeys(g,function(r){if(y["default"].has(e,r)&&v[r]!==[]){var n=y["default"].findIndex(v[r],{ReqId:e[r]+""});v[r][n]=p({},v[r][n],{resolve:null,reject:null,callback:t})}}),v}function l(e,t){_[e]=_[e]||[],_[e]=t}function h(e){return v=y["default"].omit(v,[e])}Object.defineProperty(t,"__esModule",{value:!0});var p=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.getListeners=i,t.generateRequestId=u,t.getListener=s,t.getRequest=a,t.registerRequest=f,t.registerEventEmitter=c,t.registerListener=l,t.deleteRequest=h;var d=r(3),y=o(d),E=r(6),g=n(E),v={},_={}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.SOCKET_ID="SocketID",t.REQUEST_ID="ReqID",t.TEST_REQUEST_ID="TestReqID",t.USER_REQUEST_ID="UserReqID",t.SECURITY_REQUEST_ID="SecurityReqID",t.RESET_PASSWORD_REQUEST_ID="ResetPasswordReqID",t.DEPOSIT_REQUEST_ID="DepositReqID",t.WITHDRAW_REQUEST_ID="WithdrawReqID",t.BALANCE_REQUEST_ID="BalanceReqID",t.ORDERS_REQUEST_ID="OrdersReqID",t.ENABLE_TWO_FACTOR_REQUEST_ID="EnableTwoFactorReqID",t.DEPOSIT_METHOD_REQUEST_ID="DepositMethodReqID",t.WITHDRAW_LIST_REQUEST_ID="WithdrawListReqID",t.BROKER_LIST_REQUEST_ID="BrokerListReqID",t.DEPOSIT_LIST_REQUEST_ID="DepositListReqID",t.TRADE_HISTORY_REQUEST_ID="TradeHistoryReqID",t.LEDGER_LIST_REQUEST_ID="LedgerListReqID",t.TRADERS_RANK_REQUEST_ID="TradersRankReqID",t.UPDATE_REQUEST_ID="UpdateReqID",t.POSITION_REQUEST_ID="PositionReqID",t.SECURITY_STATUS_REQUEST_ID="SecurityStatusReqID",t.API_KEY_LIST_REQUEST_ID="APIKeyListReqID",t.API_KEY_CREATE_REQUEST_ID="APIKeyCreateReqID",t.API_KEY_REVOKE_REQUEST_ID="APIKeyRevokeReqID",t.PROCESS_DEPOSIT_REQUEST_ID="ProcessDepositReqID",t.CUSTOMER_LIST_REQUEST_ID="CustomerListReqID",t.CUSTOMER_REQUEST_ID="CustomerReqID",t.PROCESS_WITHDRAW_REQUEST_ID="ProcessWithdrawReqID",t.VERIFY_CUSTOMER_REQUEST_ID="VerifyCustomerReqID",t.MD_REQUEST_ID="MDReqID",t.CLIENT_ORDER_ID="ClOrdID"},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=(t.BALANCE="BALANCE",t.ORDER_BOOK="OB",t.ORDER_BOOK_TRADE_NEW="TRADE_NEW"),n=t.ORDER_BOOK_NEW_ORDER="NEW_ORDER",o=t.ORDER_BOOK_UPDATE_ORDER="UPDATE_ORDER",i=t.ORDER_BOOK_DELETE_ORDER="DELETE_ORDER",u=t.ORDER_BOOK_DELETE_ORDERS_THRU="DELETE_ORDERS_THRU",s=(t.EXECUTION_REPORT="EXECUTION_REPORT",t.EXECUTION_REPORT_NEW="NEW"),a=t.EXECUTION_REPORT_PARTIAL="PARTIAL",f=t.EXECUTION_REPORT_EXECUTION="EXECUTION",c=t.EXECUTION_REPORT_CANCELED="CANCELED",l=t.EXECUTION_REPORT_REJECTED="REJECTED";t.DEPOSIT_REFRESH="DEPOSIT_REFRESH",t.WITHDRAW_REFRESH="WITHDRAW_REFRESH",t.EVENTS={ORDERBOOK:{0:n,1:o,2:i,3:u},TRADES:{0:r},EXECUTION_REPORT:{0:s,1:a,2:f,4:c,8:l}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={HEARTBEAT:"1",LOGIN:"BE",LOGOUT:"BE",CHANGE_PASSWORD:"BE",MARKET_DATA_FULL_REFRESH:"V",MARKET_DATA_UNSUBSCRIBE:"V",ORDER_SEND:"D",ORDER_CANCEL:"F",SECURITY_LIST:"x",SECURITY_STATUS:"e",BALANCE:"U2",ORDER_LIST:"U4",BROKER_LIST:"U28",TRADE_HISTORY:"U32",PROFILE_UPDATE:"U38",REQUEST_DEPOSIT:"U18",REQUEST_DEPOSIT_LIST:"U30",REQUEST_DEPOSIT_METHODS:"U20",REQUEST_WITHDRAW:"U6",REQUEST_WITHDRAW_LIST:"U26",CONFIRM_WITHDRAW:"U24",CANCEL_WITHDRAW:"U70"}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(10),f=n(a),c=r(13),l=n(c),h=r(14),p=n(h),d=r(4),y=r(5),E=function(e){function t(e){o(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"ws"));return r.stun={local:null,"public":[]},r.getStun(),r.getFingerPrint(),r.eventEmitter=new d.EventEmitter2({wildcard:!0,delimiter:":"}),r}return u(t,e),s(t,[{key:"connect",value:function(e){var t=this;return p["default"].extend(new Promise(function(e,n){t.request={resolve:e,reject:n};var o=t.isNode?r(15):window.WebSocket;t.socket=new o(t.endpoint),t.socket.onopen=t.onOpen.bind(t),t.socket.onclose=t.onClose.bind(t),t.socket.onerror=t.onError.bind(t),t.socket.onmessage=t.onMessage.bind(t)})).nodeify(e)}},{key:"disconnect",value:function(){this.socket.close()}},{key:"onOpen",value:function(){this.request.resolve({connected:!0})}},{key:"onClose",value:function(){}},{key:"onError",value:function(){this.request.reject()}},{key:"sendMessage",value:function(e){if(1===this.socket.readyState){var t=e;t.STUNTIP=this.stun,t.FingerPrint=this.fingerPrint,this.socket.send(JSON.stringify(t))}}},{key:"sendMessageAsPromise",value:function(e,t){var r=this;return p["default"].extend(new Promise(function(t,n){var o={resolve:t,reject:n};return e?((0,y.registerRequest)(e,o),void r.sendMessage(e,o)):n("Missing Message")})).nodeify(t)}},{key:"onMessage",value:function(e){var t=JSON.parse(e.data);if("ERROR"===t.MsgType)throw Error("Error: "+t.Detail+" "+t.Description);var r=(0,y.getRequest)(t),n=(0,y.getListener)(t.MsgType);this.dispatchPromise(r,t),this.dispatchListeners(n,t)}},{key:"dispatchPromise",value:function(e,t){if(e)return e.resolve?e.resolve(t):e.callback?e.callback(t):null}},{key:"dispatchListeners",value:function(e,t){return e&&e(t)}},{key:"emitterPromise",value:function(e){var t=this;return e.on=function(r,n){return t.eventEmitter.on(r,n),e},e.onAny=function(r){return t.eventEmitter.onAny(r),e},e.offAny=function(r){return t.eventEmitter.offAny(r),e},e.once=function(r,n){return t.eventEmitter.once(r,n),e},e.many=function(r,n,o){return t.eventEmitter.many(r,n,o),e},e.removeListener=function(r,n){return t.eventEmitter.removeListener(r,n),e},e.removeAllListeners=function(r){return t.eventEmitter.removeAllListeners(r),e},e}},{key:"getFingerPrint",value:function(){var e=this;return this.isNode?r(16).getMac(function(t){e.fingerPrint=t}):(new l["default"]).get(function(t){e.fingerPrint=t})}},{key:"getStun",value:function(){var e=this;this.isNode&&r(18).getStun(function(t){e.stun=t})}}]),t}(f["default"]);t["default"]=E},function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){var r={};for(var n in e)t.indexOf(n)<0&&Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var f=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(){function e(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),l=r(3),h=o(l),p=r(11),d=o(p),y=r(8),E=o(y),g=r(6),v=n(g),_=r(5),R=function(e){function t(e,r){u(this,t);var n=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.send="ws"===r?n.sendMessageAsPromise:n.fetchTrade,n}return a(t,e),c(t,[{key:"balance",value:function(e){var t=this,r={MsgType:E["default"].BALANCE,BalanceReqID:(0,_.generateRequestId)()};return new Promise(function(n,o){return t.send(r,e).then(function(e){var r={},o=e[t.brokerId];return Object.keys(o).map(function(e){return e.includes("locked")||(r[e]=o[e]-o[e+"_locked"]),r}),n(f({},e,{Available:r}))})["catch"](o)})}},{key:"myOrders",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.page,n=void 0===r?0:r,o=t.pageSize,u=void 0===o?40:o,s=arguments[1],a={MsgType:E["default"].ORDER_LIST,OrdersReqID:(0,_.generateRequestId)(),Page:n,PageSize:u};return new Promise(function(t,r){return e.send(a,s).then(function(e){var r=e.Columns,n=i(e,["Columns"]),o=h["default"].map(e.OrdListGrp,function(e){return h["default"].zipObject(r,e)});return t(f({},n,{OrdListGrp:o}))})["catch"](r)})}},{key:"sendOrder",value:function(e,t){var r=this,n=e.side,o=e.amount,i=e.price,u=e.symbol,s={MsgType:E["default"].ORDER_SEND,ClOrdID:(0,_.generateRequestId)(),Symbol:u,Side:n,OrdType:"2",Price:i,OrderQty:o,BrokerID:this.brokerId};return new Promise(function(e,n){return r.send(s,t).then(function(t){(0,_.deleteRequest)(v.CLIENT_ORDER_ID),e(t)})["catch"](n)})}},{key:"cancelOrder",value:function(e,t){var r=e.orderId?e.orderId:e,n={MsgType:E["default"].ORDER_CANCEL,OrderID:r};return e.clientId&&(n.ClOrdID=e.clientId),this.send(n,t)}},{key:"requestWithdrawList",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.page,n=void 0===r?0:r,o=t.pageSize,u=void 0===o?20:o,s=t.statusList,a=void 0===s?["1","2","4","8"]:s,c=arguments[1],l={MsgType:E["default"].REQUEST_WITHDRAW_LIST,WithdrawListReqID:(0,_.generateRequestId)(),Page:n,PageSize:u,StatusList:a};return new Promise(function(t,r){return e.send(l,c).then(function(e){var r=e.Columns,n=i(e,["Columns"]),o=h["default"].map(e.WithdrawListGrp,function(e){return h["default"].zipObject(r,e)});return t(f({},n,{WithdrawListGrp:o}))})["catch"](r)})}},{key:"requestWithdraw",value:function(e,t){var r=e.amount,n=e.data,o=e.currency,i=void 0===o?"BTC":o,u=e.method,s=void 0===u?"bitcoin":u,a=(0,_.generateRequestId)(),f={MsgType:E["default"].REQUEST_WITHDRAW,WithdrawReqID:a,ClOrdID:a,Method:s,Amount:r,Currency:i,Data:n};return this.send(f,t)}},{key:"confirmWithdraw",value:function(e,t){var r=this,n=e.withdrawId,o=e.confirmationToken,i=e.secondFactor,u={MsgType:E["default"].CONFIRM_WITHDRAW,WithdrawReqID:(0,_.generateRequestId)(),WithdrawID:n};return o&&(u.ConfirmationToken=o),i&&(u.SecondFactor=i),new Promise(function(e,n){return r.send(u,t).then(function(t){return e(f({},t))})["catch"](n)})}},{key:"cancelWithdraw",value:function(e,t){var r=this,n=(0,_.generateRequestId)(),o={MsgType:E["default"].CANCEL_WITHDRAW,WithdrawCancelReqID:n,ClOrdID:n,WithdrawID:e};return new Promise(function(e,n){return r.send(o,t).then(function(t){return e(f({},t))})["catch"](n)})}},{key:"requestDepositList",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.page,n=void 0===r?0:r,o=t.pageSize,u=void 0===o?20:o,s=t.status,a=void 0===s?["1","2","4","8"]:s,c=arguments[1],l={MsgType:E["default"].REQUEST_DEPOSIT_LIST,DepositListReqID:(0,_.generateRequestId)(),Page:n,PageSize:u,StatusList:a};return new Promise(function(t,r){return e.send(l,c).then(function(e){var r=e.Columns,n=i(e,["Columns"]),o=h["default"].map(e.DepositListGrp,function(e){return h["default"].zipObject(r,e)});return t(f({},n,{DepositListGrp:o}))})["catch"](r)})}},{key:"requestDeposit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.currency,r=void 0===t?"BTC":t,n=e.value,o=e.depositMethodId,i=arguments[1],u=(0,_.generateRequestId)(),s={MsgType:E["default"].REQUEST_DEPOSIT,DepositReqID:u,ClOrdID:u,Currency:r,BrokerID:this.brokerId};return"BTC"!==r&&(s.DepositMethodID=o,s.Value=n),this.send(s,i)}},{key:"requestDepositMethods",value:function(e){var t={MsgType:E["default"].REQUEST_DEPOSIT_METHODS,DepositMethodReqID:(0,_.generateRequestId)()};return this.send(t,e)}}]),t}(d["default"]);t["default"]=R},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=r(12),u=n(i),s=function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];o(this,a);var r=e.url?e.url:e.prod?u["default"].prod[t]:u["default"].testnet[t];this.brokerId=e.brokerId||5,this.endpoint=r,this.isNode="undefined"==typeof window};t["default"]=s},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={prod:{ws:"wss://api.blinktrade.com/trade/",rest:"https://api.blinktrade.com/"},testnet:{ws:"wss://api.testnet.blinktrade.com/trade/",rest:"https://api.testnet.blinktrade.com/"}}},function(e,t){e.exports=require("fingerprintjs2")},function(e,t){e.exports=require("nodeify")},function(e,t){e.exports=require("ws")},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){u["default"].all(function(t,r){var n=function(e){var t=0;if(0===e.length)return t;for(var r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return t},o="";Object.keys(r).forEach(function(e){o+=r[e].mac});var i=n(o);0>i&&(i*=-1),e(i)})}Object.defineProperty(t,"__esModule",{value:!0}),t.getMac=o;var i=r(17),u=n(i)},function(e,t){e.exports=require("macaddress")},function(e,t,r){(function(e){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){e.match(/^(192\.168\.|169\.254\.|10\.|172\.(1[6-9]|2\d|3[01]))/)?l.local=e:l["public"].indexOf(e)===-1&&l["public"].push(e)}function i(t){var r=c["default"].createSocket("udp4"),n=20,i=new e(n),s=0,f=1,h=554869826,p=Math.pow(2,32),d=1,y=32800,E=32,g=Math.random()*p,v=[[3478,"stun.services.mozilla.com"],[19302,"stun.l.google.com"],[3478,"stun.stunprotocol.org"],[3478,"stun.softjoys.com"],[3478,"stun.samsungsmartcam.com"],[3478,"stun.sonetel.com"],[3478,"stun.tagan.ru"],[3478,"stun.voipgain.com"],[3478,"stunserver.org"],[3478,"stun.advfn.com"],[3478,"stun.annatel.net"],[3478,"stun.freevoipdeal.com"]];i.writeUInt16BE(16383&(f|s),0),i.writeUInt16BE(0,2),i.writeUInt32BE(h,4),i.writeUInt32BE(0,8),i.writeUInt32BE(0,12),i.writeUInt32BE(g,16),r.on("message",function(r){var i=function(t,r){var n=[];if(r.length>t.length){var o=t;t=r,r=o}for(var i=0,u=t.length;u>i;i++)n.push(t[i]^r[i]);return new e(n)},u=r.readUInt8(0),s=128&u,f=64&u;if(0===s&&0===f){for(var c=r.slice(0,n),h=r.slice(n,r.length),p=0;h.length>p;){var g=h.readUInt16BE(p);p+=2;var v=h.readUInt16BE(p),_=v%4;_>0&&(v+=4-_),p+=2;var R=h.slice(p,p+v);p+=v;var T=void 0,b=void 0;switch(g){case d:T=2===R.readUInt16BE(0)?6:4,b=a["default"].toString(R,4,T),o(b);break;case y:case E:T=2===R.readUInt16BE(0)?6:4;var m=c.slice(4,8),O=c.slice(8,20),w=R.slice(4,4===T?8:20),I=i(w,4===T?m:R.concat([m,O]));b=a["default"].toString(I,0,T),o(b)}}t(l)}}),v.map(function(e){var t=u(e,2),n=t[0],o=t[1];return r.send(i,0,i.length,n,o)})}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var u,s=e[Symbol.iterator]();!(n=(u=s.next()).done)&&(r.push(u.value),!t||r.length!==t);n=!0);}catch(a){o=!0,i=a}finally{try{!n&&s["return"]&&s["return"]()}finally{if(o)throw i}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.getStun=i;var s=r(23),a=n(s),f=r(24),c=n(f),l={local:null,"public":[]}}).call(t,r(19).Buffer)},function(e,t,r){(function(e,n){/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -"use strict";function o(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(t){return!1}}function i(){return e.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(t,r){if(i()e)throw new RangeError('"size" argument must not be negative')}function f(e,t,r,n){return a(t),t>0&&void 0!==r?"string"==typeof n?u(e,t).fill(r,n):u(e,t).fill(r):u(e,t)}function c(t,r){if(a(r),t=u(t,0>r?0:0|y(r)),!e.TYPED_ARRAY_SUPPORT)for(var n=0;r>n;++n)t[n]=0;return t}function l(t,r,n){if("string"==typeof n&&""!==n||(n="utf8"),!e.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var o=0|g(r,n);t=u(t,o);var i=t.write(r,n);return i!==o&&(t=t.slice(0,i)),t}function h(e,t){var r=0>t.length?0:0|y(t.length);e=u(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function p(t,r,n,o){if(0>n||n>r.byteLength)throw new RangeError("'offset' is out of bounds");if(n+(o||0)>r.byteLength)throw new RangeError("'length' is out of bounds");return r=void 0===n&&void 0===o?new Uint8Array(r):void 0===o?new Uint8Array(r,n):new Uint8Array(r,n,o),e.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=e.prototype):t=h(t,r),t}function d(t,r){if(e.isBuffer(r)){var n=0|y(r.length);return t=u(t,n),0===t.length?t:(r.copy(t,0,0,n),t)}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||X(r.length)?u(t,0):h(t,r);if("Buffer"===r.type&&Z(r.data))return h(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function y(e){if(e>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function E(t){return+t!=t&&(t=0),e.alloc(+t)}function g(t,r){if(e.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var o=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(t).length;default:if(o)return F(t).length;r=(""+r).toLowerCase(),o=!0}}function v(e,t,r){var n=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),0>=r)return"";if(r>>>=0,t>>>=0,t>=r)return"";for(e||(e="utf8");;)switch(e){case"hex":return B(this,t,r);case"utf8":case"utf-8":return S(this,t,r);case"ascii":return U(this,t,r);case"latin1":case"binary":return M(this,t,r);case"base64":return P(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function _(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function R(t,r,n,o,i){if(0===t.length)return-1;if("string"==typeof n?(o=n,n=0):n>2147483647?n=2147483647:-2147483648>n&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),0>n&&(n=t.length+n),t.length>n){if(0>n){if(!i)return-1;n=0}}else{if(i)return-1;n=t.length-1}if("string"==typeof r&&(r=e.from(r,o)),e.isBuffer(r))return 0===r.length?-1:T(t,r,n,o,i);if("number"==typeof r)return r=255&r,e.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):T(t,[r],n,o,i);throw new TypeError("val must be string, number or Buffer")}function T(e,t,r,n,o){function i(e,t){return 1===u?e[t]:e.readUInt16BE(t*u)}var u=1,s=e.length,a=t.length;if(void 0!==n&&(n=(n+"").toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(2>e.length||2>t.length)return-1;u=2,s/=2,a/=2,r/=2}var f;if(o){var c=-1;for(f=r;s>f;f++)if(i(e,f)===i(t,c===-1?0:f-c)){if(c===-1&&(c=f),f-c+1===a)return c*u}else c!==-1&&(f-=f-c),c=-1}else for(r+a>s&&(r=s-a),f=r;f>=0;f--){for(var l=!0,h=0;a>h;h++)if(i(e,f+h)!==i(t,h)){l=!1;break}if(l)return f}return-1}function b(e,t,r,n){r=+r||0;var o=e.length-r;n?(n=+n,n>o&&(n=o)):n=o;var i=t.length;if(i%2!==0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var u=0;n>u;++u){var s=parseInt(t.substr(2*u,2),16);if(isNaN(s))return u;e[r+u]=s}return u}function m(e,t,r,n){return G(F(t,e.length-r),e,r,n)}function O(e,t,r,n){return G(z(t),e,r,n)}function w(e,t,r,n){return O(e,t,r,n)}function I(e,t,r,n){return G(V(t),e,r,n)}function D(e,t,r,n){return G(K(t,e.length-r),e,r,n)}function P(e,t,r){return J.fromByteArray(0===t&&r===e.length?e:e.slice(t,r))}function S(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;r>o;){var i=e[o],u=null,s=i>239?4:i>223?3:i>191?2:1;if(r>=o+s){var a,f,c,l;switch(s){case 1:128>i&&(u=i);break;case 2:a=e[o+1],128===(192&a)&&(l=(31&i)<<6|63&a,l>127&&(u=l));break;case 3:a=e[o+1],f=e[o+2],128===(192&a)&&128===(192&f)&&(l=(15&i)<<12|(63&a)<<6|63&f,l>2047&&(55296>l||l>57343)&&(u=l));break;case 4:a=e[o+1],f=e[o+2],c=e[o+3],128===(192&a)&&128===(192&f)&&128===(192&c)&&(l=(15&i)<<18|(63&a)<<12|(63&f)<<6|63&c,l>65535&&1114112>l&&(u=l))}}null===u?(u=65533,s=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),o+=s}return A(n)}function A(e){var t=e.length;if(ee>=t)return String.fromCharCode.apply(String,e);for(var r="",n=0;t>n;)r+=String.fromCharCode.apply(String,e.slice(n,n+=ee));return r}function U(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;r>o;++o)n+=String.fromCharCode(127&e[o]);return n}function M(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;r>o;++o)n+=String.fromCharCode(e[o]);return n}function B(e,t,r){var n=e.length;t&&t>=0||(t=0),(!r||0>r||r>n)&&(r=n);for(var o="",i=t;r>i;++i)o+=Q(e[i]);return o}function k(e,t,r){for(var n=e.slice(t,r),o="",i=0;n.length>i;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function L(e,t,r){if(e%1!==0||0>e)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function C(t,r,n,o,i,u){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||u>r)throw new RangeError('"value" argument is out of bounds');if(n+o>t.length)throw new RangeError("Index out of range")}function q(e,t,r,n){0>t&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-r,2);i>o;++o)e[r+o]=(t&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function j(e,t,r,n){0>t&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-r,4);i>o;++o)e[r+o]=t>>>8*(n?o:3-o)&255}function N(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(0>r)throw new RangeError("Index out of range")}function x(e,t,r,n,o){return o||N(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),$.write(e,t,r,n,23,4),r+4}function W(e,t,r,n,o){return o||N(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(e,t,r,n,52,8),r+8}function Y(e){if(e=H(e).replace(te,""),2>e.length)return"";for(;e.length%4!==0;)e+="=";return e}function H(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function Q(e){return 16>e?"0"+e.toString(16):e.toString(16)}function F(e,t){t=t||1/0;for(var r,n=e.length,o=null,i=[],u=0;n>u;++u){if(r=e.charCodeAt(u),r>55295&&57344>r){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(u+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(56320>r){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,128>r){if((t-=1)<0)break;i.push(r)}else if(2048>r){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(65536>r){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(r>=1114112)throw Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function z(e){for(var t=[],r=0;e.length>r;++r)t.push(255&e.charCodeAt(r));return t}function K(e,t){for(var r,n,o,i=[],u=0;e.length>u&&(t-=2)>=0;++u)r=e.charCodeAt(u),n=r>>8,o=r%256,i.push(o),i.push(n);return i}function V(e){return J.toByteArray(Y(e))}function G(e,t,r,n){for(var o=0;n>o&&(o+ri;++i)if(t[i]!==r[i]){n=t[i],o=r[i];break}return o>n?-1:n>o?1:0},e.isEncoding=function(e){switch((e+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},e.concat=function(t,r){if(!Z(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return e.alloc(0);var n;if(void 0===r)for(r=0,n=0;t.length>n;++n)r+=t[n].length;var o=e.allocUnsafe(r),i=0;for(n=0;t.length>n;++n){var u=t[n];if(!e.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(o,i),i+=u.length}return o},e.byteLength=g,e.prototype._isBuffer=!0,e.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;e>t;t+=2)_(this,t,t+1);return this},e.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;e>t;t+=4)_(this,t,t+3),_(this,t+1,t+2);return this},e.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;e>t;t+=8)_(this,t,t+7),_(this,t+1,t+6),_(this,t+2,t+5),_(this,t+3,t+4);return this},e.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?S(this,0,e):v.apply(this,arguments)},e.prototype.equals=function(t){if(!e.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===e.compare(this,t)},e.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},e.prototype.compare=function(t,r,n,o,i){if(!e.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===o&&(o=0),void 0===i&&(i=this.length),0>r||n>t.length||0>o||i>this.length)throw new RangeError("out of range index");if(o>=i&&r>=n)return 0;if(o>=i)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,o>>>=0,i>>>=0,this===t)return 0;for(var u=i-o,s=n-r,a=Math.min(u,s),f=this.slice(o,i),c=t.slice(r,n),l=0;a>l;++l)if(f[l]!==c[l]){u=f[l],s=c[l];break}return s>u?-1:u>s?1:0},e.prototype.includes=function(e,t,r){return this.indexOf(e,t,r)!==-1},e.prototype.indexOf=function(e,t,r){return R(this,e,t,r,!0)},e.prototype.lastIndexOf=function(e,t,r){return R(this,e,t,r,!1)},e.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t=0|t,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(0>r||0>t)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return m(this,e,t,r);case"ascii":return O(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ee=4096;e.prototype.slice=function(t,r){var n=this.length;t=~~t,r=void 0===r?n:~~r,0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),0>r?(r+=n,0>r&&(r=0)):r>n&&(r=n),t>r&&(r=t);var o;if(e.TYPED_ARRAY_SUPPORT)o=this.subarray(t,r),o.__proto__=e.prototype;else{var i=r-t;o=new e(i,(void 0));for(var u=0;i>u;++u)o[u]=this[u+t]}return o},e.prototype.readUIntLE=function(e,t,r){e=0|e,t=0|t,r||L(e,t,this.length);for(var n=this[e],o=1,i=0;++i0&&(o*=256);)n+=this[e+--t]*o;return n},e.prototype.readUInt8=function(e,t){return t||L(e,1,this.length),this[e]},e.prototype.readUInt16LE=function(e,t){return t||L(e,2,this.length),this[e]|this[e+1]<<8},e.prototype.readUInt16BE=function(e,t){return t||L(e,2,this.length),this[e]<<8|this[e+1]},e.prototype.readUInt32LE=function(e,t){return t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},e.prototype.readUInt32BE=function(e,t){return t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},e.prototype.readIntLE=function(e,t,r){e=0|e,t=0|t,r||L(e,t,this.length);for(var n=this[e],o=1,i=0;++in||(n-=Math.pow(2,8*t)),n},e.prototype.readIntBE=function(e,t,r){e=0|e,t=0|t,r||L(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return o*=128,o>i||(i-=Math.pow(2,8*t)),i},e.prototype.readInt8=function(e,t){return t||L(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},e.prototype.readInt16LE=function(e,t){t||L(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt16BE=function(e,t){t||L(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt32LE=function(e,t){return t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},e.prototype.readInt32BE=function(e,t){return t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},e.prototype.readFloatLE=function(e,t){return t||L(e,4,this.length),$.read(this,e,!0,23,4)},e.prototype.readFloatBE=function(e,t){return t||L(e,4,this.length),$.read(this,e,!1,23,4)},e.prototype.readDoubleLE=function(e,t){return t||L(e,8,this.length),$.read(this,e,!0,52,8)},e.prototype.readDoubleBE=function(e,t){return t||L(e,8,this.length),$.read(this,e,!1,52,8)},e.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t=0|t,r=0|r,!n){var o=Math.pow(2,8*r)-1;C(this,e,t,r,o,0)}var i=1,u=0;for(this[t]=255&e;++u=0&&(u*=256);)this[t+i]=e/u&255;return t+r},e.prototype.writeUInt8=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,1,255,0),e.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},e.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,2,65535,0),e.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):q(this,t,r,!0),r+2},e.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,2,65535,0),e.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):q(this,t,r,!1),r+2},e.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,4,4294967295,0),e.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):j(this,t,r,!0),r+4},e.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,4,4294967295,0),e.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):j(this,t,r,!1),r+4},e.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t=0|t,!n){var o=Math.pow(2,8*r-1);C(this,e,t,r,o-1,-o)}var i=0,u=1,s=0;for(this[t]=255&e;++ie&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/u>>0)-s&255;return t+r},e.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t=0|t,!n){var o=Math.pow(2,8*r-1);C(this,e,t,r,o-1,-o)}var i=r-1,u=1,s=0;for(this[t+i]=255&e;--i>=0&&(u*=256);)0>e&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/u>>0)-s&255;return t+r},e.prototype.writeInt8=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,1,127,-128),e.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),0>t&&(t=255+t+1),this[r]=255&t,r+1},e.prototype.writeInt16LE=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,2,32767,-32768),e.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):q(this,t,r,!0),r+2},e.prototype.writeInt16BE=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,2,32767,-32768),e.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):q(this,t,r,!1),r+2},e.prototype.writeInt32LE=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,4,2147483647,-2147483648),e.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):j(this,t,r,!0),r+4},e.prototype.writeInt32BE=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,4,2147483647,-2147483648),0>t&&(t=4294967295+t+1),e.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):j(this,t,r,!1),r+4},e.prototype.writeFloatLE=function(e,t,r){return x(this,e,t,!0,r)},e.prototype.writeFloatBE=function(e,t,r){return x(this,e,t,!1,r)},e.prototype.writeDoubleLE=function(e,t,r){return W(this,e,t,!0,r)},e.prototype.writeDoubleBE=function(e,t,r){return W(this,e,t,!1,r)},e.prototype.copy=function(t,r,n,o){if(n||(n=0),o||0===o||(o=this.length),t.length>r||(r=t.length),r||(r=0),o>0&&n>o&&(o=n),o===n)return 0;if(0===t.length||0===this.length)return 0;if(0>r)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("sourceStart out of bounds");if(0>o)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),o-n>t.length-r&&(o=t.length-r+n);var i,u=o-n;if(this===t&&r>n&&o>r)for(i=u-1;i>=0;--i)t[i+r]=this[i+n];else if(1e3>u||!e.TYPED_ARRAY_SUPPORT)for(i=0;u>i;++i)t[i+r]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+u),r);return u},e.prototype.fill=function(t,r,n,o){if("string"==typeof t){if("string"==typeof r?(o=r,r=0,n=this.length):"string"==typeof n&&(o=n,n=this.length),1===t.length){var i=t.charCodeAt(0);256>i&&(t=i)}if(void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!e.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else"number"==typeof t&&(t=255&t);if(0>r||r>this.length||n>this.length)throw new RangeError("Out of range index");if(r>=n)return this;r>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0);var u;if("number"==typeof t)for(u=r;n>u;++u)this[u]=t;else{var s=e.isBuffer(t)?t:F(""+new e(t,o)),a=s.length;for(u=0;n-r>u;++u)this[u+r]=s[u%a]}return this};var te=/[^+\/0-9A-Za-z-_]/g}).call(t,r(18).Buffer,function(){return this}())},function(e,t){e.exports=require("base64-js")},function(e,t){e.exports=require("ieee754")},function(e,t){e.exports=require("isarray")},function(e,t){e.exports=require("ip")},function(e,t){},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=(t.BALANCE="BALANCE",t.ORDER_BOOK="OB",t.ORDER_BOOK_TRADE_NEW="TRADE_NEW"),n=t.ORDER_BOOK_NEW_ORDER="NEW_ORDER",o=t.ORDER_BOOK_UPDATE_ORDER="UPDATE_ORDER",i=t.ORDER_BOOK_DELETE_ORDER="DELETE_ORDER",u=t.ORDER_BOOK_DELETE_ORDERS_THRU="DELETE_ORDERS_THRU",s=(t.EXECUTION_REPORT="EXECUTION_REPORT",t.EXECUTION_REPORT_NEW="NEW"),a=t.EXECUTION_REPORT_PARTIAL="PARTIAL",f=t.EXECUTION_REPORT_EXECUTION="EXECUTION",c=t.EXECUTION_REPORT_CANCELED="CANCELED",l=t.EXECUTION_REPORT_REJECTED="REJECTED";t.DEPOSIT_REFRESH="DEPOSIT_REFRESH",t.WITHDRAW_REFRESH="WITHDRAW_REFRESH",t.EVENTS={ORDERBOOK:{0:n,1:o,2:i,3:u},TRADES:{0:r},EXECUTION_REPORT:{0:s,1:a,2:f,4:c,8:l}}},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n"},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function p(e,t,r){null===e&&(e=Function.prototype);var n=Object.getOwnPropertyDescriptor(e,t);if(void 0===n){var o=Object.getPrototypeOf(e);return null===o?void 0:p(o,t,r)}if("value"in n)return n.value;var i=n.get;if(void 0!==i)return i.call(r)},f=r(3),c=(n(f),r(27)),l=n(c),h=(r(10),function(e){function t(){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return u(t,e),s(t,[{key:"ticker",value:function(e){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"fetchPublic",this).call(this,"ticker",e)}},{key:"trades",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.limit,n=void 0===r?1e3:r,o=e.since,i=void 0===o?"0":o,u=arguments[1];return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"fetchPublic",this).call(this,"trades?limit="+n+"&since="+i,u)}},{key:"orderbook",value:function(e){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"fetchPublic",this).call(this,"orderbook",e)}}]),t}(l["default"]));t["default"]=h},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(6),f=(n(a),r(5)),c=n(f),l=r(28),h=n(l),p=r(12),d=n(p),y=r(29),E=n(y),g=r(30),v=n(g),_=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"rest"));return n.key=e.key,n.secret=e.secret,n.currency=e.currency||"USD",n.fetchRequest=r(n.isNode?32:33),n}return u(t,e),s(t,[{key:"headers",value:function(e,t){var r=""+Date.now(),n=h["default"].codec.utf8String.toBits(this.secret),o=new h["default"].misc.hmac(n,h["default"].hash.sha256),i=h["default"].codec.hex.fromBits(o.encrypt(r));return{method:e,headers:{"Content-Type":"application/json",Nonce:r,APIKey:this.key,Signature:i},body:JSON.stringify(t)}}},{key:"fetch",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.fetchRequest(E["default"].resolve(this.endpoint,t),r).then(function(e){return e.json()})}},{key:"fetchPublic",value:function(e,t){return(0,d["default"])(this.fetch({},v["default"].join("api/v1",this.currency,e)),t)}},{key:"fetchTrade",value:function(e,t){var r=this.headers("POST",e);return(0,d["default"])(this.fetch(e,"tapi/v1/message",r,t).then(function(e){return 500===e.Status?Promise.reject(e):e.Responses}).then(function(e){return 1===e.length?e[0]:e}),t)}}]),t}(c["default"]);t["default"]=_},function(e,t){e.exports=require("sjcl")},function(e,t){e.exports=require("url")},function(e,t,r){(function(e){function r(e,t){for(var r=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;e.length>n;n++)t(e[n],n,e)&&r.push(e[n]);return r}var o=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return o.exec(e).slice(1)};t.resolve=function(){for(var t="",o=!1,i=arguments.length-1;i>=-1&&!o;i--){var u=0>i?e.cwd():arguments[i];if("string"!=typeof u)throw new TypeError("Arguments to path.resolve must be strings");u&&(t=u+"/"+t,o="/"===u.charAt(0))}return t=r(n(t.split("/"),function(e){return!!e}),!o).join("/"),(o?"/":"")+t||"."},t.normalize=function(e){var o=t.isAbsolute(e),i="/"===u(e,-1);return e=r(n(e.split("/"),function(e){return!!e}),!o).join("/"),e||o||(e="."),e&&i&&(e+="/"),(o?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,r){function n(e){for(var t=0;e.length>t&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=t.resolve(e).substr(1),r=t.resolve(r).substr(1);for(var o=n(e.split("/")),i=n(r.split("/")),u=Math.min(o.length,i.length),s=u,a=0;u>a;a++)if(o[a]!==i[a]){s=a;break}for(var f=[],a=s;o.length>a;a++)f.push("..");return f=f.concat(i.slice(s)),f.join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){var t=i(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},t.basename=function(e,t){var r=i(e)[2];return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},t.extname=function(e){return i(e)[3]};var u="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return 0>t&&(t=e.length+t),e.substr(t,r)}}).call(t,r(31))},function(e,t){function r(e){if(a===setTimeout)return setTimeout(e,0);try{return a(e,0)}catch(t){try{return a.call(null,e,0)}catch(t){return a.call(this,e,0)}}}function n(e){if(f===clearTimeout)return clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function o(){p&&l&&(p=!1,l.length?h=l.concat(h):d=-1,h.length&&i())}function i(){if(!p){var e=r(o);p=!0;for(var t=h.length;t;){for(l=h,h=[];++d1)for(var n=1;arguments.length>n;n++)t[n-1]=arguments[n];h.push(new u(e,t)),1!==h.length||p||r(i)},u.prototype.run=function(){this.fun.apply(null,this.array)},c.title="browser",c.browser=!0,c.env={},c.argv=[],c.version="",c.versions={},c.on=s,c.addListener=s,c.once=s,c.off=s,c.removeListener=s,c.removeAllListeners=s,c.emit=s,c.binding=function(e){throw Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(e){throw Error("process.chdir is not supported")},c.umask=function(){return 0}},function(e,t){e.exports=require("isomorphic-fetch")},function(e,t){e.exports=require("fetch-jsonp")}]); +"use strict";function o(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(t){return!1}}function i(){return e.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(t,r){if(i()e)throw new RangeError('"size" argument must not be negative')}function f(e,t,r,n){return a(t),t>0&&void 0!==r?"string"==typeof n?u(e,t).fill(r,n):u(e,t).fill(r):u(e,t)}function c(t,r){if(a(r),t=u(t,0>r?0:0|y(r)),!e.TYPED_ARRAY_SUPPORT)for(var n=0;r>n;++n)t[n]=0;return t}function l(t,r,n){if("string"==typeof n&&""!==n||(n="utf8"),!e.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var o=0|g(r,n);t=u(t,o);var i=t.write(r,n);return i!==o&&(t=t.slice(0,i)),t}function h(e,t){var r=0>t.length?0:0|y(t.length);e=u(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function p(t,r,n,o){if(0>n||n>r.byteLength)throw new RangeError("'offset' is out of bounds");if(n+(o||0)>r.byteLength)throw new RangeError("'length' is out of bounds");return r=void 0===n&&void 0===o?new Uint8Array(r):void 0===o?new Uint8Array(r,n):new Uint8Array(r,n,o),e.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=e.prototype):t=h(t,r),t}function d(t,r){if(e.isBuffer(r)){var n=0|y(r.length);return t=u(t,n),0===t.length?t:(r.copy(t,0,0,n),t)}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||X(r.length)?u(t,0):h(t,r);if("Buffer"===r.type&&Z(r.data))return h(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function y(e){if(e>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function E(t){return+t!=t&&(t=0),e.alloc(+t)}function g(t,r){if(e.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var o=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(t).length;default:if(o)return F(t).length;r=(""+r).toLowerCase(),o=!0}}function v(e,t,r){var n=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),0>=r)return"";if(r>>>=0,t>>>=0,t>=r)return"";for(e||(e="utf8");;)switch(e){case"hex":return B(this,t,r);case"utf8":case"utf-8":return S(this,t,r);case"ascii":return U(this,t,r);case"latin1":case"binary":return M(this,t,r);case"base64":return P(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function _(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function R(t,r,n,o,i){if(0===t.length)return-1;if("string"==typeof n?(o=n,n=0):n>2147483647?n=2147483647:-2147483648>n&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),0>n&&(n=t.length+n),t.length>n){if(0>n){if(!i)return-1;n=0}}else{if(i)return-1;n=t.length-1}if("string"==typeof r&&(r=e.from(r,o)),e.isBuffer(r))return 0===r.length?-1:T(t,r,n,o,i);if("number"==typeof r)return r=255&r,e.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):T(t,[r],n,o,i);throw new TypeError("val must be string, number or Buffer")}function T(e,t,r,n,o){function i(e,t){return 1===u?e[t]:e.readUInt16BE(t*u)}var u=1,s=e.length,a=t.length;if(void 0!==n&&(n=(n+"").toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(2>e.length||2>t.length)return-1;u=2,s/=2,a/=2,r/=2}var f;if(o){var c=-1;for(f=r;s>f;f++)if(i(e,f)===i(t,c===-1?0:f-c)){if(c===-1&&(c=f),f-c+1===a)return c*u}else c!==-1&&(f-=f-c),c=-1}else for(r+a>s&&(r=s-a),f=r;f>=0;f--){for(var l=!0,h=0;a>h;h++)if(i(e,f+h)!==i(t,h)){l=!1;break}if(l)return f}return-1}function b(e,t,r,n){r=+r||0;var o=e.length-r;n?(n=+n,n>o&&(n=o)):n=o;var i=t.length;if(i%2!==0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var u=0;n>u;++u){var s=parseInt(t.substr(2*u,2),16);if(isNaN(s))return u;e[r+u]=s}return u}function m(e,t,r,n){return G(F(t,e.length-r),e,r,n)}function O(e,t,r,n){return G(z(t),e,r,n)}function w(e,t,r,n){return O(e,t,r,n)}function I(e,t,r,n){return G(V(t),e,r,n)}function D(e,t,r,n){return G(K(t,e.length-r),e,r,n)}function P(e,t,r){return J.fromByteArray(0===t&&r===e.length?e:e.slice(t,r))}function S(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;r>o;){var i=e[o],u=null,s=i>239?4:i>223?3:i>191?2:1;if(r>=o+s){var a,f,c,l;switch(s){case 1:128>i&&(u=i);break;case 2:a=e[o+1],128===(192&a)&&(l=(31&i)<<6|63&a,l>127&&(u=l));break;case 3:a=e[o+1],f=e[o+2],128===(192&a)&&128===(192&f)&&(l=(15&i)<<12|(63&a)<<6|63&f,l>2047&&(55296>l||l>57343)&&(u=l));break;case 4:a=e[o+1],f=e[o+2],c=e[o+3],128===(192&a)&&128===(192&f)&&128===(192&c)&&(l=(15&i)<<18|(63&a)<<12|(63&f)<<6|63&c,l>65535&&1114112>l&&(u=l))}}null===u?(u=65533,s=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),o+=s}return A(n)}function A(e){var t=e.length;if(ee>=t)return String.fromCharCode.apply(String,e);for(var r="",n=0;t>n;)r+=String.fromCharCode.apply(String,e.slice(n,n+=ee));return r}function U(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;r>o;++o)n+=String.fromCharCode(127&e[o]);return n}function M(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;r>o;++o)n+=String.fromCharCode(e[o]);return n}function B(e,t,r){var n=e.length;t&&t>=0||(t=0),(!r||0>r||r>n)&&(r=n);for(var o="",i=t;r>i;++i)o+=Q(e[i]);return o}function k(e,t,r){for(var n=e.slice(t,r),o="",i=0;n.length>i;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function L(e,t,r){if(e%1!==0||0>e)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function C(t,r,n,o,i,u){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||u>r)throw new RangeError('"value" argument is out of bounds');if(n+o>t.length)throw new RangeError("Index out of range")}function q(e,t,r,n){0>t&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-r,2);i>o;++o)e[r+o]=(t&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function j(e,t,r,n){0>t&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-r,4);i>o;++o)e[r+o]=t>>>8*(n?o:3-o)&255}function N(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(0>r)throw new RangeError("Index out of range")}function x(e,t,r,n,o){return o||N(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),$.write(e,t,r,n,23,4),r+4}function W(e,t,r,n,o){return o||N(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(e,t,r,n,52,8),r+8}function Y(e){if(e=H(e).replace(te,""),2>e.length)return"";for(;e.length%4!==0;)e+="=";return e}function H(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function Q(e){return 16>e?"0"+e.toString(16):e.toString(16)}function F(e,t){t=t||1/0;for(var r,n=e.length,o=null,i=[],u=0;n>u;++u){if(r=e.charCodeAt(u),r>55295&&57344>r){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(u+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(56320>r){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,128>r){if((t-=1)<0)break;i.push(r)}else if(2048>r){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(65536>r){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(r>=1114112)throw Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function z(e){for(var t=[],r=0;e.length>r;++r)t.push(255&e.charCodeAt(r));return t}function K(e,t){for(var r,n,o,i=[],u=0;e.length>u&&(t-=2)>=0;++u)r=e.charCodeAt(u),n=r>>8,o=r%256,i.push(o),i.push(n);return i}function V(e){return J.toByteArray(Y(e))}function G(e,t,r,n){for(var o=0;n>o&&(o+ri;++i)if(t[i]!==r[i]){n=t[i],o=r[i];break}return o>n?-1:n>o?1:0},e.isEncoding=function(e){switch((e+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},e.concat=function(t,r){if(!Z(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return e.alloc(0);var n;if(void 0===r)for(r=0,n=0;t.length>n;++n)r+=t[n].length;var o=e.allocUnsafe(r),i=0;for(n=0;t.length>n;++n){var u=t[n];if(!e.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(o,i),i+=u.length}return o},e.byteLength=g,e.prototype._isBuffer=!0,e.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;e>t;t+=2)_(this,t,t+1);return this},e.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;e>t;t+=4)_(this,t,t+3),_(this,t+1,t+2);return this},e.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;e>t;t+=8)_(this,t,t+7),_(this,t+1,t+6),_(this,t+2,t+5),_(this,t+3,t+4);return this},e.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?S(this,0,e):v.apply(this,arguments)},e.prototype.equals=function(t){if(!e.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===e.compare(this,t)},e.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},e.prototype.compare=function(t,r,n,o,i){if(!e.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===o&&(o=0),void 0===i&&(i=this.length),0>r||n>t.length||0>o||i>this.length)throw new RangeError("out of range index");if(o>=i&&r>=n)return 0;if(o>=i)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,o>>>=0,i>>>=0,this===t)return 0;for(var u=i-o,s=n-r,a=Math.min(u,s),f=this.slice(o,i),c=t.slice(r,n),l=0;a>l;++l)if(f[l]!==c[l]){u=f[l],s=c[l];break}return s>u?-1:u>s?1:0},e.prototype.includes=function(e,t,r){return this.indexOf(e,t,r)!==-1},e.prototype.indexOf=function(e,t,r){return R(this,e,t,r,!0)},e.prototype.lastIndexOf=function(e,t,r){return R(this,e,t,r,!1)},e.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t=0|t,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(0>r||0>t)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return m(this,e,t,r);case"ascii":return O(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ee=4096;e.prototype.slice=function(t,r){var n=this.length;t=~~t,r=void 0===r?n:~~r,0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),0>r?(r+=n,0>r&&(r=0)):r>n&&(r=n),t>r&&(r=t);var o;if(e.TYPED_ARRAY_SUPPORT)o=this.subarray(t,r),o.__proto__=e.prototype;else{var i=r-t;o=new e(i,(void 0));for(var u=0;i>u;++u)o[u]=this[u+t]}return o},e.prototype.readUIntLE=function(e,t,r){e=0|e,t=0|t,r||L(e,t,this.length);for(var n=this[e],o=1,i=0;++i0&&(o*=256);)n+=this[e+--t]*o;return n},e.prototype.readUInt8=function(e,t){return t||L(e,1,this.length),this[e]},e.prototype.readUInt16LE=function(e,t){return t||L(e,2,this.length),this[e]|this[e+1]<<8},e.prototype.readUInt16BE=function(e,t){return t||L(e,2,this.length),this[e]<<8|this[e+1]},e.prototype.readUInt32LE=function(e,t){return t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},e.prototype.readUInt32BE=function(e,t){return t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},e.prototype.readIntLE=function(e,t,r){e=0|e,t=0|t,r||L(e,t,this.length);for(var n=this[e],o=1,i=0;++in||(n-=Math.pow(2,8*t)),n},e.prototype.readIntBE=function(e,t,r){e=0|e,t=0|t,r||L(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return o*=128,o>i||(i-=Math.pow(2,8*t)),i},e.prototype.readInt8=function(e,t){return t||L(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},e.prototype.readInt16LE=function(e,t){t||L(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt16BE=function(e,t){t||L(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt32LE=function(e,t){return t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},e.prototype.readInt32BE=function(e,t){return t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},e.prototype.readFloatLE=function(e,t){return t||L(e,4,this.length),$.read(this,e,!0,23,4)},e.prototype.readFloatBE=function(e,t){return t||L(e,4,this.length),$.read(this,e,!1,23,4)},e.prototype.readDoubleLE=function(e,t){return t||L(e,8,this.length),$.read(this,e,!0,52,8)},e.prototype.readDoubleBE=function(e,t){return t||L(e,8,this.length),$.read(this,e,!1,52,8)},e.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t=0|t,r=0|r,!n){var o=Math.pow(2,8*r)-1;C(this,e,t,r,o,0)}var i=1,u=0;for(this[t]=255&e;++u=0&&(u*=256);)this[t+i]=e/u&255;return t+r},e.prototype.writeUInt8=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,1,255,0),e.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},e.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,2,65535,0),e.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):q(this,t,r,!0),r+2},e.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,2,65535,0),e.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):q(this,t,r,!1),r+2},e.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,4,4294967295,0),e.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):j(this,t,r,!0),r+4},e.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,4,4294967295,0),e.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):j(this,t,r,!1),r+4},e.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t=0|t,!n){var o=Math.pow(2,8*r-1);C(this,e,t,r,o-1,-o)}var i=0,u=1,s=0;for(this[t]=255&e;++ie&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/u>>0)-s&255;return t+r},e.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t=0|t,!n){var o=Math.pow(2,8*r-1);C(this,e,t,r,o-1,-o)}var i=r-1,u=1,s=0;for(this[t+i]=255&e;--i>=0&&(u*=256);)0>e&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/u>>0)-s&255;return t+r},e.prototype.writeInt8=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,1,127,-128),e.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),0>t&&(t=255+t+1),this[r]=255&t,r+1},e.prototype.writeInt16LE=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,2,32767,-32768),e.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):q(this,t,r,!0),r+2},e.prototype.writeInt16BE=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,2,32767,-32768),e.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):q(this,t,r,!1),r+2},e.prototype.writeInt32LE=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,4,2147483647,-2147483648),e.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):j(this,t,r,!0),r+4},e.prototype.writeInt32BE=function(t,r,n){return t=+t,r=0|r,n||C(this,t,r,4,2147483647,-2147483648),0>t&&(t=4294967295+t+1),e.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):j(this,t,r,!1),r+4},e.prototype.writeFloatLE=function(e,t,r){return x(this,e,t,!0,r)},e.prototype.writeFloatBE=function(e,t,r){return x(this,e,t,!1,r)},e.prototype.writeDoubleLE=function(e,t,r){return W(this,e,t,!0,r)},e.prototype.writeDoubleBE=function(e,t,r){return W(this,e,t,!1,r)},e.prototype.copy=function(t,r,n,o){if(n||(n=0),o||0===o||(o=this.length),t.length>r||(r=t.length),r||(r=0),o>0&&n>o&&(o=n),o===n)return 0;if(0===t.length||0===this.length)return 0;if(0>r)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("sourceStart out of bounds");if(0>o)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),o-n>t.length-r&&(o=t.length-r+n);var i,u=o-n;if(this===t&&r>n&&o>r)for(i=u-1;i>=0;--i)t[i+r]=this[i+n];else if(1e3>u||!e.TYPED_ARRAY_SUPPORT)for(i=0;u>i;++i)t[i+r]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+u),r);return u},e.prototype.fill=function(t,r,n,o){if("string"==typeof t){if("string"==typeof r?(o=r,r=0,n=this.length):"string"==typeof n&&(o=n,n=this.length),1===t.length){var i=t.charCodeAt(0);256>i&&(t=i)}if(void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!e.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else"number"==typeof t&&(t=255&t);if(0>r||r>this.length||n>this.length)throw new RangeError("Out of range index");if(r>=n)return this;r>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0);var u;if("number"==typeof t)for(u=r;n>u;++u)this[u]=t;else{var s=e.isBuffer(t)?t:F(""+new e(t,o)),a=s.length;for(u=0;n-r>u;++u)this[u+r]=s[u%a]}return this};var te=/[^+\/0-9A-Za-z-_]/g}).call(t,r(19).Buffer,function(){return this}())},function(e,t){e.exports=require("base64-js")},function(e,t){e.exports=require("ieee754")},function(e,t){e.exports=require("isarray")},function(e,t){e.exports=require("ip")},function(e,t){},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n"},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function h(e,t,r){null===e&&(e=Function.prototype);var n=Object.getOwnPropertyDescriptor(e,t);if(void 0===n){var o=Object.getPrototypeOf(e);return null===o?void 0:h(o,t,r)}if("value"in n)return n.value;var i=n.get;if(void 0!==i)return i.call(r)},f=r(27),c=n(f),l=function(e){function t(){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return u(t,e),s(t,[{key:"ticker",value:function(e){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"fetchPublic",this).call(this,"ticker",e)}},{key:"trades",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.limit,n=void 0===r?1e3:r,o=e.since,i=void 0===o?"0":o,u=arguments[1];return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"fetchPublic",this).call(this,"trades?limit="+n+"&since="+i,u)}},{key:"orderbook",value:function(e){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"fetchPublic",this).call(this,"orderbook",e)}}]),t}(c["default"]);t["default"]=l},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(28),f=n(a),c=r(14),l=n(c),h=r(29),p=n(h),d=r(30),y=n(d),E=r(10),g=n(E),v=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"rest"));return n.key=e.key,n.secret=e.secret,n.currency=e.currency||"USD",n.fetchRequest=r(n.isNode?32:33),n}return u(t,e),s(t,[{key:"headers",value:function(e,t){var r=""+Date.now(),n=f["default"].codec.utf8String.toBits(this.secret),o=new f["default"].misc.hmac(n,f["default"].hash.sha256),i=f["default"].codec.hex.fromBits(o.encrypt(r));return{method:e,headers:{"Content-Type":"application/json",Nonce:r,APIKey:this.key,Signature:i},body:JSON.stringify(t)}}},{key:"fetch",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.fetchRequest(p["default"].resolve(this.endpoint,t),r).then(function(e){return e.json()})}},{key:"fetchPublic",value:function(e,t){return(0,l["default"])(this.fetch({},y["default"].join("api/v1",this.currency,e)),t)}},{key:"fetchTrade",value:function(e,t){var r=this.headers("POST",e);return(0,l["default"])(this.fetch(e,"tapi/v1/message",r,t).then(function(e){return 500===e.Status?Promise.reject(e):e.Responses}).then(function(e){return 1===e.length?e[0]:e}),t)}}]),t}(g["default"]);t["default"]=v},function(e,t){e.exports=require("sjcl")},function(e,t){e.exports=require("url")},function(e,t,r){(function(e){function r(e,t){for(var r=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;e.length>n;n++)t(e[n],n,e)&&r.push(e[n]);return r}var o=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return o.exec(e).slice(1)};t.resolve=function(){for(var t="",o=!1,i=arguments.length-1;i>=-1&&!o;i--){var u=0>i?e.cwd():arguments[i];if("string"!=typeof u)throw new TypeError("Arguments to path.resolve must be strings");u&&(t=u+"/"+t,o="/"===u.charAt(0))}return t=r(n(t.split("/"),function(e){return!!e}),!o).join("/"),(o?"/":"")+t||"."},t.normalize=function(e){var o=t.isAbsolute(e),i="/"===u(e,-1);return e=r(n(e.split("/"),function(e){return!!e}),!o).join("/"),e||o||(e="."),e&&i&&(e+="/"),(o?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,r){function n(e){for(var t=0;e.length>t&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=t.resolve(e).substr(1),r=t.resolve(r).substr(1);for(var o=n(e.split("/")),i=n(r.split("/")),u=Math.min(o.length,i.length),s=u,a=0;u>a;a++)if(o[a]!==i[a]){s=a;break}for(var f=[],a=s;o.length>a;a++)f.push("..");return f=f.concat(i.slice(s)),f.join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){var t=i(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},t.basename=function(e,t){var r=i(e)[2];return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},t.extname=function(e){return i(e)[3]};var u="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return 0>t&&(t=e.length+t),e.substr(t,r)}}).call(t,r(31))},function(e,t){function r(e){if(a===setTimeout)return setTimeout(e,0);try{return a(e,0)}catch(t){try{return a.call(null,e,0)}catch(t){return a.call(this,e,0)}}}function n(e){if(f===clearTimeout)return clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function o(){p&&l&&(p=!1,l.length?h=l.concat(h):d=-1,h.length&&i())}function i(){if(!p){var e=r(o);p=!0;for(var t=h.length;t;){for(l=h,h=[];++d1)for(var n=1;arguments.length>n;n++)t[n-1]=arguments[n];h.push(new u(e,t)),1!==h.length||p||r(i)},u.prototype.run=function(){this.fun.apply(null,this.array)},c.title="browser",c.browser=!0,c.env={},c.argv=[],c.version="",c.versions={},c.on=s,c.addListener=s,c.once=s,c.off=s,c.removeListener=s,c.removeAllListeners=s,c.emit=s,c.binding=function(e){throw Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(e){throw Error("process.chdir is not supported")},c.umask=function(){return 0}},function(e,t){e.exports=require("isomorphic-fetch")},function(e,t){e.exports=require("fetch-jsonp")}]); //# sourceMappingURL=blinktrade.min.js.map \ No newline at end of file diff --git a/dist/blinktrade.min.js.map b/dist/blinktrade.min.js.map index bc34164..bdb41aa 100644 --- a/dist/blinktrade.min.js.map +++ b/dist/blinktrade.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///blinktrade.min.js","webpack:///webpack/bootstrap 1feb3295b6518f09d5a7","webpack:///./src/index.js","webpack:///./src/constants/brokers.js","webpack:///./src/ws.js","webpack:///./src/constants/requests.js","webpack:///./src/wsTransport.js","webpack:///./src/baseTransport.js","webpack:///./src/base.js","webpack:///./src/constants/common.js","webpack:///./src/constants/requestTypes.js","webpack:///external \"lodash\"","webpack:///./src/listener.js","webpack:///external \"fingerprintjs2\"","webpack:///external \"nodeify\"","webpack:///external \"eventemitter2\"","webpack:///external \"ws\"","webpack:///./src/util/macaddress.js","webpack:///external \"macaddress\"","webpack:///./src/util/stun.js","webpack:///./~/buffer/index.js","webpack:///external \"base64-js\"","webpack:///external \"ieee754\"","webpack:///external \"isarray\"","webpack:///external \"ip\"","webpack:///./src/constants/actionTypes.js","webpack:///./~/os-browserify/browser.js","webpack:///./src/rest.js","webpack:///./src/restTransport.js","webpack:///external \"sjcl\"","webpack:///external \"url\"","webpack:///./~/path-browserify/index.js","webpack:///./~/process/browser.js","webpack:///external \"isomorphic-fetch\"","webpack:///external \"fetch-jsonp\""],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","Object","defineProperty","value","BlinkTradeRest","BlinkTradeWS","Brokers","undefined","_brokers","_brokers2","_ws","_ws2","_rest","_rest2","SURBITCOIN","VBTC","FOXBIT","TESTNET","URDUBIT","CHILEBIT","_defineProperty","key","enumerable","configurable","writable","_objectWithoutProperties","keys","target","i","indexOf","prototype","hasOwnProperty","_classCallCheck","instance","Constructor","TypeError","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","create","constructor","setPrototypeOf","__proto__","_extends","assign","arguments","length","source","_createClass","defineProperties","props","descriptor","protoProps","staticProps","_get","get","object","property","receiver","Function","desc","getOwnPropertyDescriptor","parent","getPrototypeOf","getter","_requests","_requests2","_wsTransport","_wsTransport2","_lodash","_lodash2","_listener","_actionTypes","_WebSocketTransport","params","this","_this","session","callback","_this2","d","Date","msg","MsgType","HEARTBEAT","TestReqID","getTime","SendTime","Promise","resolve","reject","then","data","Latency","now","_ref","_this3","username","password","secondFactor","userAgent","isNode","os","UserAgent","type","release","UserAgentLanguage","UserAgentPlatform","platform","arch","UserAgentTimezoneOffset","getTimezoneOffset","window","navigator","language","LOGIN","UserReqID","generateRequestId","BrokerID","brokerId","Username","Password","UserReqTyp","SecondFactor","UserStatus","LOGOUT","profile","_session$Profile","Profile","_this4","registerListener","balance","eventEmitter","emit","BALANCE","symbols","_this5","SECURITY_STATUS","SecurityStatusReqID","SubscriptionRequestType","Instruments","formatTicker","SellVolume","LowPx","LastPx","BestAsk","HighPx","BuyVolume","BestBid","registerEventEmitter","ticker","Symbol","_this6","MARKET_DATA_FULL_REFRESH","MDReqID","MarketDepth","MDUpdateType","MDEntryTypes","subscribeEvent","MDBkTyp","MDIncGrp","map","order","dataOrder","index","MDEntryPositionNo","price","MDEntryPx","size","MDEntrySize","side","MDEntryType","userId","UserID","orderId","OrderID","symbol","time","MDEntryDate","MDEntryTime","orderbookEvent","ORDER_BOOK","EVENTS","ORDERBOOK","MDUpdateAction","tradeEvent","TRADES","_data$MDFullGrp$filte","MDFullGrp","filter","reduce","prev","push","bids","asks","err","MARKET_DATA_UNSUBSCRIBE","_this7","event","EXECUTION_REPORT","ExecType","_this8","_ref2","since","_ref2$page","page","Page","_ref2$pageSize","pageSize","PageSize","TRADE_HISTORY","TradeHistoryReqID","Filter","Since","Columns","trades","TradeHistory","groupBy","TradeHistoryGrp","trade","zipObject","Market","_this9","_ref3","_ref3$currency","currency","depositMethodId","deposit","DEPOSIT_REFRESH","_ref4","_this10","amount","_ref4$currency","_ref4$method","method","withdraw","WITHDRAW_REFRESH","CHANGE_PASSWORD","ORDER_SEND","ORDER_CANCEL","SECURITY_LIST","ORDER_LIST","BROKER_LIST","PROFILE_UPDATE","REQUEST_DEPOSIT","REQUEST_DEPOSIT_LIST","REQUEST_DEPOSIT_METHODS","REQUEST_WITHDRAW","REQUEST_WITHDRAW_LIST","CONFIRM_WITHDRAW","CANCEL_WITHDRAW","_baseTransport","_baseTransport2","_fingerprintjs","_fingerprintjs2","_nodeify","_nodeify2","_eventemitter","WebSocketTransport","_BaseTransport","stun","local","public","getStun","getFingerPrint","EventEmitter2","wildcard","delimiter","extend","request","WebSocket","socket","endpoint","onopen","onOpen","bind","onclose","onClose","onerror","onError","onmessage","onMessage","nodeify","close","connected","readyState","STUNTIP","FingerPrint","fingerPrint","send","JSON","stringify","promise","registerRequest","sendMessage","parse","Error","Detail","Description","getRequest","listener","getListener","dispatchPromise","dispatchListeners","on","onAny","offAny","once","many","times","removeListener","removeAllListeners","events","getMac","macAddress","_interopRequireWildcard","newObj","_base","_base2","_requestTypes","RequestTypes","BaseTransport","_Base","env","sendMessageAsPromise","fetchTrade","BalanceReqID","Available","balances","includes","_ref$page","_ref$pageSize","OrdersReqID","orders","OrdListGrp","ClOrdID","Side","OrdType","Price","OrderQty","deleteRequest","CLIENT_ORDER_ID","param","clientId","_ref3$page","_ref3$pageSize","_ref3$statusList","statusList","StatusList","WithdrawListReqID","withdrawData","WithdrawListGrp","reqId","WithdrawReqID","Method","Amount","Currency","Data","_ref5","WithdrawID","withdrawId","confirmationToken","ConfirmationToken","WithdrawCancelReqID","_ref6","_ref6$page","_ref6$pageSize","_ref6$status","status","DepositListReqID","depositData","DepositListGrp","_ref7","_ref7$currency","DepositReqID","DepositMethodID","Value","DepositMethodReqID","_common","_common2","Base","url","prod","testnet","ws","rest","SOCKET_ID","REQUEST_ID","TEST_REQUEST_ID","USER_REQUEST_ID","SECURITY_REQUEST_ID","RESET_PASSWORD_REQUEST_ID","DEPOSIT_REQUEST_ID","WITHDRAW_REQUEST_ID","BALANCE_REQUEST_ID","ORDERS_REQUEST_ID","ENABLE_TWO_FACTOR_REQUEST_ID","DEPOSIT_METHOD_REQUEST_ID","WITHDRAW_LIST_REQUEST_ID","BROKER_LIST_REQUEST_ID","DEPOSIT_LIST_REQUEST_ID","TRADE_HISTORY_REQUEST_ID","LEDGER_LIST_REQUEST_ID","TRADERS_RANK_REQUEST_ID","UPDATE_REQUEST_ID","POSITION_REQUEST_ID","SECURITY_STATUS_REQUEST_ID","API_KEY_LIST_REQUEST_ID","API_KEY_CREATE_REQUEST_ID","API_KEY_REVOKE_REQUEST_ID","PROCESS_DEPOSIT_REQUEST_ID","CUSTOMER_LIST_REQUEST_ID","CUSTOMER_REQUEST_ID","PROCESS_WITHDRAW_REQUEST_ID","VERIFY_CUSTOMER_REQUEST_ID","MD_REQUEST_ID","require","getListeners","requests","parseInt","Math","random","String","msgType","listeners","message","result","mapKeys","has","find","ReqId","findIndex","omit","_macaddress2","all","hashCode","str","hash","charCodeAt","macAddresses","forEach","iface","mac","_macaddress","Buffer","addIPAddress","ipAddress","match","stunIp","_dgram2","createSocket","STUN_HEADER_LENGTH","stunRequest","STUN_METHOD_REQUEST","STUN_BINDING_CLASS","STUN_MAGIC_COOKIE","STUN_TID_MAX","pow","STUN_ATTR_MAPPED_ADDRESS","STUN_ATTR_XOR_MAPPED_ADDRESS","STUN_ATTR_XOR_MAPPED_ADDRESS_ALT","stunTxId","stunServers","writeUInt16BE","writeUInt32BE","xor","a","b","tmp","len","block","readUInt8","bit1","bit2","msgHeader","slice","msgAttrs","offset","attrType","readUInt16BE","attrBuffLength","blockOut","family","address","_ip2","toString","magic","tid","xaddr","addr","concat","_slicedToArray","port","host","sliceIterator","arr","_arr","_n","_d","_e","_s","_i","iterator","next","done","Array","isArray","_ip","_dgram","global","typedArraySupport","Uint8Array","foo","subarray","byteLength","e","kMaxLength","TYPED_ARRAY_SUPPORT","createBuffer","that","RangeError","arg","encodingOrOffset","allocUnsafe","from","ArrayBuffer","fromArrayBuffer","fromString","fromObject","assertSize","alloc","fill","encoding","checked","string","isEncoding","actual","write","fromArrayLike","array","byteOffset","isBuffer","copy","buffer","isnan","SlowBuffer","isView","loweredCase","utf8ToBytes","base64ToBytes","toLowerCase","slowToString","start","end","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","n","bidirectionalIndexOf","val","dir","isNaN","arrayIndexOf","lastIndexOf","read","buf","indexSize","arrLength","valLength","foundIndex","found","j","hexWrite","remaining","strLen","parsed","substr","utf8Write","blitBuffer","asciiWrite","asciiToBytes","latin1Write","base64Write","ucs2Write","utf16leToBytes","base64","fromByteArray","min","res","firstByte","codePoint","bytesPerSequence","secondByte","thirdByte","fourthByte","tempCodePoint","decodeCodePointsArray","codePoints","MAX_ARGUMENTS_LENGTH","fromCharCode","apply","ret","out","toHex","bytes","checkOffset","ext","checkInt","max","objectWriteUInt16","littleEndian","objectWriteUInt32","checkIEEE754","writeFloat","noAssert","ieee754","writeDouble","base64clean","stringtrim","replace","INVALID_BASE64_RE","trim","units","Infinity","leadSurrogate","byteArray","hi","lo","toByteArray","src","dst","INSPECT_MAX_BYTES","poolSize","_augment","species","allocUnsafeSlow","_isBuffer","compare","x","y","list","pos","swap16","swap32","swap64","equals","inspect","join","thisStart","thisEnd","thisCopy","targetCopy","isFinite","toJSON","newBuf","sliceLen","readUIntLE","mul","readUIntBE","readUInt16LE","readUInt32LE","readUInt32BE","readIntLE","readIntBE","readInt8","readInt16LE","readInt16BE","readInt32LE","readInt32BE","readFloatLE","readFloatBE","readDoubleLE","readDoubleBE","writeUIntLE","maxBytes","writeUIntBE","writeUInt8","floor","writeUInt16LE","writeUInt32LE","writeIntLE","limit","sub","writeIntBE","writeInt8","writeInt16LE","writeInt16BE","writeInt32LE","writeInt32BE","writeFloatLE","writeFloatBE","writeDoubleLE","writeDoubleBE","targetStart","set","code","ORDER_BOOK_TRADE_NEW","ORDER_BOOK_NEW_ORDER","ORDER_BOOK_UPDATE_ORDER","ORDER_BOOK_DELETE_ORDER","ORDER_BOOK_DELETE_ORDERS_THRU","EXECUTION_REPORT_NEW","EXECUTION_REPORT_PARTIAL","EXECUTION_REPORT_EXECUTION","EXECUTION_REPORT_CANCELED","EXECUTION_REPORT_REJECTED","0","1","2","3","4","8","endianness","hostname","location","loadavg","uptime","freemem","Number","MAX_VALUE","totalmem","cpus","appVersion","networkInterfaces","getNetworkInterfaces","tmpdir","tmpDir","EOL","_restTransport","_restTransport2","_RestTransport","_ref$limit","_ref$since","_sjcl","_sjcl2","_url","_url2","_path","_path2","RestTransport","secret","fetchRequest","body","timeStamp","hexKey","codec","utf8String","toBits","hmac","misc","sha256","Signature","hex","fromBits","encrypt","headers","Content-Type","Nonce","APIKey","api","response","json","fetch","Status","Responses","process","normalizeArray","parts","allowAboveRoot","up","last","splice","unshift","xs","f","splitPathRe","splitPath","filename","exec","resolvedPath","resolvedAbsolute","path","cwd","charAt","split","normalize","isAbsolute","trailingSlash","paths","relative","to","fromParts","toParts","samePartsLength","outputParts","sep","dirname","root","basename","extname","runTimeout","fun","cachedSetTimeout","setTimeout","runClearTimeout","marker","cachedClearTimeout","clearTimeout","cleanUpNextTick","draining","currentQueue","queue","queueIndex","drainQueue","timeout","run","Item","noop","nextTick","args","title","browser","argv","version","versions","addListener","off","binding","name","chdir","umask"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAE,WACAE,GAAAJ,EACAK,QAAA,EAUA,OANAP,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,QAAA,EAGAF,EAAAD,QAvBA,GAAAD,KAqCA,OATAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,GAGAV,EAAA,KDMM,SAASI,EAAQD,EAASH,GAE/B,YAmBA,SAASW,GAAuBC,GAAO,MAAOA,IAAOA,EAAIC,WAAaD,GAAQE,UAASF,GAjBvFG,OAAOC,eAAeb,EAAS,cAC7Bc,OAAO,IAETd,EAAQe,eAAiBf,EAAQgB,aAAehB,EAAQiB,QAAUC,ME7BnE,IAAAC,GAAAtB,EAAA,GFiCKuB,EAAYZ,EAAuBW,GEhCxCE,EAAAxB,EAAA,GFoCKyB,EAAOd,EAAuBa,GEnCnCE,EAAA1B,EAAA,IFuCK2B,EAAShB,EAAuBe,EAIpCvB,GExCCiB,QFwCiBG,aAClBpB,E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AA,KAAAjhB,KAAAgd,QAEAsO,EAAAuD,MAAA,UACAvD,EAAAwD,SAAA,EACAxD,EAAA9b,OACA8b,EAAAyD,QACAzD,EAAA0D,QAAA,GACA1D,EAAA2D,YAIA3D,EAAAjd,GAAAqgB,EACApD,EAAA4D,YAAAR,EACApD,EAAA9c,KAAAkgB,EACApD,EAAA6D,IAAAT,EACApD,EAAA3c,eAAA+f,EACApD,EAAA1c,mBAAA8f,EACApD,EAAA5nB,KAAAgrB,EAEApD,EAAA8D,QAAA,SAAAC,GACA,KAAAxhB,OAAA,qCAGAyd,EAAAiB,IAAA,WAA2B,WAC3BjB,EAAAgE,MAAA,SAAA7Q,GACA,KAAA5Q,OAAA,mCAEAyd,EAAAiE,MAAA,WAA4B,WhC0kItB,SAAS/0B,EAAQD,GiCzuIvBC,EAAAD,QAAA8a,QAAA,qBjC+uIM,SAAS7a,EAAQD,GkC/uIvBC,EAAAD,QAAA8a,QAAA","file":"blinktrade.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.BlinkTradeRest = exports.BlinkTradeWS = exports.Brokers = undefined;\n\t\n\tvar _brokers = __webpack_require__(1);\n\t\n\tvar _brokers2 = _interopRequireDefault(_brokers);\n\t\n\tvar _ws = __webpack_require__(2);\n\t\n\tvar _ws2 = _interopRequireDefault(_ws);\n\t\n\tvar _rest = __webpack_require__(26);\n\t\n\tvar _rest2 = _interopRequireDefault(_rest);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\texports.Brokers = _brokers2.default;\n\texports.BlinkTradeWS = _ws2.default;\n\texports.BlinkTradeRest = _rest2.default; /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.default = {\n\t SURBITCOIN: 1,\n\t VBTC: 3,\n\t FOXBIT: 4,\n\t TESTNET: 5,\n\t URDUBIT: 8,\n\t CHILEBIT: 9\n\t};\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\t\n\tvar _requests = __webpack_require__(3);\n\t\n\tvar _requests2 = _interopRequireDefault(_requests);\n\t\n\tvar _wsTransport = __webpack_require__(4);\n\t\n\tvar _wsTransport2 = _interopRequireDefault(_wsTransport);\n\t\n\tvar _lodash = __webpack_require__(9);\n\t\n\tvar _lodash2 = _interopRequireDefault(_lodash);\n\t\n\tvar _eventemitter = __webpack_require__(13);\n\t\n\tvar _listener = __webpack_require__(10);\n\t\n\tvar _actionTypes = __webpack_require__(24);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\t\n\tfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\t\n\tvar BlinkTradeWS = function (_WebSocketTransport) {\n\t _inherits(BlinkTradeWS, _WebSocketTransport);\n\t\n\t function BlinkTradeWS(params) {\n\t _classCallCheck(this, BlinkTradeWS);\n\t\n\t var _this = _possibleConstructorReturn(this, (BlinkTradeWS.__proto__ || Object.getPrototypeOf(BlinkTradeWS)).call(this, params));\n\t\n\t _this.session = {};\n\t return _this;\n\t }\n\t\n\t /**\n\t * Session to store login information\n\t */\n\t\n\t\n\t _createClass(BlinkTradeWS, [{\n\t key: 'heartbeat',\n\t value: function heartbeat(callback) {\n\t var _this2 = this;\n\t\n\t var d = new Date();\n\t var msg = {\n\t MsgType: _requests2.default.HEARTBEAT,\n\t TestReqID: d.getTime(),\n\t SendTime: d.getTime()\n\t };\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'sendMessageAsPromise', _this2).call(_this2, msg, callback).then(function (data) {\n\t return resolve(_extends({}, data, {\n\t Latency: new Date(Date.now()) - data.SendTime\n\t }));\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'login',\n\t value: function login(_ref, callback) {\n\t var _this3 = this;\n\t\n\t var username = _ref.username;\n\t var password = _ref.password;\n\t var secondFactor = _ref.secondFactor;\n\t\n\t var userAgent = void 0;\n\t if (!this.isNode) {\n\t userAgent = {\n\t UserAgent: window.navigator.userAgent,\n\t UserAgentLanguage: window.navigator.language,\n\t UserAgentPlatform: window.navigator.platform,\n\t UserAgentTimezoneOffset: new Date().getTimezoneOffset()\n\t };\n\t } else {\n\t var os = __webpack_require__(25);\n\t userAgent = {\n\t UserAgent: os.type() + ' ' + os.release(),\n\t UserAgentLanguage: 'en_US',\n\t UserAgentPlatform: os.platform() + ' (' + os.arch() + ')',\n\t UserAgentTimezoneOffset: new Date().getTimezoneOffset()\n\t };\n\t }\n\t\n\t var msg = _extends({\n\t MsgType: _requests2.default.LOGIN,\n\t UserReqID: (0, _listener.generateRequestId)(),\n\t BrokerID: this.brokerId,\n\t Username: username,\n\t Password: password,\n\t UserReqTyp: '1'\n\t }, userAgent);\n\t\n\t if (secondFactor) {\n\t msg.SecondFactor = secondFactor;\n\t }\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'sendMessageAsPromise', _this3).call(_this3, msg, callback).then(function (data) {\n\t if (data.UserStatus === 1) {\n\t _this3.session = data;\n\t return resolve(data);\n\t }\n\t\n\t return reject(data);\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'logout',\n\t value: function logout(callback) {\n\t var msg = {\n\t MsgType: _requests2.default.LOGOUT,\n\t BrokerID: this.brokerId,\n\t UserReqID: (0, _listener.generateRequestId)(),\n\t Username: this.session.Username,\n\t UserReqTyp: '2'\n\t };\n\t\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'sendMessageAsPromise', this).call(this, msg, callback);\n\t }\n\t }, {\n\t key: 'profile',\n\t value: function profile(callback) {\n\t var _session$Profile = this.session.Profile;\n\t var VerificationData = _session$Profile.VerificationData;\n\t\n\t var profile = _objectWithoutProperties(_session$Profile, ['VerificationData']);\n\t\n\t return callback ? callback(profile) : Promise.resolve(profile);\n\t }\n\t }, {\n\t key: 'balance',\n\t value: function balance(callback) {\n\t var _this4 = this;\n\t\n\t (0, _listener.registerListener)('U3', function (balance) {\n\t callback && callback(null, balance);\n\t return _this4.eventEmitter.emit(_actionTypes.BALANCE, balance);\n\t });\n\t\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'emitterPromise', this).call(this, new Promise(function (resolve, reject) {\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'balance', _this4).call(_this4, callback).then(resolve).catch(reject);\n\t }));\n\t }\n\t }, {\n\t key: 'subscribeTicker',\n\t value: function subscribeTicker(symbols, callback) {\n\t var _this5 = this;\n\t\n\t var msg = {\n\t MsgType: _requests2.default.SECURITY_STATUS,\n\t SecurityStatusReqID: (0, _listener.generateRequestId)(),\n\t SubscriptionRequestType: '1',\n\t Instruments: symbols\n\t };\n\t\n\t var formatTicker = function formatTicker(data) {\n\t return _extends({}, data, {\n\t SellVolume: data.SellVolume / 1e8,\n\t LowPx: data.LowPx / 1e8,\n\t LastPx: data.LastPx / 1e8,\n\t BestAsk: data.BestAsk / 1e8,\n\t HighPx: data.HighPx / 1e8,\n\t BuyVolume: data.BuyVolume / 1e8,\n\t BestBid: data.BestBid / 1e8\n\t });\n\t };\n\t\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'emitterPromise', this).call(this, new Promise(function (resolve, reject) {\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'sendMessageAsPromise', _this5).call(_this5, msg, callback).then(function (data) {\n\t resolve(formatTicker(data));\n\t (0, _listener.registerEventEmitter)({ SecurityStatusReqID: data.SecurityStatusReqID }, function (ticker) {\n\t callback && callback(null, formatTicker(ticker));\n\t return _this5.eventEmitter.emit('BLINK:' + ticker.Symbol, formatTicker(ticker));\n\t });\n\t }).catch(reject);\n\t }));\n\t }\n\t }, {\n\t key: 'unSubscribeTicker',\n\t value: function unSubscribeTicker(SecurityStatusReqID) {\n\t var msg = {\n\t MsgType: _requests2.default.SECURITY_STATUS,\n\t SecurityStatusReqID: SecurityStatusReqID,\n\t SubscriptionRequestType: '2'\n\t };\n\t\n\t _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'sendMessage', this).call(this, msg);\n\t return SecurityStatusReqID;\n\t }\n\t }, {\n\t key: 'subscribeOrderbook',\n\t value: function subscribeOrderbook(symbols, callback) {\n\t var _this6 = this;\n\t\n\t var msg = {\n\t MsgType: _requests2.default.MARKET_DATA_FULL_REFRESH,\n\t MDReqID: (0, _listener.generateRequestId)(),\n\t SubscriptionRequestType: '1',\n\t MarketDepth: 0,\n\t MDUpdateType: '1', // Incremental refresh\n\t MDEntryTypes: ['0', '1', '2'],\n\t Instruments: symbols\n\t };\n\t\n\t var subscribeEvent = function subscribeEvent(data) {\n\t if (data.MDBkTyp === '3') {\n\t data.MDIncGrp.map(function (order) {\n\t var dataOrder = {\n\t index: order.MDEntryPositionNo,\n\t price: order.MDEntryPx / 1e8,\n\t size: order.MDEntrySize / 1e8,\n\t side: order.MDEntryType === '0' ? 'buy' : 'sell',\n\t userId: order.UserID,\n\t orderId: order.OrderID,\n\t symbol: order.Symbol,\n\t time: new Date(order.MDEntryDate + ' ' + order.MDEntryTime).toString()\n\t };\n\t\n\t callback && callback(null, dataOrder);\n\t\n\t switch (order.MDEntryType) {\n\t case '0':\n\t case '1':\n\t var orderbookEvent = _actionTypes.ORDER_BOOK + ':' + _actionTypes.EVENTS.ORDERBOOK[order.MDUpdateAction];\n\t return _this6.eventEmitter.emit(orderbookEvent, _extends({}, dataOrder, {\n\t type: orderbookEvent\n\t }));\n\t case '2':\n\t var tradeEvent = _actionTypes.ORDER_BOOK + ':' + _actionTypes.EVENTS.TRADES[order.MDUpdateAction];\n\t return _this6.eventEmitter.emit(tradeEvent, _extends({}, dataOrder, {\n\t type: tradeEvent\n\t }));\n\t case '4':\n\t break;\n\t default:\n\t return null;\n\t }\n\t return null;\n\t });\n\t }\n\t };\n\t\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'emitterPromise', this).call(this, new Promise(function (resolve, reject) {\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'sendMessageAsPromise', _this6).call(_this6, msg, callback).then(function (data) {\n\t if (data.MsgType === 'W') {\n\t // Split orders in bids and asks\n\t /* eslint-disable no-param-reassign */\n\t var _data$MDFullGrp$filte = data.MDFullGrp.filter(function (order) {\n\t return order.MDEntryType === '0' || order.MDEntryType === '1';\n\t }).reduce(function (prev, order) {\n\t var side = order.MDEntryType === '0' ? 'bids' : 'asks';\n\t (prev[side] || (prev[side] = [])).push([order.MDEntryPx / 1e8, order.MDEntrySize / 1e8, order.UserID]);\n\t return prev;\n\t }, []);\n\t\n\t var bids = _data$MDFullGrp$filte.bids;\n\t var asks = _data$MDFullGrp$filte.asks;\n\t /* eslint-enable no-param-reassign */\n\t\n\t (0, _listener.registerEventEmitter)({ MDReqID: data.MDReqID }, subscribeEvent);\n\t\n\t return resolve(_extends({}, data, {\n\t MDFullGrp: _defineProperty({}, data.Symbol, {\n\t bids: bids,\n\t asks: asks\n\t })\n\t }));\n\t }\n\t }).catch(function (err) {\n\t return reject(err);\n\t });\n\t }));\n\t }\n\t }, {\n\t key: 'unSubscribeOrderbook',\n\t value: function unSubscribeOrderbook(MDReqID) {\n\t var msg = {\n\t MsgType: _requests2.default.MARKET_DATA_UNSUBSCRIBE,\n\t MDReqID: MDReqID,\n\t MarketDepth: 0,\n\t SubscriptionRequestType: '2'\n\t };\n\t\n\t _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'sendMessage', this).call(this, msg);\n\t return MDReqID;\n\t }\n\t }, {\n\t key: 'executionReport',\n\t value: function executionReport(callback) {\n\t var _this7 = this;\n\t\n\t (0, _listener.registerListener)('8', function (data) {\n\t callback && callback(data);\n\t var event = _actionTypes.EVENTS.EXECUTION_REPORT[data.ExecType];\n\t return _this7.eventEmitter.emit(_actionTypes.EXECUTION_REPORT + ':' + event, data);\n\t });\n\t\n\t return this.eventEmitter;\n\t }\n\t }, {\n\t key: 'tradeHistory',\n\t value: function tradeHistory() {\n\t var _this8 = this;\n\t\n\t var _ref2 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t var since = _ref2.since;\n\t var filter = _ref2.filter;\n\t var _ref2$page = _ref2.page;\n\t var Page = _ref2$page === undefined ? 0 : _ref2$page;\n\t var _ref2$pageSize = _ref2.pageSize;\n\t var PageSize = _ref2$pageSize === undefined ? 80 : _ref2$pageSize;\n\t var callback = arguments[1];\n\t\n\t var msg = {\n\t MsgType: _requests2.default.TRADE_HISTORY,\n\t TradeHistoryReqID: (0, _listener.generateRequestId)(),\n\t Page: Page,\n\t PageSize: PageSize\n\t };\n\t\n\t if (filter && filter.length > 0) {\n\t msg.Filter = filter;\n\t }\n\t\n\t if (since && typeof since === 'number') {\n\t msg.Since = since;\n\t }\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'sendMessageAsPromise', _this8).call(_this8, msg, callback).then(function (data) {\n\t var Columns = data.Columns;\n\t\n\t var trades = _objectWithoutProperties(data, ['Columns']);\n\t\n\t var TradeHistory = _lodash2.default.groupBy(_lodash2.default.map(data.TradeHistoryGrp, function (trade) {\n\t return _lodash2.default.zipObject(Columns, trade);\n\t }), function (trade) {\n\t return trade.Market;\n\t });\n\t return resolve(_extends({}, trades, {\n\t TradeHistoryGrp: TradeHistory\n\t }));\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'requestDeposit',\n\t value: function requestDeposit() {\n\t var _this9 = this;\n\t\n\t var _ref3 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t var _ref3$currency = _ref3.currency;\n\t var currency = _ref3$currency === undefined ? 'BTC' : _ref3$currency;\n\t var value = _ref3.value;\n\t var depositMethodId = _ref3.depositMethodId;\n\t var callback = arguments[1];\n\t\n\t (0, _listener.registerListener)('U23', function (deposit) {\n\t callback && callback(null, deposit);\n\t return _this9.eventEmitter.emit(_actionTypes.DEPOSIT_REFRESH, deposit);\n\t });\n\t\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'emitterPromise', this).call(this, new Promise(function (resolve, reject) {\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'requestDeposit', _this9).call(_this9, { currency: currency, value: value, depositMethodId: depositMethodId }, callback).then(resolve).catch(reject);\n\t }));\n\t }\n\t }, {\n\t key: 'onDepositRefresh',\n\t value: function onDepositRefresh(callback) {\n\t return new Promise(function (resolve) {\n\t (0, _listener.registerListener)('U23', function (deposit) {\n\t callback && callback(deposit);\n\t return resolve(deposit);\n\t });\n\t });\n\t }\n\t }, {\n\t key: 'requestWithdraw',\n\t value: function requestWithdraw(_ref4, callback) {\n\t var _this10 = this;\n\t\n\t var amount = _ref4.amount;\n\t var data = _ref4.data;\n\t var _ref4$currency = _ref4.currency;\n\t var currency = _ref4$currency === undefined ? 'BTC' : _ref4$currency;\n\t var _ref4$method = _ref4.method;\n\t var method = _ref4$method === undefined ? 'bitcoin' : _ref4$method;\n\t\n\t (0, _listener.registerListener)('U9', function (withdraw) {\n\t callback && callback(null, withdraw);\n\t return _this10.eventEmitter.emit(_actionTypes.WITHDRAW_REFRESH, withdraw);\n\t });\n\t\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'emitterPromise', this).call(this, new Promise(function (resolve, reject) {\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'requestWithdraw', _this10).call(_this10, { amount: amount, data: data, currency: currency, method: method }, callback).then(resolve).catch(reject);\n\t }));\n\t }\n\t }, {\n\t key: 'onWithdrawRefresh',\n\t value: function onWithdrawRefresh(callback) {\n\t return new Promise(function (resolve) {\n\t (0, _listener.registerListener)('U9', function (withdraw) {\n\t callback && callback(withdraw);\n\t return resolve(withdraw);\n\t });\n\t });\n\t }\n\t }]);\n\t\n\t return BlinkTradeWS;\n\t}(_wsTransport2.default);\n\t\n\texports.default = BlinkTradeWS;\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.default = {\n\t HEARTBEAT: '1',\n\t LOGIN: 'BE',\n\t LOGOUT: 'BE',\n\t CHANGE_PASSWORD: 'BE',\n\t\n\t MARKET_DATA_FULL_REFRESH: 'V',\n\t MARKET_DATA_UNSUBSCRIBE: 'V',\n\t\n\t ORDER_SEND: 'D',\n\t ORDER_CANCEL: 'F',\n\t\n\t SECURITY_LIST: 'x',\n\t SECURITY_STATUS: 'e',\n\t BALANCE: 'U2',\n\t ORDER_LIST: 'U4',\n\t BROKER_LIST: 'U28',\n\t TRADE_HISTORY: 'U32',\n\t PROFILE_UPDATE: 'U38',\n\t\n\t REQUEST_DEPOSIT: 'U18',\n\t REQUEST_DEPOSIT_LIST: 'U30',\n\t REQUEST_DEPOSIT_METHODS: 'U20',\n\t REQUEST_WITHDRAW: 'U6',\n\t REQUEST_WITHDRAW_LIST: 'U26',\n\t\n\t CONFIRM_WITHDRAW: 'U24',\n\t CANCEL_WITHDRAW: 'U70'\n\t};\n\n/***/ },\n/* 4 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _baseTransport = __webpack_require__(5);\n\t\n\tvar _baseTransport2 = _interopRequireDefault(_baseTransport);\n\t\n\tvar _fingerprintjs = __webpack_require__(11);\n\t\n\tvar _fingerprintjs2 = _interopRequireDefault(_fingerprintjs);\n\t\n\tvar _nodeify = __webpack_require__(12);\n\t\n\tvar _nodeify2 = _interopRequireDefault(_nodeify);\n\t\n\tvar _eventemitter = __webpack_require__(13);\n\t\n\tvar _listener = __webpack_require__(10);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\t\n\t/* eslint-disable global-require */\n\t\n\tvar WebSocketTransport = function (_BaseTransport) {\n\t _inherits(WebSocketTransport, _BaseTransport);\n\t\n\t /*\n\t * Transport Promise\n\t */\n\t\n\t\n\t /*\n\t * FingerPrint\n\t */\n\t function WebSocketTransport(params) {\n\t _classCallCheck(this, WebSocketTransport);\n\t\n\t var _this = _possibleConstructorReturn(this, (WebSocketTransport.__proto__ || Object.getPrototypeOf(WebSocketTransport)).call(this, params, 'ws'));\n\t\n\t _this.stun = { local: null, public: [] };\n\t\n\t _this.getStun();\n\t _this.getFingerPrint();\n\t\n\t _this.eventEmitter = new _eventemitter.EventEmitter2({ wildcard: true, delimiter: ':' });\n\t return _this;\n\t }\n\t\n\t /*\n\t * Event emitter to dispatch websocket updates\n\t */\n\t\n\t\n\t /*\n\t * Stun object\n\t */\n\t\n\t\n\t /*\n\t * WebSocket Instance\n\t */\n\t\n\t\n\t _createClass(WebSocketTransport, [{\n\t key: 'connect',\n\t value: function connect(callback) {\n\t var _this2 = this;\n\t\n\t return _nodeify2.default.extend(new Promise(function (resolve, reject) {\n\t _this2.request = { resolve: resolve, reject: reject };\n\t\n\t var WebSocket = _this2.isNode ? __webpack_require__(14) : window.WebSocket;\n\t\n\t _this2.socket = new WebSocket(_this2.endpoint);\n\t _this2.socket.onopen = _this2.onOpen.bind(_this2);\n\t _this2.socket.onclose = _this2.onClose.bind(_this2);\n\t _this2.socket.onerror = _this2.onError.bind(_this2);\n\t _this2.socket.onmessage = _this2.onMessage.bind(_this2);\n\t })).nodeify(callback);\n\t }\n\t }, {\n\t key: 'disconnect',\n\t value: function disconnect() {\n\t this.socket.close();\n\t }\n\t }, {\n\t key: 'onOpen',\n\t value: function onOpen() {\n\t this.request.resolve({ connected: true });\n\t }\n\t }, {\n\t key: 'onClose',\n\t value: function onClose() {}\n\t }, {\n\t key: 'onError',\n\t value: function onError() {\n\t this.request.reject();\n\t }\n\t }, {\n\t key: 'sendMessage',\n\t value: function sendMessage(msg) {\n\t if (this.socket.readyState === 1) {\n\t var data = msg;\n\t\n\t data.STUNTIP = this.stun;\n\t data.FingerPrint = this.fingerPrint;\n\t\n\t this.socket.send(JSON.stringify(data));\n\t }\n\t }\n\t }, {\n\t key: 'sendMessageAsPromise',\n\t value: function sendMessageAsPromise(msg, callback) {\n\t var _this3 = this;\n\t\n\t return _nodeify2.default.extend(new Promise(function (resolve, reject) {\n\t var promise = { resolve: resolve, reject: reject };\n\t\n\t if (!msg) {\n\t return reject('Missing Message');\n\t }\n\t\n\t (0, _listener.registerRequest)(msg, promise);\n\t\n\t // Send promise to sendMessage to we can mock it.\n\t _this3.sendMessage(msg, promise);\n\t })).nodeify(callback);\n\t }\n\t }, {\n\t key: 'onMessage',\n\t value: function onMessage(msg) {\n\t var data = JSON.parse(msg.data);\n\t if (data.MsgType === 'ERROR') {\n\t throw new Error('Error: ' + data.Detail + ' ' + data.Description);\n\t }\n\t\n\t var request = (0, _listener.getRequest)(data);\n\t var listener = (0, _listener.getListener)(data.MsgType);\n\t this.dispatchPromise(request, data);\n\t this.dispatchListeners(listener, data);\n\t }\n\t }, {\n\t key: 'dispatchPromise',\n\t value: function dispatchPromise(request, data) {\n\t if (request) {\n\t return request.resolve ? request.resolve(data) : request.callback ? request.callback(data) : null;\n\t }\n\t }\n\t }, {\n\t key: 'dispatchListeners',\n\t value: function dispatchListeners(listener, data) {\n\t return listener && listener(data);\n\t }\n\t\n\t /* eslint-disable no-param-reassign */\n\t\n\t }, {\n\t key: 'emitterPromise',\n\t value: function emitterPromise(promise) {\n\t var _this4 = this;\n\t\n\t promise.on = function (event, listener) {\n\t _this4.eventEmitter.on(event, listener);\n\t return promise;\n\t };\n\t promise.onAny = function (listener) {\n\t _this4.eventEmitter.onAny(listener);\n\t return promise;\n\t };\n\t promise.offAny = function (listener) {\n\t _this4.eventEmitter.offAny(listener);\n\t return promise;\n\t };\n\t promise.once = function (event, listener) {\n\t _this4.eventEmitter.once(event, listener);\n\t return promise;\n\t };\n\t promise.many = function (event, times, listener) {\n\t _this4.eventEmitter.many(event, times, listener);\n\t return promise;\n\t };\n\t promise.removeListener = function (event, listener) {\n\t _this4.eventEmitter.removeListener(event, listener);\n\t return promise;\n\t };\n\t promise.removeAllListeners = function (events) {\n\t _this4.eventEmitter.removeAllListeners(events);\n\t return promise;\n\t };\n\t\n\t return promise;\n\t }\n\t /* eslint-enable no-param-reassign */\n\t\n\t }, {\n\t key: 'getFingerPrint',\n\t value: function getFingerPrint() {\n\t var _this5 = this;\n\t\n\t if (this.isNode) {\n\t return __webpack_require__(15).getMac(function (macAddress) {\n\t _this5.fingerPrint = macAddress;\n\t });\n\t }\n\t return new _fingerprintjs2.default().get(function (fingerPrint) {\n\t _this5.fingerPrint = fingerPrint;\n\t });\n\t }\n\t }, {\n\t key: 'getStun',\n\t value: function getStun() {\n\t var _this6 = this;\n\t\n\t if (this.isNode) {\n\t __webpack_require__(17).getStun(function (data) {\n\t _this6.stun = data;\n\t });\n\t }\n\t }\n\t }]);\n\t\n\t return WebSocketTransport;\n\t}(_baseTransport2.default);\n\t\n\texports.default = WebSocketTransport;\n\n/***/ },\n/* 5 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _base = __webpack_require__(6);\n\t\n\tvar _base2 = _interopRequireDefault(_base);\n\t\n\tvar _requests = __webpack_require__(3);\n\t\n\tvar _requests2 = _interopRequireDefault(_requests);\n\t\n\tvar _requestTypes = __webpack_require__(8);\n\t\n\tvar RequestTypes = _interopRequireWildcard(_requestTypes);\n\t\n\tvar _lodash = __webpack_require__(9);\n\t\n\tvar _lodash2 = _interopRequireDefault(_lodash);\n\t\n\tvar _listener = __webpack_require__(10);\n\t\n\tfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\t\n\tvar BaseTransport = function (_Base) {\n\t _inherits(BaseTransport, _Base);\n\t\n\t function BaseTransport(params, env) {\n\t _classCallCheck(this, BaseTransport);\n\t\n\t var _this = _possibleConstructorReturn(this, (BaseTransport.__proto__ || Object.getPrototypeOf(BaseTransport)).call(this, params, env));\n\t\n\t _this.send = env === 'ws' ? _this.sendMessageAsPromise : _this.fetchTrade;\n\t return _this;\n\t }\n\t\n\t _createClass(BaseTransport, [{\n\t key: 'balance',\n\t value: function balance(callback) {\n\t var _this2 = this;\n\t\n\t var msg = {\n\t MsgType: _requests2.default.BALANCE,\n\t BalanceReqID: (0, _listener.generateRequestId)()\n\t };\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _this2.send(msg, callback).then(function (data) {\n\t var Available = {};\n\t var balances = data[_this2.brokerId];\n\t Object.keys(balances).map(function (currency) {\n\t if (!currency.includes('locked')) {\n\t Available[currency] = balances[currency] - balances[currency + '_locked'];\n\t }\n\t return Available;\n\t });\n\t\n\t return resolve(_extends({}, data, { Available: Available }));\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'myOrders',\n\t value: function myOrders() {\n\t var _this3 = this;\n\t\n\t var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t var _ref$page = _ref.page;\n\t var Page = _ref$page === undefined ? 0 : _ref$page;\n\t var _ref$pageSize = _ref.pageSize;\n\t var PageSize = _ref$pageSize === undefined ? 40 : _ref$pageSize;\n\t var callback = arguments[1];\n\t\n\t var msg = {\n\t MsgType: _requests2.default.ORDER_LIST,\n\t OrdersReqID: (0, _listener.generateRequestId)(),\n\t Page: Page,\n\t PageSize: PageSize\n\t };\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _this3.send(msg, callback).then(function (data) {\n\t var Columns = data.Columns;\n\t\n\t var orders = _objectWithoutProperties(data, ['Columns']);\n\t\n\t var OrdListGrp = _lodash2.default.map(data.OrdListGrp, function (order) {\n\t return _lodash2.default.zipObject(Columns, order);\n\t });\n\t return resolve(_extends({}, orders, {\n\t OrdListGrp: OrdListGrp\n\t }));\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'sendOrder',\n\t value: function sendOrder(_ref2, callback) {\n\t var _this4 = this;\n\t\n\t var side = _ref2.side;\n\t var amount = _ref2.amount;\n\t var price = _ref2.price;\n\t var symbol = _ref2.symbol;\n\t\n\t var msg = {\n\t MsgType: _requests2.default.ORDER_SEND,\n\t ClOrdID: (0, _listener.generateRequestId)(),\n\t Symbol: symbol,\n\t Side: side,\n\t OrdType: '2',\n\t Price: price,\n\t OrderQty: amount,\n\t BrokerID: this.brokerId\n\t };\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _this4.send(msg, callback).then(function (data) {\n\t (0, _listener.deleteRequest)(RequestTypes.CLIENT_ORDER_ID);\n\t resolve(data);\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'cancelOrder',\n\t value: function cancelOrder(param, callback) {\n\t var orderId = param.orderId ? param.orderId : param;\n\t var msg = {\n\t MsgType: _requests2.default.ORDER_CANCEL,\n\t OrderID: orderId\n\t };\n\t\n\t if (param.clientId) {\n\t msg.ClOrdID = param.clientId;\n\t }\n\t\n\t return this.send(msg, callback);\n\t }\n\t\n\t /**\n\t * statusList: 1-Pending, 2-In Progress, 4-Completed, 8-Cancelled\n\t */\n\t\n\t }, {\n\t key: 'requestWithdrawList',\n\t value: function requestWithdrawList() {\n\t var _this5 = this;\n\t\n\t var _ref3 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t var _ref3$page = _ref3.page;\n\t var Page = _ref3$page === undefined ? 0 : _ref3$page;\n\t var _ref3$pageSize = _ref3.pageSize;\n\t var PageSize = _ref3$pageSize === undefined ? 20 : _ref3$pageSize;\n\t var _ref3$statusList = _ref3.statusList;\n\t var StatusList = _ref3$statusList === undefined ? ['1', '2', '4', '8'] : _ref3$statusList;\n\t var callback = arguments[1];\n\t\n\t var msg = {\n\t MsgType: _requests2.default.REQUEST_WITHDRAW_LIST,\n\t WithdrawListReqID: (0, _listener.generateRequestId)(),\n\t Page: Page,\n\t PageSize: PageSize,\n\t StatusList: StatusList\n\t };\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _this5.send(msg, callback).then(function (data) {\n\t var Columns = data.Columns;\n\t\n\t var withdrawData = _objectWithoutProperties(data, ['Columns']);\n\t\n\t var WithdrawListGrp = _lodash2.default.map(data.WithdrawListGrp, function (withdraw) {\n\t return _lodash2.default.zipObject(Columns, withdraw);\n\t });\n\t return resolve(_extends({}, withdrawData, {\n\t WithdrawListGrp: WithdrawListGrp\n\t }));\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'requestWithdraw',\n\t value: function requestWithdraw(_ref4, callback) {\n\t var amount = _ref4.amount;\n\t var data = _ref4.data;\n\t var _ref4$currency = _ref4.currency;\n\t var currency = _ref4$currency === undefined ? 'BTC' : _ref4$currency;\n\t var _ref4$method = _ref4.method;\n\t var method = _ref4$method === undefined ? 'bitcoin' : _ref4$method;\n\t\n\t var reqId = (0, _listener.generateRequestId)();\n\t var msg = {\n\t MsgType: _requests2.default.REQUEST_WITHDRAW,\n\t WithdrawReqID: reqId,\n\t ClOrdID: reqId,\n\t Method: method,\n\t Amount: amount,\n\t Currency: currency,\n\t Data: data\n\t };\n\t\n\t return this.send(msg, callback);\n\t }\n\t }, {\n\t key: 'confirmWithdraw',\n\t value: function confirmWithdraw(_ref5, callback) {\n\t var _this6 = this;\n\t\n\t var WithdrawID = _ref5.withdrawId;\n\t var confirmationToken = _ref5.confirmationToken;\n\t var secondFactor = _ref5.secondFactor;\n\t\n\t var msg = {\n\t MsgType: _requests2.default.CONFIRM_WITHDRAW,\n\t WithdrawReqID: (0, _listener.generateRequestId)(),\n\t WithdrawID: WithdrawID\n\t };\n\t\n\t if (confirmationToken) {\n\t msg.ConfirmationToken = confirmationToken;\n\t }\n\t\n\t if (secondFactor) {\n\t msg.SecondFactor = secondFactor;\n\t }\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _this6.send(msg, callback).then(function (data) {\n\t return resolve(_extends({}, data));\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'cancelWithdraw',\n\t value: function cancelWithdraw(withdrawId, callback) {\n\t var _this7 = this;\n\t\n\t var reqId = (0, _listener.generateRequestId)();\n\t var msg = {\n\t MsgType: _requests2.default.CANCEL_WITHDRAW,\n\t WithdrawCancelReqID: reqId,\n\t ClOrdID: reqId,\n\t WithdrawID: withdrawId\n\t };\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _this7.send(msg, callback).then(function (data) {\n\t return resolve(_extends({}, data));\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'requestDepositList',\n\t value: function requestDepositList() {\n\t var _this8 = this;\n\t\n\t var _ref6 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t var _ref6$page = _ref6.page;\n\t var Page = _ref6$page === undefined ? 0 : _ref6$page;\n\t var _ref6$pageSize = _ref6.pageSize;\n\t var PageSize = _ref6$pageSize === undefined ? 20 : _ref6$pageSize;\n\t var _ref6$status = _ref6.status;\n\t var StatusList = _ref6$status === undefined ? ['1', '2', '4', '8'] : _ref6$status;\n\t var callback = arguments[1];\n\t\n\t var msg = {\n\t MsgType: _requests2.default.REQUEST_DEPOSIT_LIST,\n\t DepositListReqID: (0, _listener.generateRequestId)(),\n\t Page: Page,\n\t PageSize: PageSize,\n\t StatusList: StatusList\n\t };\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _this8.send(msg, callback).then(function (data) {\n\t var Columns = data.Columns;\n\t\n\t var depositData = _objectWithoutProperties(data, ['Columns']);\n\t\n\t var DepositListGrp = _lodash2.default.map(data.DepositListGrp, function (deposit) {\n\t return _lodash2.default.zipObject(Columns, deposit);\n\t });\n\t return resolve(_extends({}, depositData, {\n\t DepositListGrp: DepositListGrp\n\t }));\n\t });\n\t });\n\t }\n\t }, {\n\t key: 'requestDeposit',\n\t value: function requestDeposit() {\n\t var _ref7 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t var _ref7$currency = _ref7.currency;\n\t var currency = _ref7$currency === undefined ? 'BTC' : _ref7$currency;\n\t var value = _ref7.value;\n\t var depositMethodId = _ref7.depositMethodId;\n\t var callback = arguments[1];\n\t\n\t var reqId = (0, _listener.generateRequestId)();\n\t var msg = {\n\t MsgType: _requests2.default.REQUEST_DEPOSIT,\n\t DepositReqID: reqId,\n\t ClOrdID: reqId,\n\t Currency: currency,\n\t BrokerID: this.brokerId\n\t };\n\t\n\t if (currency !== 'BTC') {\n\t msg.DepositMethodID = depositMethodId;\n\t msg.Value = value;\n\t }\n\t\n\t return this.send(msg, callback);\n\t }\n\t }, {\n\t key: 'requestDepositMethods',\n\t value: function requestDepositMethods(callback) {\n\t var msg = {\n\t MsgType: _requests2.default.REQUEST_DEPOSIT_METHODS,\n\t DepositMethodReqID: (0, _listener.generateRequestId)()\n\t };\n\t\n\t return this.send(msg, callback);\n\t }\n\t }]);\n\t\n\t return BaseTransport;\n\t}(_base2.default);\n\t\n\texports.default = BaseTransport;\n\n/***/ },\n/* 6 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _common = __webpack_require__(7);\n\t\n\tvar _common2 = _interopRequireDefault(_common);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } } /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\t\n\tvar Base =\n\t\n\t/*\n\t * Broker id\n\t */\n\tfunction Base() {\n\t var params = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t var env = arguments[1];\n\t\n\t _classCallCheck(this, Base);\n\t\n\t var endpoint = params.url ? params.url : params.prod ? _common2.default.prod[env] : _common2.default.testnet[env];\n\t\n\t this.brokerId = params.brokerId || 5;\n\t\n\t this.endpoint = endpoint;\n\t\n\t this.isNode = typeof window === 'undefined';\n\t}\n\t\n\t/*\n\t * Is node.js environment.\n\t */\n\t\n\t\n\t/*\n\t * url endpoint.\n\t */\n\t;\n\t\n\texports.default = Base;\n\n/***/ },\n/* 7 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.default = {\n\t prod: {\n\t ws: 'wss://api.blinktrade.com/trade/',\n\t rest: 'https://api.blinktrade.com/'\n\t },\n\t testnet: {\n\t ws: 'wss://api.testnet.blinktrade.com/trade/',\n\t rest: 'https://api.testnet.blinktrade.com/'\n\t }\n\t};\n\n/***/ },\n/* 8 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\tvar SOCKET_ID = exports.SOCKET_ID = 'SocketID';\n\tvar REQUEST_ID = exports.REQUEST_ID = 'ReqID';\n\tvar TEST_REQUEST_ID = exports.TEST_REQUEST_ID = 'TestReqID';\n\tvar USER_REQUEST_ID = exports.USER_REQUEST_ID = 'UserReqID';\n\tvar SECURITY_REQUEST_ID = exports.SECURITY_REQUEST_ID = 'SecurityReqID';\n\tvar RESET_PASSWORD_REQUEST_ID = exports.RESET_PASSWORD_REQUEST_ID = 'ResetPasswordReqID';\n\tvar DEPOSIT_REQUEST_ID = exports.DEPOSIT_REQUEST_ID = 'DepositReqID';\n\tvar WITHDRAW_REQUEST_ID = exports.WITHDRAW_REQUEST_ID = 'WithdrawReqID';\n\tvar BALANCE_REQUEST_ID = exports.BALANCE_REQUEST_ID = 'BalanceReqID';\n\tvar ORDERS_REQUEST_ID = exports.ORDERS_REQUEST_ID = 'OrdersReqID';\n\tvar ENABLE_TWO_FACTOR_REQUEST_ID = exports.ENABLE_TWO_FACTOR_REQUEST_ID = 'EnableTwoFactorReqID';\n\tvar DEPOSIT_METHOD_REQUEST_ID = exports.DEPOSIT_METHOD_REQUEST_ID = 'DepositMethodReqID';\n\tvar WITHDRAW_LIST_REQUEST_ID = exports.WITHDRAW_LIST_REQUEST_ID = 'WithdrawListReqID';\n\tvar BROKER_LIST_REQUEST_ID = exports.BROKER_LIST_REQUEST_ID = 'BrokerListReqID';\n\tvar DEPOSIT_LIST_REQUEST_ID = exports.DEPOSIT_LIST_REQUEST_ID = 'DepositListReqID';\n\tvar TRADE_HISTORY_REQUEST_ID = exports.TRADE_HISTORY_REQUEST_ID = 'TradeHistoryReqID';\n\tvar LEDGER_LIST_REQUEST_ID = exports.LEDGER_LIST_REQUEST_ID = 'LedgerListReqID';\n\tvar TRADERS_RANK_REQUEST_ID = exports.TRADERS_RANK_REQUEST_ID = 'TradersRankReqID';\n\tvar UPDATE_REQUEST_ID = exports.UPDATE_REQUEST_ID = 'UpdateReqID';\n\tvar POSITION_REQUEST_ID = exports.POSITION_REQUEST_ID = 'PositionReqID';\n\tvar SECURITY_STATUS_REQUEST_ID = exports.SECURITY_STATUS_REQUEST_ID = 'SecurityStatusReqID';\n\tvar API_KEY_LIST_REQUEST_ID = exports.API_KEY_LIST_REQUEST_ID = 'APIKeyListReqID';\n\tvar API_KEY_CREATE_REQUEST_ID = exports.API_KEY_CREATE_REQUEST_ID = 'APIKeyCreateReqID';\n\tvar API_KEY_REVOKE_REQUEST_ID = exports.API_KEY_REVOKE_REQUEST_ID = 'APIKeyRevokeReqID';\n\tvar PROCESS_DEPOSIT_REQUEST_ID = exports.PROCESS_DEPOSIT_REQUEST_ID = 'ProcessDepositReqID';\n\tvar CUSTOMER_LIST_REQUEST_ID = exports.CUSTOMER_LIST_REQUEST_ID = 'CustomerListReqID';\n\tvar CUSTOMER_REQUEST_ID = exports.CUSTOMER_REQUEST_ID = 'CustomerReqID';\n\tvar PROCESS_WITHDRAW_REQUEST_ID = exports.PROCESS_WITHDRAW_REQUEST_ID = 'ProcessWithdrawReqID';\n\tvar VERIFY_CUSTOMER_REQUEST_ID = exports.VERIFY_CUSTOMER_REQUEST_ID = 'VerifyCustomerReqID';\n\tvar MD_REQUEST_ID = exports.MD_REQUEST_ID = 'MDReqID';\n\tvar CLIENT_ORDER_ID = exports.CLIENT_ORDER_ID = 'ClOrdID';\n\n/***/ },\n/* 9 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"lodash\");\n\n/***/ },\n/* 10 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\t\n\texports.getListeners = getListeners;\n\texports.generateRequestId = generateRequestId;\n\texports.getListener = getListener;\n\texports.getRequest = getRequest;\n\texports.registerRequest = registerRequest;\n\texports.registerEventEmitter = registerEventEmitter;\n\texports.registerListener = registerListener;\n\texports.deleteRequest = deleteRequest;\n\t\n\tvar _lodash = __webpack_require__(9);\n\t\n\tvar _lodash2 = _interopRequireDefault(_lodash);\n\t\n\tvar _requestTypes = __webpack_require__(8);\n\t\n\tvar RequestTypes = _interopRequireWildcard(_requestTypes);\n\t\n\tfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tvar requests = {};\n\tvar listeners = {};\n\t\n\tfunction getListeners() {\n\t return requests;\n\t}\n\t\n\tfunction generateRequestId() {\n\t return parseInt(String(1e7 * Math.random()), 10);\n\t}\n\t\n\tfunction getListener(msgType) {\n\t return listeners[msgType];\n\t}\n\t\n\tfunction getRequest(message) {\n\t var result = void 0;\n\t _lodash2.default.mapKeys(RequestTypes, function (key) {\n\t if (_lodash2.default.has(message, key)) {\n\t result = _lodash2.default.find(requests[key], { ReqId: String(message[key]) });\n\t }\n\t });\n\t\n\t return result;\n\t}\n\t\n\tfunction registerRequest(message, promise) {\n\t _lodash2.default.mapKeys(RequestTypes, function (key) {\n\t if (_lodash2.default.has(message, key)) {\n\t requests[key] = requests[key] || [];\n\t requests[key].push(_extends({ ReqId: String(message[key]) }, promise));\n\t }\n\t });\n\t\n\t return requests;\n\t}\n\t\n\tfunction registerEventEmitter(message, callback) {\n\t _lodash2.default.mapKeys(RequestTypes, function (key) {\n\t if (_lodash2.default.has(message, key)) {\n\t if (requests[key] !== []) {\n\t var index = _lodash2.default.findIndex(requests[key], { ReqId: String(message[key]) });\n\t requests[key][index] = _extends({}, requests[key][index], {\n\t resolve: null,\n\t reject: null,\n\t callback: callback\n\t });\n\t }\n\t }\n\t });\n\t\n\t return requests;\n\t}\n\t\n\tfunction registerListener(msgType, callback) {\n\t listeners[msgType] = listeners[msgType] || [];\n\t listeners[msgType] = callback;\n\t}\n\t\n\tfunction deleteRequest(key) {\n\t requests = _lodash2.default.omit(requests, [key]);\n\t return requests;\n\t}\n\n/***/ },\n/* 11 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"fingerprintjs2\");\n\n/***/ },\n/* 12 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"nodeify\");\n\n/***/ },\n/* 13 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"eventemitter2\");\n\n/***/ },\n/* 14 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"ws\");\n\n/***/ },\n/* 15 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.getMac = getMac;\n\t\n\tvar _macaddress = __webpack_require__(16);\n\t\n\tvar _macaddress2 = _interopRequireDefault(_macaddress);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction getMac(callback) {\n\t _macaddress2.default.all(function (err, all) {\n\t var hashCode = function hashCode(str) {\n\t var hash = 0;\n\t if (str.length === 0) return hash;\n\t for (var i = 0; i < str.length; i++) {\n\t hash = (hash << 5) - hash + str.charCodeAt(i);\n\t hash = hash & hash; // Convert to 32bit integer\n\t }\n\t return hash;\n\t };\n\t\n\t var macAddresses = '';\n\t Object.keys(all).forEach(function (iface) {\n\t macAddresses += all[iface].mac;\n\t });\n\t\n\t var fingerPrint = hashCode(macAddresses);\n\t if (fingerPrint < 0) {\n\t fingerPrint *= -1;\n\t }\n\t\n\t callback(fingerPrint);\n\t });\n\t} /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\n/***/ },\n/* 16 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"macaddress\");\n\n/***/ },\n/* 17 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(Buffer) {'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }(); /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t */\n\t\n\t/* eslint-disable no-param-reassign */\n\t\n\texports.getStun = getStun;\n\t\n\tvar _ip = __webpack_require__(22);\n\t\n\tvar _ip2 = _interopRequireDefault(_ip);\n\t\n\tvar _dgram = __webpack_require__(23);\n\t\n\tvar _dgram2 = _interopRequireDefault(_dgram);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tvar stunIp = { local: null, public: [] };\n\t\n\tfunction addIPAddress(ipAddress) {\n\t if (ipAddress.match(/^(192\\.168\\.|169\\.254\\.|10\\.|172\\.(1[6-9]|2\\d|3[01]))/)) {\n\t stunIp.local = ipAddress;\n\t } else {\n\t if (stunIp.public.indexOf(ipAddress) === -1) {\n\t stunIp.public.push(ipAddress);\n\t }\n\t }\n\t}\n\t\n\tfunction getStun(callback) {\n\t var socket = _dgram2.default.createSocket('udp4');\n\t\n\t var STUN_HEADER_LENGTH = 20;\n\t var stunRequest = new Buffer(STUN_HEADER_LENGTH);\n\t\n\t var STUN_METHOD_REQUEST = 0x000;\n\t var STUN_BINDING_CLASS = 0x0001;\n\t var STUN_MAGIC_COOKIE = 0x2112A442;\n\t var STUN_TID_MAX = Math.pow(2, 32);\n\t\n\t var STUN_ATTR_MAPPED_ADDRESS = 0x0001;\n\t var STUN_ATTR_XOR_MAPPED_ADDRESS = 0x8020;\n\t var STUN_ATTR_XOR_MAPPED_ADDRESS_ALT = 0x0020;\n\t\n\t var stunTxId = Math.random() * STUN_TID_MAX;\n\t\n\t var stunServers = [[3478, 'stun.services.mozilla.com'], [19302, 'stun.l.google.com'], [3478, 'stun.stunprotocol.org'], [3478, 'stun.softjoys.com'], [3478, 'stun.samsungsmartcam.com'], [3478, 'stun.sonetel.com'], [3478, 'stun.tagan.ru'], [3478, 'stun.voipgain.com'], [3478, 'stunserver.org'], [3478, 'stun.advfn.com'], [3478, 'stun.annatel.net'], [3478, 'stun.freevoipdeal.com']];\n\t\n\t stunRequest.writeUInt16BE((STUN_BINDING_CLASS | STUN_METHOD_REQUEST) & 0x3fff, 0);\n\t stunRequest.writeUInt16BE(0, 2);\n\t stunRequest.writeUInt32BE(STUN_MAGIC_COOKIE, 4);\n\t stunRequest.writeUInt32BE(0, 8);\n\t stunRequest.writeUInt32BE(0, 12);\n\t stunRequest.writeUInt32BE(stunTxId, 16);\n\t\n\t socket.on('message', function (msg) {\n\t var xor = function xor(a, b) {\n\t var data = [];\n\t if (b.length > a.length) {\n\t var tmp = a;\n\t a = b;\n\t b = tmp;\n\t }\n\t for (var i = 0, len = a.length; i < len; i++) {\n\t data.push(a[i] ^ b[i]);\n\t }\n\t\n\t return new Buffer(data);\n\t };\n\t\n\t var block = msg.readUInt8(0);\n\t var bit1 = block & 0x80;\n\t var bit2 = block & 0x40;\n\t\n\t if (!(bit1 === 0 && bit2 === 0)) {\n\t return;\n\t }\n\t\n\t var msgHeader = msg.slice(0, STUN_HEADER_LENGTH);\n\t var msgAttrs = msg.slice(STUN_HEADER_LENGTH, msg.length);\n\t\n\t var offset = 0;\n\t\n\t while (offset < msgAttrs.length) {\n\t var attrType = msgAttrs.readUInt16BE(offset);\n\t offset += 2;\n\t\n\t var attrBuffLength = msgAttrs.readUInt16BE(offset);\n\t var blockOut = attrBuffLength % 4;\n\t if (blockOut > 0) {\n\t attrBuffLength += 4 - blockOut;\n\t }\n\t offset += 2;\n\t\n\t var value = msgAttrs.slice(offset, offset + attrBuffLength);\n\t offset += attrBuffLength;\n\t\n\t var family = void 0;\n\t var address = void 0;\n\t switch (attrType) {\n\t case STUN_ATTR_MAPPED_ADDRESS:\n\t family = value.readUInt16BE(0) === 0x02 ? 6 : 4;\n\t address = _ip2.default.toString(value, 4, family);\n\t addIPAddress(address);\n\t break;\n\t\n\t case STUN_ATTR_XOR_MAPPED_ADDRESS:\n\t case STUN_ATTR_XOR_MAPPED_ADDRESS_ALT:\n\t family = value.readUInt16BE(0) === 0x02 ? 6 : 4;\n\t var magic = msgHeader.slice(4, 8);\n\t var tid = msgHeader.slice(8, 20);\n\t var xaddr = value.slice(4, family === 4 ? 8 : 20);\n\t var addr = xor(xaddr, family === 4 ? magic : value.concat([magic, tid]));\n\t address = _ip2.default.toString(addr, 0, family);\n\t addIPAddress(address);\n\t break;\n\t default:\n\t }\n\t }\n\t\n\t callback(stunIp);\n\t });\n\t\n\t stunServers.map(function (_ref) {\n\t var _ref2 = _slicedToArray(_ref, 2);\n\t\n\t var port = _ref2[0];\n\t var host = _ref2[1];\n\t return socket.send(stunRequest, 0, stunRequest.length, port, host);\n\t });\n\t}\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18).Buffer))\n\n/***/ },\n/* 18 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(Buffer, global) {/*!\n\t * The buffer module from node.js, for the browser.\n\t *\n\t * @author Feross Aboukhadijeh \n\t * @license MIT\n\t */\n\t/* eslint-disable no-proto */\n\t\n\t'use strict'\n\t\n\tvar base64 = __webpack_require__(19)\n\tvar ieee754 = __webpack_require__(20)\n\tvar isArray = __webpack_require__(21)\n\t\n\texports.Buffer = Buffer\n\texports.SlowBuffer = SlowBuffer\n\texports.INSPECT_MAX_BYTES = 50\n\t\n\t/**\n\t * If `Buffer.TYPED_ARRAY_SUPPORT`:\n\t * === true Use Uint8Array implementation (fastest)\n\t * === false Use Object implementation (most compatible, even IE6)\n\t *\n\t * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n\t * Opera 11.6+, iOS 4.2+.\n\t *\n\t * Due to various browser bugs, sometimes the Object implementation will be used even\n\t * when the browser supports typed arrays.\n\t *\n\t * Note:\n\t *\n\t * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n\t * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n\t *\n\t * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n\t *\n\t * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n\t * incorrect length in some situations.\n\t\n\t * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n\t * get the Object implementation, which is slower but behaves correctly.\n\t */\n\tBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n\t ? global.TYPED_ARRAY_SUPPORT\n\t : typedArraySupport()\n\t\n\t/*\n\t * Export kMaxLength after typed array support is determined.\n\t */\n\texports.kMaxLength = kMaxLength()\n\t\n\tfunction typedArraySupport () {\n\t try {\n\t var arr = new Uint8Array(1)\n\t arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n\t return arr.foo() === 42 && // typed array instances can be augmented\n\t typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n\t arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n\t } catch (e) {\n\t return false\n\t }\n\t}\n\t\n\tfunction kMaxLength () {\n\t return Buffer.TYPED_ARRAY_SUPPORT\n\t ? 0x7fffffff\n\t : 0x3fffffff\n\t}\n\t\n\tfunction createBuffer (that, length) {\n\t if (kMaxLength() < length) {\n\t throw new RangeError('Invalid typed array length')\n\t }\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t // Return an augmented `Uint8Array` instance, for best performance\n\t that = new Uint8Array(length)\n\t that.__proto__ = Buffer.prototype\n\t } else {\n\t // Fallback: Return an object instance of the Buffer class\n\t if (that === null) {\n\t that = new Buffer(length)\n\t }\n\t that.length = length\n\t }\n\t\n\t return that\n\t}\n\t\n\t/**\n\t * The Buffer constructor returns instances of `Uint8Array` that have their\n\t * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n\t * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n\t * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n\t * returns a single octet.\n\t *\n\t * The `Uint8Array` prototype remains unmodified.\n\t */\n\t\n\tfunction Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}\n\t\n\tBuffer.poolSize = 8192 // not used by this implementation\n\t\n\t// TODO: Legacy, not needed anymore. Remove in next major version.\n\tBuffer._augment = function (arr) {\n\t arr.__proto__ = Buffer.prototype\n\t return arr\n\t}\n\t\n\tfunction from (that, value, encodingOrOffset, length) {\n\t if (typeof value === 'number') {\n\t throw new TypeError('\"value\" argument must not be a number')\n\t }\n\t\n\t if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n\t return fromArrayBuffer(that, value, encodingOrOffset, length)\n\t }\n\t\n\t if (typeof value === 'string') {\n\t return fromString(that, value, encodingOrOffset)\n\t }\n\t\n\t return fromObject(that, value)\n\t}\n\t\n\t/**\n\t * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n\t * if value is a number.\n\t * Buffer.from(str[, encoding])\n\t * Buffer.from(array)\n\t * Buffer.from(buffer)\n\t * Buffer.from(arrayBuffer[, byteOffset[, length]])\n\t **/\n\tBuffer.from = function (value, encodingOrOffset, length) {\n\t return from(null, value, encodingOrOffset, length)\n\t}\n\t\n\tif (Buffer.TYPED_ARRAY_SUPPORT) {\n\t Buffer.prototype.__proto__ = Uint8Array.prototype\n\t Buffer.__proto__ = Uint8Array\n\t if (typeof Symbol !== 'undefined' && Symbol.species &&\n\t Buffer[Symbol.species] === Buffer) {\n\t // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n\t Object.defineProperty(Buffer, Symbol.species, {\n\t value: null,\n\t configurable: true\n\t })\n\t }\n\t}\n\t\n\tfunction assertSize (size) {\n\t if (typeof size !== 'number') {\n\t throw new TypeError('\"size\" argument must be a number')\n\t } else if (size < 0) {\n\t throw new RangeError('\"size\" argument must not be negative')\n\t }\n\t}\n\t\n\tfunction alloc (that, size, fill, encoding) {\n\t assertSize(size)\n\t if (size <= 0) {\n\t return createBuffer(that, size)\n\t }\n\t if (fill !== undefined) {\n\t // Only pay attention to encoding if it's a string. This\n\t // prevents accidentally sending in a number that would\n\t // be interpretted as a start offset.\n\t return typeof encoding === 'string'\n\t ? createBuffer(that, size).fill(fill, encoding)\n\t : createBuffer(that, size).fill(fill)\n\t }\n\t return createBuffer(that, size)\n\t}\n\t\n\t/**\n\t * Creates a new filled Buffer instance.\n\t * alloc(size[, fill[, encoding]])\n\t **/\n\tBuffer.alloc = function (size, fill, encoding) {\n\t return alloc(null, size, fill, encoding)\n\t}\n\t\n\tfunction allocUnsafe (that, size) {\n\t assertSize(size)\n\t that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t for (var i = 0; i < size; ++i) {\n\t that[i] = 0\n\t }\n\t }\n\t return that\n\t}\n\t\n\t/**\n\t * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n\t * */\n\tBuffer.allocUnsafe = function (size) {\n\t return allocUnsafe(null, size)\n\t}\n\t/**\n\t * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n\t */\n\tBuffer.allocUnsafeSlow = function (size) {\n\t return allocUnsafe(null, size)\n\t}\n\t\n\tfunction fromString (that, string, encoding) {\n\t if (typeof encoding !== 'string' || encoding === '') {\n\t encoding = 'utf8'\n\t }\n\t\n\t if (!Buffer.isEncoding(encoding)) {\n\t throw new TypeError('\"encoding\" must be a valid string encoding')\n\t }\n\t\n\t var length = byteLength(string, encoding) | 0\n\t that = createBuffer(that, length)\n\t\n\t var actual = that.write(string, encoding)\n\t\n\t if (actual !== length) {\n\t // Writing a hex string, for example, that contains invalid characters will\n\t // cause everything after the first invalid character to be ignored. (e.g.\n\t // 'abxxcd' will be treated as 'ab')\n\t that = that.slice(0, actual)\n\t }\n\t\n\t return that\n\t}\n\t\n\tfunction fromArrayLike (that, array) {\n\t var length = array.length < 0 ? 0 : checked(array.length) | 0\n\t that = createBuffer(that, length)\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}\n\t\n\tfunction fromArrayBuffer (that, array, byteOffset, length) {\n\t array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\t\n\t if (byteOffset < 0 || array.byteLength < byteOffset) {\n\t throw new RangeError('\\'offset\\' is out of bounds')\n\t }\n\t\n\t if (array.byteLength < byteOffset + (length || 0)) {\n\t throw new RangeError('\\'length\\' is out of bounds')\n\t }\n\t\n\t if (byteOffset === undefined && length === undefined) {\n\t array = new Uint8Array(array)\n\t } else if (length === undefined) {\n\t array = new Uint8Array(array, byteOffset)\n\t } else {\n\t array = new Uint8Array(array, byteOffset, length)\n\t }\n\t\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t // Return an augmented `Uint8Array` instance, for best performance\n\t that = array\n\t that.__proto__ = Buffer.prototype\n\t } else {\n\t // Fallback: Return an object instance of the Buffer class\n\t that = fromArrayLike(that, array)\n\t }\n\t return that\n\t}\n\t\n\tfunction fromObject (that, obj) {\n\t if (Buffer.isBuffer(obj)) {\n\t var len = checked(obj.length) | 0\n\t that = createBuffer(that, len)\n\t\n\t if (that.length === 0) {\n\t return that\n\t }\n\t\n\t obj.copy(that, 0, 0, len)\n\t return that\n\t }\n\t\n\t if (obj) {\n\t if ((typeof ArrayBuffer !== 'undefined' &&\n\t obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n\t if (typeof obj.length !== 'number' || isnan(obj.length)) {\n\t return createBuffer(that, 0)\n\t }\n\t return fromArrayLike(that, obj)\n\t }\n\t\n\t if (obj.type === 'Buffer' && isArray(obj.data)) {\n\t return fromArrayLike(that, obj.data)\n\t }\n\t }\n\t\n\t throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n\t}\n\t\n\tfunction checked (length) {\n\t // Note: cannot use `length < kMaxLength()` here because that fails when\n\t // length is NaN (which is otherwise coerced to zero.)\n\t if (length >= kMaxLength()) {\n\t throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n\t 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n\t }\n\t return length | 0\n\t}\n\t\n\tfunction SlowBuffer (length) {\n\t if (+length != length) { // eslint-disable-line eqeqeq\n\t length = 0\n\t }\n\t return Buffer.alloc(+length)\n\t}\n\t\n\tBuffer.isBuffer = function isBuffer (b) {\n\t return !!(b != null && b._isBuffer)\n\t}\n\t\n\tBuffer.compare = function compare (a, b) {\n\t if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n\t throw new TypeError('Arguments must be Buffers')\n\t }\n\t\n\t if (a === b) return 0\n\t\n\t var x = a.length\n\t var y = b.length\n\t\n\t for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n\t if (a[i] !== b[i]) {\n\t x = a[i]\n\t y = b[i]\n\t break\n\t }\n\t }\n\t\n\t if (x < y) return -1\n\t if (y < x) return 1\n\t return 0\n\t}\n\t\n\tBuffer.isEncoding = function isEncoding (encoding) {\n\t switch (String(encoding).toLowerCase()) {\n\t case 'hex':\n\t case 'utf8':\n\t case 'utf-8':\n\t case 'ascii':\n\t case 'latin1':\n\t case 'binary':\n\t case 'base64':\n\t case 'ucs2':\n\t case 'ucs-2':\n\t case 'utf16le':\n\t case 'utf-16le':\n\t return true\n\t default:\n\t return false\n\t }\n\t}\n\t\n\tBuffer.concat = function concat (list, length) {\n\t if (!isArray(list)) {\n\t throw new TypeError('\"list\" argument must be an Array of Buffers')\n\t }\n\t\n\t if (list.length === 0) {\n\t return Buffer.alloc(0)\n\t }\n\t\n\t var i\n\t if (length === undefined) {\n\t length = 0\n\t for (i = 0; i < list.length; ++i) {\n\t length += list[i].length\n\t }\n\t }\n\t\n\t var buffer = Buffer.allocUnsafe(length)\n\t var pos = 0\n\t for (i = 0; i < list.length; ++i) {\n\t var buf = list[i]\n\t if (!Buffer.isBuffer(buf)) {\n\t throw new TypeError('\"list\" argument must be an Array of Buffers')\n\t }\n\t buf.copy(buffer, pos)\n\t pos += buf.length\n\t }\n\t return buffer\n\t}\n\t\n\tfunction byteLength (string, encoding) {\n\t if (Buffer.isBuffer(string)) {\n\t return string.length\n\t }\n\t if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n\t (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n\t return string.byteLength\n\t }\n\t if (typeof string !== 'string') {\n\t string = '' + string\n\t }\n\t\n\t var len = string.length\n\t if (len === 0) return 0\n\t\n\t // Use a for loop to avoid recursion\n\t var loweredCase = false\n\t for (;;) {\n\t switch (encoding) {\n\t case 'ascii':\n\t case 'latin1':\n\t case 'binary':\n\t return len\n\t case 'utf8':\n\t case 'utf-8':\n\t case undefined:\n\t return utf8ToBytes(string).length\n\t case 'ucs2':\n\t case 'ucs-2':\n\t case 'utf16le':\n\t case 'utf-16le':\n\t return len * 2\n\t case 'hex':\n\t return len >>> 1\n\t case 'base64':\n\t return base64ToBytes(string).length\n\t default:\n\t if (loweredCase) return utf8ToBytes(string).length // assume utf8\n\t encoding = ('' + encoding).toLowerCase()\n\t loweredCase = true\n\t }\n\t }\n\t}\n\tBuffer.byteLength = byteLength\n\t\n\tfunction slowToString (encoding, start, end) {\n\t var loweredCase = false\n\t\n\t // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n\t // property of a typed array.\n\t\n\t // This behaves neither like String nor Uint8Array in that we set start/end\n\t // to their upper/lower bounds if the value passed is out of range.\n\t // undefined is handled specially as per ECMA-262 6th Edition,\n\t // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n\t if (start === undefined || start < 0) {\n\t start = 0\n\t }\n\t // Return early if start > this.length. Done here to prevent potential uint32\n\t // coercion fail below.\n\t if (start > this.length) {\n\t return ''\n\t }\n\t\n\t if (end === undefined || end > this.length) {\n\t end = this.length\n\t }\n\t\n\t if (end <= 0) {\n\t return ''\n\t }\n\t\n\t // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n\t end >>>= 0\n\t start >>>= 0\n\t\n\t if (end <= start) {\n\t return ''\n\t }\n\t\n\t if (!encoding) encoding = 'utf8'\n\t\n\t while (true) {\n\t switch (encoding) {\n\t case 'hex':\n\t return hexSlice(this, start, end)\n\t\n\t case 'utf8':\n\t case 'utf-8':\n\t return utf8Slice(this, start, end)\n\t\n\t case 'ascii':\n\t return asciiSlice(this, start, end)\n\t\n\t case 'latin1':\n\t case 'binary':\n\t return latin1Slice(this, start, end)\n\t\n\t case 'base64':\n\t return base64Slice(this, start, end)\n\t\n\t case 'ucs2':\n\t case 'ucs-2':\n\t case 'utf16le':\n\t case 'utf-16le':\n\t return utf16leSlice(this, start, end)\n\t\n\t default:\n\t if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n\t encoding = (encoding + '').toLowerCase()\n\t loweredCase = true\n\t }\n\t }\n\t}\n\t\n\t// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n\t// Buffer instances.\n\tBuffer.prototype._isBuffer = true\n\t\n\tfunction swap (b, n, m) {\n\t var i = b[n]\n\t b[n] = b[m]\n\t b[m] = i\n\t}\n\t\n\tBuffer.prototype.swap16 = function swap16 () {\n\t var len = this.length\n\t if (len % 2 !== 0) {\n\t throw new RangeError('Buffer size must be a multiple of 16-bits')\n\t }\n\t for (var i = 0; i < len; i += 2) {\n\t swap(this, i, i + 1)\n\t }\n\t return this\n\t}\n\t\n\tBuffer.prototype.swap32 = function swap32 () {\n\t var len = this.length\n\t if (len % 4 !== 0) {\n\t throw new RangeError('Buffer size must be a multiple of 32-bits')\n\t }\n\t for (var i = 0; i < len; i += 4) {\n\t swap(this, i, i + 3)\n\t swap(this, i + 1, i + 2)\n\t }\n\t return this\n\t}\n\t\n\tBuffer.prototype.swap64 = function swap64 () {\n\t var len = this.length\n\t if (len % 8 !== 0) {\n\t throw new RangeError('Buffer size must be a multiple of 64-bits')\n\t }\n\t for (var i = 0; i < len; i += 8) {\n\t swap(this, i, i + 7)\n\t swap(this, i + 1, i + 6)\n\t swap(this, i + 2, i + 5)\n\t swap(this, i + 3, i + 4)\n\t }\n\t return this\n\t}\n\t\n\tBuffer.prototype.toString = function toString () {\n\t var length = this.length | 0\n\t if (length === 0) return ''\n\t if (arguments.length === 0) return utf8Slice(this, 0, length)\n\t return slowToString.apply(this, arguments)\n\t}\n\t\n\tBuffer.prototype.equals = function equals (b) {\n\t if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n\t if (this === b) return true\n\t return Buffer.compare(this, b) === 0\n\t}\n\t\n\tBuffer.prototype.inspect = function inspect () {\n\t var str = ''\n\t var max = exports.INSPECT_MAX_BYTES\n\t if (this.length > 0) {\n\t str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n\t if (this.length > max) str += ' ... '\n\t }\n\t return ''\n\t}\n\t\n\tBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n\t if (!Buffer.isBuffer(target)) {\n\t throw new TypeError('Argument must be a Buffer')\n\t }\n\t\n\t if (start === undefined) {\n\t start = 0\n\t }\n\t if (end === undefined) {\n\t end = target ? target.length : 0\n\t }\n\t if (thisStart === undefined) {\n\t thisStart = 0\n\t }\n\t if (thisEnd === undefined) {\n\t thisEnd = this.length\n\t }\n\t\n\t if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n\t throw new RangeError('out of range index')\n\t }\n\t\n\t if (thisStart >= thisEnd && start >= end) {\n\t return 0\n\t }\n\t if (thisStart >= thisEnd) {\n\t return -1\n\t }\n\t if (start >= end) {\n\t return 1\n\t }\n\t\n\t start >>>= 0\n\t end >>>= 0\n\t thisStart >>>= 0\n\t thisEnd >>>= 0\n\t\n\t if (this === target) return 0\n\t\n\t var x = thisEnd - thisStart\n\t var y = end - start\n\t var len = Math.min(x, y)\n\t\n\t var thisCopy = this.slice(thisStart, thisEnd)\n\t var targetCopy = target.slice(start, end)\n\t\n\t for (var i = 0; i < len; ++i) {\n\t if (thisCopy[i] !== targetCopy[i]) {\n\t x = thisCopy[i]\n\t y = targetCopy[i]\n\t break\n\t }\n\t }\n\t\n\t if (x < y) return -1\n\t if (y < x) return 1\n\t return 0\n\t}\n\t\n\t// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n\t// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n\t//\n\t// Arguments:\n\t// - buffer - a Buffer to search\n\t// - val - a string, Buffer, or number\n\t// - byteOffset - an index into `buffer`; will be clamped to an int32\n\t// - encoding - an optional encoding, relevant is val is a string\n\t// - dir - true for indexOf, false for lastIndexOf\n\tfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n\t // Empty buffer means no match\n\t if (buffer.length === 0) return -1\n\t\n\t // Normalize byteOffset\n\t if (typeof byteOffset === 'string') {\n\t encoding = byteOffset\n\t byteOffset = 0\n\t } else if (byteOffset > 0x7fffffff) {\n\t byteOffset = 0x7fffffff\n\t } else if (byteOffset < -0x80000000) {\n\t byteOffset = -0x80000000\n\t }\n\t byteOffset = +byteOffset // Coerce to Number.\n\t if (isNaN(byteOffset)) {\n\t // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n\t byteOffset = dir ? 0 : (buffer.length - 1)\n\t }\n\t\n\t // Normalize byteOffset: negative offsets start from the end of the buffer\n\t if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n\t if (byteOffset >= buffer.length) {\n\t if (dir) return -1\n\t else byteOffset = buffer.length - 1\n\t } else if (byteOffset < 0) {\n\t if (dir) byteOffset = 0\n\t else return -1\n\t }\n\t\n\t // Normalize val\n\t if (typeof val === 'string') {\n\t val = Buffer.from(val, encoding)\n\t }\n\t\n\t // Finally, search either indexOf (if dir is true) or lastIndexOf\n\t if (Buffer.isBuffer(val)) {\n\t // Special case: looking for empty string/buffer always fails\n\t if (val.length === 0) {\n\t return -1\n\t }\n\t return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n\t } else if (typeof val === 'number') {\n\t val = val & 0xFF // Search for a byte value [0-255]\n\t if (Buffer.TYPED_ARRAY_SUPPORT &&\n\t typeof Uint8Array.prototype.indexOf === 'function') {\n\t if (dir) {\n\t return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n\t } else {\n\t return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n\t }\n\t }\n\t return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n\t }\n\t\n\t throw new TypeError('val must be string, number or Buffer')\n\t}\n\t\n\tfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n\t var indexSize = 1\n\t var arrLength = arr.length\n\t var valLength = val.length\n\t\n\t if (encoding !== undefined) {\n\t encoding = String(encoding).toLowerCase()\n\t if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n\t encoding === 'utf16le' || encoding === 'utf-16le') {\n\t if (arr.length < 2 || val.length < 2) {\n\t return -1\n\t }\n\t indexSize = 2\n\t arrLength /= 2\n\t valLength /= 2\n\t byteOffset /= 2\n\t }\n\t }\n\t\n\t function read (buf, i) {\n\t if (indexSize === 1) {\n\t return buf[i]\n\t } else {\n\t return buf.readUInt16BE(i * indexSize)\n\t }\n\t }\n\t\n\t var i\n\t if (dir) {\n\t var foundIndex = -1\n\t for (i = byteOffset; i < arrLength; i++) {\n\t if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n\t if (foundIndex === -1) foundIndex = i\n\t if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n\t } else {\n\t if (foundIndex !== -1) i -= i - foundIndex\n\t foundIndex = -1\n\t }\n\t }\n\t } else {\n\t if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n\t for (i = byteOffset; i >= 0; i--) {\n\t var found = true\n\t for (var j = 0; j < valLength; j++) {\n\t if (read(arr, i + j) !== read(val, j)) {\n\t found = false\n\t break\n\t }\n\t }\n\t if (found) return i\n\t }\n\t }\n\t\n\t return -1\n\t}\n\t\n\tBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n\t return this.indexOf(val, byteOffset, encoding) !== -1\n\t}\n\t\n\tBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n\t return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n\t}\n\t\n\tBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n\t return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n\t}\n\t\n\tfunction hexWrite (buf, string, offset, length) {\n\t offset = Number(offset) || 0\n\t var remaining = buf.length - offset\n\t if (!length) {\n\t length = remaining\n\t } else {\n\t length = Number(length)\n\t if (length > remaining) {\n\t length = remaining\n\t }\n\t }\n\t\n\t // must be an even number of digits\n\t var strLen = string.length\n\t if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\t\n\t if (length > strLen / 2) {\n\t length = strLen / 2\n\t }\n\t for (var i = 0; i < length; ++i) {\n\t var parsed = parseInt(string.substr(i * 2, 2), 16)\n\t if (isNaN(parsed)) return i\n\t buf[offset + i] = parsed\n\t }\n\t return i\n\t}\n\t\n\tfunction utf8Write (buf, string, offset, length) {\n\t return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n\t}\n\t\n\tfunction asciiWrite (buf, string, offset, length) {\n\t return blitBuffer(asciiToBytes(string), buf, offset, length)\n\t}\n\t\n\tfunction latin1Write (buf, string, offset, length) {\n\t return asciiWrite(buf, string, offset, length)\n\t}\n\t\n\tfunction base64Write (buf, string, offset, length) {\n\t return blitBuffer(base64ToBytes(string), buf, offset, length)\n\t}\n\t\n\tfunction ucs2Write (buf, string, offset, length) {\n\t return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n\t}\n\t\n\tBuffer.prototype.write = function write (string, offset, length, encoding) {\n\t // Buffer#write(string)\n\t if (offset === undefined) {\n\t encoding = 'utf8'\n\t length = this.length\n\t offset = 0\n\t // Buffer#write(string, encoding)\n\t } else if (length === undefined && typeof offset === 'string') {\n\t encoding = offset\n\t length = this.length\n\t offset = 0\n\t // Buffer#write(string, offset[, length][, encoding])\n\t } else if (isFinite(offset)) {\n\t offset = offset | 0\n\t if (isFinite(length)) {\n\t length = length | 0\n\t if (encoding === undefined) encoding = 'utf8'\n\t } else {\n\t encoding = length\n\t length = undefined\n\t }\n\t // legacy write(string, encoding, offset, length) - remove in v0.13\n\t } else {\n\t throw new Error(\n\t 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n\t )\n\t }\n\t\n\t var remaining = this.length - offset\n\t if (length === undefined || length > remaining) length = remaining\n\t\n\t if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n\t throw new RangeError('Attempt to write outside buffer bounds')\n\t }\n\t\n\t if (!encoding) encoding = 'utf8'\n\t\n\t var loweredCase = false\n\t for (;;) {\n\t switch (encoding) {\n\t case 'hex':\n\t return hexWrite(this, string, offset, length)\n\t\n\t case 'utf8':\n\t case 'utf-8':\n\t return utf8Write(this, string, offset, length)\n\t\n\t case 'ascii':\n\t return asciiWrite(this, string, offset, length)\n\t\n\t case 'latin1':\n\t case 'binary':\n\t return latin1Write(this, string, offset, length)\n\t\n\t case 'base64':\n\t // Warning: maxLength not taken into account in base64Write\n\t return base64Write(this, string, offset, length)\n\t\n\t case 'ucs2':\n\t case 'ucs-2':\n\t case 'utf16le':\n\t case 'utf-16le':\n\t return ucs2Write(this, string, offset, length)\n\t\n\t default:\n\t if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n\t encoding = ('' + encoding).toLowerCase()\n\t loweredCase = true\n\t }\n\t }\n\t}\n\t\n\tBuffer.prototype.toJSON = function toJSON () {\n\t return {\n\t type: 'Buffer',\n\t data: Array.prototype.slice.call(this._arr || this, 0)\n\t }\n\t}\n\t\n\tfunction base64Slice (buf, start, end) {\n\t if (start === 0 && end === buf.length) {\n\t return base64.fromByteArray(buf)\n\t } else {\n\t return base64.fromByteArray(buf.slice(start, end))\n\t }\n\t}\n\t\n\tfunction utf8Slice (buf, start, end) {\n\t end = Math.min(buf.length, end)\n\t var res = []\n\t\n\t var i = start\n\t while (i < end) {\n\t var firstByte = buf[i]\n\t var codePoint = null\n\t var bytesPerSequence = (firstByte > 0xEF) ? 4\n\t : (firstByte > 0xDF) ? 3\n\t : (firstByte > 0xBF) ? 2\n\t : 1\n\t\n\t if (i + bytesPerSequence <= end) {\n\t var secondByte, thirdByte, fourthByte, tempCodePoint\n\t\n\t switch (bytesPerSequence) {\n\t case 1:\n\t if (firstByte < 0x80) {\n\t codePoint = firstByte\n\t }\n\t break\n\t case 2:\n\t secondByte = buf[i + 1]\n\t if ((secondByte & 0xC0) === 0x80) {\n\t tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n\t if (tempCodePoint > 0x7F) {\n\t codePoint = tempCodePoint\n\t }\n\t }\n\t break\n\t case 3:\n\t secondByte = buf[i + 1]\n\t thirdByte = buf[i + 2]\n\t if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n\t tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n\t if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n\t codePoint = tempCodePoint\n\t }\n\t }\n\t break\n\t case 4:\n\t secondByte = buf[i + 1]\n\t thirdByte = buf[i + 2]\n\t fourthByte = buf[i + 3]\n\t if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n\t tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n\t if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n\t codePoint = tempCodePoint\n\t }\n\t }\n\t }\n\t }\n\t\n\t if (codePoint === null) {\n\t // we did not generate a valid codePoint so insert a\n\t // replacement char (U+FFFD) and advance only 1 byte\n\t codePoint = 0xFFFD\n\t bytesPerSequence = 1\n\t } else if (codePoint > 0xFFFF) {\n\t // encode to utf16 (surrogate pair dance)\n\t codePoint -= 0x10000\n\t res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n\t codePoint = 0xDC00 | codePoint & 0x3FF\n\t }\n\t\n\t res.push(codePoint)\n\t i += bytesPerSequence\n\t }\n\t\n\t return decodeCodePointsArray(res)\n\t}\n\t\n\t// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n\t// the lowest limit is Chrome, with 0x10000 args.\n\t// We go 1 magnitude less, for safety\n\tvar MAX_ARGUMENTS_LENGTH = 0x1000\n\t\n\tfunction decodeCodePointsArray (codePoints) {\n\t var len = codePoints.length\n\t if (len <= MAX_ARGUMENTS_LENGTH) {\n\t return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n\t }\n\t\n\t // Decode in chunks to avoid \"call stack size exceeded\".\n\t var res = ''\n\t var i = 0\n\t while (i < len) {\n\t res += String.fromCharCode.apply(\n\t String,\n\t codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n\t )\n\t }\n\t return res\n\t}\n\t\n\tfunction asciiSlice (buf, start, end) {\n\t var ret = ''\n\t end = Math.min(buf.length, end)\n\t\n\t for (var i = start; i < end; ++i) {\n\t ret += String.fromCharCode(buf[i] & 0x7F)\n\t }\n\t return ret\n\t}\n\t\n\tfunction latin1Slice (buf, start, end) {\n\t var ret = ''\n\t end = Math.min(buf.length, end)\n\t\n\t for (var i = start; i < end; ++i) {\n\t ret += String.fromCharCode(buf[i])\n\t }\n\t return ret\n\t}\n\t\n\tfunction hexSlice (buf, start, end) {\n\t var len = buf.length\n\t\n\t if (!start || start < 0) start = 0\n\t if (!end || end < 0 || end > len) end = len\n\t\n\t var out = ''\n\t for (var i = start; i < end; ++i) {\n\t out += toHex(buf[i])\n\t }\n\t return out\n\t}\n\t\n\tfunction utf16leSlice (buf, start, end) {\n\t var bytes = buf.slice(start, end)\n\t var res = ''\n\t for (var i = 0; i < bytes.length; i += 2) {\n\t res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n\t }\n\t return res\n\t}\n\t\n\tBuffer.prototype.slice = function slice (start, end) {\n\t var len = this.length\n\t start = ~~start\n\t end = end === undefined ? len : ~~end\n\t\n\t if (start < 0) {\n\t start += len\n\t if (start < 0) start = 0\n\t } else if (start > len) {\n\t start = len\n\t }\n\t\n\t if (end < 0) {\n\t end += len\n\t if (end < 0) end = 0\n\t } else if (end > len) {\n\t end = len\n\t }\n\t\n\t if (end < start) end = start\n\t\n\t var newBuf\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t newBuf = this.subarray(start, end)\n\t newBuf.__proto__ = Buffer.prototype\n\t } else {\n\t var sliceLen = end - start\n\t newBuf = new Buffer(sliceLen, undefined)\n\t for (var i = 0; i < sliceLen; ++i) {\n\t newBuf[i] = this[i + start]\n\t }\n\t }\n\t\n\t return newBuf\n\t}\n\t\n\t/*\n\t * Need to make sure that buffer isn't trying to write out of bounds.\n\t */\n\tfunction checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}\n\t\n\tBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n\t offset = offset | 0\n\t byteLength = byteLength | 0\n\t if (!noAssert) checkOffset(offset, byteLength, this.length)\n\t\n\t var val = this[offset]\n\t var mul = 1\n\t var i = 0\n\t while (++i < byteLength && (mul *= 0x100)) {\n\t val += this[offset + i] * mul\n\t }\n\t\n\t return val\n\t}\n\t\n\tBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n\t offset = offset | 0\n\t byteLength = byteLength | 0\n\t if (!noAssert) {\n\t checkOffset(offset, byteLength, this.length)\n\t }\n\t\n\t var val = this[offset + --byteLength]\n\t var mul = 1\n\t while (byteLength > 0 && (mul *= 0x100)) {\n\t val += this[offset + --byteLength] * mul\n\t }\n\t\n\t return val\n\t}\n\t\n\tBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 1, this.length)\n\t return this[offset]\n\t}\n\t\n\tBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 2, this.length)\n\t return this[offset] | (this[offset + 1] << 8)\n\t}\n\t\n\tBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 2, this.length)\n\t return (this[offset] << 8) | this[offset + 1]\n\t}\n\t\n\tBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 4, this.length)\n\t\n\t return ((this[offset]) |\n\t (this[offset + 1] << 8) |\n\t (this[offset + 2] << 16)) +\n\t (this[offset + 3] * 0x1000000)\n\t}\n\t\n\tBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 4, this.length)\n\t\n\t return (this[offset] * 0x1000000) +\n\t ((this[offset + 1] << 16) |\n\t (this[offset + 2] << 8) |\n\t this[offset + 3])\n\t}\n\t\n\tBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n\t offset = offset | 0\n\t byteLength = byteLength | 0\n\t if (!noAssert) checkOffset(offset, byteLength, this.length)\n\t\n\t var val = this[offset]\n\t var mul = 1\n\t var i = 0\n\t while (++i < byteLength && (mul *= 0x100)) {\n\t val += this[offset + i] * mul\n\t }\n\t mul *= 0x80\n\t\n\t if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\t\n\t return val\n\t}\n\t\n\tBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n\t offset = offset | 0\n\t byteLength = byteLength | 0\n\t if (!noAssert) checkOffset(offset, byteLength, this.length)\n\t\n\t var i = byteLength\n\t var mul = 1\n\t var val = this[offset + --i]\n\t while (i > 0 && (mul *= 0x100)) {\n\t val += this[offset + --i] * mul\n\t }\n\t mul *= 0x80\n\t\n\t if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\t\n\t return val\n\t}\n\t\n\tBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 1, this.length)\n\t if (!(this[offset] & 0x80)) return (this[offset])\n\t return ((0xff - this[offset] + 1) * -1)\n\t}\n\t\n\tBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 2, this.length)\n\t var val = this[offset] | (this[offset + 1] << 8)\n\t return (val & 0x8000) ? val | 0xFFFF0000 : val\n\t}\n\t\n\tBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 2, this.length)\n\t var val = this[offset + 1] | (this[offset] << 8)\n\t return (val & 0x8000) ? val | 0xFFFF0000 : val\n\t}\n\t\n\tBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 4, this.length)\n\t\n\t return (this[offset]) |\n\t (this[offset + 1] << 8) |\n\t (this[offset + 2] << 16) |\n\t (this[offset + 3] << 24)\n\t}\n\t\n\tBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 4, this.length)\n\t\n\t return (this[offset] << 24) |\n\t (this[offset + 1] << 16) |\n\t (this[offset + 2] << 8) |\n\t (this[offset + 3])\n\t}\n\t\n\tBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 4, this.length)\n\t return ieee754.read(this, offset, true, 23, 4)\n\t}\n\t\n\tBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 4, this.length)\n\t return ieee754.read(this, offset, false, 23, 4)\n\t}\n\t\n\tBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 8, this.length)\n\t return ieee754.read(this, offset, true, 52, 8)\n\t}\n\t\n\tBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 8, this.length)\n\t return ieee754.read(this, offset, false, 52, 8)\n\t}\n\t\n\tfunction checkInt (buf, value, offset, ext, max, min) {\n\t if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n\t if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n\t if (offset + ext > buf.length) throw new RangeError('Index out of range')\n\t}\n\t\n\tBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t byteLength = byteLength | 0\n\t if (!noAssert) {\n\t var maxBytes = Math.pow(2, 8 * byteLength) - 1\n\t checkInt(this, value, offset, byteLength, maxBytes, 0)\n\t }\n\t\n\t var mul = 1\n\t var i = 0\n\t this[offset] = value & 0xFF\n\t while (++i < byteLength && (mul *= 0x100)) {\n\t this[offset + i] = (value / mul) & 0xFF\n\t }\n\t\n\t return offset + byteLength\n\t}\n\t\n\tBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t byteLength = byteLength | 0\n\t if (!noAssert) {\n\t var maxBytes = Math.pow(2, 8 * byteLength) - 1\n\t checkInt(this, value, offset, byteLength, maxBytes, 0)\n\t }\n\t\n\t var i = byteLength - 1\n\t var mul = 1\n\t this[offset + i] = value & 0xFF\n\t while (--i >= 0 && (mul *= 0x100)) {\n\t this[offset + i] = (value / mul) & 0xFF\n\t }\n\t\n\t return offset + byteLength\n\t}\n\t\n\tBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n\t this[offset] = (value & 0xff)\n\t return offset + 1\n\t}\n\t\n\tfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n\t if (value < 0) value = 0xffff + value + 1\n\t for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n\t buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n\t (littleEndian ? i : 1 - i) * 8\n\t }\n\t}\n\t\n\tBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t this[offset] = (value & 0xff)\n\t this[offset + 1] = (value >>> 8)\n\t } else {\n\t objectWriteUInt16(this, value, offset, true)\n\t }\n\t return offset + 2\n\t}\n\t\n\tBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t this[offset] = (value >>> 8)\n\t this[offset + 1] = (value & 0xff)\n\t } else {\n\t objectWriteUInt16(this, value, offset, false)\n\t }\n\t return offset + 2\n\t}\n\t\n\tfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n\t if (value < 0) value = 0xffffffff + value + 1\n\t for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n\t buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n\t }\n\t}\n\t\n\tBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t this[offset + 3] = (value >>> 24)\n\t this[offset + 2] = (value >>> 16)\n\t this[offset + 1] = (value >>> 8)\n\t this[offset] = (value & 0xff)\n\t } else {\n\t objectWriteUInt32(this, value, offset, true)\n\t }\n\t return offset + 4\n\t}\n\t\n\tBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t this[offset] = (value >>> 24)\n\t this[offset + 1] = (value >>> 16)\n\t this[offset + 2] = (value >>> 8)\n\t this[offset + 3] = (value & 0xff)\n\t } else {\n\t objectWriteUInt32(this, value, offset, false)\n\t }\n\t return offset + 4\n\t}\n\t\n\tBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) {\n\t var limit = Math.pow(2, 8 * byteLength - 1)\n\t\n\t checkInt(this, value, offset, byteLength, limit - 1, -limit)\n\t }\n\t\n\t var i = 0\n\t var mul = 1\n\t var sub = 0\n\t this[offset] = value & 0xFF\n\t while (++i < byteLength && (mul *= 0x100)) {\n\t if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n\t sub = 1\n\t }\n\t this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n\t }\n\t\n\t return offset + byteLength\n\t}\n\t\n\tBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) {\n\t var limit = Math.pow(2, 8 * byteLength - 1)\n\t\n\t checkInt(this, value, offset, byteLength, limit - 1, -limit)\n\t }\n\t\n\t var i = byteLength - 1\n\t var mul = 1\n\t var sub = 0\n\t this[offset + i] = value & 0xFF\n\t while (--i >= 0 && (mul *= 0x100)) {\n\t if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n\t sub = 1\n\t }\n\t this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n\t }\n\t\n\t return offset + byteLength\n\t}\n\t\n\tBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n\t if (value < 0) value = 0xff + value + 1\n\t this[offset] = (value & 0xff)\n\t return offset + 1\n\t}\n\t\n\tBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t this[offset] = (value & 0xff)\n\t this[offset + 1] = (value >>> 8)\n\t } else {\n\t objectWriteUInt16(this, value, offset, true)\n\t }\n\t return offset + 2\n\t}\n\t\n\tBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t this[offset] = (value >>> 8)\n\t this[offset + 1] = (value & 0xff)\n\t } else {\n\t objectWriteUInt16(this, value, offset, false)\n\t }\n\t return offset + 2\n\t}\n\t\n\tBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t this[offset] = (value & 0xff)\n\t this[offset + 1] = (value >>> 8)\n\t this[offset + 2] = (value >>> 16)\n\t this[offset + 3] = (value >>> 24)\n\t } else {\n\t objectWriteUInt32(this, value, offset, true)\n\t }\n\t return offset + 4\n\t}\n\t\n\tBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n\t if (value < 0) value = 0xffffffff + value + 1\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t this[offset] = (value >>> 24)\n\t this[offset + 1] = (value >>> 16)\n\t this[offset + 2] = (value >>> 8)\n\t this[offset + 3] = (value & 0xff)\n\t } else {\n\t objectWriteUInt32(this, value, offset, false)\n\t }\n\t return offset + 4\n\t}\n\t\n\tfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n\t if (offset + ext > buf.length) throw new RangeError('Index out of range')\n\t if (offset < 0) throw new RangeError('Index out of range')\n\t}\n\t\n\tfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n\t if (!noAssert) {\n\t checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n\t }\n\t ieee754.write(buf, value, offset, littleEndian, 23, 4)\n\t return offset + 4\n\t}\n\t\n\tBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n\t return writeFloat(this, value, offset, true, noAssert)\n\t}\n\t\n\tBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n\t return writeFloat(this, value, offset, false, noAssert)\n\t}\n\t\n\tfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n\t if (!noAssert) {\n\t checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n\t }\n\t ieee754.write(buf, value, offset, littleEndian, 52, 8)\n\t return offset + 8\n\t}\n\t\n\tBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n\t return writeDouble(this, value, offset, true, noAssert)\n\t}\n\t\n\tBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n\t return writeDouble(this, value, offset, false, noAssert)\n\t}\n\t\n\t// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\n\tBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n\t if (!start) start = 0\n\t if (!end && end !== 0) end = this.length\n\t if (targetStart >= target.length) targetStart = target.length\n\t if (!targetStart) targetStart = 0\n\t if (end > 0 && end < start) end = start\n\t\n\t // Copy 0 bytes; we're done\n\t if (end === start) return 0\n\t if (target.length === 0 || this.length === 0) return 0\n\t\n\t // Fatal error conditions\n\t if (targetStart < 0) {\n\t throw new RangeError('targetStart out of bounds')\n\t }\n\t if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n\t if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\t\n\t // Are we oob?\n\t if (end > this.length) end = this.length\n\t if (target.length - targetStart < end - start) {\n\t end = target.length - targetStart + start\n\t }\n\t\n\t var len = end - start\n\t var i\n\t\n\t if (this === target && start < targetStart && targetStart < end) {\n\t // descending copy from end\n\t for (i = len - 1; i >= 0; --i) {\n\t target[i + targetStart] = this[i + start]\n\t }\n\t } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n\t // ascending copy from start\n\t for (i = 0; i < len; ++i) {\n\t target[i + targetStart] = this[i + start]\n\t }\n\t } else {\n\t Uint8Array.prototype.set.call(\n\t target,\n\t this.subarray(start, start + len),\n\t targetStart\n\t )\n\t }\n\t\n\t return len\n\t}\n\t\n\t// Usage:\n\t// buffer.fill(number[, offset[, end]])\n\t// buffer.fill(buffer[, offset[, end]])\n\t// buffer.fill(string[, offset[, end]][, encoding])\n\tBuffer.prototype.fill = function fill (val, start, end, encoding) {\n\t // Handle string cases:\n\t if (typeof val === 'string') {\n\t if (typeof start === 'string') {\n\t encoding = start\n\t start = 0\n\t end = this.length\n\t } else if (typeof end === 'string') {\n\t encoding = end\n\t end = this.length\n\t }\n\t if (val.length === 1) {\n\t var code = val.charCodeAt(0)\n\t if (code < 256) {\n\t val = code\n\t }\n\t }\n\t if (encoding !== undefined && typeof encoding !== 'string') {\n\t throw new TypeError('encoding must be a string')\n\t }\n\t if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n\t throw new TypeError('Unknown encoding: ' + encoding)\n\t }\n\t } else if (typeof val === 'number') {\n\t val = val & 255\n\t }\n\t\n\t // Invalid ranges are not set to a default, so can range check early.\n\t if (start < 0 || this.length < start || this.length < end) {\n\t throw new RangeError('Out of range index')\n\t }\n\t\n\t if (end <= start) {\n\t return this\n\t }\n\t\n\t start = start >>> 0\n\t end = end === undefined ? this.length : end >>> 0\n\t\n\t if (!val) val = 0\n\t\n\t var i\n\t if (typeof val === 'number') {\n\t for (i = start; i < end; ++i) {\n\t this[i] = val\n\t }\n\t } else {\n\t var bytes = Buffer.isBuffer(val)\n\t ? val\n\t : utf8ToBytes(new Buffer(val, encoding).toString())\n\t var len = bytes.length\n\t for (i = 0; i < end - start; ++i) {\n\t this[i + start] = bytes[i % len]\n\t }\n\t }\n\t\n\t return this\n\t}\n\t\n\t// HELPER FUNCTIONS\n\t// ================\n\t\n\tvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\t\n\tfunction base64clean (str) {\n\t // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n\t str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n\t // Node converts strings with length < 2 to ''\n\t if (str.length < 2) return ''\n\t // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n\t while (str.length % 4 !== 0) {\n\t str = str + '='\n\t }\n\t return str\n\t}\n\t\n\tfunction stringtrim (str) {\n\t if (str.trim) return str.trim()\n\t return str.replace(/^\\s+|\\s+$/g, '')\n\t}\n\t\n\tfunction toHex (n) {\n\t if (n < 16) return '0' + n.toString(16)\n\t return n.toString(16)\n\t}\n\t\n\tfunction utf8ToBytes (string, units) {\n\t units = units || Infinity\n\t var codePoint\n\t var length = string.length\n\t var leadSurrogate = null\n\t var bytes = []\n\t\n\t for (var i = 0; i < length; ++i) {\n\t codePoint = string.charCodeAt(i)\n\t\n\t // is surrogate component\n\t if (codePoint > 0xD7FF && codePoint < 0xE000) {\n\t // last char was a lead\n\t if (!leadSurrogate) {\n\t // no lead yet\n\t if (codePoint > 0xDBFF) {\n\t // unexpected trail\n\t if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n\t continue\n\t } else if (i + 1 === length) {\n\t // unpaired lead\n\t if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n\t continue\n\t }\n\t\n\t // valid lead\n\t leadSurrogate = codePoint\n\t\n\t continue\n\t }\n\t\n\t // 2 leads in a row\n\t if (codePoint < 0xDC00) {\n\t if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n\t leadSurrogate = codePoint\n\t continue\n\t }\n\t\n\t // valid surrogate pair\n\t codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n\t } else if (leadSurrogate) {\n\t // valid bmp char, but last char was a lead\n\t if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n\t }\n\t\n\t leadSurrogate = null\n\t\n\t // encode utf8\n\t if (codePoint < 0x80) {\n\t if ((units -= 1) < 0) break\n\t bytes.push(codePoint)\n\t } else if (codePoint < 0x800) {\n\t if ((units -= 2) < 0) break\n\t bytes.push(\n\t codePoint >> 0x6 | 0xC0,\n\t codePoint & 0x3F | 0x80\n\t )\n\t } else if (codePoint < 0x10000) {\n\t if ((units -= 3) < 0) break\n\t bytes.push(\n\t codePoint >> 0xC | 0xE0,\n\t codePoint >> 0x6 & 0x3F | 0x80,\n\t codePoint & 0x3F | 0x80\n\t )\n\t } else if (codePoint < 0x110000) {\n\t if ((units -= 4) < 0) break\n\t bytes.push(\n\t codePoint >> 0x12 | 0xF0,\n\t codePoint >> 0xC & 0x3F | 0x80,\n\t codePoint >> 0x6 & 0x3F | 0x80,\n\t codePoint & 0x3F | 0x80\n\t )\n\t } else {\n\t throw new Error('Invalid code point')\n\t }\n\t }\n\t\n\t return bytes\n\t}\n\t\n\tfunction asciiToBytes (str) {\n\t var byteArray = []\n\t for (var i = 0; i < str.length; ++i) {\n\t // Node's code seems to be doing this and not & 0x7F..\n\t byteArray.push(str.charCodeAt(i) & 0xFF)\n\t }\n\t return byteArray\n\t}\n\t\n\tfunction utf16leToBytes (str, units) {\n\t var c, hi, lo\n\t var byteArray = []\n\t for (var i = 0; i < str.length; ++i) {\n\t if ((units -= 2) < 0) break\n\t\n\t c = str.charCodeAt(i)\n\t hi = c >> 8\n\t lo = c % 256\n\t byteArray.push(lo)\n\t byteArray.push(hi)\n\t }\n\t\n\t return byteArray\n\t}\n\t\n\tfunction base64ToBytes (str) {\n\t return base64.toByteArray(base64clean(str))\n\t}\n\t\n\tfunction blitBuffer (src, dst, offset, length) {\n\t for (var i = 0; i < length; ++i) {\n\t if ((i + offset >= dst.length) || (i >= src.length)) break\n\t dst[i + offset] = src[i]\n\t }\n\t return i\n\t}\n\t\n\tfunction isnan (val) {\n\t return val !== val // eslint-disable-line no-self-compare\n\t}\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18).Buffer, (function() { return this; }())))\n\n/***/ },\n/* 19 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"base64-js\");\n\n/***/ },\n/* 20 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"ieee754\");\n\n/***/ },\n/* 21 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"isarray\");\n\n/***/ },\n/* 22 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"ip\");\n\n/***/ },\n/* 23 */\n/***/ function(module, exports) {\n\n\n\n/***/ },\n/* 24 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\tvar BALANCE = exports.BALANCE = 'BALANCE';\n\t\n\tvar ORDER_BOOK = exports.ORDER_BOOK = 'OB';\n\tvar ORDER_BOOK_TRADE_NEW = exports.ORDER_BOOK_TRADE_NEW = 'TRADE_NEW';\n\tvar ORDER_BOOK_NEW_ORDER = exports.ORDER_BOOK_NEW_ORDER = 'NEW_ORDER';\n\tvar ORDER_BOOK_UPDATE_ORDER = exports.ORDER_BOOK_UPDATE_ORDER = 'UPDATE_ORDER';\n\tvar ORDER_BOOK_DELETE_ORDER = exports.ORDER_BOOK_DELETE_ORDER = 'DELETE_ORDER';\n\tvar ORDER_BOOK_DELETE_ORDERS_THRU = exports.ORDER_BOOK_DELETE_ORDERS_THRU = 'DELETE_ORDERS_THRU';\n\t\n\tvar EXECUTION_REPORT = exports.EXECUTION_REPORT = 'EXECUTION_REPORT';\n\tvar EXECUTION_REPORT_NEW = exports.EXECUTION_REPORT_NEW = 'NEW';\n\tvar EXECUTION_REPORT_PARTIAL = exports.EXECUTION_REPORT_PARTIAL = 'PARTIAL';\n\tvar EXECUTION_REPORT_EXECUTION = exports.EXECUTION_REPORT_EXECUTION = 'EXECUTION';\n\tvar EXECUTION_REPORT_CANCELED = exports.EXECUTION_REPORT_CANCELED = 'CANCELED';\n\tvar EXECUTION_REPORT_REJECTED = exports.EXECUTION_REPORT_REJECTED = 'REJECTED';\n\t\n\tvar DEPOSIT_REFRESH = exports.DEPOSIT_REFRESH = 'DEPOSIT_REFRESH';\n\tvar WITHDRAW_REFRESH = exports.WITHDRAW_REFRESH = 'WITHDRAW_REFRESH';\n\t\n\t/* eslint-disable quote-props */\n\tvar EVENTS = exports.EVENTS = {\n\t ORDERBOOK: {\n\t '0': ORDER_BOOK_NEW_ORDER,\n\t '1': ORDER_BOOK_UPDATE_ORDER,\n\t '2': ORDER_BOOK_DELETE_ORDER,\n\t '3': ORDER_BOOK_DELETE_ORDERS_THRU\n\t },\n\t TRADES: {\n\t '0': ORDER_BOOK_TRADE_NEW\n\t },\n\t EXECUTION_REPORT: {\n\t '0': EXECUTION_REPORT_NEW,\n\t '1': EXECUTION_REPORT_PARTIAL,\n\t '2': EXECUTION_REPORT_EXECUTION,\n\t '4': EXECUTION_REPORT_CANCELED,\n\t '8': EXECUTION_REPORT_REJECTED\n\t }\n\t};\n\n/***/ },\n/* 25 */\n/***/ function(module, exports) {\n\n\texports.endianness = function () { return 'LE' };\n\t\n\texports.hostname = function () {\n\t if (typeof location !== 'undefined') {\n\t return location.hostname\n\t }\n\t else return '';\n\t};\n\t\n\texports.loadavg = function () { return [] };\n\t\n\texports.uptime = function () { return 0 };\n\t\n\texports.freemem = function () {\n\t return Number.MAX_VALUE;\n\t};\n\t\n\texports.totalmem = function () {\n\t return Number.MAX_VALUE;\n\t};\n\t\n\texports.cpus = function () { return [] };\n\t\n\texports.type = function () { return 'Browser' };\n\t\n\texports.release = function () {\n\t if (typeof navigator !== 'undefined') {\n\t return navigator.appVersion;\n\t }\n\t return '';\n\t};\n\t\n\texports.networkInterfaces\n\t= exports.getNetworkInterfaces\n\t= function () { return {} };\n\t\n\texports.arch = function () { return 'javascript' };\n\t\n\texports.platform = function () { return 'browser' };\n\t\n\texports.tmpdir = exports.tmpDir = function () {\n\t return '/tmp';\n\t};\n\t\n\texports.EOL = '\\n';\n\n\n/***/ },\n/* 26 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\t\n\tvar _requests = __webpack_require__(3);\n\t\n\tvar _requests2 = _interopRequireDefault(_requests);\n\t\n\tvar _restTransport = __webpack_require__(27);\n\t\n\tvar _restTransport2 = _interopRequireDefault(_restTransport);\n\t\n\tvar _listener = __webpack_require__(10);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\t\n\tvar BlinkTradeRest = function (_RestTransport) {\n\t _inherits(BlinkTradeRest, _RestTransport);\n\t\n\t function BlinkTradeRest() {\n\t _classCallCheck(this, BlinkTradeRest);\n\t\n\t return _possibleConstructorReturn(this, (BlinkTradeRest.__proto__ || Object.getPrototypeOf(BlinkTradeRest)).apply(this, arguments));\n\t }\n\t\n\t _createClass(BlinkTradeRest, [{\n\t key: 'ticker',\n\t value: function ticker(callback) {\n\t return _get(BlinkTradeRest.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeRest.prototype), 'fetchPublic', this).call(this, 'ticker', callback);\n\t }\n\t }, {\n\t key: 'trades',\n\t value: function trades() {\n\t var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t var _ref$limit = _ref.limit;\n\t var limit = _ref$limit === undefined ? 1000 : _ref$limit;\n\t var _ref$since = _ref.since;\n\t var since = _ref$since === undefined ? '0' : _ref$since;\n\t var callback = arguments[1];\n\t\n\t return _get(BlinkTradeRest.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeRest.prototype), 'fetchPublic', this).call(this, 'trades?limit=' + limit + '&since=' + since, callback);\n\t }\n\t }, {\n\t key: 'orderbook',\n\t value: function orderbook(callback) {\n\t return _get(BlinkTradeRest.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeRest.prototype), 'fetchPublic', this).call(this, 'orderbook', callback);\n\t }\n\t }]);\n\t\n\t return BlinkTradeRest;\n\t}(_restTransport2.default);\n\t\n\texports.default = BlinkTradeRest;\n\n/***/ },\n/* 27 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _base = __webpack_require__(6);\n\t\n\tvar _base2 = _interopRequireDefault(_base);\n\t\n\tvar _baseTransport = __webpack_require__(5);\n\t\n\tvar _baseTransport2 = _interopRequireDefault(_baseTransport);\n\t\n\tvar _sjcl = __webpack_require__(28);\n\t\n\tvar _sjcl2 = _interopRequireDefault(_sjcl);\n\t\n\tvar _nodeify = __webpack_require__(12);\n\t\n\tvar _nodeify2 = _interopRequireDefault(_nodeify);\n\t\n\tvar _url = __webpack_require__(29);\n\t\n\tvar _url2 = _interopRequireDefault(_url);\n\t\n\tvar _path = __webpack_require__(30);\n\t\n\tvar _path2 = _interopRequireDefault(_path);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\t\n\tvar RestTransport = function (_BaseTransport) {\n\t _inherits(RestTransport, _BaseTransport);\n\t\n\t /**\n\t * Exchanges currencies available.\n\t */\n\t\n\t\n\t /**\n\t * APIKey\n\t */\n\t function RestTransport(params) {\n\t _classCallCheck(this, RestTransport);\n\t\n\t var _this = _possibleConstructorReturn(this, (RestTransport.__proto__ || Object.getPrototypeOf(RestTransport)).call(this, params, 'rest'));\n\t\n\t _this.key = params.key;\n\t _this.secret = params.secret;\n\t _this.currency = params.currency || 'USD';\n\t\n\t _this.fetchRequest = _this.isNode ? __webpack_require__(32) : __webpack_require__(33);\n\t return _this;\n\t }\n\t\n\t /**\n\t * Fetch rest API\n\t */\n\t\n\t\n\t /**\n\t * APISecret\n\t */\n\t\n\t\n\t _createClass(RestTransport, [{\n\t key: 'headers',\n\t value: function headers(method, body) {\n\t var timeStamp = Date.now().toString();\n\t var hexKey = _sjcl2.default.codec.utf8String.toBits(this.secret);\n\t var hmac = new _sjcl2.default.misc.hmac(hexKey, _sjcl2.default.hash.sha256);\n\t var Signature = _sjcl2.default.codec.hex.fromBits(hmac.encrypt(timeStamp));\n\t return {\n\t method: method,\n\t headers: {\n\t 'Content-Type': 'application/json',\n\t Nonce: timeStamp,\n\t APIKey: this.key,\n\t Signature: Signature\n\t },\n\t body: JSON.stringify(body)\n\t };\n\t }\n\t }, {\n\t key: 'fetch',\n\t value: function fetch(msg, api) {\n\t var headers = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];\n\t\n\t return this.fetchRequest(_url2.default.resolve(this.endpoint, api), headers).then(function (response) {\n\t return response.json();\n\t });\n\t }\n\t }, {\n\t key: 'fetchPublic',\n\t value: function fetchPublic(api, callback) {\n\t return (0, _nodeify2.default)(this.fetch({}, _path2.default.join('api/v1', this.currency, api)), callback);\n\t }\n\t }, {\n\t key: 'fetchTrade',\n\t value: function fetchTrade(msg, callback) {\n\t var headers = this.headers('POST', msg);\n\t return (0, _nodeify2.default)(this.fetch(msg, 'tapi/v1/message', headers, callback).then(function (response) {\n\t return response.Status === 500 ? Promise.reject(response) : response.Responses;\n\t }).then(function (response) {\n\t return response.length === 1 ? response[0] : response;\n\t }), callback);\n\t }\n\t }]);\n\t\n\t return RestTransport;\n\t}(_baseTransport2.default);\n\t\n\texports.default = RestTransport;\n\n/***/ },\n/* 28 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"sjcl\");\n\n/***/ },\n/* 29 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"url\");\n\n/***/ },\n/* 30 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors.\n\t//\n\t// Permission is hereby granted, free of charge, to any person obtaining a\n\t// copy of this software and associated documentation files (the\n\t// \"Software\"), to deal in the Software without restriction, including\n\t// without limitation the rights to use, copy, modify, merge, publish,\n\t// distribute, sublicense, and/or sell copies of the Software, and to permit\n\t// persons to whom the Software is furnished to do so, subject to the\n\t// following conditions:\n\t//\n\t// The above copyright notice and this permission notice shall be included\n\t// in all copies or substantial portions of the Software.\n\t//\n\t// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n\t// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\t// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n\t// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n\t// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n\t// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n\t// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\t\n\t// resolves . and .. elements in a path array with directory names there\n\t// must be no slashes, empty elements, or device names (c:\\) in the array\n\t// (so also no leading and trailing slashes - it does not distinguish\n\t// relative and absolute paths)\n\tfunction normalizeArray(parts, allowAboveRoot) {\n\t // if the path tries to go above the root, `up` ends up > 0\n\t var up = 0;\n\t for (var i = parts.length - 1; i >= 0; i--) {\n\t var last = parts[i];\n\t if (last === '.') {\n\t parts.splice(i, 1);\n\t } else if (last === '..') {\n\t parts.splice(i, 1);\n\t up++;\n\t } else if (up) {\n\t parts.splice(i, 1);\n\t up--;\n\t }\n\t }\n\t\n\t // if the path is allowed to go above the root, restore leading ..s\n\t if (allowAboveRoot) {\n\t for (; up--; up) {\n\t parts.unshift('..');\n\t }\n\t }\n\t\n\t return parts;\n\t}\n\t\n\t// Split a filename into [root, dir, basename, ext], unix version\n\t// 'root' is just a slash, or nothing.\n\tvar splitPathRe =\n\t /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\n\tvar splitPath = function(filename) {\n\t return splitPathRe.exec(filename).slice(1);\n\t};\n\t\n\t// path.resolve([from ...], to)\n\t// posix version\n\texports.resolve = function() {\n\t var resolvedPath = '',\n\t resolvedAbsolute = false;\n\t\n\t for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n\t var path = (i >= 0) ? arguments[i] : process.cwd();\n\t\n\t // Skip empty and invalid entries\n\t if (typeof path !== 'string') {\n\t throw new TypeError('Arguments to path.resolve must be strings');\n\t } else if (!path) {\n\t continue;\n\t }\n\t\n\t resolvedPath = path + '/' + resolvedPath;\n\t resolvedAbsolute = path.charAt(0) === '/';\n\t }\n\t\n\t // At this point the path should be resolved to a full absolute path, but\n\t // handle relative paths to be safe (might happen when process.cwd() fails)\n\t\n\t // Normalize the path\n\t resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n\t return !!p;\n\t }), !resolvedAbsolute).join('/');\n\t\n\t return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n\t};\n\t\n\t// path.normalize(path)\n\t// posix version\n\texports.normalize = function(path) {\n\t var isAbsolute = exports.isAbsolute(path),\n\t trailingSlash = substr(path, -1) === '/';\n\t\n\t // Normalize the path\n\t path = normalizeArray(filter(path.split('/'), function(p) {\n\t return !!p;\n\t }), !isAbsolute).join('/');\n\t\n\t if (!path && !isAbsolute) {\n\t path = '.';\n\t }\n\t if (path && trailingSlash) {\n\t path += '/';\n\t }\n\t\n\t return (isAbsolute ? '/' : '') + path;\n\t};\n\t\n\t// posix version\n\texports.isAbsolute = function(path) {\n\t return path.charAt(0) === '/';\n\t};\n\t\n\t// posix version\n\texports.join = function() {\n\t var paths = Array.prototype.slice.call(arguments, 0);\n\t return exports.normalize(filter(paths, function(p, index) {\n\t if (typeof p !== 'string') {\n\t throw new TypeError('Arguments to path.join must be strings');\n\t }\n\t return p;\n\t }).join('/'));\n\t};\n\t\n\t\n\t// path.relative(from, to)\n\t// posix version\n\texports.relative = function(from, to) {\n\t from = exports.resolve(from).substr(1);\n\t to = exports.resolve(to).substr(1);\n\t\n\t function trim(arr) {\n\t var start = 0;\n\t for (; start < arr.length; start++) {\n\t if (arr[start] !== '') break;\n\t }\n\t\n\t var end = arr.length - 1;\n\t for (; end >= 0; end--) {\n\t if (arr[end] !== '') break;\n\t }\n\t\n\t if (start > end) return [];\n\t return arr.slice(start, end - start + 1);\n\t }\n\t\n\t var fromParts = trim(from.split('/'));\n\t var toParts = trim(to.split('/'));\n\t\n\t var length = Math.min(fromParts.length, toParts.length);\n\t var samePartsLength = length;\n\t for (var i = 0; i < length; i++) {\n\t if (fromParts[i] !== toParts[i]) {\n\t samePartsLength = i;\n\t break;\n\t }\n\t }\n\t\n\t var outputParts = [];\n\t for (var i = samePartsLength; i < fromParts.length; i++) {\n\t outputParts.push('..');\n\t }\n\t\n\t outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\t\n\t return outputParts.join('/');\n\t};\n\t\n\texports.sep = '/';\n\texports.delimiter = ':';\n\t\n\texports.dirname = function(path) {\n\t var result = splitPath(path),\n\t root = result[0],\n\t dir = result[1];\n\t\n\t if (!root && !dir) {\n\t // No dirname whatsoever\n\t return '.';\n\t }\n\t\n\t if (dir) {\n\t // It has a dirname, strip trailing slash\n\t dir = dir.substr(0, dir.length - 1);\n\t }\n\t\n\t return root + dir;\n\t};\n\t\n\t\n\texports.basename = function(path, ext) {\n\t var f = splitPath(path)[2];\n\t // TODO: make this comparison case-insensitive on windows?\n\t if (ext && f.substr(-1 * ext.length) === ext) {\n\t f = f.substr(0, f.length - ext.length);\n\t }\n\t return f;\n\t};\n\t\n\t\n\texports.extname = function(path) {\n\t return splitPath(path)[3];\n\t};\n\t\n\tfunction filter (xs, f) {\n\t if (xs.filter) return xs.filter(f);\n\t var res = [];\n\t for (var i = 0; i < xs.length; i++) {\n\t if (f(xs[i], i, xs)) res.push(xs[i]);\n\t }\n\t return res;\n\t}\n\t\n\t// String.prototype.substr - negative index don't work in IE8\n\tvar substr = 'ab'.substr(-1) === 'b'\n\t ? function (str, start, len) { return str.substr(start, len) }\n\t : function (str, start, len) {\n\t if (start < 0) start = str.length + start;\n\t return str.substr(start, len);\n\t }\n\t;\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(31)))\n\n/***/ },\n/* 31 */\n/***/ function(module, exports) {\n\n\t// shim for using process in browser\n\tvar process = module.exports = {};\n\t\n\t// cached from whatever global is present so that test runners that stub it\n\t// don't break things. But we need to wrap it in a try catch in case it is\n\t// wrapped in strict mode code which doesn't define any globals. It's inside a\n\t// function because try/catches deoptimize in certain engines.\n\t\n\tvar cachedSetTimeout;\n\tvar cachedClearTimeout;\n\t\n\t(function () {\n\t try {\n\t cachedSetTimeout = setTimeout;\n\t } catch (e) {\n\t cachedSetTimeout = function () {\n\t throw new Error('setTimeout is not defined');\n\t }\n\t }\n\t try {\n\t cachedClearTimeout = clearTimeout;\n\t } catch (e) {\n\t cachedClearTimeout = function () {\n\t throw new Error('clearTimeout is not defined');\n\t }\n\t }\n\t} ())\n\tfunction runTimeout(fun) {\n\t if (cachedSetTimeout === setTimeout) {\n\t //normal enviroments in sane situations\n\t return setTimeout(fun, 0);\n\t }\n\t try {\n\t // when when somebody has screwed with setTimeout but no I.E. maddness\n\t return cachedSetTimeout(fun, 0);\n\t } catch(e){\n\t try {\n\t // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n\t return cachedSetTimeout.call(null, fun, 0);\n\t } catch(e){\n\t // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n\t return cachedSetTimeout.call(this, fun, 0);\n\t }\n\t }\n\t\n\t\n\t}\n\tfunction runClearTimeout(marker) {\n\t if (cachedClearTimeout === clearTimeout) {\n\t //normal enviroments in sane situations\n\t return clearTimeout(marker);\n\t }\n\t try {\n\t // when when somebody has screwed with setTimeout but no I.E. maddness\n\t return cachedClearTimeout(marker);\n\t } catch (e){\n\t try {\n\t // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n\t return cachedClearTimeout.call(null, marker);\n\t } catch (e){\n\t // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n\t // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n\t return cachedClearTimeout.call(this, marker);\n\t }\n\t }\n\t\n\t\n\t\n\t}\n\tvar queue = [];\n\tvar draining = false;\n\tvar currentQueue;\n\tvar queueIndex = -1;\n\t\n\tfunction cleanUpNextTick() {\n\t if (!draining || !currentQueue) {\n\t return;\n\t }\n\t draining = false;\n\t if (currentQueue.length) {\n\t queue = currentQueue.concat(queue);\n\t } else {\n\t queueIndex = -1;\n\t }\n\t if (queue.length) {\n\t drainQueue();\n\t }\n\t}\n\t\n\tfunction drainQueue() {\n\t if (draining) {\n\t return;\n\t }\n\t var timeout = runTimeout(cleanUpNextTick);\n\t draining = true;\n\t\n\t var len = queue.length;\n\t while(len) {\n\t currentQueue = queue;\n\t queue = [];\n\t while (++queueIndex < len) {\n\t if (currentQueue) {\n\t currentQueue[queueIndex].run();\n\t }\n\t }\n\t queueIndex = -1;\n\t len = queue.length;\n\t }\n\t currentQueue = null;\n\t draining = false;\n\t runClearTimeout(timeout);\n\t}\n\t\n\tprocess.nextTick = function (fun) {\n\t var args = new Array(arguments.length - 1);\n\t if (arguments.length > 1) {\n\t for (var i = 1; i < arguments.length; i++) {\n\t args[i - 1] = arguments[i];\n\t }\n\t }\n\t queue.push(new Item(fun, args));\n\t if (queue.length === 1 && !draining) {\n\t runTimeout(drainQueue);\n\t }\n\t};\n\t\n\t// v8 likes predictible objects\n\tfunction Item(fun, array) {\n\t this.fun = fun;\n\t this.array = array;\n\t}\n\tItem.prototype.run = function () {\n\t this.fun.apply(null, this.array);\n\t};\n\tprocess.title = 'browser';\n\tprocess.browser = true;\n\tprocess.env = {};\n\tprocess.argv = [];\n\tprocess.version = ''; // empty string to avoid regexp issues\n\tprocess.versions = {};\n\t\n\tfunction noop() {}\n\t\n\tprocess.on = noop;\n\tprocess.addListener = noop;\n\tprocess.once = noop;\n\tprocess.off = noop;\n\tprocess.removeListener = noop;\n\tprocess.removeAllListeners = noop;\n\tprocess.emit = noop;\n\t\n\tprocess.binding = function (name) {\n\t throw new Error('process.binding is not supported');\n\t};\n\t\n\tprocess.cwd = function () { return '/' };\n\tprocess.chdir = function (dir) {\n\t throw new Error('process.chdir is not supported');\n\t};\n\tprocess.umask = function() { return 0; };\n\n\n/***/ },\n/* 32 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"isomorphic-fetch\");\n\n/***/ },\n/* 33 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"fetch-jsonp\");\n\n/***/ }\n/******/ ]);\n\n\n/** WEBPACK FOOTER **\n ** blinktrade.min.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 1feb3295b6518f09d5a7\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport Brokers from './constants/brokers';\nimport BlinkTradeWS from './ws';\nimport BlinkTradeRest from './rest';\n\nexport {\n Brokers,\n BlinkTradeWS,\n BlinkTradeRest,\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/index.js\n **/","export default {\n SURBITCOIN: 1,\n VBTC: 3,\n FOXBIT: 4,\n TESTNET: 5,\n URDUBIT: 8,\n CHILEBIT: 9,\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/brokers.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport MsgTypes from './constants/requests';\n\nimport WebSocketTransport from './wsTransport';\nimport _ from 'lodash';\nimport { EventEmitter2 as EventEmitter } from 'eventemitter2';\nimport {\n registerListener,\n generateRequestId,\n registerEventEmitter,\n} from './listener';\n\nimport {\n EVENTS,\n BALANCE,\n ORDER_BOOK,\n DEPOSIT_REFRESH,\n WITHDRAW_REFRESH,\n EXECUTION_REPORT,\n} from './constants/actionTypes';\n\nclass BlinkTradeWS extends WebSocketTransport {\n\n /**\n * Session to store login information\n */\n session: Object;\n\n constructor(params?: BlinkTradeBase) {\n super(params);\n\n this.session = {};\n }\n\n heartbeat(callback?: Function): Promise {\n const d = new Date();\n const msg: Object = {\n MsgType: MsgTypes.HEARTBEAT,\n TestReqID: d.getTime(),\n SendTime: d.getTime(),\n };\n\n return new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then((data) => {\n return resolve({\n ...data,\n Latency: new Date(Date.now()) - data.SendTime,\n });\n }).catch(reject);\n });\n }\n\n login({ username, password, secondFactor }: {\n username: string;\n password: string;\n secondFactor?: string;\n }, callback?: Function): Promise {\n let userAgent;\n if (!this.isNode) {\n userAgent = {\n UserAgent: window.navigator.userAgent,\n UserAgentLanguage: window.navigator.language,\n UserAgentPlatform: window.navigator.platform,\n UserAgentTimezoneOffset: new Date().getTimezoneOffset(),\n };\n } else {\n const os = require('os');\n userAgent = {\n UserAgent: `${os.type()} ${os.release()}`,\n UserAgentLanguage: 'en_US',\n UserAgentPlatform: `${os.platform()} (${os.arch()})`,\n UserAgentTimezoneOffset: new Date().getTimezoneOffset(),\n };\n }\n\n const msg: Object = {\n MsgType: MsgTypes.LOGIN,\n UserReqID: generateRequestId(),\n BrokerID: this.brokerId,\n Username: username,\n Password: password,\n UserReqTyp: '1',\n ...userAgent,\n };\n\n if (secondFactor) {\n msg.SecondFactor = secondFactor;\n }\n\n return new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then(data => {\n if (data.UserStatus === 1) {\n this.session = data;\n return resolve(data);\n }\n\n return reject(data);\n }).catch(reject);\n });\n }\n\n logout(callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.LOGOUT,\n BrokerID: this.brokerId,\n UserReqID: generateRequestId(),\n Username: this.session.Username,\n UserReqTyp: '2',\n };\n\n return super.sendMessageAsPromise(msg, callback);\n }\n\n profile(callback?: Function): Promise {\n const { VerificationData, ...profile } = this.session.Profile;\n return callback ? callback(profile) : Promise.resolve(profile);\n }\n\n balance(callback?: Function): Promise {\n registerListener('U3', (balance) => {\n callback && callback(null, balance);\n return this.eventEmitter.emit(BALANCE, balance);\n });\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.balance(callback).then(resolve).catch(reject);\n }));\n }\n\n subscribeTicker(symbols: Array, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.SECURITY_STATUS,\n SecurityStatusReqID: generateRequestId(),\n SubscriptionRequestType: '1',\n Instruments: symbols,\n };\n\n const formatTicker = (data) => {\n return {\n ...data,\n SellVolume: data.SellVolume / 1e8,\n LowPx: data.LowPx / 1e8,\n LastPx: data.LastPx / 1e8,\n BestAsk: data.BestAsk / 1e8,\n HighPx: data.HighPx / 1e8,\n BuyVolume: data.BuyVolume / 1e8,\n BestBid: data.BestBid / 1e8,\n };\n };\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then(data => {\n resolve(formatTicker(data));\n registerEventEmitter({ SecurityStatusReqID: data.SecurityStatusReqID }, (ticker) => {\n callback && callback(null, formatTicker(ticker));\n return this.eventEmitter.emit(`BLINK:${ticker.Symbol}`, formatTicker(ticker));\n });\n }).catch(reject);\n }));\n }\n\n unSubscribeTicker(SecurityStatusReqID: number): number {\n const msg = {\n MsgType: MsgTypes.SECURITY_STATUS,\n SecurityStatusReqID,\n SubscriptionRequestType: '2',\n };\n\n super.sendMessage(msg);\n return SecurityStatusReqID;\n }\n\n subscribeOrderbook(symbols: Array, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.MARKET_DATA_FULL_REFRESH,\n MDReqID: generateRequestId(),\n SubscriptionRequestType: '1',\n MarketDepth: 0,\n MDUpdateType: '1', // Incremental refresh\n MDEntryTypes: ['0', '1', '2'],\n Instruments: symbols,\n };\n\n const subscribeEvent = (data) => {\n if (data.MDBkTyp === '3') {\n data.MDIncGrp.map(order => {\n const dataOrder = {\n index: order.MDEntryPositionNo,\n price: order.MDEntryPx / 1e8,\n size: order.MDEntrySize / 1e8,\n side: order.MDEntryType === '0' ? 'buy' : 'sell',\n userId: order.UserID,\n orderId: order.OrderID,\n symbol: order.Symbol,\n time: new Date(`${order.MDEntryDate} ${order.MDEntryTime}`).toString(),\n };\n\n callback && callback(null, dataOrder);\n\n switch (order.MDEntryType) {\n case '0':\n case '1':\n const orderbookEvent = ORDER_BOOK + ':' + EVENTS.ORDERBOOK[order.MDUpdateAction];\n return this.eventEmitter.emit(orderbookEvent, {\n ...dataOrder,\n type: orderbookEvent,\n });\n case '2':\n const tradeEvent = ORDER_BOOK + ':' + EVENTS.TRADES[order.MDUpdateAction];\n return this.eventEmitter.emit(tradeEvent, {\n ...dataOrder,\n type: tradeEvent,\n });\n case '4':\n break;\n default:\n return null;\n }\n return null;\n });\n }\n };\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then(data => {\n if (data.MsgType === 'W') {\n // Split orders in bids and asks\n /* eslint-disable no-param-reassign */\n const { bids, asks } = data.MDFullGrp\n .filter(order => order.MDEntryType === '0' || order.MDEntryType === '1')\n .reduce((prev, order) => {\n const side = order.MDEntryType === '0' ? 'bids' : 'asks';\n (prev[side] || (prev[side] = [])).push([\n order.MDEntryPx / 1e8,\n order.MDEntrySize / 1e8,\n order.UserID,\n ]);\n return prev;\n }, []);\n /* eslint-enable no-param-reassign */\n\n registerEventEmitter({ MDReqID: data.MDReqID }, subscribeEvent);\n\n return resolve({\n ...data,\n MDFullGrp: {\n [data.Symbol]: {\n bids,\n asks,\n },\n },\n });\n }\n }).catch(err => reject(err));\n }));\n }\n\n unSubscribeOrderbook(MDReqID: number): number {\n const msg = {\n MsgType: MsgTypes.MARKET_DATA_UNSUBSCRIBE,\n MDReqID,\n MarketDepth: 0,\n SubscriptionRequestType: '2',\n };\n\n super.sendMessage(msg);\n return MDReqID;\n }\n\n executionReport(callback?: Function): EventEmitter {\n registerListener('8', (data) => {\n callback && callback(data);\n const event = EVENTS.EXECUTION_REPORT[data.ExecType];\n return this.eventEmitter.emit(`${EXECUTION_REPORT}:${event}`, data);\n });\n\n return this.eventEmitter;\n }\n\n tradeHistory({ since, filter, page: Page = 0, pageSize: PageSize = 80 }: {\n since?: string;\n filter?: Array;\n page?: number;\n pageSize?: number;\n } = {}, callback?: Function): Promise {\n const msg: Object = {\n MsgType: MsgTypes.TRADE_HISTORY,\n TradeHistoryReqID: generateRequestId(),\n Page,\n PageSize,\n };\n\n if (filter && filter.length > 0) {\n msg.Filter = filter;\n }\n\n if (since && typeof since === 'number') {\n msg.Since = since;\n }\n\n return new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then(data => {\n const { Columns, ...trades } = data;\n const TradeHistory = _.groupBy(_.map(data.TradeHistoryGrp, trade => _.zipObject(Columns, trade)), trade => trade.Market);\n return resolve({\n ...trades,\n TradeHistoryGrp: TradeHistory,\n });\n }).catch(reject);\n });\n }\n\n requestDeposit({ currency = 'BTC', value, depositMethodId }: {\n value?: number;\n currency?: string;\n depositMethodId?: number;\n } = {}, callback?: Function): Promise {\n registerListener('U23', (deposit) => {\n callback && callback(null, deposit);\n return this.eventEmitter.emit(DEPOSIT_REFRESH, deposit);\n });\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.requestDeposit({ currency, value, depositMethodId }, callback)\n .then(resolve)\n .catch(reject);\n }));\n }\n\n onDepositRefresh(callback: Function): Promise {\n return new Promise((resolve) => {\n registerListener('U23', (deposit) => {\n callback && callback(deposit);\n return resolve(deposit);\n });\n });\n }\n\n requestWithdraw({ amount, data, currency = 'BTC', method = 'bitcoin' }: {\n data: Object,\n amount: number;\n method?: string;\n currency?: string;\n }, callback: Function): Promise {\n registerListener('U9', (withdraw) => {\n callback && callback(null, withdraw);\n return this.eventEmitter.emit(WITHDRAW_REFRESH, withdraw);\n });\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.requestWithdraw({ amount, data, currency, method }, callback)\n .then(resolve)\n .catch(reject);\n }));\n }\n\n onWithdrawRefresh(callback: Function): Promise {\n return new Promise((resolve) => {\n registerListener('U9', (withdraw) => {\n callback && callback(withdraw);\n return resolve(withdraw);\n });\n });\n }\n}\n\nexport default BlinkTradeWS;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/ws.js\n **/","export default {\n HEARTBEAT: '1',\n LOGIN: 'BE',\n LOGOUT: 'BE',\n CHANGE_PASSWORD: 'BE',\n\n MARKET_DATA_FULL_REFRESH: 'V',\n MARKET_DATA_UNSUBSCRIBE: 'V',\n\n ORDER_SEND: 'D',\n ORDER_CANCEL: 'F',\n\n SECURITY_LIST: 'x',\n SECURITY_STATUS: 'e',\n BALANCE: 'U2',\n ORDER_LIST: 'U4',\n BROKER_LIST: 'U28',\n TRADE_HISTORY: 'U32',\n PROFILE_UPDATE: 'U38',\n\n REQUEST_DEPOSIT: 'U18',\n REQUEST_DEPOSIT_LIST: 'U30',\n REQUEST_DEPOSIT_METHODS: 'U20',\n REQUEST_WITHDRAW: 'U6',\n REQUEST_WITHDRAW_LIST: 'U26',\n\n CONFIRM_WITHDRAW: 'U24',\n CANCEL_WITHDRAW: 'U70',\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/requests.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport BaseTransport from './baseTransport';\nimport Fingerprint2 from 'fingerprintjs2';\nimport nodeify from 'nodeify';\nimport { EventEmitter2 as EventEmitter } from 'eventemitter2';\n\nimport {\n getRequest,\n getListener,\n registerRequest,\n} from './listener';\n\n/* eslint-disable global-require */\n\nclass WebSocketTransport extends BaseTransport {\n\n /*\n * WebSocket Instance\n */\n socket: WebSocket;\n\n /*\n * FingerPrint\n */\n fingerPrint: string;\n\n /*\n * Stun object\n */\n stun: Stun;\n\n /*\n * Transport Promise\n */\n request: Request;\n\n /*\n * Event emitter to dispatch websocket updates\n */\n eventEmitter: EventEmitter;\n\n constructor(params?: BlinkTradeBase) {\n super(params, 'ws');\n\n this.stun = { local: null, public: [] };\n\n this.getStun();\n this.getFingerPrint();\n\n this.eventEmitter = new EventEmitter({ wildcard: true, delimiter: ':' });\n }\n\n connect(callback?: Function): Promise {\n return nodeify.extend(new Promise((resolve, reject) => {\n this.request = { resolve, reject };\n\n const WebSocket = this.isNode ? require('ws') : window.WebSocket;\n\n this.socket = new WebSocket(this.endpoint);\n this.socket.onopen = this.onOpen.bind(this);\n this.socket.onclose = this.onClose.bind(this);\n this.socket.onerror = this.onError.bind(this);\n this.socket.onmessage = this.onMessage.bind(this);\n })).nodeify(callback);\n }\n\n disconnect(): void {\n this.socket.close();\n }\n\n onOpen(): void {\n this.request.resolve({ connected: true });\n }\n\n onClose(): void {\n }\n\n onError(): void {\n this.request.reject();\n }\n\n sendMessage(msg: Object): void {\n if (this.socket.readyState === 1) {\n const data = msg;\n\n data.STUNTIP = this.stun;\n data.FingerPrint = this.fingerPrint;\n\n this.socket.send(JSON.stringify(data));\n }\n }\n\n sendMessageAsPromise(msg: Object, callback?: Function): Promise {\n return nodeify.extend(new Promise((resolve, reject) => {\n const promise = { resolve, reject };\n\n if (!msg) {\n return reject('Missing Message');\n }\n\n registerRequest(msg, promise);\n\n // Send promise to sendMessage to we can mock it.\n this.sendMessage(msg, promise);\n })).nodeify(callback);\n }\n\n onMessage(msg: Object): void {\n const data = JSON.parse(msg.data);\n if (data.MsgType === 'ERROR') {\n throw new Error(`Error: ${data.Detail} ${data.Description}`);\n }\n\n const request = getRequest(data);\n const listener = getListener(data.MsgType);\n this.dispatchPromise(request, data);\n this.dispatchListeners(listener, data);\n }\n\n dispatchPromise(request: ?Request, data: Object): any {\n if (request) {\n return request.resolve ? request.resolve(data)\n : request.callback ? request.callback(data)\n : null;\n }\n }\n\n dispatchListeners(listener: Function, data: Object): void {\n return listener && listener(data);\n }\n\n /* eslint-disable no-param-reassign */\n emitterPromise(promise: Promise): Promise {\n promise.on = (event: string, listener: Function) => {\n this.eventEmitter.on(event, listener);\n return promise;\n };\n promise.onAny = (listener: Function) => {\n this.eventEmitter.onAny(listener);\n return promise;\n };\n promise.offAny = (listener: Function) => {\n this.eventEmitter.offAny(listener);\n return promise;\n };\n promise.once = (event: string, listener: Function) => {\n this.eventEmitter.once(event, listener);\n return promise;\n };\n promise.many = (event: string, times: number, listener: Function) => {\n this.eventEmitter.many(event, times, listener);\n return promise;\n };\n promise.removeListener = (event: string, listener: Function) => {\n this.eventEmitter.removeListener(event, listener);\n return promise;\n };\n promise.removeAllListeners = (events: Array) => {\n this.eventEmitter.removeAllListeners(events);\n return promise;\n };\n\n return promise;\n }\n /* eslint-enable no-param-reassign */\n\n getFingerPrint(): void {\n if (this.isNode) {\n return require('./util/macaddress').getMac(macAddress => {\n this.fingerPrint = macAddress;\n });\n }\n return new Fingerprint2().get(fingerPrint => {\n this.fingerPrint = fingerPrint;\n });\n }\n\n getStun(): void {\n if (this.isNode) {\n require('./util/stun').getStun(data => {\n this.stun = data;\n });\n }\n }\n}\n\nexport default WebSocketTransport;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/wsTransport.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport Base from './base';\nimport MsgTypes from './constants/requests';\nimport * as RequestTypes from './constants/requestTypes';\nimport _ from 'lodash';\nimport {\n deleteRequest,\n generateRequestId,\n} from './listener';\n\ntype StatusList = '1' | '2' | '4' | '8';\n\nclass BaseTransport extends Base {\n\n env: BlinkTradeEnv;\n\n send: Function;\n\n fetchTrade: Function;\n\n sendMessageAsPromise: Function;\n\n constructor(params?: BlinkTradeBase, env: BlinkTradeEnv) {\n super(params, env);\n\n this.send = env === 'ws' ? this.sendMessageAsPromise : this.fetchTrade;\n }\n\n balance(callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.BALANCE,\n BalanceReqID: generateRequestId(),\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n const Available = {};\n const balances = data[this.brokerId];\n Object.keys(balances).map(currency => {\n if (!currency.includes('locked')) {\n Available[currency] = balances[currency] - balances[`${currency}_locked`];\n }\n return Available;\n });\n\n return resolve({ ...data, Available });\n }).catch(reject);\n });\n }\n\n myOrders({ page: Page = 0, pageSize: PageSize = 40 }: {\n page?: number;\n pageSize?: number;\n } = {}, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.ORDER_LIST,\n OrdersReqID: generateRequestId(),\n Page,\n PageSize,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n const { Columns, ...orders } = data;\n const OrdListGrp = _.map(data.OrdListGrp, order => _.zipObject(Columns, order));\n return resolve({\n ...orders,\n OrdListGrp,\n });\n }).catch(reject);\n });\n }\n\n sendOrder({ side, amount, price, symbol }: {\n side: '1' | '2';\n price: number;\n amount: number;\n symbol: string;\n }, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.ORDER_SEND,\n ClOrdID: generateRequestId(),\n Symbol: symbol,\n Side: side,\n OrdType: '2',\n Price: price,\n OrderQty: amount,\n BrokerID: this.brokerId,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n deleteRequest(RequestTypes.CLIENT_ORDER_ID);\n resolve(data);\n }).catch(reject);\n });\n }\n\n cancelOrder(param: number | {\n orderId: number;\n clientId?: number;\n }, callback?: Function): Promise {\n const orderId = param.orderId ? param.orderId : param;\n const msg: Object = {\n MsgType: MsgTypes.ORDER_CANCEL,\n OrderID: orderId,\n };\n\n if (param.clientId) {\n msg.ClOrdID = param.clientId;\n }\n\n return this.send(msg, callback);\n }\n\n /**\n * statusList: 1-Pending, 2-In Progress, 4-Completed, 8-Cancelled\n */\n requestWithdrawList({\n page: Page = 0,\n pageSize: PageSize = 20,\n statusList: StatusList = ['1', '2', '4', '8'],\n }: {\n page?: number;\n pageSize?: number;\n statusList?: Array;\n } = {}, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.REQUEST_WITHDRAW_LIST,\n WithdrawListReqID: generateRequestId(),\n Page,\n PageSize,\n StatusList,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n const { Columns, ...withdrawData } = data;\n const WithdrawListGrp = _.map(data.WithdrawListGrp, withdraw => _.zipObject(Columns, withdraw));\n return resolve({\n ...withdrawData,\n WithdrawListGrp,\n });\n }).catch(reject);\n });\n }\n\n requestWithdraw({ amount, data, currency = 'BTC', method = 'bitcoin' }: {\n data: Object,\n amount: number;\n method?: string;\n currency?: string;\n }, callback: Function): Promise {\n const reqId = generateRequestId();\n const msg = {\n MsgType: MsgTypes.REQUEST_WITHDRAW,\n WithdrawReqID: reqId,\n ClOrdID: reqId,\n Method: method,\n Amount: amount,\n Currency: currency,\n Data: data,\n };\n\n return this.send(msg, callback);\n }\n\n confirmWithdraw({ withdrawId: WithdrawID, confirmationToken, secondFactor }: {\n withdrawId: string;\n confirmationToken?: string;\n secondFactor?: string;\n }, callback: Function): Promise {\n const msg: Object = {\n MsgType: MsgTypes.CONFIRM_WITHDRAW,\n WithdrawReqID: generateRequestId(),\n WithdrawID,\n };\n\n if (confirmationToken) {\n msg.ConfirmationToken = confirmationToken;\n }\n\n if (secondFactor) {\n msg.SecondFactor = secondFactor;\n }\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n return resolve({\n ...data,\n });\n }).catch(reject);\n });\n }\n\n cancelWithdraw(withdrawId: string, callback: Function): Promise {\n const reqId = generateRequestId();\n const msg = {\n MsgType: MsgTypes.CANCEL_WITHDRAW,\n WithdrawCancelReqID: reqId,\n ClOrdID: reqId,\n WithdrawID: withdrawId,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n return resolve({\n ...data,\n });\n }).catch(reject);\n });\n }\n\n requestDepositList({\n page: Page = 0,\n pageSize: PageSize = 20,\n status: StatusList = ['1', '2', '4', '8']\n }: {\n page: number;\n pageSize: number;\n status: Array;\n } = {}, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.REQUEST_DEPOSIT_LIST,\n DepositListReqID: generateRequestId(),\n Page,\n PageSize,\n StatusList,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n const { Columns, ...depositData } = data;\n const DepositListGrp = _.map(data.DepositListGrp, deposit => _.zipObject(Columns, deposit));\n return resolve({\n ...depositData,\n DepositListGrp,\n });\n });\n });\n }\n\n requestDeposit({ currency = 'BTC', value, depositMethodId }: {\n value?: number;\n currency?: string;\n depositMethodId?: number;\n } = {}, callback?: Function): Promise {\n const reqId = generateRequestId();\n const msg: Object = {\n MsgType: MsgTypes.REQUEST_DEPOSIT,\n DepositReqID: reqId,\n ClOrdID: reqId,\n Currency: currency,\n BrokerID: this.brokerId,\n };\n\n if (currency !== 'BTC') {\n msg.DepositMethodID = depositMethodId;\n msg.Value = value;\n }\n\n return this.send(msg, callback);\n }\n\n requestDepositMethods(callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.REQUEST_DEPOSIT_METHODS,\n DepositMethodReqID: generateRequestId(),\n };\n\n return this.send(msg, callback);\n }\n}\n\nexport default BaseTransport;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/baseTransport.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport common from './constants/common';\n\nclass Base {\n\n /*\n * url endpoint.\n */\n endpoint: string;\n\n /*\n * Broker id\n */\n brokerId: number;\n\n /*\n * Is node.js environment.\n */\n isNode: boolean;\n\n constructor(params: BlinkTradeBase = {}, env: BlinkTradeEnv) {\n const endpoint =\n params.url ? params.url\n : params.prod ? common.prod[env]\n : common.testnet[env];\n\n this.brokerId = params.brokerId || 5;\n\n this.endpoint = endpoint;\n\n this.isNode = typeof window === 'undefined';\n }\n}\n\nexport default Base;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/base.js\n **/","export default {\n prod: {\n ws: 'wss://api.blinktrade.com/trade/',\n rest: 'https://api.blinktrade.com/',\n },\n testnet: {\n ws: 'wss://api.testnet.blinktrade.com/trade/',\n rest: 'https://api.testnet.blinktrade.com/',\n },\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/common.js\n **/","export const SOCKET_ID = 'SocketID';\nexport const REQUEST_ID = 'ReqID';\nexport const TEST_REQUEST_ID = 'TestReqID';\nexport const USER_REQUEST_ID = 'UserReqID';\nexport const SECURITY_REQUEST_ID = 'SecurityReqID';\nexport const RESET_PASSWORD_REQUEST_ID = 'ResetPasswordReqID';\nexport const DEPOSIT_REQUEST_ID = 'DepositReqID';\nexport const WITHDRAW_REQUEST_ID = 'WithdrawReqID';\nexport const BALANCE_REQUEST_ID = 'BalanceReqID';\nexport const ORDERS_REQUEST_ID = 'OrdersReqID';\nexport const ENABLE_TWO_FACTOR_REQUEST_ID = 'EnableTwoFactorReqID';\nexport const DEPOSIT_METHOD_REQUEST_ID = 'DepositMethodReqID';\nexport const WITHDRAW_LIST_REQUEST_ID = 'WithdrawListReqID';\nexport const BROKER_LIST_REQUEST_ID = 'BrokerListReqID';\nexport const DEPOSIT_LIST_REQUEST_ID = 'DepositListReqID';\nexport const TRADE_HISTORY_REQUEST_ID = 'TradeHistoryReqID';\nexport const LEDGER_LIST_REQUEST_ID = 'LedgerListReqID';\nexport const TRADERS_RANK_REQUEST_ID = 'TradersRankReqID';\nexport const UPDATE_REQUEST_ID = 'UpdateReqID';\nexport const POSITION_REQUEST_ID = 'PositionReqID';\nexport const SECURITY_STATUS_REQUEST_ID = 'SecurityStatusReqID';\nexport const API_KEY_LIST_REQUEST_ID = 'APIKeyListReqID';\nexport const API_KEY_CREATE_REQUEST_ID = 'APIKeyCreateReqID';\nexport const API_KEY_REVOKE_REQUEST_ID = 'APIKeyRevokeReqID';\nexport const PROCESS_DEPOSIT_REQUEST_ID = 'ProcessDepositReqID';\nexport const CUSTOMER_LIST_REQUEST_ID = 'CustomerListReqID';\nexport const CUSTOMER_REQUEST_ID = 'CustomerReqID';\nexport const PROCESS_WITHDRAW_REQUEST_ID = 'ProcessWithdrawReqID';\nexport const VERIFY_CUSTOMER_REQUEST_ID = 'VerifyCustomerReqID';\nexport const MD_REQUEST_ID = 'MDReqID';\nexport const CLIENT_ORDER_ID = 'ClOrdID';\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/requestTypes.js\n **/","module.exports = require(\"lodash\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"lodash\"\n ** module id = 9\n ** module chunks = 0\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport lodash from 'lodash';\nimport * as RequestTypes from './constants/requestTypes';\n\nlet requests: Object = {};\nconst listeners: Object = {};\n\nexport function getListeners() {\n return requests;\n}\n\nexport function generateRequestId(): number {\n return parseInt(String(1e7 * Math.random()), 10);\n}\n\nexport function getListener(msgType: string): Function {\n return listeners[msgType];\n}\n\nexport function getRequest(message: Object): ?Request {\n let result;\n lodash.mapKeys(RequestTypes, (key) => {\n if (lodash.has(message, key)) {\n result = lodash.find(requests[key], { ReqId: String(message[key]) });\n }\n });\n\n return result;\n}\n\nexport function registerRequest(message: Object, promise: Request): Object {\n lodash.mapKeys(RequestTypes, (key) => {\n if (lodash.has(message, key)) {\n requests[key] = requests[key] || [];\n requests[key].push({ ReqId: String(message[key]), ...promise });\n }\n });\n\n return requests;\n}\n\nexport function registerEventEmitter(message: Object, callback: Function): Object {\n lodash.mapKeys(RequestTypes, (key) => {\n if (lodash.has(message, key)) {\n if (requests[key] !== []) {\n const index = lodash.findIndex(requests[key], { ReqId: String(message[key]) });\n requests[key][index] = {\n ...requests[key][index],\n resolve: null,\n reject: null,\n callback,\n };\n }\n }\n });\n\n return requests;\n}\n\nexport function registerListener(msgType: string, callback: Function): void {\n listeners[msgType] = listeners[msgType] || [];\n listeners[msgType] = callback;\n}\n\nexport function deleteRequest(key: string): Object {\n requests = lodash.omit(requests, [key]);\n return requests;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/listener.js\n **/","module.exports = require(\"fingerprintjs2\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"fingerprintjs2\"\n ** module id = 11\n ** module chunks = 0\n **/","module.exports = require(\"nodeify\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"nodeify\"\n ** module id = 12\n ** module chunks = 0\n **/","module.exports = require(\"eventemitter2\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"eventemitter2\"\n ** module id = 13\n ** module chunks = 0\n **/","module.exports = require(\"ws\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"ws\"\n ** module id = 14\n ** module chunks = 0\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport macaddress from 'macaddress';\n\nexport function getMac(callback: Function): void {\n macaddress.all((err, all) => {\n const hashCode = (str) => {\n let hash = 0;\n if (str.length === 0) return hash;\n for (let i = 0; i < str.length; i++) {\n hash = ((hash << 5) - hash) + str.charCodeAt(i);\n hash = hash & hash; // Convert to 32bit integer\n }\n return hash;\n };\n\n let macAddresses = '';\n Object.keys(all).forEach(iface => {\n macAddresses += all[iface].mac;\n });\n\n let fingerPrint = hashCode(macAddresses);\n if (fingerPrint < 0) {\n fingerPrint *= -1;\n }\n\n callback(fingerPrint);\n });\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/macaddress.js\n **/","module.exports = require(\"macaddress\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"macaddress\"\n ** module id = 16\n ** module chunks = 0\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n/* eslint-disable no-param-reassign */\n\nimport ip from 'ip';\nimport dgram from 'dgram';\n\nconst stunIp = { local: null, public: [] };\n\nfunction addIPAddress(ipAddress) {\n if (ipAddress.match(/^(192\\.168\\.|169\\.254\\.|10\\.|172\\.(1[6-9]|2\\d|3[01]))/)) {\n stunIp.local = ipAddress;\n } else {\n if (stunIp.public.indexOf(ipAddress) === -1) {\n stunIp.public.push(ipAddress);\n }\n }\n}\n\nexport function getStun(callback: Function) {\n const socket = dgram.createSocket('udp4');\n\n const STUN_HEADER_LENGTH = 20;\n const stunRequest = new Buffer(STUN_HEADER_LENGTH);\n\n const STUN_METHOD_REQUEST = 0x000;\n const STUN_BINDING_CLASS = 0x0001;\n const STUN_MAGIC_COOKIE = 0x2112A442;\n const STUN_TID_MAX = Math.pow(2, 32);\n\n const STUN_ATTR_MAPPED_ADDRESS = 0x0001;\n const STUN_ATTR_XOR_MAPPED_ADDRESS = 0x8020;\n const STUN_ATTR_XOR_MAPPED_ADDRESS_ALT = 0x0020;\n\n const stunTxId = (Math.random() * STUN_TID_MAX);\n\n const stunServers = [\n [3478, 'stun.services.mozilla.com'],\n [19302, 'stun.l.google.com'],\n [3478, 'stun.stunprotocol.org'],\n [3478, 'stun.softjoys.com'],\n [3478, 'stun.samsungsmartcam.com'],\n [3478, 'stun.sonetel.com'],\n [3478, 'stun.tagan.ru'],\n [3478, 'stun.voipgain.com'],\n [3478, 'stunserver.org'],\n [3478, 'stun.advfn.com'],\n [3478, 'stun.annatel.net'],\n [3478, 'stun.freevoipdeal.com'],\n ];\n\n stunRequest.writeUInt16BE(((STUN_BINDING_CLASS | STUN_METHOD_REQUEST) & 0x3fff), 0);\n stunRequest.writeUInt16BE(0, 2);\n stunRequest.writeUInt32BE(STUN_MAGIC_COOKIE, 4);\n stunRequest.writeUInt32BE(0, 8);\n stunRequest.writeUInt32BE(0, 12);\n stunRequest.writeUInt32BE(stunTxId, 16);\n\n socket.on('message', (msg) => {\n const xor = (a, b) => {\n const data = [];\n if (b.length > a.length) {\n const tmp = a;\n a = b;\n b = tmp;\n }\n for (let i = 0, len = a.length; i < len; i++) {\n data.push(a[i] ^ b[i]);\n }\n\n return new Buffer(data);\n };\n\n const block = msg.readUInt8(0);\n const bit1 = block & 0x80;\n const bit2 = block & 0x40;\n\n if (!(bit1 === 0 && bit2 === 0)) {\n return;\n }\n\n const msgHeader = msg.slice(0, STUN_HEADER_LENGTH);\n const msgAttrs = msg.slice(STUN_HEADER_LENGTH, msg.length);\n\n let offset = 0;\n\n while (offset < msgAttrs.length) {\n const attrType = msgAttrs.readUInt16BE(offset);\n offset += 2;\n\n let attrBuffLength = msgAttrs.readUInt16BE(offset);\n const blockOut = attrBuffLength % 4;\n if (blockOut > 0) {\n attrBuffLength += 4 - blockOut;\n }\n offset += 2;\n\n const value = msgAttrs.slice(offset, offset + attrBuffLength);\n offset += attrBuffLength;\n\n let family;\n let address;\n switch (attrType) {\n case STUN_ATTR_MAPPED_ADDRESS:\n family = (value.readUInt16BE(0) === 0x02) ? 6 : 4;\n address = ip.toString(value, 4, family);\n addIPAddress(address);\n break;\n\n case STUN_ATTR_XOR_MAPPED_ADDRESS:\n case STUN_ATTR_XOR_MAPPED_ADDRESS_ALT:\n family = (value.readUInt16BE(0) === 0x02) ? 6 : 4;\n const magic = msgHeader.slice(4, 8);\n const tid = msgHeader.slice(8, 20);\n const xaddr = value.slice(4, family === 4 ? 8 : 20);\n const addr = xor(xaddr, family === 4 ? magic : value.concat([magic, tid]));\n address = ip.toString(addr, 0, family);\n addIPAddress(address);\n break;\n default:\n }\n }\n\n callback(stunIp);\n });\n\n stunServers.map(([port, host]) => socket.send(stunRequest, 0, stunRequest.length, port, host));\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/stun.js\n **/","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/buffer/index.js\n ** module id = 18\n ** module chunks = 0\n **/","module.exports = require(\"base64-js\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"base64-js\"\n ** module id = 19\n ** module chunks = 0\n **/","module.exports = require(\"ieee754\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"ieee754\"\n ** module id = 20\n ** module chunks = 0\n **/","module.exports = require(\"isarray\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"isarray\"\n ** module id = 21\n ** module chunks = 0\n **/","module.exports = require(\"ip\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"ip\"\n ** module id = 22\n ** module chunks = 0\n **/","export const BALANCE = 'BALANCE';\n\nexport const ORDER_BOOK = 'OB';\nexport const ORDER_BOOK_TRADE_NEW = 'TRADE_NEW';\nexport const ORDER_BOOK_NEW_ORDER = 'NEW_ORDER';\nexport const ORDER_BOOK_UPDATE_ORDER = 'UPDATE_ORDER';\nexport const ORDER_BOOK_DELETE_ORDER = 'DELETE_ORDER';\nexport const ORDER_BOOK_DELETE_ORDERS_THRU = 'DELETE_ORDERS_THRU';\n\nexport const EXECUTION_REPORT = 'EXECUTION_REPORT';\nexport const EXECUTION_REPORT_NEW = 'NEW';\nexport const EXECUTION_REPORT_PARTIAL = 'PARTIAL';\nexport const EXECUTION_REPORT_EXECUTION = 'EXECUTION';\nexport const EXECUTION_REPORT_CANCELED = 'CANCELED';\nexport const EXECUTION_REPORT_REJECTED = 'REJECTED';\n\nexport const DEPOSIT_REFRESH = 'DEPOSIT_REFRESH';\nexport const WITHDRAW_REFRESH = 'WITHDRAW_REFRESH';\n\n/* eslint-disable quote-props */\nexport const EVENTS = {\n ORDERBOOK: {\n '0': ORDER_BOOK_NEW_ORDER,\n '1': ORDER_BOOK_UPDATE_ORDER,\n '2': ORDER_BOOK_DELETE_ORDER,\n '3': ORDER_BOOK_DELETE_ORDERS_THRU,\n },\n TRADES: {\n '0': ORDER_BOOK_TRADE_NEW,\n },\n EXECUTION_REPORT: {\n '0': EXECUTION_REPORT_NEW,\n '1': EXECUTION_REPORT_PARTIAL,\n '2': EXECUTION_REPORT_EXECUTION,\n '4': EXECUTION_REPORT_CANCELED,\n '8': EXECUTION_REPORT_REJECTED,\n },\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/actionTypes.js\n **/","exports.endianness = function () { return 'LE' };\n\nexports.hostname = function () {\n if (typeof location !== 'undefined') {\n return location.hostname\n }\n else return '';\n};\n\nexports.loadavg = function () { return [] };\n\nexports.uptime = function () { return 0 };\n\nexports.freemem = function () {\n return Number.MAX_VALUE;\n};\n\nexports.totalmem = function () {\n return Number.MAX_VALUE;\n};\n\nexports.cpus = function () { return [] };\n\nexports.type = function () { return 'Browser' };\n\nexports.release = function () {\n if (typeof navigator !== 'undefined') {\n return navigator.appVersion;\n }\n return '';\n};\n\nexports.networkInterfaces\n= exports.getNetworkInterfaces\n= function () { return {} };\n\nexports.arch = function () { return 'javascript' };\n\nexports.platform = function () { return 'browser' };\n\nexports.tmpdir = exports.tmpDir = function () {\n return '/tmp';\n};\n\nexports.EOL = '\\n';\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/os-browserify/browser.js\n ** module id = 25\n ** module chunks = 0\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport MsgTypes from './constants/requests';\nimport RestTransport from './restTransport';\nimport { generateRequestId } from './listener';\n\nclass BlinkTradeRest extends RestTransport {\n ticker(callback?: Function): Promise {\n return super.fetchPublic('ticker', callback);\n }\n\n trades({ limit = 1000, since = '0' }: {\n limit: number;\n since: string;\n } = {}, callback?: Function): Promise {\n return super.fetchPublic(`trades?limit=${limit}&since=${since}`, callback);\n }\n\n orderbook(callback?: Function): Promise {\n return super.fetchPublic('orderbook', callback);\n }\n}\n\nexport default BlinkTradeRest;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/rest.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport Base from './base';\nimport BaseTransport from './baseTransport'\nimport sjcl from 'sjcl';\nimport nodeify from 'nodeify';\nimport url from 'url';\nimport path from 'path';\n\nclass RestTransport extends BaseTransport {\n\n /**\n * APIKey\n */\n key: string;\n\n /**\n * APISecret\n */\n secret: string;\n\n /**\n * Exchanges currencies available.\n */\n currency: 'USD' | 'BRL' | 'VEF' | 'CLP' | 'VND' | 'PKR';\n\n /**\n * Fetch rest API\n */\n fetchRequest: Function\n\n constructor(params: BlinkTradeRest) {\n super(params, 'rest');\n\n this.key = params.key;\n this.secret = params.secret;\n this.currency = params.currency || 'USD';\n\n this.fetchRequest = this.isNode ? require('isomorphic-fetch') : require('fetch-jsonp');\n }\n\n headers(method: string, body: Object): Object {\n const timeStamp = Date.now().toString();\n const hexKey = sjcl.codec.utf8String.toBits(this.secret);\n const hmac = new sjcl.misc.hmac(hexKey, sjcl.hash.sha256);\n const Signature = sjcl.codec.hex.fromBits(hmac.encrypt(timeStamp));\n return {\n method,\n headers: {\n 'Content-Type': 'application/json',\n Nonce: timeStamp,\n APIKey: this.key,\n Signature\n },\n body: JSON.stringify(body),\n };\n }\n\n fetch(msg: Object, api: string, headers?: Object = {}): Promise {\n return this.fetchRequest(url.resolve(this.endpoint, api), headers)\n .then(response => response.json())\n }\n\n fetchPublic(api: string, callback?: Function): Promise {\n return nodeify(this.fetch({}, path.join('api/v1', this.currency, api)), callback);\n }\n\n fetchTrade(msg: Object, callback?: Function): Promise {\n const headers = this.headers('POST', msg);\n return nodeify(this.fetch(msg, 'tapi/v1/message', headers, callback)\n .then(response => response.Status === 500 ? Promise.reject(response) : response.Responses)\n .then(response => response.length === 1 ? response[0] : response)\n , callback);\n }\n}\n\nexport default RestTransport;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/restTransport.js\n **/","module.exports = require(\"sjcl\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"sjcl\"\n ** module id = 28\n ** module chunks = 0\n **/","module.exports = require(\"url\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"url\"\n ** module id = 29\n ** module chunks = 0\n **/","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nvar splitPathRe =\n /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\nvar splitPath = function(filename) {\n return splitPathRe.exec(filename).slice(1);\n};\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n var isAbsolute = exports.isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isAbsolute).join('/');\n\n if (!path && !isAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return exports.normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n from = exports.resolve(from).substr(1);\n to = exports.resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function(path) {\n var result = splitPath(path),\n root = result[0],\n dir = result[1];\n\n if (!root && !dir) {\n // No dirname whatsoever\n return '.';\n }\n\n if (dir) {\n // It has a dirname, strip trailing slash\n dir = dir.substr(0, dir.length - 1);\n }\n\n return root + dir;\n};\n\n\nexports.basename = function(path, ext) {\n var f = splitPath(path)[2];\n // TODO: make this comparison case-insensitive on windows?\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n};\n\n\nexports.extname = function(path) {\n return splitPath(path)[3];\n};\n\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n ? function (str, start, len) { return str.substr(start, len) }\n : function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/path-browserify/index.js\n ** module id = 30\n ** module chunks = 0\n **/","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\n(function () {\n try {\n cachedSetTimeout = setTimeout;\n } catch (e) {\n cachedSetTimeout = function () {\n throw new Error('setTimeout is not defined');\n }\n }\n try {\n cachedClearTimeout = clearTimeout;\n } catch (e) {\n cachedClearTimeout = function () {\n throw new Error('clearTimeout is not defined');\n }\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/process/browser.js\n ** module id = 31\n ** module chunks = 0\n **/","module.exports = require(\"isomorphic-fetch\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"isomorphic-fetch\"\n ** module id = 32\n ** module chunks = 0\n **/","module.exports = require(\"fetch-jsonp\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"fetch-jsonp\"\n ** module id = 33\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///blinktrade.min.js","webpack:///webpack/bootstrap 796c750e873e00d67f9b","webpack:///./src/index.js","webpack:///./src/constants/brokers.js","webpack:///./src/ws.js","webpack:///external \"lodash\"","webpack:///external \"eventemitter2\"","webpack:///./src/listener.js","webpack:///./src/constants/requestTypes.js","webpack:///./src/constants/actionTypes.js","webpack:///./src/constants/requests.js","webpack:///./src/wsTransport.js","webpack:///./src/baseTransport.js","webpack:///./src/base.js","webpack:///./src/constants/common.js","webpack:///external \"fingerprintjs2\"","webpack:///external \"nodeify\"","webpack:///external \"ws\"","webpack:///./src/util/macaddress.js","webpack:///external \"macaddress\"","webpack:///./src/util/stun.js","webpack:///./~/buffer/index.js","webpack:///external \"base64-js\"","webpack:///external \"ieee754\"","webpack:///external \"isarray\"","webpack:///external \"ip\"","webpack:///./~/os-browserify/browser.js","webpack:///./src/rest.js","webpack:///./src/restTransport.js","webpack:///external \"sjcl\"","webpack:///external \"url\"","webpack:///./~/path-browserify/index.js","webpack:///./~/process/browser.js","webpack:///external \"isomorphic-fetch\"","webpack:///external \"fetch-jsonp\""],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","Object","defineProperty","value","BlinkTradeRest","BlinkTradeWS","Brokers","undefined","_brokers","_brokers2","_ws","_ws2","_rest","_rest2","SURBITCOIN","VBTC","FOXBIT","TESTNET","URDUBIT","CHILEBIT","_defineProperty","key","enumerable","configurable","writable","_objectWithoutProperties","keys","target","i","indexOf","prototype","hasOwnProperty","_classCallCheck","instance","Constructor","TypeError","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","create","constructor","setPrototypeOf","__proto__","_extends","assign","arguments","length","source","_createClass","defineProperties","props","descriptor","protoProps","staticProps","_get","get","object","property","receiver","Function","desc","getOwnPropertyDescriptor","parent","getPrototypeOf","getter","_lodash","_lodash2","_listener","_actionTypes","_requests","_requests2","_wsTransport","_wsTransport2","_WebSocketTransport","params","this","_this","session","callback","_this2","d","Date","msg","MsgType","HEARTBEAT","TestReqID","getTime","SendTime","Promise","resolve","reject","then","data","Latency","now","_ref","_this3","username","password","secondFactor","userAgent","isNode","os","UserAgent","type","release","UserAgentLanguage","UserAgentPlatform","platform","arch","UserAgentTimezoneOffset","getTimezoneOffset","window","navigator","language","LOGIN","UserReqID","generateRequestId","BrokerID","brokerId","Username","Password","UserReqTyp","SecondFactor","UserStatus","LOGOUT","profile","_session$Profile","Profile","_this4","registerListener","balance","eventEmitter","emit","BALANCE","symbols","_this5","SECURITY_STATUS","SecurityStatusReqID","SubscriptionRequestType","Instruments","formatTicker","SellVolume","LowPx","LastPx","BestAsk","HighPx","BuyVolume","BestBid","registerEventEmitter","ticker","Symbol","_this6","MARKET_DATA_FULL_REFRESH","MDReqID","MarketDepth","MDUpdateType","MDEntryTypes","subscribeEvent","MDBkTyp","MDIncGrp","map","order","dataOrder","index","MDEntryPositionNo","price","MDEntryPx","size","MDEntrySize","side","MDEntryType","userId","UserID","orderId","OrderID","symbol","time","MDEntryDate","MDEntryTime","orderbookEvent","EVENTS","ORDERBOOK","MDUpdateAction","tradeEvent","TRADES","_data$MDFullGrp$filte","MDFullGrp","filter","reduce","prev","push","bids","asks","err","MARKET_DATA_UNSUBSCRIBE","_this7","event","EXECUTION_REPORT","ExecType","_this8","_ref2","since","_ref2$page","page","Page","_ref2$pageSize","pageSize","PageSize","TRADE_HISTORY","TradeHistoryReqID","Filter","Since","Columns","trades","TradeHistory","groupBy","TradeHistoryGrp","trade","zipObject","Market","_this9","_ref3","_ref3$currency","currency","depositMethodId","deposit","DEPOSIT_REFRESH","_ref4","_this10","amount","_ref4$currency","_ref4$method","method","withdraw","WITHDRAW_REFRESH","require","_interopRequireWildcard","newObj","getListeners","requests","parseInt","Math","random","String","getListener","msgType","listeners","getRequest","message","result","mapKeys","RequestTypes","has","find","ReqId","registerRequest","promise","findIndex","deleteRequest","omit","_requestTypes","SOCKET_ID","REQUEST_ID","TEST_REQUEST_ID","USER_REQUEST_ID","SECURITY_REQUEST_ID","RESET_PASSWORD_REQUEST_ID","DEPOSIT_REQUEST_ID","WITHDRAW_REQUEST_ID","BALANCE_REQUEST_ID","ORDERS_REQUEST_ID","ENABLE_TWO_FACTOR_REQUEST_ID","DEPOSIT_METHOD_REQUEST_ID","WITHDRAW_LIST_REQUEST_ID","BROKER_LIST_REQUEST_ID","DEPOSIT_LIST_REQUEST_ID","TRADE_HISTORY_REQUEST_ID","LEDGER_LIST_REQUEST_ID","TRADERS_RANK_REQUEST_ID","UPDATE_REQUEST_ID","POSITION_REQUEST_ID","SECURITY_STATUS_REQUEST_ID","API_KEY_LIST_REQUEST_ID","API_KEY_CREATE_REQUEST_ID","API_KEY_REVOKE_REQUEST_ID","PROCESS_DEPOSIT_REQUEST_ID","CUSTOMER_LIST_REQUEST_ID","CUSTOMER_REQUEST_ID","PROCESS_WITHDRAW_REQUEST_ID","VERIFY_CUSTOMER_REQUEST_ID","MD_REQUEST_ID","CLIENT_ORDER_ID","ORDER_BOOK_TRADE_NEW","ORDER_BOOK","ORDER_BOOK_NEW_ORDER","ORDER_BOOK_UPDATE_ORDER","ORDER_BOOK_DELETE_ORDER","ORDER_BOOK_DELETE_ORDERS_THRU","EXECUTION_REPORT_NEW","EXECUTION_REPORT_PARTIAL","EXECUTION_REPORT_EXECUTION","EXECUTION_REPORT_CANCELED","EXECUTION_REPORT_REJECTED","0","1","2","3","4","8","CHANGE_PASSWORD","ORDER_SEND","ORDER_CANCEL","SECURITY_LIST","ORDER_LIST","BROKER_LIST","PROFILE_UPDATE","REQUEST_DEPOSIT","REQUEST_DEPOSIT_LIST","REQUEST_DEPOSIT_METHODS","REQUEST_WITHDRAW","REQUEST_WITHDRAW_LIST","CONFIRM_WITHDRAW","CANCEL_WITHDRAW","_baseTransport","_baseTransport2","_fingerprintjs","_fingerprintjs2","_nodeify","_nodeify2","_eventemitter","WebSocketTransport","_BaseTransport","stun","local","public","getStun","getFingerPrint","EventEmitter2","wildcard","delimiter","extend","request","WebSocket","socket","endpoint","onopen","onOpen","bind","onclose","onClose","onerror","onError","onmessage","onMessage","nodeify","close","connected","readyState","STUNTIP","FingerPrint","fingerPrint","send","JSON","stringify","sendMessage","parse","Error","Detail","Description","listener","dispatchPromise","dispatchListeners","on","onAny","offAny","once","many","times","removeListener","removeAllListeners","events","getMac","macAddress","_base","_base2","BaseTransport","_Base","env","sendMessageAsPromise","fetchTrade","BalanceReqID","Available","balances","includes","_ref$page","_ref$pageSize","OrdersReqID","orders","OrdListGrp","ClOrdID","Side","OrdType","Price","OrderQty","param","clientId","_ref3$page","_ref3$pageSize","_ref3$statusList","statusList","StatusList","WithdrawListReqID","withdrawData","WithdrawListGrp","reqId","WithdrawReqID","Method","Amount","Currency","Data","_ref5","WithdrawID","withdrawId","confirmationToken","ConfirmationToken","WithdrawCancelReqID","_ref6","_ref6$page","_ref6$pageSize","_ref6$status","status","DepositListReqID","depositData","DepositListGrp","_ref7","_ref7$currency","DepositReqID","DepositMethodID","Value","DepositMethodReqID","_common","_common2","Base","url","prod","testnet","ws","rest","_macaddress2","all","hashCode","str","hash","charCodeAt","macAddresses","forEach","iface","mac","_macaddress","Buffer","addIPAddress","ipAddress","match","stunIp","_dgram2","createSocket","STUN_HEADER_LENGTH","stunRequest","STUN_METHOD_REQUEST","STUN_BINDING_CLASS","STUN_MAGIC_COOKIE","STUN_TID_MAX","pow","STUN_ATTR_MAPPED_ADDRESS","STUN_ATTR_XOR_MAPPED_ADDRESS","STUN_ATTR_XOR_MAPPED_ADDRESS_ALT","stunTxId","stunServers","writeUInt16BE","writeUInt32BE","xor","a","b","tmp","len","block","readUInt8","bit1","bit2","msgHeader","slice","msgAttrs","offset","attrType","readUInt16BE","attrBuffLength","blockOut","family","address","_ip2","toString","magic","tid","xaddr","addr","concat","_slicedToArray","port","host","sliceIterator","arr","_arr","_n","_d","_e","_s","_i","iterator","next","done","Array","isArray","_ip","_dgram","global","typedArraySupport","Uint8Array","foo","subarray","byteLength","e","kMaxLength","TYPED_ARRAY_SUPPORT","createBuffer","that","RangeError","arg","encodingOrOffset","allocUnsafe","from","ArrayBuffer","fromArrayBuffer","fromString","fromObject","assertSize","alloc","fill","encoding","checked","string","isEncoding","actual","write","fromArrayLike","array","byteOffset","isBuffer","copy","buffer","isnan","SlowBuffer","isView","loweredCase","utf8ToBytes","base64ToBytes","toLowerCase","slowToString","start","end","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","n","bidirectionalIndexOf","val","dir","isNaN","arrayIndexOf","lastIndexOf","read","buf","indexSize","arrLength","valLength","foundIndex","found","j","hexWrite","remaining","strLen","parsed","substr","utf8Write","blitBuffer","asciiWrite","asciiToBytes","latin1Write","base64Write","ucs2Write","utf16leToBytes","base64","fromByteArray","min","res","firstByte","codePoint","bytesPerSequence","secondByte","thirdByte","fourthByte","tempCodePoint","decodeCodePointsArray","codePoints","MAX_ARGUMENTS_LENGTH","fromCharCode","apply","ret","out","toHex","bytes","checkOffset","ext","checkInt","max","objectWriteUInt16","littleEndian","objectWriteUInt32","checkIEEE754","writeFloat","noAssert","ieee754","writeDouble","base64clean","stringtrim","replace","INVALID_BASE64_RE","trim","units","Infinity","leadSurrogate","byteArray","hi","lo","toByteArray","src","dst","INSPECT_MAX_BYTES","poolSize","_augment","species","allocUnsafeSlow","_isBuffer","compare","x","y","list","pos","swap16","swap32","swap64","equals","inspect","join","thisStart","thisEnd","thisCopy","targetCopy","isFinite","toJSON","newBuf","sliceLen","readUIntLE","mul","readUIntBE","readUInt16LE","readUInt32LE","readUInt32BE","readIntLE","readIntBE","readInt8","readInt16LE","readInt16BE","readInt32LE","readInt32BE","readFloatLE","readFloatBE","readDoubleLE","readDoubleBE","writeUIntLE","maxBytes","writeUIntBE","writeUInt8","floor","writeUInt16LE","writeUInt32LE","writeIntLE","limit","sub","writeIntBE","writeInt8","writeInt16LE","writeInt16BE","writeInt32LE","writeInt32BE","writeFloatLE","writeFloatBE","writeDoubleLE","writeDoubleBE","targetStart","set","code","endianness","hostname","location","loadavg","uptime","freemem","Number","MAX_VALUE","totalmem","cpus","appVersion","networkInterfaces","getNetworkInterfaces","tmpdir","tmpDir","EOL","_restTransport","_restTransport2","_RestTransport","_ref$limit","_ref$since","_sjcl","_sjcl2","_url","_url2","_path","_path2","RestTransport","secret","fetchRequest","body","timeStamp","hexKey","codec","utf8String","toBits","hmac","misc","sha256","Signature","hex","fromBits","encrypt","headers","Content-Type","Nonce","APIKey","api","response","json","fetch","Status","Responses","process","normalizeArray","parts","allowAboveRoot","up","last","splice","unshift","xs","f","splitPathRe","splitPath","filename","exec","resolvedPath","resolvedAbsolute","path","cwd","charAt","split","normalize","isAbsolute","trailingSlash","paths","relative","to","fromParts","toParts","samePartsLength","outputParts","sep","dirname","root","basename","extname","runTimeout","fun","cachedSetTimeout","setTimeout","runClearTimeout","marker","cachedClearTimeout","clearTimeout","cleanUpNextTick","draining","currentQueue","queue","queueIndex","drainQueue","timeout","run","Item","noop","nextTick","args","title","browser","argv","version","versions","addListener","off","binding","name","chdir","umask"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAE,WACAE,GAAAJ,EACAK,QAAA,EAUA,OANAP,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,QAAA,EAGAF,EAAAD,QAvBA,GAAAD,KAqCA,OATAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,GAGAV,EAAA,KDMM,SAASI,EAAQD,EAASH,GAE/B,YAmBA,SAASW,GAAuBC,GAAO,MAAOA,IAAOA,EAAIC,WAAaD,GAAQE,UAASF,GAjBvFG,OAAOC,eAAeb,EAAS,cAC7Bc,OAAO,IAETd,EAAQe,eAAiBf,EAAQgB,aAAehB,EAAQiB,QAAUC,ME7BnE,IAAAC,GAAAtB,EAAA,GFiCKuB,EAAYZ,EAAuBW,GEhCxCE,EAAAxB,EAAA,GFoCKyB,EAAOd,EAAuBa,GEnCnCE,EAAA1B,EAAA,IFuCK2B,EAAShB,EAAuBe,EAIpCvB,GExCCiB,QFwCiBG,aAClBpB,EExCCgB,aFwCsBM,aACvBtB,EExCCe,eFwCwBS,cAwBpB,SAASvB,EAAQD,GAEtB,YAEAY,QAAOC,eAAeb,EAAS,cAC7Bc,OAAO,IAETd,cGnGCyB,WAAY,EACZC,KAAM,EACNC,OAAQ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A0P,QAAA,qBjCquIM,SAASzP,EAAQD,GkCruIvBC,EAAAD,QAAA0P,QAAA","file":"blinktrade.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.BlinkTradeRest = exports.BlinkTradeWS = exports.Brokers = undefined;\n\t\n\tvar _brokers = __webpack_require__(1);\n\t\n\tvar _brokers2 = _interopRequireDefault(_brokers);\n\t\n\tvar _ws = __webpack_require__(2);\n\t\n\tvar _ws2 = _interopRequireDefault(_ws);\n\t\n\tvar _rest = __webpack_require__(26);\n\t\n\tvar _rest2 = _interopRequireDefault(_rest);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\texports.Brokers = _brokers2.default;\n\texports.BlinkTradeWS = _ws2.default;\n\texports.BlinkTradeRest = _rest2.default; /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.default = {\n\t SURBITCOIN: 1,\n\t VBTC: 3,\n\t FOXBIT: 4,\n\t TESTNET: 5,\n\t URDUBIT: 8,\n\t CHILEBIT: 9\n\t};\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\t\n\tvar _lodash = __webpack_require__(3);\n\t\n\tvar _lodash2 = _interopRequireDefault(_lodash);\n\t\n\tvar _eventemitter = __webpack_require__(4);\n\t\n\tvar _listener = __webpack_require__(5);\n\t\n\tvar _actionTypes = __webpack_require__(7);\n\t\n\tvar _requests = __webpack_require__(8);\n\t\n\tvar _requests2 = _interopRequireDefault(_requests);\n\t\n\tvar _wsTransport = __webpack_require__(9);\n\t\n\tvar _wsTransport2 = _interopRequireDefault(_wsTransport);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\t\n\tfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\t\n\tvar BlinkTradeWS = function (_WebSocketTransport) {\n\t _inherits(BlinkTradeWS, _WebSocketTransport);\n\t\n\t function BlinkTradeWS(params) {\n\t _classCallCheck(this, BlinkTradeWS);\n\t\n\t var _this = _possibleConstructorReturn(this, (BlinkTradeWS.__proto__ || Object.getPrototypeOf(BlinkTradeWS)).call(this, params));\n\t\n\t _this.session = {};\n\t return _this;\n\t }\n\t\n\t /**\n\t * Session to store login information\n\t */\n\t\n\t\n\t _createClass(BlinkTradeWS, [{\n\t key: 'heartbeat',\n\t value: function heartbeat(callback) {\n\t var _this2 = this;\n\t\n\t var d = new Date();\n\t var msg = {\n\t MsgType: _requests2.default.HEARTBEAT,\n\t TestReqID: d.getTime(),\n\t SendTime: d.getTime()\n\t };\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'sendMessageAsPromise', _this2).call(_this2, msg, callback).then(function (data) {\n\t return resolve(_extends({}, data, {\n\t Latency: new Date(Date.now()) - data.SendTime\n\t }));\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'login',\n\t value: function login(_ref, callback) {\n\t var _this3 = this;\n\t\n\t var username = _ref.username;\n\t var password = _ref.password;\n\t var secondFactor = _ref.secondFactor;\n\t\n\t var userAgent = void 0;\n\t if (!this.isNode) {\n\t userAgent = {\n\t UserAgent: window.navigator.userAgent,\n\t UserAgentLanguage: window.navigator.language,\n\t UserAgentPlatform: window.navigator.platform,\n\t UserAgentTimezoneOffset: new Date().getTimezoneOffset()\n\t };\n\t } else {\n\t var os = __webpack_require__(25);\n\t userAgent = {\n\t UserAgent: os.type() + ' ' + os.release(),\n\t UserAgentLanguage: 'en_US',\n\t UserAgentPlatform: os.platform() + ' (' + os.arch() + ')',\n\t UserAgentTimezoneOffset: new Date().getTimezoneOffset()\n\t };\n\t }\n\t\n\t var msg = _extends({\n\t MsgType: _requests2.default.LOGIN,\n\t UserReqID: (0, _listener.generateRequestId)(),\n\t BrokerID: this.brokerId,\n\t Username: username,\n\t Password: password,\n\t UserReqTyp: '1'\n\t }, userAgent);\n\t\n\t if (secondFactor) {\n\t msg.SecondFactor = secondFactor;\n\t }\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'sendMessageAsPromise', _this3).call(_this3, msg, callback).then(function (data) {\n\t if (data.UserStatus === 1) {\n\t _this3.session = data;\n\t return resolve(data);\n\t }\n\t\n\t return reject(data);\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'logout',\n\t value: function logout(callback) {\n\t var msg = {\n\t MsgType: _requests2.default.LOGOUT,\n\t BrokerID: this.brokerId,\n\t UserReqID: (0, _listener.generateRequestId)(),\n\t Username: this.session.Username,\n\t UserReqTyp: '2'\n\t };\n\t\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'sendMessageAsPromise', this).call(this, msg, callback);\n\t }\n\t }, {\n\t key: 'profile',\n\t value: function profile(callback) {\n\t var _session$Profile = this.session.Profile;\n\t var VerificationData = _session$Profile.VerificationData;\n\t\n\t var profile = _objectWithoutProperties(_session$Profile, ['VerificationData']);\n\t\n\t return callback ? callback(profile) : Promise.resolve(profile);\n\t }\n\t }, {\n\t key: 'balance',\n\t value: function balance(callback) {\n\t var _this4 = this;\n\t\n\t (0, _listener.registerListener)('U3', function (balance) {\n\t callback && callback(null, balance);\n\t return _this4.eventEmitter.emit(_actionTypes.BALANCE, balance);\n\t });\n\t\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'emitterPromise', this).call(this, new Promise(function (resolve, reject) {\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'balance', _this4).call(_this4, callback).then(resolve).catch(reject);\n\t }));\n\t }\n\t }, {\n\t key: 'subscribeTicker',\n\t value: function subscribeTicker(symbols, callback) {\n\t var _this5 = this;\n\t\n\t var msg = {\n\t MsgType: _requests2.default.SECURITY_STATUS,\n\t SecurityStatusReqID: (0, _listener.generateRequestId)(),\n\t SubscriptionRequestType: '1',\n\t Instruments: symbols\n\t };\n\t\n\t var formatTicker = function formatTicker(data) {\n\t return _extends({}, data, {\n\t SellVolume: data.SellVolume / 1e8,\n\t LowPx: data.LowPx / 1e8,\n\t LastPx: data.LastPx / 1e8,\n\t BestAsk: data.BestAsk / 1e8,\n\t HighPx: data.HighPx / 1e8,\n\t BuyVolume: data.BuyVolume / 1e8,\n\t BestBid: data.BestBid / 1e8\n\t });\n\t };\n\t\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'emitterPromise', this).call(this, new Promise(function (resolve, reject) {\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'sendMessageAsPromise', _this5).call(_this5, msg, callback).then(function (data) {\n\t resolve(formatTicker(data));\n\t (0, _listener.registerEventEmitter)({ SecurityStatusReqID: data.SecurityStatusReqID }, function (ticker) {\n\t callback && callback(null, formatTicker(ticker));\n\t return _this5.eventEmitter.emit('BLINK:' + ticker.Symbol, formatTicker(ticker));\n\t });\n\t }).catch(reject);\n\t }));\n\t }\n\t }, {\n\t key: 'unSubscribeTicker',\n\t value: function unSubscribeTicker(SecurityStatusReqID) {\n\t var msg = {\n\t MsgType: _requests2.default.SECURITY_STATUS,\n\t SecurityStatusReqID: SecurityStatusReqID,\n\t SubscriptionRequestType: '2'\n\t };\n\t\n\t _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'sendMessage', this).call(this, msg);\n\t return SecurityStatusReqID;\n\t }\n\t }, {\n\t key: 'subscribeOrderbook',\n\t value: function subscribeOrderbook(symbols, callback) {\n\t var _this6 = this;\n\t\n\t var msg = {\n\t MsgType: _requests2.default.MARKET_DATA_FULL_REFRESH,\n\t MDReqID: (0, _listener.generateRequestId)(),\n\t SubscriptionRequestType: '1',\n\t MarketDepth: 0,\n\t MDUpdateType: '1', // Incremental refresh\n\t MDEntryTypes: ['0', '1', '2'],\n\t Instruments: symbols\n\t };\n\t\n\t var subscribeEvent = function subscribeEvent(data) {\n\t if (data.MDBkTyp === '3') {\n\t data.MDIncGrp.map(function (order) {\n\t var dataOrder = {\n\t index: order.MDEntryPositionNo,\n\t price: order.MDEntryPx / 1e8,\n\t size: order.MDEntrySize / 1e8,\n\t side: order.MDEntryType === '0' ? 'buy' : 'sell',\n\t userId: order.UserID,\n\t orderId: order.OrderID,\n\t symbol: order.Symbol,\n\t time: new Date(order.MDEntryDate + ' ' + order.MDEntryTime).toString()\n\t };\n\t\n\t callback && callback(null, dataOrder);\n\t\n\t switch (order.MDEntryType) {\n\t case '0':\n\t case '1':\n\t var orderbookEvent = _actionTypes.ORDER_BOOK + ':' + _actionTypes.EVENTS.ORDERBOOK[order.MDUpdateAction];\n\t return _this6.eventEmitter.emit(orderbookEvent, _extends({}, dataOrder, {\n\t type: orderbookEvent\n\t }));\n\t case '2':\n\t var tradeEvent = _actionTypes.ORDER_BOOK + ':' + _actionTypes.EVENTS.TRADES[order.MDUpdateAction];\n\t return _this6.eventEmitter.emit(tradeEvent, _extends({}, dataOrder, {\n\t type: tradeEvent\n\t }));\n\t case '4':\n\t break;\n\t default:\n\t return null;\n\t }\n\t return null;\n\t });\n\t }\n\t };\n\t\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'emitterPromise', this).call(this, new Promise(function (resolve, reject) {\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'sendMessageAsPromise', _this6).call(_this6, msg, callback).then(function (data) {\n\t if (data.MsgType === 'W') {\n\t // Split orders in bids and asks\n\t /* eslint-disable no-param-reassign */\n\t var _data$MDFullGrp$filte = data.MDFullGrp.filter(function (order) {\n\t return order.MDEntryType === '0' || order.MDEntryType === '1';\n\t }).reduce(function (prev, order) {\n\t var side = order.MDEntryType === '0' ? 'bids' : 'asks';\n\t (prev[side] || (prev[side] = [])).push([order.MDEntryPx / 1e8, order.MDEntrySize / 1e8, order.UserID]);\n\t return prev;\n\t }, []);\n\t\n\t var bids = _data$MDFullGrp$filte.bids;\n\t var asks = _data$MDFullGrp$filte.asks;\n\t /* eslint-enable no-param-reassign */\n\t\n\t (0, _listener.registerEventEmitter)({ MDReqID: data.MDReqID }, subscribeEvent);\n\t\n\t return resolve(_extends({}, data, {\n\t MDFullGrp: _defineProperty({}, data.Symbol, {\n\t bids: bids,\n\t asks: asks\n\t })\n\t }));\n\t }\n\t }).catch(function (err) {\n\t return reject(err);\n\t });\n\t }));\n\t }\n\t }, {\n\t key: 'unSubscribeOrderbook',\n\t value: function unSubscribeOrderbook(MDReqID) {\n\t var msg = {\n\t MsgType: _requests2.default.MARKET_DATA_UNSUBSCRIBE,\n\t MDReqID: MDReqID,\n\t MarketDepth: 0,\n\t SubscriptionRequestType: '2'\n\t };\n\t\n\t _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'sendMessage', this).call(this, msg);\n\t return MDReqID;\n\t }\n\t }, {\n\t key: 'executionReport',\n\t value: function executionReport(callback) {\n\t var _this7 = this;\n\t\n\t (0, _listener.registerListener)('8', function (data) {\n\t callback && callback(data);\n\t var event = _actionTypes.EVENTS.EXECUTION_REPORT[data.ExecType];\n\t return _this7.eventEmitter.emit(_actionTypes.EXECUTION_REPORT + ':' + event, data);\n\t });\n\t\n\t return this.eventEmitter;\n\t }\n\t }, {\n\t key: 'tradeHistory',\n\t value: function tradeHistory() {\n\t var _this8 = this;\n\t\n\t var _ref2 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t var since = _ref2.since;\n\t var filter = _ref2.filter;\n\t var _ref2$page = _ref2.page;\n\t var Page = _ref2$page === undefined ? 0 : _ref2$page;\n\t var _ref2$pageSize = _ref2.pageSize;\n\t var PageSize = _ref2$pageSize === undefined ? 80 : _ref2$pageSize;\n\t var callback = arguments[1];\n\t\n\t var msg = {\n\t MsgType: _requests2.default.TRADE_HISTORY,\n\t TradeHistoryReqID: (0, _listener.generateRequestId)(),\n\t Page: Page,\n\t PageSize: PageSize\n\t };\n\t\n\t if (filter && filter.length > 0) {\n\t msg.Filter = filter;\n\t }\n\t\n\t if (since && typeof since === 'number') {\n\t msg.Since = since;\n\t }\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'sendMessageAsPromise', _this8).call(_this8, msg, callback).then(function (data) {\n\t var Columns = data.Columns;\n\t\n\t var trades = _objectWithoutProperties(data, ['Columns']);\n\t\n\t var TradeHistory = _lodash2.default.groupBy(_lodash2.default.map(data.TradeHistoryGrp, function (trade) {\n\t return _lodash2.default.zipObject(Columns, trade);\n\t }), function (trade) {\n\t return trade.Market;\n\t });\n\t return resolve(_extends({}, trades, {\n\t TradeHistoryGrp: TradeHistory\n\t }));\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'requestDeposit',\n\t value: function requestDeposit() {\n\t var _this9 = this;\n\t\n\t var _ref3 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t var _ref3$currency = _ref3.currency;\n\t var currency = _ref3$currency === undefined ? 'BTC' : _ref3$currency;\n\t var value = _ref3.value;\n\t var depositMethodId = _ref3.depositMethodId;\n\t var callback = arguments[1];\n\t\n\t (0, _listener.registerListener)('U23', function (deposit) {\n\t callback && callback(null, deposit);\n\t return _this9.eventEmitter.emit(_actionTypes.DEPOSIT_REFRESH, deposit);\n\t });\n\t\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'emitterPromise', this).call(this, new Promise(function (resolve, reject) {\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'requestDeposit', _this9).call(_this9, { currency: currency, value: value, depositMethodId: depositMethodId }, callback).then(resolve).catch(reject);\n\t }));\n\t }\n\t }, {\n\t key: 'onDepositRefresh',\n\t value: function onDepositRefresh(callback) {\n\t return new Promise(function (resolve) {\n\t (0, _listener.registerListener)('U23', function (deposit) {\n\t callback && callback(deposit);\n\t return resolve(deposit);\n\t });\n\t });\n\t }\n\t }, {\n\t key: 'requestWithdraw',\n\t value: function requestWithdraw(_ref4, callback) {\n\t var _this10 = this;\n\t\n\t var amount = _ref4.amount;\n\t var data = _ref4.data;\n\t var _ref4$currency = _ref4.currency;\n\t var currency = _ref4$currency === undefined ? 'BTC' : _ref4$currency;\n\t var _ref4$method = _ref4.method;\n\t var method = _ref4$method === undefined ? 'bitcoin' : _ref4$method;\n\t\n\t (0, _listener.registerListener)('U9', function (withdraw) {\n\t callback && callback(null, withdraw);\n\t return _this10.eventEmitter.emit(_actionTypes.WITHDRAW_REFRESH, withdraw);\n\t });\n\t\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'emitterPromise', this).call(this, new Promise(function (resolve, reject) {\n\t return _get(BlinkTradeWS.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeWS.prototype), 'requestWithdraw', _this10).call(_this10, { amount: amount, data: data, currency: currency, method: method }, callback).then(resolve).catch(reject);\n\t }));\n\t }\n\t }, {\n\t key: 'onWithdrawRefresh',\n\t value: function onWithdrawRefresh(callback) {\n\t return new Promise(function (resolve) {\n\t (0, _listener.registerListener)('U9', function (withdraw) {\n\t callback && callback(withdraw);\n\t return resolve(withdraw);\n\t });\n\t });\n\t }\n\t }]);\n\t\n\t return BlinkTradeWS;\n\t}(_wsTransport2.default);\n\t\n\texports.default = BlinkTradeWS;\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"lodash\");\n\n/***/ },\n/* 4 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"eventemitter2\");\n\n/***/ },\n/* 5 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\t\n\texports.getListeners = getListeners;\n\texports.generateRequestId = generateRequestId;\n\texports.getListener = getListener;\n\texports.getRequest = getRequest;\n\texports.registerRequest = registerRequest;\n\texports.registerEventEmitter = registerEventEmitter;\n\texports.registerListener = registerListener;\n\texports.deleteRequest = deleteRequest;\n\t\n\tvar _lodash = __webpack_require__(3);\n\t\n\tvar _lodash2 = _interopRequireDefault(_lodash);\n\t\n\tvar _requestTypes = __webpack_require__(6);\n\t\n\tvar RequestTypes = _interopRequireWildcard(_requestTypes);\n\t\n\tfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tvar requests = {};\n\tvar listeners = {};\n\t\n\tfunction getListeners() {\n\t return requests;\n\t}\n\t\n\tfunction generateRequestId() {\n\t return parseInt(String(1e7 * Math.random()), 10);\n\t}\n\t\n\tfunction getListener(msgType) {\n\t return listeners[msgType];\n\t}\n\t\n\tfunction getRequest(message) {\n\t var result = void 0;\n\t _lodash2.default.mapKeys(RequestTypes, function (key) {\n\t if (_lodash2.default.has(message, key)) {\n\t result = _lodash2.default.find(requests[key], { ReqId: String(message[key]) });\n\t }\n\t });\n\t\n\t return result;\n\t}\n\t\n\tfunction registerRequest(message, promise) {\n\t _lodash2.default.mapKeys(RequestTypes, function (key) {\n\t if (_lodash2.default.has(message, key)) {\n\t requests[key] = requests[key] || [];\n\t requests[key].push(_extends({ ReqId: String(message[key]) }, promise));\n\t }\n\t });\n\t\n\t return requests;\n\t}\n\t\n\tfunction registerEventEmitter(message, callback) {\n\t _lodash2.default.mapKeys(RequestTypes, function (key) {\n\t if (_lodash2.default.has(message, key)) {\n\t if (requests[key] !== []) {\n\t var index = _lodash2.default.findIndex(requests[key], { ReqId: String(message[key]) });\n\t requests[key][index] = _extends({}, requests[key][index], {\n\t resolve: null,\n\t reject: null,\n\t callback: callback\n\t });\n\t }\n\t }\n\t });\n\t\n\t return requests;\n\t}\n\t\n\tfunction registerListener(msgType, callback) {\n\t listeners[msgType] = listeners[msgType] || [];\n\t listeners[msgType] = callback;\n\t}\n\t\n\tfunction deleteRequest(key) {\n\t requests = _lodash2.default.omit(requests, [key]);\n\t return requests;\n\t}\n\n/***/ },\n/* 6 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\tvar SOCKET_ID = exports.SOCKET_ID = 'SocketID';\n\tvar REQUEST_ID = exports.REQUEST_ID = 'ReqID';\n\tvar TEST_REQUEST_ID = exports.TEST_REQUEST_ID = 'TestReqID';\n\tvar USER_REQUEST_ID = exports.USER_REQUEST_ID = 'UserReqID';\n\tvar SECURITY_REQUEST_ID = exports.SECURITY_REQUEST_ID = 'SecurityReqID';\n\tvar RESET_PASSWORD_REQUEST_ID = exports.RESET_PASSWORD_REQUEST_ID = 'ResetPasswordReqID';\n\tvar DEPOSIT_REQUEST_ID = exports.DEPOSIT_REQUEST_ID = 'DepositReqID';\n\tvar WITHDRAW_REQUEST_ID = exports.WITHDRAW_REQUEST_ID = 'WithdrawReqID';\n\tvar BALANCE_REQUEST_ID = exports.BALANCE_REQUEST_ID = 'BalanceReqID';\n\tvar ORDERS_REQUEST_ID = exports.ORDERS_REQUEST_ID = 'OrdersReqID';\n\tvar ENABLE_TWO_FACTOR_REQUEST_ID = exports.ENABLE_TWO_FACTOR_REQUEST_ID = 'EnableTwoFactorReqID';\n\tvar DEPOSIT_METHOD_REQUEST_ID = exports.DEPOSIT_METHOD_REQUEST_ID = 'DepositMethodReqID';\n\tvar WITHDRAW_LIST_REQUEST_ID = exports.WITHDRAW_LIST_REQUEST_ID = 'WithdrawListReqID';\n\tvar BROKER_LIST_REQUEST_ID = exports.BROKER_LIST_REQUEST_ID = 'BrokerListReqID';\n\tvar DEPOSIT_LIST_REQUEST_ID = exports.DEPOSIT_LIST_REQUEST_ID = 'DepositListReqID';\n\tvar TRADE_HISTORY_REQUEST_ID = exports.TRADE_HISTORY_REQUEST_ID = 'TradeHistoryReqID';\n\tvar LEDGER_LIST_REQUEST_ID = exports.LEDGER_LIST_REQUEST_ID = 'LedgerListReqID';\n\tvar TRADERS_RANK_REQUEST_ID = exports.TRADERS_RANK_REQUEST_ID = 'TradersRankReqID';\n\tvar UPDATE_REQUEST_ID = exports.UPDATE_REQUEST_ID = 'UpdateReqID';\n\tvar POSITION_REQUEST_ID = exports.POSITION_REQUEST_ID = 'PositionReqID';\n\tvar SECURITY_STATUS_REQUEST_ID = exports.SECURITY_STATUS_REQUEST_ID = 'SecurityStatusReqID';\n\tvar API_KEY_LIST_REQUEST_ID = exports.API_KEY_LIST_REQUEST_ID = 'APIKeyListReqID';\n\tvar API_KEY_CREATE_REQUEST_ID = exports.API_KEY_CREATE_REQUEST_ID = 'APIKeyCreateReqID';\n\tvar API_KEY_REVOKE_REQUEST_ID = exports.API_KEY_REVOKE_REQUEST_ID = 'APIKeyRevokeReqID';\n\tvar PROCESS_DEPOSIT_REQUEST_ID = exports.PROCESS_DEPOSIT_REQUEST_ID = 'ProcessDepositReqID';\n\tvar CUSTOMER_LIST_REQUEST_ID = exports.CUSTOMER_LIST_REQUEST_ID = 'CustomerListReqID';\n\tvar CUSTOMER_REQUEST_ID = exports.CUSTOMER_REQUEST_ID = 'CustomerReqID';\n\tvar PROCESS_WITHDRAW_REQUEST_ID = exports.PROCESS_WITHDRAW_REQUEST_ID = 'ProcessWithdrawReqID';\n\tvar VERIFY_CUSTOMER_REQUEST_ID = exports.VERIFY_CUSTOMER_REQUEST_ID = 'VerifyCustomerReqID';\n\tvar MD_REQUEST_ID = exports.MD_REQUEST_ID = 'MDReqID';\n\tvar CLIENT_ORDER_ID = exports.CLIENT_ORDER_ID = 'ClOrdID';\n\n/***/ },\n/* 7 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\tvar BALANCE = exports.BALANCE = 'BALANCE';\n\t\n\tvar ORDER_BOOK = exports.ORDER_BOOK = 'OB';\n\tvar ORDER_BOOK_TRADE_NEW = exports.ORDER_BOOK_TRADE_NEW = 'TRADE_NEW';\n\tvar ORDER_BOOK_NEW_ORDER = exports.ORDER_BOOK_NEW_ORDER = 'NEW_ORDER';\n\tvar ORDER_BOOK_UPDATE_ORDER = exports.ORDER_BOOK_UPDATE_ORDER = 'UPDATE_ORDER';\n\tvar ORDER_BOOK_DELETE_ORDER = exports.ORDER_BOOK_DELETE_ORDER = 'DELETE_ORDER';\n\tvar ORDER_BOOK_DELETE_ORDERS_THRU = exports.ORDER_BOOK_DELETE_ORDERS_THRU = 'DELETE_ORDERS_THRU';\n\t\n\tvar EXECUTION_REPORT = exports.EXECUTION_REPORT = 'EXECUTION_REPORT';\n\tvar EXECUTION_REPORT_NEW = exports.EXECUTION_REPORT_NEW = 'NEW';\n\tvar EXECUTION_REPORT_PARTIAL = exports.EXECUTION_REPORT_PARTIAL = 'PARTIAL';\n\tvar EXECUTION_REPORT_EXECUTION = exports.EXECUTION_REPORT_EXECUTION = 'EXECUTION';\n\tvar EXECUTION_REPORT_CANCELED = exports.EXECUTION_REPORT_CANCELED = 'CANCELED';\n\tvar EXECUTION_REPORT_REJECTED = exports.EXECUTION_REPORT_REJECTED = 'REJECTED';\n\t\n\tvar DEPOSIT_REFRESH = exports.DEPOSIT_REFRESH = 'DEPOSIT_REFRESH';\n\tvar WITHDRAW_REFRESH = exports.WITHDRAW_REFRESH = 'WITHDRAW_REFRESH';\n\t\n\t/* eslint-disable quote-props */\n\tvar EVENTS = exports.EVENTS = {\n\t ORDERBOOK: {\n\t '0': ORDER_BOOK_NEW_ORDER,\n\t '1': ORDER_BOOK_UPDATE_ORDER,\n\t '2': ORDER_BOOK_DELETE_ORDER,\n\t '3': ORDER_BOOK_DELETE_ORDERS_THRU\n\t },\n\t TRADES: {\n\t '0': ORDER_BOOK_TRADE_NEW\n\t },\n\t EXECUTION_REPORT: {\n\t '0': EXECUTION_REPORT_NEW,\n\t '1': EXECUTION_REPORT_PARTIAL,\n\t '2': EXECUTION_REPORT_EXECUTION,\n\t '4': EXECUTION_REPORT_CANCELED,\n\t '8': EXECUTION_REPORT_REJECTED\n\t }\n\t};\n\n/***/ },\n/* 8 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.default = {\n\t HEARTBEAT: '1',\n\t LOGIN: 'BE',\n\t LOGOUT: 'BE',\n\t CHANGE_PASSWORD: 'BE',\n\t\n\t MARKET_DATA_FULL_REFRESH: 'V',\n\t MARKET_DATA_UNSUBSCRIBE: 'V',\n\t\n\t ORDER_SEND: 'D',\n\t ORDER_CANCEL: 'F',\n\t\n\t SECURITY_LIST: 'x',\n\t SECURITY_STATUS: 'e',\n\t BALANCE: 'U2',\n\t ORDER_LIST: 'U4',\n\t BROKER_LIST: 'U28',\n\t TRADE_HISTORY: 'U32',\n\t PROFILE_UPDATE: 'U38',\n\t\n\t REQUEST_DEPOSIT: 'U18',\n\t REQUEST_DEPOSIT_LIST: 'U30',\n\t REQUEST_DEPOSIT_METHODS: 'U20',\n\t REQUEST_WITHDRAW: 'U6',\n\t REQUEST_WITHDRAW_LIST: 'U26',\n\t\n\t CONFIRM_WITHDRAW: 'U24',\n\t CANCEL_WITHDRAW: 'U70'\n\t};\n\n/***/ },\n/* 9 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _baseTransport = __webpack_require__(10);\n\t\n\tvar _baseTransport2 = _interopRequireDefault(_baseTransport);\n\t\n\tvar _fingerprintjs = __webpack_require__(13);\n\t\n\tvar _fingerprintjs2 = _interopRequireDefault(_fingerprintjs);\n\t\n\tvar _nodeify = __webpack_require__(14);\n\t\n\tvar _nodeify2 = _interopRequireDefault(_nodeify);\n\t\n\tvar _eventemitter = __webpack_require__(4);\n\t\n\tvar _listener = __webpack_require__(5);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\t\n\t/* eslint-disable global-require */\n\t\n\tvar WebSocketTransport = function (_BaseTransport) {\n\t _inherits(WebSocketTransport, _BaseTransport);\n\t\n\t /*\n\t * Transport Promise\n\t */\n\t\n\t\n\t /*\n\t * FingerPrint\n\t */\n\t function WebSocketTransport(params) {\n\t _classCallCheck(this, WebSocketTransport);\n\t\n\t var _this = _possibleConstructorReturn(this, (WebSocketTransport.__proto__ || Object.getPrototypeOf(WebSocketTransport)).call(this, params, 'ws'));\n\t\n\t _this.stun = { local: null, public: [] };\n\t\n\t _this.getStun();\n\t _this.getFingerPrint();\n\t\n\t _this.eventEmitter = new _eventemitter.EventEmitter2({ wildcard: true, delimiter: ':' });\n\t return _this;\n\t }\n\t\n\t /*\n\t * Event emitter to dispatch websocket updates\n\t */\n\t\n\t\n\t /*\n\t * Stun object\n\t */\n\t\n\t\n\t /*\n\t * WebSocket Instance\n\t */\n\t\n\t\n\t _createClass(WebSocketTransport, [{\n\t key: 'connect',\n\t value: function connect(callback) {\n\t var _this2 = this;\n\t\n\t return _nodeify2.default.extend(new Promise(function (resolve, reject) {\n\t _this2.request = { resolve: resolve, reject: reject };\n\t\n\t var WebSocket = _this2.isNode ? __webpack_require__(15) : window.WebSocket;\n\t\n\t _this2.socket = new WebSocket(_this2.endpoint);\n\t _this2.socket.onopen = _this2.onOpen.bind(_this2);\n\t _this2.socket.onclose = _this2.onClose.bind(_this2);\n\t _this2.socket.onerror = _this2.onError.bind(_this2);\n\t _this2.socket.onmessage = _this2.onMessage.bind(_this2);\n\t })).nodeify(callback);\n\t }\n\t }, {\n\t key: 'disconnect',\n\t value: function disconnect() {\n\t this.socket.close();\n\t }\n\t }, {\n\t key: 'onOpen',\n\t value: function onOpen() {\n\t this.request.resolve({ connected: true });\n\t }\n\t }, {\n\t key: 'onClose',\n\t value: function onClose() {}\n\t }, {\n\t key: 'onError',\n\t value: function onError() {\n\t this.request.reject();\n\t }\n\t }, {\n\t key: 'sendMessage',\n\t value: function sendMessage(msg) {\n\t if (this.socket.readyState === 1) {\n\t var data = msg;\n\t\n\t data.STUNTIP = this.stun;\n\t data.FingerPrint = this.fingerPrint;\n\t\n\t this.socket.send(JSON.stringify(data));\n\t }\n\t }\n\t }, {\n\t key: 'sendMessageAsPromise',\n\t value: function sendMessageAsPromise(msg, callback) {\n\t var _this3 = this;\n\t\n\t return _nodeify2.default.extend(new Promise(function (resolve, reject) {\n\t var promise = { resolve: resolve, reject: reject };\n\t\n\t if (!msg) {\n\t return reject('Missing Message');\n\t }\n\t\n\t (0, _listener.registerRequest)(msg, promise);\n\t\n\t // Send promise to sendMessage to we can mock it.\n\t _this3.sendMessage(msg, promise);\n\t })).nodeify(callback);\n\t }\n\t }, {\n\t key: 'onMessage',\n\t value: function onMessage(msg) {\n\t var data = JSON.parse(msg.data);\n\t if (data.MsgType === 'ERROR') {\n\t throw new Error('Error: ' + data.Detail + ' ' + data.Description);\n\t }\n\t\n\t var request = (0, _listener.getRequest)(data);\n\t var listener = (0, _listener.getListener)(data.MsgType);\n\t this.dispatchPromise(request, data);\n\t this.dispatchListeners(listener, data);\n\t }\n\t }, {\n\t key: 'dispatchPromise',\n\t value: function dispatchPromise(request, data) {\n\t if (request) {\n\t return request.resolve ? request.resolve(data) : request.callback ? request.callback(data) : null;\n\t }\n\t }\n\t }, {\n\t key: 'dispatchListeners',\n\t value: function dispatchListeners(listener, data) {\n\t return listener && listener(data);\n\t }\n\t\n\t /* eslint-disable no-param-reassign */\n\t\n\t }, {\n\t key: 'emitterPromise',\n\t value: function emitterPromise(promise) {\n\t var _this4 = this;\n\t\n\t promise.on = function (event, listener) {\n\t _this4.eventEmitter.on(event, listener);\n\t return promise;\n\t };\n\t promise.onAny = function (listener) {\n\t _this4.eventEmitter.onAny(listener);\n\t return promise;\n\t };\n\t promise.offAny = function (listener) {\n\t _this4.eventEmitter.offAny(listener);\n\t return promise;\n\t };\n\t promise.once = function (event, listener) {\n\t _this4.eventEmitter.once(event, listener);\n\t return promise;\n\t };\n\t promise.many = function (event, times, listener) {\n\t _this4.eventEmitter.many(event, times, listener);\n\t return promise;\n\t };\n\t promise.removeListener = function (event, listener) {\n\t _this4.eventEmitter.removeListener(event, listener);\n\t return promise;\n\t };\n\t promise.removeAllListeners = function (events) {\n\t _this4.eventEmitter.removeAllListeners(events);\n\t return promise;\n\t };\n\t\n\t return promise;\n\t }\n\t /* eslint-enable no-param-reassign */\n\t\n\t }, {\n\t key: 'getFingerPrint',\n\t value: function getFingerPrint() {\n\t var _this5 = this;\n\t\n\t if (this.isNode) {\n\t return __webpack_require__(16).getMac(function (macAddress) {\n\t _this5.fingerPrint = macAddress;\n\t });\n\t }\n\t return new _fingerprintjs2.default().get(function (fingerPrint) {\n\t _this5.fingerPrint = fingerPrint;\n\t });\n\t }\n\t }, {\n\t key: 'getStun',\n\t value: function getStun() {\n\t var _this6 = this;\n\t\n\t if (this.isNode) {\n\t __webpack_require__(18).getStun(function (data) {\n\t _this6.stun = data;\n\t });\n\t }\n\t }\n\t }]);\n\t\n\t return WebSocketTransport;\n\t}(_baseTransport2.default);\n\t\n\texports.default = WebSocketTransport;\n\n/***/ },\n/* 10 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _lodash = __webpack_require__(3);\n\t\n\tvar _lodash2 = _interopRequireDefault(_lodash);\n\t\n\tvar _base = __webpack_require__(11);\n\t\n\tvar _base2 = _interopRequireDefault(_base);\n\t\n\tvar _requests = __webpack_require__(8);\n\t\n\tvar _requests2 = _interopRequireDefault(_requests);\n\t\n\tvar _requestTypes = __webpack_require__(6);\n\t\n\tvar RequestTypes = _interopRequireWildcard(_requestTypes);\n\t\n\tvar _listener = __webpack_require__(5);\n\t\n\tfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\t\n\tvar BaseTransport = function (_Base) {\n\t _inherits(BaseTransport, _Base);\n\t\n\t function BaseTransport(params, env) {\n\t _classCallCheck(this, BaseTransport);\n\t\n\t var _this = _possibleConstructorReturn(this, (BaseTransport.__proto__ || Object.getPrototypeOf(BaseTransport)).call(this, params, env));\n\t\n\t _this.send = env === 'ws' ? _this.sendMessageAsPromise : _this.fetchTrade;\n\t return _this;\n\t }\n\t\n\t _createClass(BaseTransport, [{\n\t key: 'balance',\n\t value: function balance(callback) {\n\t var _this2 = this;\n\t\n\t var msg = {\n\t MsgType: _requests2.default.BALANCE,\n\t BalanceReqID: (0, _listener.generateRequestId)()\n\t };\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _this2.send(msg, callback).then(function (data) {\n\t var Available = {};\n\t var balances = data[_this2.brokerId];\n\t Object.keys(balances).map(function (currency) {\n\t if (!currency.includes('locked')) {\n\t Available[currency] = balances[currency] - balances[currency + '_locked'];\n\t }\n\t return Available;\n\t });\n\t\n\t return resolve(_extends({}, data, { Available: Available }));\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'myOrders',\n\t value: function myOrders() {\n\t var _this3 = this;\n\t\n\t var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t var _ref$page = _ref.page;\n\t var Page = _ref$page === undefined ? 0 : _ref$page;\n\t var _ref$pageSize = _ref.pageSize;\n\t var PageSize = _ref$pageSize === undefined ? 40 : _ref$pageSize;\n\t var callback = arguments[1];\n\t\n\t var msg = {\n\t MsgType: _requests2.default.ORDER_LIST,\n\t OrdersReqID: (0, _listener.generateRequestId)(),\n\t Page: Page,\n\t PageSize: PageSize\n\t };\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _this3.send(msg, callback).then(function (data) {\n\t var Columns = data.Columns;\n\t\n\t var orders = _objectWithoutProperties(data, ['Columns']);\n\t\n\t var OrdListGrp = _lodash2.default.map(data.OrdListGrp, function (order) {\n\t return _lodash2.default.zipObject(Columns, order);\n\t });\n\t return resolve(_extends({}, orders, {\n\t OrdListGrp: OrdListGrp\n\t }));\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'sendOrder',\n\t value: function sendOrder(_ref2, callback) {\n\t var _this4 = this;\n\t\n\t var side = _ref2.side;\n\t var amount = _ref2.amount;\n\t var price = _ref2.price;\n\t var symbol = _ref2.symbol;\n\t\n\t var msg = {\n\t MsgType: _requests2.default.ORDER_SEND,\n\t ClOrdID: (0, _listener.generateRequestId)(),\n\t Symbol: symbol,\n\t Side: side,\n\t OrdType: '2',\n\t Price: price,\n\t OrderQty: amount,\n\t BrokerID: this.brokerId\n\t };\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _this4.send(msg, callback).then(function (data) {\n\t (0, _listener.deleteRequest)(RequestTypes.CLIENT_ORDER_ID);\n\t resolve(data);\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'cancelOrder',\n\t value: function cancelOrder(param, callback) {\n\t var orderId = param.orderId ? param.orderId : param;\n\t var msg = {\n\t MsgType: _requests2.default.ORDER_CANCEL,\n\t OrderID: orderId\n\t };\n\t\n\t if (param.clientId) {\n\t msg.ClOrdID = param.clientId;\n\t }\n\t\n\t return this.send(msg, callback);\n\t }\n\t\n\t /**\n\t * statusList: 1-Pending, 2-In Progress, 4-Completed, 8-Cancelled\n\t */\n\t\n\t }, {\n\t key: 'requestWithdrawList',\n\t value: function requestWithdrawList() {\n\t var _this5 = this;\n\t\n\t var _ref3 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t var _ref3$page = _ref3.page;\n\t var Page = _ref3$page === undefined ? 0 : _ref3$page;\n\t var _ref3$pageSize = _ref3.pageSize;\n\t var PageSize = _ref3$pageSize === undefined ? 20 : _ref3$pageSize;\n\t var _ref3$statusList = _ref3.statusList;\n\t var StatusList = _ref3$statusList === undefined ? ['1', '2', '4', '8'] : _ref3$statusList;\n\t var callback = arguments[1];\n\t\n\t var msg = {\n\t MsgType: _requests2.default.REQUEST_WITHDRAW_LIST,\n\t WithdrawListReqID: (0, _listener.generateRequestId)(),\n\t Page: Page,\n\t PageSize: PageSize,\n\t StatusList: StatusList\n\t };\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _this5.send(msg, callback).then(function (data) {\n\t var Columns = data.Columns;\n\t\n\t var withdrawData = _objectWithoutProperties(data, ['Columns']);\n\t\n\t var WithdrawListGrp = _lodash2.default.map(data.WithdrawListGrp, function (withdraw) {\n\t return _lodash2.default.zipObject(Columns, withdraw);\n\t });\n\t return resolve(_extends({}, withdrawData, {\n\t WithdrawListGrp: WithdrawListGrp\n\t }));\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'requestWithdraw',\n\t value: function requestWithdraw(_ref4, callback) {\n\t var amount = _ref4.amount;\n\t var data = _ref4.data;\n\t var _ref4$currency = _ref4.currency;\n\t var currency = _ref4$currency === undefined ? 'BTC' : _ref4$currency;\n\t var _ref4$method = _ref4.method;\n\t var method = _ref4$method === undefined ? 'bitcoin' : _ref4$method;\n\t\n\t var reqId = (0, _listener.generateRequestId)();\n\t var msg = {\n\t MsgType: _requests2.default.REQUEST_WITHDRAW,\n\t WithdrawReqID: reqId,\n\t ClOrdID: reqId,\n\t Method: method,\n\t Amount: amount,\n\t Currency: currency,\n\t Data: data\n\t };\n\t\n\t return this.send(msg, callback);\n\t }\n\t }, {\n\t key: 'confirmWithdraw',\n\t value: function confirmWithdraw(_ref5, callback) {\n\t var _this6 = this;\n\t\n\t var WithdrawID = _ref5.withdrawId;\n\t var confirmationToken = _ref5.confirmationToken;\n\t var secondFactor = _ref5.secondFactor;\n\t\n\t var msg = {\n\t MsgType: _requests2.default.CONFIRM_WITHDRAW,\n\t WithdrawReqID: (0, _listener.generateRequestId)(),\n\t WithdrawID: WithdrawID\n\t };\n\t\n\t if (confirmationToken) {\n\t msg.ConfirmationToken = confirmationToken;\n\t }\n\t\n\t if (secondFactor) {\n\t msg.SecondFactor = secondFactor;\n\t }\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _this6.send(msg, callback).then(function (data) {\n\t return resolve(_extends({}, data));\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'cancelWithdraw',\n\t value: function cancelWithdraw(withdrawId, callback) {\n\t var _this7 = this;\n\t\n\t var reqId = (0, _listener.generateRequestId)();\n\t var msg = {\n\t MsgType: _requests2.default.CANCEL_WITHDRAW,\n\t WithdrawCancelReqID: reqId,\n\t ClOrdID: reqId,\n\t WithdrawID: withdrawId\n\t };\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _this7.send(msg, callback).then(function (data) {\n\t return resolve(_extends({}, data));\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'requestDepositList',\n\t value: function requestDepositList() {\n\t var _this8 = this;\n\t\n\t var _ref6 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t var _ref6$page = _ref6.page;\n\t var Page = _ref6$page === undefined ? 0 : _ref6$page;\n\t var _ref6$pageSize = _ref6.pageSize;\n\t var PageSize = _ref6$pageSize === undefined ? 20 : _ref6$pageSize;\n\t var _ref6$status = _ref6.status;\n\t var StatusList = _ref6$status === undefined ? ['1', '2', '4', '8'] : _ref6$status;\n\t var callback = arguments[1];\n\t\n\t var msg = {\n\t MsgType: _requests2.default.REQUEST_DEPOSIT_LIST,\n\t DepositListReqID: (0, _listener.generateRequestId)(),\n\t Page: Page,\n\t PageSize: PageSize,\n\t StatusList: StatusList\n\t };\n\t\n\t return new Promise(function (resolve, reject) {\n\t return _this8.send(msg, callback).then(function (data) {\n\t var Columns = data.Columns;\n\t\n\t var depositData = _objectWithoutProperties(data, ['Columns']);\n\t\n\t var DepositListGrp = _lodash2.default.map(data.DepositListGrp, function (deposit) {\n\t return _lodash2.default.zipObject(Columns, deposit);\n\t });\n\t return resolve(_extends({}, depositData, {\n\t DepositListGrp: DepositListGrp\n\t }));\n\t }).catch(reject);\n\t });\n\t }\n\t }, {\n\t key: 'requestDeposit',\n\t value: function requestDeposit() {\n\t var _ref7 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t var _ref7$currency = _ref7.currency;\n\t var currency = _ref7$currency === undefined ? 'BTC' : _ref7$currency;\n\t var value = _ref7.value;\n\t var depositMethodId = _ref7.depositMethodId;\n\t var callback = arguments[1];\n\t\n\t var reqId = (0, _listener.generateRequestId)();\n\t var msg = {\n\t MsgType: _requests2.default.REQUEST_DEPOSIT,\n\t DepositReqID: reqId,\n\t ClOrdID: reqId,\n\t Currency: currency,\n\t BrokerID: this.brokerId\n\t };\n\t\n\t if (currency !== 'BTC') {\n\t msg.DepositMethodID = depositMethodId;\n\t msg.Value = value;\n\t }\n\t\n\t return this.send(msg, callback);\n\t }\n\t }, {\n\t key: 'requestDepositMethods',\n\t value: function requestDepositMethods(callback) {\n\t var msg = {\n\t MsgType: _requests2.default.REQUEST_DEPOSIT_METHODS,\n\t DepositMethodReqID: (0, _listener.generateRequestId)()\n\t };\n\t\n\t return this.send(msg, callback);\n\t }\n\t }]);\n\t\n\t return BaseTransport;\n\t}(_base2.default);\n\t\n\texports.default = BaseTransport;\n\n/***/ },\n/* 11 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _common = __webpack_require__(12);\n\t\n\tvar _common2 = _interopRequireDefault(_common);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } } /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\t\n\tvar Base =\n\t\n\t/*\n\t * Broker id\n\t */\n\tfunction Base() {\n\t var params = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t var env = arguments[1];\n\t\n\t _classCallCheck(this, Base);\n\t\n\t var endpoint = params.url ? params.url : params.prod ? _common2.default.prod[env] : _common2.default.testnet[env];\n\t\n\t this.brokerId = params.brokerId || 5;\n\t\n\t this.endpoint = endpoint;\n\t\n\t this.isNode = typeof window === 'undefined';\n\t}\n\t\n\t/*\n\t * Is node.js environment.\n\t */\n\t\n\t\n\t/*\n\t * url endpoint.\n\t */\n\t;\n\t\n\texports.default = Base;\n\n/***/ },\n/* 12 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.default = {\n\t prod: {\n\t ws: 'wss://api.blinktrade.com/trade/',\n\t rest: 'https://api.blinktrade.com/'\n\t },\n\t testnet: {\n\t ws: 'wss://api.testnet.blinktrade.com/trade/',\n\t rest: 'https://api.testnet.blinktrade.com/'\n\t }\n\t};\n\n/***/ },\n/* 13 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"fingerprintjs2\");\n\n/***/ },\n/* 14 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"nodeify\");\n\n/***/ },\n/* 15 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"ws\");\n\n/***/ },\n/* 16 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.getMac = getMac;\n\t\n\tvar _macaddress = __webpack_require__(17);\n\t\n\tvar _macaddress2 = _interopRequireDefault(_macaddress);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction getMac(callback) {\n\t _macaddress2.default.all(function (err, all) {\n\t var hashCode = function hashCode(str) {\n\t var hash = 0;\n\t if (str.length === 0) return hash;\n\t for (var i = 0; i < str.length; i++) {\n\t hash = (hash << 5) - hash + str.charCodeAt(i);\n\t hash = hash & hash; // Convert to 32bit integer\n\t }\n\t return hash;\n\t };\n\t\n\t var macAddresses = '';\n\t Object.keys(all).forEach(function (iface) {\n\t macAddresses += all[iface].mac;\n\t });\n\t\n\t var fingerPrint = hashCode(macAddresses);\n\t if (fingerPrint < 0) {\n\t fingerPrint *= -1;\n\t }\n\t\n\t callback(fingerPrint);\n\t });\n\t} /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\n/***/ },\n/* 17 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"macaddress\");\n\n/***/ },\n/* 18 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(Buffer) {'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }(); /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t */\n\t\n\t/* eslint-disable no-param-reassign */\n\t\n\texports.getStun = getStun;\n\t\n\tvar _ip = __webpack_require__(23);\n\t\n\tvar _ip2 = _interopRequireDefault(_ip);\n\t\n\tvar _dgram = __webpack_require__(24);\n\t\n\tvar _dgram2 = _interopRequireDefault(_dgram);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tvar stunIp = { local: null, public: [] };\n\t\n\tfunction addIPAddress(ipAddress) {\n\t if (ipAddress.match(/^(192\\.168\\.|169\\.254\\.|10\\.|172\\.(1[6-9]|2\\d|3[01]))/)) {\n\t stunIp.local = ipAddress;\n\t } else {\n\t if (stunIp.public.indexOf(ipAddress) === -1) {\n\t stunIp.public.push(ipAddress);\n\t }\n\t }\n\t}\n\t\n\tfunction getStun(callback) {\n\t var socket = _dgram2.default.createSocket('udp4');\n\t\n\t var STUN_HEADER_LENGTH = 20;\n\t var stunRequest = new Buffer(STUN_HEADER_LENGTH);\n\t\n\t var STUN_METHOD_REQUEST = 0x000;\n\t var STUN_BINDING_CLASS = 0x0001;\n\t var STUN_MAGIC_COOKIE = 0x2112A442;\n\t var STUN_TID_MAX = Math.pow(2, 32);\n\t\n\t var STUN_ATTR_MAPPED_ADDRESS = 0x0001;\n\t var STUN_ATTR_XOR_MAPPED_ADDRESS = 0x8020;\n\t var STUN_ATTR_XOR_MAPPED_ADDRESS_ALT = 0x0020;\n\t\n\t var stunTxId = Math.random() * STUN_TID_MAX;\n\t\n\t var stunServers = [[3478, 'stun.services.mozilla.com'], [19302, 'stun.l.google.com'], [3478, 'stun.stunprotocol.org'], [3478, 'stun.softjoys.com'], [3478, 'stun.samsungsmartcam.com'], [3478, 'stun.sonetel.com'], [3478, 'stun.tagan.ru'], [3478, 'stun.voipgain.com'], [3478, 'stunserver.org'], [3478, 'stun.advfn.com'], [3478, 'stun.annatel.net'], [3478, 'stun.freevoipdeal.com']];\n\t\n\t stunRequest.writeUInt16BE((STUN_BINDING_CLASS | STUN_METHOD_REQUEST) & 0x3fff, 0);\n\t stunRequest.writeUInt16BE(0, 2);\n\t stunRequest.writeUInt32BE(STUN_MAGIC_COOKIE, 4);\n\t stunRequest.writeUInt32BE(0, 8);\n\t stunRequest.writeUInt32BE(0, 12);\n\t stunRequest.writeUInt32BE(stunTxId, 16);\n\t\n\t socket.on('message', function (msg) {\n\t var xor = function xor(a, b) {\n\t var data = [];\n\t if (b.length > a.length) {\n\t var tmp = a;\n\t a = b;\n\t b = tmp;\n\t }\n\t for (var i = 0, len = a.length; i < len; i++) {\n\t data.push(a[i] ^ b[i]);\n\t }\n\t\n\t return new Buffer(data);\n\t };\n\t\n\t var block = msg.readUInt8(0);\n\t var bit1 = block & 0x80;\n\t var bit2 = block & 0x40;\n\t\n\t if (!(bit1 === 0 && bit2 === 0)) {\n\t return;\n\t }\n\t\n\t var msgHeader = msg.slice(0, STUN_HEADER_LENGTH);\n\t var msgAttrs = msg.slice(STUN_HEADER_LENGTH, msg.length);\n\t\n\t var offset = 0;\n\t\n\t while (offset < msgAttrs.length) {\n\t var attrType = msgAttrs.readUInt16BE(offset);\n\t offset += 2;\n\t\n\t var attrBuffLength = msgAttrs.readUInt16BE(offset);\n\t var blockOut = attrBuffLength % 4;\n\t if (blockOut > 0) {\n\t attrBuffLength += 4 - blockOut;\n\t }\n\t offset += 2;\n\t\n\t var value = msgAttrs.slice(offset, offset + attrBuffLength);\n\t offset += attrBuffLength;\n\t\n\t var family = void 0;\n\t var address = void 0;\n\t switch (attrType) {\n\t case STUN_ATTR_MAPPED_ADDRESS:\n\t family = value.readUInt16BE(0) === 0x02 ? 6 : 4;\n\t address = _ip2.default.toString(value, 4, family);\n\t addIPAddress(address);\n\t break;\n\t\n\t case STUN_ATTR_XOR_MAPPED_ADDRESS:\n\t case STUN_ATTR_XOR_MAPPED_ADDRESS_ALT:\n\t family = value.readUInt16BE(0) === 0x02 ? 6 : 4;\n\t var magic = msgHeader.slice(4, 8);\n\t var tid = msgHeader.slice(8, 20);\n\t var xaddr = value.slice(4, family === 4 ? 8 : 20);\n\t var addr = xor(xaddr, family === 4 ? magic : value.concat([magic, tid]));\n\t address = _ip2.default.toString(addr, 0, family);\n\t addIPAddress(address);\n\t break;\n\t default:\n\t }\n\t }\n\t\n\t callback(stunIp);\n\t });\n\t\n\t stunServers.map(function (_ref) {\n\t var _ref2 = _slicedToArray(_ref, 2);\n\t\n\t var port = _ref2[0];\n\t var host = _ref2[1];\n\t return socket.send(stunRequest, 0, stunRequest.length, port, host);\n\t });\n\t}\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(19).Buffer))\n\n/***/ },\n/* 19 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(Buffer, global) {/*!\n\t * The buffer module from node.js, for the browser.\n\t *\n\t * @author Feross Aboukhadijeh \n\t * @license MIT\n\t */\n\t/* eslint-disable no-proto */\n\t\n\t'use strict'\n\t\n\tvar base64 = __webpack_require__(20)\n\tvar ieee754 = __webpack_require__(21)\n\tvar isArray = __webpack_require__(22)\n\t\n\texports.Buffer = Buffer\n\texports.SlowBuffer = SlowBuffer\n\texports.INSPECT_MAX_BYTES = 50\n\t\n\t/**\n\t * If `Buffer.TYPED_ARRAY_SUPPORT`:\n\t * === true Use Uint8Array implementation (fastest)\n\t * === false Use Object implementation (most compatible, even IE6)\n\t *\n\t * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n\t * Opera 11.6+, iOS 4.2+.\n\t *\n\t * Due to various browser bugs, sometimes the Object implementation will be used even\n\t * when the browser supports typed arrays.\n\t *\n\t * Note:\n\t *\n\t * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n\t * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n\t *\n\t * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n\t *\n\t * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n\t * incorrect length in some situations.\n\t\n\t * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n\t * get the Object implementation, which is slower but behaves correctly.\n\t */\n\tBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n\t ? global.TYPED_ARRAY_SUPPORT\n\t : typedArraySupport()\n\t\n\t/*\n\t * Export kMaxLength after typed array support is determined.\n\t */\n\texports.kMaxLength = kMaxLength()\n\t\n\tfunction typedArraySupport () {\n\t try {\n\t var arr = new Uint8Array(1)\n\t arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n\t return arr.foo() === 42 && // typed array instances can be augmented\n\t typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n\t arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n\t } catch (e) {\n\t return false\n\t }\n\t}\n\t\n\tfunction kMaxLength () {\n\t return Buffer.TYPED_ARRAY_SUPPORT\n\t ? 0x7fffffff\n\t : 0x3fffffff\n\t}\n\t\n\tfunction createBuffer (that, length) {\n\t if (kMaxLength() < length) {\n\t throw new RangeError('Invalid typed array length')\n\t }\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t // Return an augmented `Uint8Array` instance, for best performance\n\t that = new Uint8Array(length)\n\t that.__proto__ = Buffer.prototype\n\t } else {\n\t // Fallback: Return an object instance of the Buffer class\n\t if (that === null) {\n\t that = new Buffer(length)\n\t }\n\t that.length = length\n\t }\n\t\n\t return that\n\t}\n\t\n\t/**\n\t * The Buffer constructor returns instances of `Uint8Array` that have their\n\t * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n\t * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n\t * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n\t * returns a single octet.\n\t *\n\t * The `Uint8Array` prototype remains unmodified.\n\t */\n\t\n\tfunction Buffer (arg, encodingOrOffset, length) {\n\t if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n\t return new Buffer(arg, encodingOrOffset, length)\n\t }\n\t\n\t // Common case.\n\t if (typeof arg === 'number') {\n\t if (typeof encodingOrOffset === 'string') {\n\t throw new Error(\n\t 'If encoding is specified then the first argument must be a string'\n\t )\n\t }\n\t return allocUnsafe(this, arg)\n\t }\n\t return from(this, arg, encodingOrOffset, length)\n\t}\n\t\n\tBuffer.poolSize = 8192 // not used by this implementation\n\t\n\t// TODO: Legacy, not needed anymore. Remove in next major version.\n\tBuffer._augment = function (arr) {\n\t arr.__proto__ = Buffer.prototype\n\t return arr\n\t}\n\t\n\tfunction from (that, value, encodingOrOffset, length) {\n\t if (typeof value === 'number') {\n\t throw new TypeError('\"value\" argument must not be a number')\n\t }\n\t\n\t if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n\t return fromArrayBuffer(that, value, encodingOrOffset, length)\n\t }\n\t\n\t if (typeof value === 'string') {\n\t return fromString(that, value, encodingOrOffset)\n\t }\n\t\n\t return fromObject(that, value)\n\t}\n\t\n\t/**\n\t * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n\t * if value is a number.\n\t * Buffer.from(str[, encoding])\n\t * Buffer.from(array)\n\t * Buffer.from(buffer)\n\t * Buffer.from(arrayBuffer[, byteOffset[, length]])\n\t **/\n\tBuffer.from = function (value, encodingOrOffset, length) {\n\t return from(null, value, encodingOrOffset, length)\n\t}\n\t\n\tif (Buffer.TYPED_ARRAY_SUPPORT) {\n\t Buffer.prototype.__proto__ = Uint8Array.prototype\n\t Buffer.__proto__ = Uint8Array\n\t if (typeof Symbol !== 'undefined' && Symbol.species &&\n\t Buffer[Symbol.species] === Buffer) {\n\t // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n\t Object.defineProperty(Buffer, Symbol.species, {\n\t value: null,\n\t configurable: true\n\t })\n\t }\n\t}\n\t\n\tfunction assertSize (size) {\n\t if (typeof size !== 'number') {\n\t throw new TypeError('\"size\" argument must be a number')\n\t } else if (size < 0) {\n\t throw new RangeError('\"size\" argument must not be negative')\n\t }\n\t}\n\t\n\tfunction alloc (that, size, fill, encoding) {\n\t assertSize(size)\n\t if (size <= 0) {\n\t return createBuffer(that, size)\n\t }\n\t if (fill !== undefined) {\n\t // Only pay attention to encoding if it's a string. This\n\t // prevents accidentally sending in a number that would\n\t // be interpretted as a start offset.\n\t return typeof encoding === 'string'\n\t ? createBuffer(that, size).fill(fill, encoding)\n\t : createBuffer(that, size).fill(fill)\n\t }\n\t return createBuffer(that, size)\n\t}\n\t\n\t/**\n\t * Creates a new filled Buffer instance.\n\t * alloc(size[, fill[, encoding]])\n\t **/\n\tBuffer.alloc = function (size, fill, encoding) {\n\t return alloc(null, size, fill, encoding)\n\t}\n\t\n\tfunction allocUnsafe (that, size) {\n\t assertSize(size)\n\t that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t for (var i = 0; i < size; ++i) {\n\t that[i] = 0\n\t }\n\t }\n\t return that\n\t}\n\t\n\t/**\n\t * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n\t * */\n\tBuffer.allocUnsafe = function (size) {\n\t return allocUnsafe(null, size)\n\t}\n\t/**\n\t * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n\t */\n\tBuffer.allocUnsafeSlow = function (size) {\n\t return allocUnsafe(null, size)\n\t}\n\t\n\tfunction fromString (that, string, encoding) {\n\t if (typeof encoding !== 'string' || encoding === '') {\n\t encoding = 'utf8'\n\t }\n\t\n\t if (!Buffer.isEncoding(encoding)) {\n\t throw new TypeError('\"encoding\" must be a valid string encoding')\n\t }\n\t\n\t var length = byteLength(string, encoding) | 0\n\t that = createBuffer(that, length)\n\t\n\t var actual = that.write(string, encoding)\n\t\n\t if (actual !== length) {\n\t // Writing a hex string, for example, that contains invalid characters will\n\t // cause everything after the first invalid character to be ignored. (e.g.\n\t // 'abxxcd' will be treated as 'ab')\n\t that = that.slice(0, actual)\n\t }\n\t\n\t return that\n\t}\n\t\n\tfunction fromArrayLike (that, array) {\n\t var length = array.length < 0 ? 0 : checked(array.length) | 0\n\t that = createBuffer(that, length)\n\t for (var i = 0; i < length; i += 1) {\n\t that[i] = array[i] & 255\n\t }\n\t return that\n\t}\n\t\n\tfunction fromArrayBuffer (that, array, byteOffset, length) {\n\t array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\t\n\t if (byteOffset < 0 || array.byteLength < byteOffset) {\n\t throw new RangeError('\\'offset\\' is out of bounds')\n\t }\n\t\n\t if (array.byteLength < byteOffset + (length || 0)) {\n\t throw new RangeError('\\'length\\' is out of bounds')\n\t }\n\t\n\t if (byteOffset === undefined && length === undefined) {\n\t array = new Uint8Array(array)\n\t } else if (length === undefined) {\n\t array = new Uint8Array(array, byteOffset)\n\t } else {\n\t array = new Uint8Array(array, byteOffset, length)\n\t }\n\t\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t // Return an augmented `Uint8Array` instance, for best performance\n\t that = array\n\t that.__proto__ = Buffer.prototype\n\t } else {\n\t // Fallback: Return an object instance of the Buffer class\n\t that = fromArrayLike(that, array)\n\t }\n\t return that\n\t}\n\t\n\tfunction fromObject (that, obj) {\n\t if (Buffer.isBuffer(obj)) {\n\t var len = checked(obj.length) | 0\n\t that = createBuffer(that, len)\n\t\n\t if (that.length === 0) {\n\t return that\n\t }\n\t\n\t obj.copy(that, 0, 0, len)\n\t return that\n\t }\n\t\n\t if (obj) {\n\t if ((typeof ArrayBuffer !== 'undefined' &&\n\t obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n\t if (typeof obj.length !== 'number' || isnan(obj.length)) {\n\t return createBuffer(that, 0)\n\t }\n\t return fromArrayLike(that, obj)\n\t }\n\t\n\t if (obj.type === 'Buffer' && isArray(obj.data)) {\n\t return fromArrayLike(that, obj.data)\n\t }\n\t }\n\t\n\t throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n\t}\n\t\n\tfunction checked (length) {\n\t // Note: cannot use `length < kMaxLength()` here because that fails when\n\t // length is NaN (which is otherwise coerced to zero.)\n\t if (length >= kMaxLength()) {\n\t throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n\t 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n\t }\n\t return length | 0\n\t}\n\t\n\tfunction SlowBuffer (length) {\n\t if (+length != length) { // eslint-disable-line eqeqeq\n\t length = 0\n\t }\n\t return Buffer.alloc(+length)\n\t}\n\t\n\tBuffer.isBuffer = function isBuffer (b) {\n\t return !!(b != null && b._isBuffer)\n\t}\n\t\n\tBuffer.compare = function compare (a, b) {\n\t if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n\t throw new TypeError('Arguments must be Buffers')\n\t }\n\t\n\t if (a === b) return 0\n\t\n\t var x = a.length\n\t var y = b.length\n\t\n\t for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n\t if (a[i] !== b[i]) {\n\t x = a[i]\n\t y = b[i]\n\t break\n\t }\n\t }\n\t\n\t if (x < y) return -1\n\t if (y < x) return 1\n\t return 0\n\t}\n\t\n\tBuffer.isEncoding = function isEncoding (encoding) {\n\t switch (String(encoding).toLowerCase()) {\n\t case 'hex':\n\t case 'utf8':\n\t case 'utf-8':\n\t case 'ascii':\n\t case 'latin1':\n\t case 'binary':\n\t case 'base64':\n\t case 'ucs2':\n\t case 'ucs-2':\n\t case 'utf16le':\n\t case 'utf-16le':\n\t return true\n\t default:\n\t return false\n\t }\n\t}\n\t\n\tBuffer.concat = function concat (list, length) {\n\t if (!isArray(list)) {\n\t throw new TypeError('\"list\" argument must be an Array of Buffers')\n\t }\n\t\n\t if (list.length === 0) {\n\t return Buffer.alloc(0)\n\t }\n\t\n\t var i\n\t if (length === undefined) {\n\t length = 0\n\t for (i = 0; i < list.length; ++i) {\n\t length += list[i].length\n\t }\n\t }\n\t\n\t var buffer = Buffer.allocUnsafe(length)\n\t var pos = 0\n\t for (i = 0; i < list.length; ++i) {\n\t var buf = list[i]\n\t if (!Buffer.isBuffer(buf)) {\n\t throw new TypeError('\"list\" argument must be an Array of Buffers')\n\t }\n\t buf.copy(buffer, pos)\n\t pos += buf.length\n\t }\n\t return buffer\n\t}\n\t\n\tfunction byteLength (string, encoding) {\n\t if (Buffer.isBuffer(string)) {\n\t return string.length\n\t }\n\t if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n\t (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n\t return string.byteLength\n\t }\n\t if (typeof string !== 'string') {\n\t string = '' + string\n\t }\n\t\n\t var len = string.length\n\t if (len === 0) return 0\n\t\n\t // Use a for loop to avoid recursion\n\t var loweredCase = false\n\t for (;;) {\n\t switch (encoding) {\n\t case 'ascii':\n\t case 'latin1':\n\t case 'binary':\n\t return len\n\t case 'utf8':\n\t case 'utf-8':\n\t case undefined:\n\t return utf8ToBytes(string).length\n\t case 'ucs2':\n\t case 'ucs-2':\n\t case 'utf16le':\n\t case 'utf-16le':\n\t return len * 2\n\t case 'hex':\n\t return len >>> 1\n\t case 'base64':\n\t return base64ToBytes(string).length\n\t default:\n\t if (loweredCase) return utf8ToBytes(string).length // assume utf8\n\t encoding = ('' + encoding).toLowerCase()\n\t loweredCase = true\n\t }\n\t }\n\t}\n\tBuffer.byteLength = byteLength\n\t\n\tfunction slowToString (encoding, start, end) {\n\t var loweredCase = false\n\t\n\t // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n\t // property of a typed array.\n\t\n\t // This behaves neither like String nor Uint8Array in that we set start/end\n\t // to their upper/lower bounds if the value passed is out of range.\n\t // undefined is handled specially as per ECMA-262 6th Edition,\n\t // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n\t if (start === undefined || start < 0) {\n\t start = 0\n\t }\n\t // Return early if start > this.length. Done here to prevent potential uint32\n\t // coercion fail below.\n\t if (start > this.length) {\n\t return ''\n\t }\n\t\n\t if (end === undefined || end > this.length) {\n\t end = this.length\n\t }\n\t\n\t if (end <= 0) {\n\t return ''\n\t }\n\t\n\t // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n\t end >>>= 0\n\t start >>>= 0\n\t\n\t if (end <= start) {\n\t return ''\n\t }\n\t\n\t if (!encoding) encoding = 'utf8'\n\t\n\t while (true) {\n\t switch (encoding) {\n\t case 'hex':\n\t return hexSlice(this, start, end)\n\t\n\t case 'utf8':\n\t case 'utf-8':\n\t return utf8Slice(this, start, end)\n\t\n\t case 'ascii':\n\t return asciiSlice(this, start, end)\n\t\n\t case 'latin1':\n\t case 'binary':\n\t return latin1Slice(this, start, end)\n\t\n\t case 'base64':\n\t return base64Slice(this, start, end)\n\t\n\t case 'ucs2':\n\t case 'ucs-2':\n\t case 'utf16le':\n\t case 'utf-16le':\n\t return utf16leSlice(this, start, end)\n\t\n\t default:\n\t if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n\t encoding = (encoding + '').toLowerCase()\n\t loweredCase = true\n\t }\n\t }\n\t}\n\t\n\t// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n\t// Buffer instances.\n\tBuffer.prototype._isBuffer = true\n\t\n\tfunction swap (b, n, m) {\n\t var i = b[n]\n\t b[n] = b[m]\n\t b[m] = i\n\t}\n\t\n\tBuffer.prototype.swap16 = function swap16 () {\n\t var len = this.length\n\t if (len % 2 !== 0) {\n\t throw new RangeError('Buffer size must be a multiple of 16-bits')\n\t }\n\t for (var i = 0; i < len; i += 2) {\n\t swap(this, i, i + 1)\n\t }\n\t return this\n\t}\n\t\n\tBuffer.prototype.swap32 = function swap32 () {\n\t var len = this.length\n\t if (len % 4 !== 0) {\n\t throw new RangeError('Buffer size must be a multiple of 32-bits')\n\t }\n\t for (var i = 0; i < len; i += 4) {\n\t swap(this, i, i + 3)\n\t swap(this, i + 1, i + 2)\n\t }\n\t return this\n\t}\n\t\n\tBuffer.prototype.swap64 = function swap64 () {\n\t var len = this.length\n\t if (len % 8 !== 0) {\n\t throw new RangeError('Buffer size must be a multiple of 64-bits')\n\t }\n\t for (var i = 0; i < len; i += 8) {\n\t swap(this, i, i + 7)\n\t swap(this, i + 1, i + 6)\n\t swap(this, i + 2, i + 5)\n\t swap(this, i + 3, i + 4)\n\t }\n\t return this\n\t}\n\t\n\tBuffer.prototype.toString = function toString () {\n\t var length = this.length | 0\n\t if (length === 0) return ''\n\t if (arguments.length === 0) return utf8Slice(this, 0, length)\n\t return slowToString.apply(this, arguments)\n\t}\n\t\n\tBuffer.prototype.equals = function equals (b) {\n\t if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n\t if (this === b) return true\n\t return Buffer.compare(this, b) === 0\n\t}\n\t\n\tBuffer.prototype.inspect = function inspect () {\n\t var str = ''\n\t var max = exports.INSPECT_MAX_BYTES\n\t if (this.length > 0) {\n\t str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n\t if (this.length > max) str += ' ... '\n\t }\n\t return ''\n\t}\n\t\n\tBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n\t if (!Buffer.isBuffer(target)) {\n\t throw new TypeError('Argument must be a Buffer')\n\t }\n\t\n\t if (start === undefined) {\n\t start = 0\n\t }\n\t if (end === undefined) {\n\t end = target ? target.length : 0\n\t }\n\t if (thisStart === undefined) {\n\t thisStart = 0\n\t }\n\t if (thisEnd === undefined) {\n\t thisEnd = this.length\n\t }\n\t\n\t if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n\t throw new RangeError('out of range index')\n\t }\n\t\n\t if (thisStart >= thisEnd && start >= end) {\n\t return 0\n\t }\n\t if (thisStart >= thisEnd) {\n\t return -1\n\t }\n\t if (start >= end) {\n\t return 1\n\t }\n\t\n\t start >>>= 0\n\t end >>>= 0\n\t thisStart >>>= 0\n\t thisEnd >>>= 0\n\t\n\t if (this === target) return 0\n\t\n\t var x = thisEnd - thisStart\n\t var y = end - start\n\t var len = Math.min(x, y)\n\t\n\t var thisCopy = this.slice(thisStart, thisEnd)\n\t var targetCopy = target.slice(start, end)\n\t\n\t for (var i = 0; i < len; ++i) {\n\t if (thisCopy[i] !== targetCopy[i]) {\n\t x = thisCopy[i]\n\t y = targetCopy[i]\n\t break\n\t }\n\t }\n\t\n\t if (x < y) return -1\n\t if (y < x) return 1\n\t return 0\n\t}\n\t\n\t// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n\t// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n\t//\n\t// Arguments:\n\t// - buffer - a Buffer to search\n\t// - val - a string, Buffer, or number\n\t// - byteOffset - an index into `buffer`; will be clamped to an int32\n\t// - encoding - an optional encoding, relevant is val is a string\n\t// - dir - true for indexOf, false for lastIndexOf\n\tfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n\t // Empty buffer means no match\n\t if (buffer.length === 0) return -1\n\t\n\t // Normalize byteOffset\n\t if (typeof byteOffset === 'string') {\n\t encoding = byteOffset\n\t byteOffset = 0\n\t } else if (byteOffset > 0x7fffffff) {\n\t byteOffset = 0x7fffffff\n\t } else if (byteOffset < -0x80000000) {\n\t byteOffset = -0x80000000\n\t }\n\t byteOffset = +byteOffset // Coerce to Number.\n\t if (isNaN(byteOffset)) {\n\t // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n\t byteOffset = dir ? 0 : (buffer.length - 1)\n\t }\n\t\n\t // Normalize byteOffset: negative offsets start from the end of the buffer\n\t if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n\t if (byteOffset >= buffer.length) {\n\t if (dir) return -1\n\t else byteOffset = buffer.length - 1\n\t } else if (byteOffset < 0) {\n\t if (dir) byteOffset = 0\n\t else return -1\n\t }\n\t\n\t // Normalize val\n\t if (typeof val === 'string') {\n\t val = Buffer.from(val, encoding)\n\t }\n\t\n\t // Finally, search either indexOf (if dir is true) or lastIndexOf\n\t if (Buffer.isBuffer(val)) {\n\t // Special case: looking for empty string/buffer always fails\n\t if (val.length === 0) {\n\t return -1\n\t }\n\t return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n\t } else if (typeof val === 'number') {\n\t val = val & 0xFF // Search for a byte value [0-255]\n\t if (Buffer.TYPED_ARRAY_SUPPORT &&\n\t typeof Uint8Array.prototype.indexOf === 'function') {\n\t if (dir) {\n\t return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n\t } else {\n\t return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n\t }\n\t }\n\t return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n\t }\n\t\n\t throw new TypeError('val must be string, number or Buffer')\n\t}\n\t\n\tfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n\t var indexSize = 1\n\t var arrLength = arr.length\n\t var valLength = val.length\n\t\n\t if (encoding !== undefined) {\n\t encoding = String(encoding).toLowerCase()\n\t if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n\t encoding === 'utf16le' || encoding === 'utf-16le') {\n\t if (arr.length < 2 || val.length < 2) {\n\t return -1\n\t }\n\t indexSize = 2\n\t arrLength /= 2\n\t valLength /= 2\n\t byteOffset /= 2\n\t }\n\t }\n\t\n\t function read (buf, i) {\n\t if (indexSize === 1) {\n\t return buf[i]\n\t } else {\n\t return buf.readUInt16BE(i * indexSize)\n\t }\n\t }\n\t\n\t var i\n\t if (dir) {\n\t var foundIndex = -1\n\t for (i = byteOffset; i < arrLength; i++) {\n\t if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n\t if (foundIndex === -1) foundIndex = i\n\t if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n\t } else {\n\t if (foundIndex !== -1) i -= i - foundIndex\n\t foundIndex = -1\n\t }\n\t }\n\t } else {\n\t if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n\t for (i = byteOffset; i >= 0; i--) {\n\t var found = true\n\t for (var j = 0; j < valLength; j++) {\n\t if (read(arr, i + j) !== read(val, j)) {\n\t found = false\n\t break\n\t }\n\t }\n\t if (found) return i\n\t }\n\t }\n\t\n\t return -1\n\t}\n\t\n\tBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n\t return this.indexOf(val, byteOffset, encoding) !== -1\n\t}\n\t\n\tBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n\t return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n\t}\n\t\n\tBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n\t return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n\t}\n\t\n\tfunction hexWrite (buf, string, offset, length) {\n\t offset = Number(offset) || 0\n\t var remaining = buf.length - offset\n\t if (!length) {\n\t length = remaining\n\t } else {\n\t length = Number(length)\n\t if (length > remaining) {\n\t length = remaining\n\t }\n\t }\n\t\n\t // must be an even number of digits\n\t var strLen = string.length\n\t if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\t\n\t if (length > strLen / 2) {\n\t length = strLen / 2\n\t }\n\t for (var i = 0; i < length; ++i) {\n\t var parsed = parseInt(string.substr(i * 2, 2), 16)\n\t if (isNaN(parsed)) return i\n\t buf[offset + i] = parsed\n\t }\n\t return i\n\t}\n\t\n\tfunction utf8Write (buf, string, offset, length) {\n\t return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n\t}\n\t\n\tfunction asciiWrite (buf, string, offset, length) {\n\t return blitBuffer(asciiToBytes(string), buf, offset, length)\n\t}\n\t\n\tfunction latin1Write (buf, string, offset, length) {\n\t return asciiWrite(buf, string, offset, length)\n\t}\n\t\n\tfunction base64Write (buf, string, offset, length) {\n\t return blitBuffer(base64ToBytes(string), buf, offset, length)\n\t}\n\t\n\tfunction ucs2Write (buf, string, offset, length) {\n\t return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n\t}\n\t\n\tBuffer.prototype.write = function write (string, offset, length, encoding) {\n\t // Buffer#write(string)\n\t if (offset === undefined) {\n\t encoding = 'utf8'\n\t length = this.length\n\t offset = 0\n\t // Buffer#write(string, encoding)\n\t } else if (length === undefined && typeof offset === 'string') {\n\t encoding = offset\n\t length = this.length\n\t offset = 0\n\t // Buffer#write(string, offset[, length][, encoding])\n\t } else if (isFinite(offset)) {\n\t offset = offset | 0\n\t if (isFinite(length)) {\n\t length = length | 0\n\t if (encoding === undefined) encoding = 'utf8'\n\t } else {\n\t encoding = length\n\t length = undefined\n\t }\n\t // legacy write(string, encoding, offset, length) - remove in v0.13\n\t } else {\n\t throw new Error(\n\t 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n\t )\n\t }\n\t\n\t var remaining = this.length - offset\n\t if (length === undefined || length > remaining) length = remaining\n\t\n\t if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n\t throw new RangeError('Attempt to write outside buffer bounds')\n\t }\n\t\n\t if (!encoding) encoding = 'utf8'\n\t\n\t var loweredCase = false\n\t for (;;) {\n\t switch (encoding) {\n\t case 'hex':\n\t return hexWrite(this, string, offset, length)\n\t\n\t case 'utf8':\n\t case 'utf-8':\n\t return utf8Write(this, string, offset, length)\n\t\n\t case 'ascii':\n\t return asciiWrite(this, string, offset, length)\n\t\n\t case 'latin1':\n\t case 'binary':\n\t return latin1Write(this, string, offset, length)\n\t\n\t case 'base64':\n\t // Warning: maxLength not taken into account in base64Write\n\t return base64Write(this, string, offset, length)\n\t\n\t case 'ucs2':\n\t case 'ucs-2':\n\t case 'utf16le':\n\t case 'utf-16le':\n\t return ucs2Write(this, string, offset, length)\n\t\n\t default:\n\t if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n\t encoding = ('' + encoding).toLowerCase()\n\t loweredCase = true\n\t }\n\t }\n\t}\n\t\n\tBuffer.prototype.toJSON = function toJSON () {\n\t return {\n\t type: 'Buffer',\n\t data: Array.prototype.slice.call(this._arr || this, 0)\n\t }\n\t}\n\t\n\tfunction base64Slice (buf, start, end) {\n\t if (start === 0 && end === buf.length) {\n\t return base64.fromByteArray(buf)\n\t } else {\n\t return base64.fromByteArray(buf.slice(start, end))\n\t }\n\t}\n\t\n\tfunction utf8Slice (buf, start, end) {\n\t end = Math.min(buf.length, end)\n\t var res = []\n\t\n\t var i = start\n\t while (i < end) {\n\t var firstByte = buf[i]\n\t var codePoint = null\n\t var bytesPerSequence = (firstByte > 0xEF) ? 4\n\t : (firstByte > 0xDF) ? 3\n\t : (firstByte > 0xBF) ? 2\n\t : 1\n\t\n\t if (i + bytesPerSequence <= end) {\n\t var secondByte, thirdByte, fourthByte, tempCodePoint\n\t\n\t switch (bytesPerSequence) {\n\t case 1:\n\t if (firstByte < 0x80) {\n\t codePoint = firstByte\n\t }\n\t break\n\t case 2:\n\t secondByte = buf[i + 1]\n\t if ((secondByte & 0xC0) === 0x80) {\n\t tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n\t if (tempCodePoint > 0x7F) {\n\t codePoint = tempCodePoint\n\t }\n\t }\n\t break\n\t case 3:\n\t secondByte = buf[i + 1]\n\t thirdByte = buf[i + 2]\n\t if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n\t tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n\t if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n\t codePoint = tempCodePoint\n\t }\n\t }\n\t break\n\t case 4:\n\t secondByte = buf[i + 1]\n\t thirdByte = buf[i + 2]\n\t fourthByte = buf[i + 3]\n\t if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n\t tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n\t if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n\t codePoint = tempCodePoint\n\t }\n\t }\n\t }\n\t }\n\t\n\t if (codePoint === null) {\n\t // we did not generate a valid codePoint so insert a\n\t // replacement char (U+FFFD) and advance only 1 byte\n\t codePoint = 0xFFFD\n\t bytesPerSequence = 1\n\t } else if (codePoint > 0xFFFF) {\n\t // encode to utf16 (surrogate pair dance)\n\t codePoint -= 0x10000\n\t res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n\t codePoint = 0xDC00 | codePoint & 0x3FF\n\t }\n\t\n\t res.push(codePoint)\n\t i += bytesPerSequence\n\t }\n\t\n\t return decodeCodePointsArray(res)\n\t}\n\t\n\t// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n\t// the lowest limit is Chrome, with 0x10000 args.\n\t// We go 1 magnitude less, for safety\n\tvar MAX_ARGUMENTS_LENGTH = 0x1000\n\t\n\tfunction decodeCodePointsArray (codePoints) {\n\t var len = codePoints.length\n\t if (len <= MAX_ARGUMENTS_LENGTH) {\n\t return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n\t }\n\t\n\t // Decode in chunks to avoid \"call stack size exceeded\".\n\t var res = ''\n\t var i = 0\n\t while (i < len) {\n\t res += String.fromCharCode.apply(\n\t String,\n\t codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n\t )\n\t }\n\t return res\n\t}\n\t\n\tfunction asciiSlice (buf, start, end) {\n\t var ret = ''\n\t end = Math.min(buf.length, end)\n\t\n\t for (var i = start; i < end; ++i) {\n\t ret += String.fromCharCode(buf[i] & 0x7F)\n\t }\n\t return ret\n\t}\n\t\n\tfunction latin1Slice (buf, start, end) {\n\t var ret = ''\n\t end = Math.min(buf.length, end)\n\t\n\t for (var i = start; i < end; ++i) {\n\t ret += String.fromCharCode(buf[i])\n\t }\n\t return ret\n\t}\n\t\n\tfunction hexSlice (buf, start, end) {\n\t var len = buf.length\n\t\n\t if (!start || start < 0) start = 0\n\t if (!end || end < 0 || end > len) end = len\n\t\n\t var out = ''\n\t for (var i = start; i < end; ++i) {\n\t out += toHex(buf[i])\n\t }\n\t return out\n\t}\n\t\n\tfunction utf16leSlice (buf, start, end) {\n\t var bytes = buf.slice(start, end)\n\t var res = ''\n\t for (var i = 0; i < bytes.length; i += 2) {\n\t res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n\t }\n\t return res\n\t}\n\t\n\tBuffer.prototype.slice = function slice (start, end) {\n\t var len = this.length\n\t start = ~~start\n\t end = end === undefined ? len : ~~end\n\t\n\t if (start < 0) {\n\t start += len\n\t if (start < 0) start = 0\n\t } else if (start > len) {\n\t start = len\n\t }\n\t\n\t if (end < 0) {\n\t end += len\n\t if (end < 0) end = 0\n\t } else if (end > len) {\n\t end = len\n\t }\n\t\n\t if (end < start) end = start\n\t\n\t var newBuf\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t newBuf = this.subarray(start, end)\n\t newBuf.__proto__ = Buffer.prototype\n\t } else {\n\t var sliceLen = end - start\n\t newBuf = new Buffer(sliceLen, undefined)\n\t for (var i = 0; i < sliceLen; ++i) {\n\t newBuf[i] = this[i + start]\n\t }\n\t }\n\t\n\t return newBuf\n\t}\n\t\n\t/*\n\t * Need to make sure that buffer isn't trying to write out of bounds.\n\t */\n\tfunction checkOffset (offset, ext, length) {\n\t if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n\t if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n\t}\n\t\n\tBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n\t offset = offset | 0\n\t byteLength = byteLength | 0\n\t if (!noAssert) checkOffset(offset, byteLength, this.length)\n\t\n\t var val = this[offset]\n\t var mul = 1\n\t var i = 0\n\t while (++i < byteLength && (mul *= 0x100)) {\n\t val += this[offset + i] * mul\n\t }\n\t\n\t return val\n\t}\n\t\n\tBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n\t offset = offset | 0\n\t byteLength = byteLength | 0\n\t if (!noAssert) {\n\t checkOffset(offset, byteLength, this.length)\n\t }\n\t\n\t var val = this[offset + --byteLength]\n\t var mul = 1\n\t while (byteLength > 0 && (mul *= 0x100)) {\n\t val += this[offset + --byteLength] * mul\n\t }\n\t\n\t return val\n\t}\n\t\n\tBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 1, this.length)\n\t return this[offset]\n\t}\n\t\n\tBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 2, this.length)\n\t return this[offset] | (this[offset + 1] << 8)\n\t}\n\t\n\tBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 2, this.length)\n\t return (this[offset] << 8) | this[offset + 1]\n\t}\n\t\n\tBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 4, this.length)\n\t\n\t return ((this[offset]) |\n\t (this[offset + 1] << 8) |\n\t (this[offset + 2] << 16)) +\n\t (this[offset + 3] * 0x1000000)\n\t}\n\t\n\tBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 4, this.length)\n\t\n\t return (this[offset] * 0x1000000) +\n\t ((this[offset + 1] << 16) |\n\t (this[offset + 2] << 8) |\n\t this[offset + 3])\n\t}\n\t\n\tBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n\t offset = offset | 0\n\t byteLength = byteLength | 0\n\t if (!noAssert) checkOffset(offset, byteLength, this.length)\n\t\n\t var val = this[offset]\n\t var mul = 1\n\t var i = 0\n\t while (++i < byteLength && (mul *= 0x100)) {\n\t val += this[offset + i] * mul\n\t }\n\t mul *= 0x80\n\t\n\t if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\t\n\t return val\n\t}\n\t\n\tBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n\t offset = offset | 0\n\t byteLength = byteLength | 0\n\t if (!noAssert) checkOffset(offset, byteLength, this.length)\n\t\n\t var i = byteLength\n\t var mul = 1\n\t var val = this[offset + --i]\n\t while (i > 0 && (mul *= 0x100)) {\n\t val += this[offset + --i] * mul\n\t }\n\t mul *= 0x80\n\t\n\t if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\t\n\t return val\n\t}\n\t\n\tBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 1, this.length)\n\t if (!(this[offset] & 0x80)) return (this[offset])\n\t return ((0xff - this[offset] + 1) * -1)\n\t}\n\t\n\tBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 2, this.length)\n\t var val = this[offset] | (this[offset + 1] << 8)\n\t return (val & 0x8000) ? val | 0xFFFF0000 : val\n\t}\n\t\n\tBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 2, this.length)\n\t var val = this[offset + 1] | (this[offset] << 8)\n\t return (val & 0x8000) ? val | 0xFFFF0000 : val\n\t}\n\t\n\tBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 4, this.length)\n\t\n\t return (this[offset]) |\n\t (this[offset + 1] << 8) |\n\t (this[offset + 2] << 16) |\n\t (this[offset + 3] << 24)\n\t}\n\t\n\tBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 4, this.length)\n\t\n\t return (this[offset] << 24) |\n\t (this[offset + 1] << 16) |\n\t (this[offset + 2] << 8) |\n\t (this[offset + 3])\n\t}\n\t\n\tBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 4, this.length)\n\t return ieee754.read(this, offset, true, 23, 4)\n\t}\n\t\n\tBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 4, this.length)\n\t return ieee754.read(this, offset, false, 23, 4)\n\t}\n\t\n\tBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 8, this.length)\n\t return ieee754.read(this, offset, true, 52, 8)\n\t}\n\t\n\tBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n\t if (!noAssert) checkOffset(offset, 8, this.length)\n\t return ieee754.read(this, offset, false, 52, 8)\n\t}\n\t\n\tfunction checkInt (buf, value, offset, ext, max, min) {\n\t if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n\t if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n\t if (offset + ext > buf.length) throw new RangeError('Index out of range')\n\t}\n\t\n\tBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t byteLength = byteLength | 0\n\t if (!noAssert) {\n\t var maxBytes = Math.pow(2, 8 * byteLength) - 1\n\t checkInt(this, value, offset, byteLength, maxBytes, 0)\n\t }\n\t\n\t var mul = 1\n\t var i = 0\n\t this[offset] = value & 0xFF\n\t while (++i < byteLength && (mul *= 0x100)) {\n\t this[offset + i] = (value / mul) & 0xFF\n\t }\n\t\n\t return offset + byteLength\n\t}\n\t\n\tBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t byteLength = byteLength | 0\n\t if (!noAssert) {\n\t var maxBytes = Math.pow(2, 8 * byteLength) - 1\n\t checkInt(this, value, offset, byteLength, maxBytes, 0)\n\t }\n\t\n\t var i = byteLength - 1\n\t var mul = 1\n\t this[offset + i] = value & 0xFF\n\t while (--i >= 0 && (mul *= 0x100)) {\n\t this[offset + i] = (value / mul) & 0xFF\n\t }\n\t\n\t return offset + byteLength\n\t}\n\t\n\tBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n\t this[offset] = (value & 0xff)\n\t return offset + 1\n\t}\n\t\n\tfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n\t if (value < 0) value = 0xffff + value + 1\n\t for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n\t buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n\t (littleEndian ? i : 1 - i) * 8\n\t }\n\t}\n\t\n\tBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t this[offset] = (value & 0xff)\n\t this[offset + 1] = (value >>> 8)\n\t } else {\n\t objectWriteUInt16(this, value, offset, true)\n\t }\n\t return offset + 2\n\t}\n\t\n\tBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t this[offset] = (value >>> 8)\n\t this[offset + 1] = (value & 0xff)\n\t } else {\n\t objectWriteUInt16(this, value, offset, false)\n\t }\n\t return offset + 2\n\t}\n\t\n\tfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n\t if (value < 0) value = 0xffffffff + value + 1\n\t for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n\t buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n\t }\n\t}\n\t\n\tBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t this[offset + 3] = (value >>> 24)\n\t this[offset + 2] = (value >>> 16)\n\t this[offset + 1] = (value >>> 8)\n\t this[offset] = (value & 0xff)\n\t } else {\n\t objectWriteUInt32(this, value, offset, true)\n\t }\n\t return offset + 4\n\t}\n\t\n\tBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t this[offset] = (value >>> 24)\n\t this[offset + 1] = (value >>> 16)\n\t this[offset + 2] = (value >>> 8)\n\t this[offset + 3] = (value & 0xff)\n\t } else {\n\t objectWriteUInt32(this, value, offset, false)\n\t }\n\t return offset + 4\n\t}\n\t\n\tBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) {\n\t var limit = Math.pow(2, 8 * byteLength - 1)\n\t\n\t checkInt(this, value, offset, byteLength, limit - 1, -limit)\n\t }\n\t\n\t var i = 0\n\t var mul = 1\n\t var sub = 0\n\t this[offset] = value & 0xFF\n\t while (++i < byteLength && (mul *= 0x100)) {\n\t if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n\t sub = 1\n\t }\n\t this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n\t }\n\t\n\t return offset + byteLength\n\t}\n\t\n\tBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) {\n\t var limit = Math.pow(2, 8 * byteLength - 1)\n\t\n\t checkInt(this, value, offset, byteLength, limit - 1, -limit)\n\t }\n\t\n\t var i = byteLength - 1\n\t var mul = 1\n\t var sub = 0\n\t this[offset + i] = value & 0xFF\n\t while (--i >= 0 && (mul *= 0x100)) {\n\t if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n\t sub = 1\n\t }\n\t this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n\t }\n\t\n\t return offset + byteLength\n\t}\n\t\n\tBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n\t if (value < 0) value = 0xff + value + 1\n\t this[offset] = (value & 0xff)\n\t return offset + 1\n\t}\n\t\n\tBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t this[offset] = (value & 0xff)\n\t this[offset + 1] = (value >>> 8)\n\t } else {\n\t objectWriteUInt16(this, value, offset, true)\n\t }\n\t return offset + 2\n\t}\n\t\n\tBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t this[offset] = (value >>> 8)\n\t this[offset + 1] = (value & 0xff)\n\t } else {\n\t objectWriteUInt16(this, value, offset, false)\n\t }\n\t return offset + 2\n\t}\n\t\n\tBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t this[offset] = (value & 0xff)\n\t this[offset + 1] = (value >>> 8)\n\t this[offset + 2] = (value >>> 16)\n\t this[offset + 3] = (value >>> 24)\n\t } else {\n\t objectWriteUInt32(this, value, offset, true)\n\t }\n\t return offset + 4\n\t}\n\t\n\tBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n\t value = +value\n\t offset = offset | 0\n\t if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n\t if (value < 0) value = 0xffffffff + value + 1\n\t if (Buffer.TYPED_ARRAY_SUPPORT) {\n\t this[offset] = (value >>> 24)\n\t this[offset + 1] = (value >>> 16)\n\t this[offset + 2] = (value >>> 8)\n\t this[offset + 3] = (value & 0xff)\n\t } else {\n\t objectWriteUInt32(this, value, offset, false)\n\t }\n\t return offset + 4\n\t}\n\t\n\tfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n\t if (offset + ext > buf.length) throw new RangeError('Index out of range')\n\t if (offset < 0) throw new RangeError('Index out of range')\n\t}\n\t\n\tfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n\t if (!noAssert) {\n\t checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n\t }\n\t ieee754.write(buf, value, offset, littleEndian, 23, 4)\n\t return offset + 4\n\t}\n\t\n\tBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n\t return writeFloat(this, value, offset, true, noAssert)\n\t}\n\t\n\tBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n\t return writeFloat(this, value, offset, false, noAssert)\n\t}\n\t\n\tfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n\t if (!noAssert) {\n\t checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n\t }\n\t ieee754.write(buf, value, offset, littleEndian, 52, 8)\n\t return offset + 8\n\t}\n\t\n\tBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n\t return writeDouble(this, value, offset, true, noAssert)\n\t}\n\t\n\tBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n\t return writeDouble(this, value, offset, false, noAssert)\n\t}\n\t\n\t// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\n\tBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n\t if (!start) start = 0\n\t if (!end && end !== 0) end = this.length\n\t if (targetStart >= target.length) targetStart = target.length\n\t if (!targetStart) targetStart = 0\n\t if (end > 0 && end < start) end = start\n\t\n\t // Copy 0 bytes; we're done\n\t if (end === start) return 0\n\t if (target.length === 0 || this.length === 0) return 0\n\t\n\t // Fatal error conditions\n\t if (targetStart < 0) {\n\t throw new RangeError('targetStart out of bounds')\n\t }\n\t if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n\t if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\t\n\t // Are we oob?\n\t if (end > this.length) end = this.length\n\t if (target.length - targetStart < end - start) {\n\t end = target.length - targetStart + start\n\t }\n\t\n\t var len = end - start\n\t var i\n\t\n\t if (this === target && start < targetStart && targetStart < end) {\n\t // descending copy from end\n\t for (i = len - 1; i >= 0; --i) {\n\t target[i + targetStart] = this[i + start]\n\t }\n\t } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n\t // ascending copy from start\n\t for (i = 0; i < len; ++i) {\n\t target[i + targetStart] = this[i + start]\n\t }\n\t } else {\n\t Uint8Array.prototype.set.call(\n\t target,\n\t this.subarray(start, start + len),\n\t targetStart\n\t )\n\t }\n\t\n\t return len\n\t}\n\t\n\t// Usage:\n\t// buffer.fill(number[, offset[, end]])\n\t// buffer.fill(buffer[, offset[, end]])\n\t// buffer.fill(string[, offset[, end]][, encoding])\n\tBuffer.prototype.fill = function fill (val, start, end, encoding) {\n\t // Handle string cases:\n\t if (typeof val === 'string') {\n\t if (typeof start === 'string') {\n\t encoding = start\n\t start = 0\n\t end = this.length\n\t } else if (typeof end === 'string') {\n\t encoding = end\n\t end = this.length\n\t }\n\t if (val.length === 1) {\n\t var code = val.charCodeAt(0)\n\t if (code < 256) {\n\t val = code\n\t }\n\t }\n\t if (encoding !== undefined && typeof encoding !== 'string') {\n\t throw new TypeError('encoding must be a string')\n\t }\n\t if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n\t throw new TypeError('Unknown encoding: ' + encoding)\n\t }\n\t } else if (typeof val === 'number') {\n\t val = val & 255\n\t }\n\t\n\t // Invalid ranges are not set to a default, so can range check early.\n\t if (start < 0 || this.length < start || this.length < end) {\n\t throw new RangeError('Out of range index')\n\t }\n\t\n\t if (end <= start) {\n\t return this\n\t }\n\t\n\t start = start >>> 0\n\t end = end === undefined ? this.length : end >>> 0\n\t\n\t if (!val) val = 0\n\t\n\t var i\n\t if (typeof val === 'number') {\n\t for (i = start; i < end; ++i) {\n\t this[i] = val\n\t }\n\t } else {\n\t var bytes = Buffer.isBuffer(val)\n\t ? val\n\t : utf8ToBytes(new Buffer(val, encoding).toString())\n\t var len = bytes.length\n\t for (i = 0; i < end - start; ++i) {\n\t this[i + start] = bytes[i % len]\n\t }\n\t }\n\t\n\t return this\n\t}\n\t\n\t// HELPER FUNCTIONS\n\t// ================\n\t\n\tvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\t\n\tfunction base64clean (str) {\n\t // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n\t str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n\t // Node converts strings with length < 2 to ''\n\t if (str.length < 2) return ''\n\t // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n\t while (str.length % 4 !== 0) {\n\t str = str + '='\n\t }\n\t return str\n\t}\n\t\n\tfunction stringtrim (str) {\n\t if (str.trim) return str.trim()\n\t return str.replace(/^\\s+|\\s+$/g, '')\n\t}\n\t\n\tfunction toHex (n) {\n\t if (n < 16) return '0' + n.toString(16)\n\t return n.toString(16)\n\t}\n\t\n\tfunction utf8ToBytes (string, units) {\n\t units = units || Infinity\n\t var codePoint\n\t var length = string.length\n\t var leadSurrogate = null\n\t var bytes = []\n\t\n\t for (var i = 0; i < length; ++i) {\n\t codePoint = string.charCodeAt(i)\n\t\n\t // is surrogate component\n\t if (codePoint > 0xD7FF && codePoint < 0xE000) {\n\t // last char was a lead\n\t if (!leadSurrogate) {\n\t // no lead yet\n\t if (codePoint > 0xDBFF) {\n\t // unexpected trail\n\t if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n\t continue\n\t } else if (i + 1 === length) {\n\t // unpaired lead\n\t if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n\t continue\n\t }\n\t\n\t // valid lead\n\t leadSurrogate = codePoint\n\t\n\t continue\n\t }\n\t\n\t // 2 leads in a row\n\t if (codePoint < 0xDC00) {\n\t if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n\t leadSurrogate = codePoint\n\t continue\n\t }\n\t\n\t // valid surrogate pair\n\t codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n\t } else if (leadSurrogate) {\n\t // valid bmp char, but last char was a lead\n\t if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n\t }\n\t\n\t leadSurrogate = null\n\t\n\t // encode utf8\n\t if (codePoint < 0x80) {\n\t if ((units -= 1) < 0) break\n\t bytes.push(codePoint)\n\t } else if (codePoint < 0x800) {\n\t if ((units -= 2) < 0) break\n\t bytes.push(\n\t codePoint >> 0x6 | 0xC0,\n\t codePoint & 0x3F | 0x80\n\t )\n\t } else if (codePoint < 0x10000) {\n\t if ((units -= 3) < 0) break\n\t bytes.push(\n\t codePoint >> 0xC | 0xE0,\n\t codePoint >> 0x6 & 0x3F | 0x80,\n\t codePoint & 0x3F | 0x80\n\t )\n\t } else if (codePoint < 0x110000) {\n\t if ((units -= 4) < 0) break\n\t bytes.push(\n\t codePoint >> 0x12 | 0xF0,\n\t codePoint >> 0xC & 0x3F | 0x80,\n\t codePoint >> 0x6 & 0x3F | 0x80,\n\t codePoint & 0x3F | 0x80\n\t )\n\t } else {\n\t throw new Error('Invalid code point')\n\t }\n\t }\n\t\n\t return bytes\n\t}\n\t\n\tfunction asciiToBytes (str) {\n\t var byteArray = []\n\t for (var i = 0; i < str.length; ++i) {\n\t // Node's code seems to be doing this and not & 0x7F..\n\t byteArray.push(str.charCodeAt(i) & 0xFF)\n\t }\n\t return byteArray\n\t}\n\t\n\tfunction utf16leToBytes (str, units) {\n\t var c, hi, lo\n\t var byteArray = []\n\t for (var i = 0; i < str.length; ++i) {\n\t if ((units -= 2) < 0) break\n\t\n\t c = str.charCodeAt(i)\n\t hi = c >> 8\n\t lo = c % 256\n\t byteArray.push(lo)\n\t byteArray.push(hi)\n\t }\n\t\n\t return byteArray\n\t}\n\t\n\tfunction base64ToBytes (str) {\n\t return base64.toByteArray(base64clean(str))\n\t}\n\t\n\tfunction blitBuffer (src, dst, offset, length) {\n\t for (var i = 0; i < length; ++i) {\n\t if ((i + offset >= dst.length) || (i >= src.length)) break\n\t dst[i + offset] = src[i]\n\t }\n\t return i\n\t}\n\t\n\tfunction isnan (val) {\n\t return val !== val // eslint-disable-line no-self-compare\n\t}\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(19).Buffer, (function() { return this; }())))\n\n/***/ },\n/* 20 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"base64-js\");\n\n/***/ },\n/* 21 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"ieee754\");\n\n/***/ },\n/* 22 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"isarray\");\n\n/***/ },\n/* 23 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"ip\");\n\n/***/ },\n/* 24 */\n/***/ function(module, exports) {\n\n\n\n/***/ },\n/* 25 */\n/***/ function(module, exports) {\n\n\texports.endianness = function () { return 'LE' };\n\t\n\texports.hostname = function () {\n\t if (typeof location !== 'undefined') {\n\t return location.hostname\n\t }\n\t else return '';\n\t};\n\t\n\texports.loadavg = function () { return [] };\n\t\n\texports.uptime = function () { return 0 };\n\t\n\texports.freemem = function () {\n\t return Number.MAX_VALUE;\n\t};\n\t\n\texports.totalmem = function () {\n\t return Number.MAX_VALUE;\n\t};\n\t\n\texports.cpus = function () { return [] };\n\t\n\texports.type = function () { return 'Browser' };\n\t\n\texports.release = function () {\n\t if (typeof navigator !== 'undefined') {\n\t return navigator.appVersion;\n\t }\n\t return '';\n\t};\n\t\n\texports.networkInterfaces\n\t= exports.getNetworkInterfaces\n\t= function () { return {} };\n\t\n\texports.arch = function () { return 'javascript' };\n\t\n\texports.platform = function () { return 'browser' };\n\t\n\texports.tmpdir = exports.tmpDir = function () {\n\t return '/tmp';\n\t};\n\t\n\texports.EOL = '\\n';\n\n\n/***/ },\n/* 26 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\t\n\tvar _restTransport = __webpack_require__(27);\n\t\n\tvar _restTransport2 = _interopRequireDefault(_restTransport);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\t\n\tvar BlinkTradeRest = function (_RestTransport) {\n\t _inherits(BlinkTradeRest, _RestTransport);\n\t\n\t function BlinkTradeRest() {\n\t _classCallCheck(this, BlinkTradeRest);\n\t\n\t return _possibleConstructorReturn(this, (BlinkTradeRest.__proto__ || Object.getPrototypeOf(BlinkTradeRest)).apply(this, arguments));\n\t }\n\t\n\t _createClass(BlinkTradeRest, [{\n\t key: 'ticker',\n\t value: function ticker(callback) {\n\t return _get(BlinkTradeRest.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeRest.prototype), 'fetchPublic', this).call(this, 'ticker', callback);\n\t }\n\t }, {\n\t key: 'trades',\n\t value: function trades() {\n\t var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t var _ref$limit = _ref.limit;\n\t var limit = _ref$limit === undefined ? 1000 : _ref$limit;\n\t var _ref$since = _ref.since;\n\t var since = _ref$since === undefined ? '0' : _ref$since;\n\t var callback = arguments[1];\n\t\n\t return _get(BlinkTradeRest.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeRest.prototype), 'fetchPublic', this).call(this, 'trades?limit=' + limit + '&since=' + since, callback);\n\t }\n\t }, {\n\t key: 'orderbook',\n\t value: function orderbook(callback) {\n\t return _get(BlinkTradeRest.prototype.__proto__ || Object.getPrototypeOf(BlinkTradeRest.prototype), 'fetchPublic', this).call(this, 'orderbook', callback);\n\t }\n\t }]);\n\t\n\t return BlinkTradeRest;\n\t}(_restTransport2.default);\n\t\n\texports.default = BlinkTradeRest;\n\n/***/ },\n/* 27 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _sjcl = __webpack_require__(28);\n\t\n\tvar _sjcl2 = _interopRequireDefault(_sjcl);\n\t\n\tvar _nodeify = __webpack_require__(14);\n\t\n\tvar _nodeify2 = _interopRequireDefault(_nodeify);\n\t\n\tvar _url = __webpack_require__(29);\n\t\n\tvar _url2 = _interopRequireDefault(_url);\n\t\n\tvar _path = __webpack_require__(30);\n\t\n\tvar _path2 = _interopRequireDefault(_path);\n\t\n\tvar _baseTransport = __webpack_require__(10);\n\t\n\tvar _baseTransport2 = _interopRequireDefault(_baseTransport);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**\n\t * BlinkTradeJS SDK\n\t * (c) 2016-present BlinkTrade, Inc.\n\t *\n\t * This file is part of BlinkTradeJS\n\t *\n\t * This program is free software: you can redistribute it and/or modify\n\t * it under the terms of the GNU General Public License as published by\n\t * the Free Software Foundation, either version 3 of the License, or\n\t * (at your option) any later version.\n\t \n\t * This program is distributed in the hope that it will be useful,\n\t * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\t * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\t * GNU General Public License for more details.\n\t \n\t * You should have received a copy of the GNU General Public License\n\t * along with this program. If not, see .\n\t *\n\t * \n\t */\n\t\n\tvar RestTransport = function (_BaseTransport) {\n\t _inherits(RestTransport, _BaseTransport);\n\t\n\t /**\n\t * Exchanges currencies available.\n\t */\n\t\n\t\n\t /**\n\t * APIKey\n\t */\n\t function RestTransport(params) {\n\t _classCallCheck(this, RestTransport);\n\t\n\t var _this = _possibleConstructorReturn(this, (RestTransport.__proto__ || Object.getPrototypeOf(RestTransport)).call(this, params, 'rest'));\n\t\n\t _this.key = params.key;\n\t _this.secret = params.secret;\n\t _this.currency = params.currency || 'USD';\n\t\n\t _this.fetchRequest = _this.isNode ? __webpack_require__(32) : __webpack_require__(33);\n\t return _this;\n\t }\n\t\n\t /**\n\t * Fetch rest API\n\t */\n\t\n\t\n\t /**\n\t * APISecret\n\t */\n\t\n\t\n\t _createClass(RestTransport, [{\n\t key: 'headers',\n\t value: function headers(method, body) {\n\t var timeStamp = Date.now().toString();\n\t var hexKey = _sjcl2.default.codec.utf8String.toBits(this.secret);\n\t var hmac = new _sjcl2.default.misc.hmac(hexKey, _sjcl2.default.hash.sha256);\n\t var Signature = _sjcl2.default.codec.hex.fromBits(hmac.encrypt(timeStamp));\n\t return {\n\t method: method,\n\t headers: {\n\t 'Content-Type': 'application/json',\n\t Nonce: timeStamp,\n\t APIKey: this.key,\n\t Signature: Signature\n\t },\n\t body: JSON.stringify(body)\n\t };\n\t }\n\t }, {\n\t key: 'fetch',\n\t value: function fetch(msg, api) {\n\t var headers = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];\n\t\n\t return this.fetchRequest(_url2.default.resolve(this.endpoint, api), headers).then(function (response) {\n\t return response.json();\n\t });\n\t }\n\t }, {\n\t key: 'fetchPublic',\n\t value: function fetchPublic(api, callback) {\n\t return (0, _nodeify2.default)(this.fetch({}, _path2.default.join('api/v1', this.currency, api)), callback);\n\t }\n\t }, {\n\t key: 'fetchTrade',\n\t value: function fetchTrade(msg, callback) {\n\t var headers = this.headers('POST', msg);\n\t return (0, _nodeify2.default)(this.fetch(msg, 'tapi/v1/message', headers, callback).then(function (response) {\n\t return response.Status === 500 ? Promise.reject(response) : response.Responses;\n\t }).then(function (response) {\n\t return response.length === 1 ? response[0] : response;\n\t }), callback);\n\t }\n\t }]);\n\t\n\t return RestTransport;\n\t}(_baseTransport2.default);\n\t\n\texports.default = RestTransport;\n\n/***/ },\n/* 28 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"sjcl\");\n\n/***/ },\n/* 29 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"url\");\n\n/***/ },\n/* 30 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors.\n\t//\n\t// Permission is hereby granted, free of charge, to any person obtaining a\n\t// copy of this software and associated documentation files (the\n\t// \"Software\"), to deal in the Software without restriction, including\n\t// without limitation the rights to use, copy, modify, merge, publish,\n\t// distribute, sublicense, and/or sell copies of the Software, and to permit\n\t// persons to whom the Software is furnished to do so, subject to the\n\t// following conditions:\n\t//\n\t// The above copyright notice and this permission notice shall be included\n\t// in all copies or substantial portions of the Software.\n\t//\n\t// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n\t// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\t// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n\t// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n\t// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n\t// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n\t// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\t\n\t// resolves . and .. elements in a path array with directory names there\n\t// must be no slashes, empty elements, or device names (c:\\) in the array\n\t// (so also no leading and trailing slashes - it does not distinguish\n\t// relative and absolute paths)\n\tfunction normalizeArray(parts, allowAboveRoot) {\n\t // if the path tries to go above the root, `up` ends up > 0\n\t var up = 0;\n\t for (var i = parts.length - 1; i >= 0; i--) {\n\t var last = parts[i];\n\t if (last === '.') {\n\t parts.splice(i, 1);\n\t } else if (last === '..') {\n\t parts.splice(i, 1);\n\t up++;\n\t } else if (up) {\n\t parts.splice(i, 1);\n\t up--;\n\t }\n\t }\n\t\n\t // if the path is allowed to go above the root, restore leading ..s\n\t if (allowAboveRoot) {\n\t for (; up--; up) {\n\t parts.unshift('..');\n\t }\n\t }\n\t\n\t return parts;\n\t}\n\t\n\t// Split a filename into [root, dir, basename, ext], unix version\n\t// 'root' is just a slash, or nothing.\n\tvar splitPathRe =\n\t /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\n\tvar splitPath = function(filename) {\n\t return splitPathRe.exec(filename).slice(1);\n\t};\n\t\n\t// path.resolve([from ...], to)\n\t// posix version\n\texports.resolve = function() {\n\t var resolvedPath = '',\n\t resolvedAbsolute = false;\n\t\n\t for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n\t var path = (i >= 0) ? arguments[i] : process.cwd();\n\t\n\t // Skip empty and invalid entries\n\t if (typeof path !== 'string') {\n\t throw new TypeError('Arguments to path.resolve must be strings');\n\t } else if (!path) {\n\t continue;\n\t }\n\t\n\t resolvedPath = path + '/' + resolvedPath;\n\t resolvedAbsolute = path.charAt(0) === '/';\n\t }\n\t\n\t // At this point the path should be resolved to a full absolute path, but\n\t // handle relative paths to be safe (might happen when process.cwd() fails)\n\t\n\t // Normalize the path\n\t resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n\t return !!p;\n\t }), !resolvedAbsolute).join('/');\n\t\n\t return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n\t};\n\t\n\t// path.normalize(path)\n\t// posix version\n\texports.normalize = function(path) {\n\t var isAbsolute = exports.isAbsolute(path),\n\t trailingSlash = substr(path, -1) === '/';\n\t\n\t // Normalize the path\n\t path = normalizeArray(filter(path.split('/'), function(p) {\n\t return !!p;\n\t }), !isAbsolute).join('/');\n\t\n\t if (!path && !isAbsolute) {\n\t path = '.';\n\t }\n\t if (path && trailingSlash) {\n\t path += '/';\n\t }\n\t\n\t return (isAbsolute ? '/' : '') + path;\n\t};\n\t\n\t// posix version\n\texports.isAbsolute = function(path) {\n\t return path.charAt(0) === '/';\n\t};\n\t\n\t// posix version\n\texports.join = function() {\n\t var paths = Array.prototype.slice.call(arguments, 0);\n\t return exports.normalize(filter(paths, function(p, index) {\n\t if (typeof p !== 'string') {\n\t throw new TypeError('Arguments to path.join must be strings');\n\t }\n\t return p;\n\t }).join('/'));\n\t};\n\t\n\t\n\t// path.relative(from, to)\n\t// posix version\n\texports.relative = function(from, to) {\n\t from = exports.resolve(from).substr(1);\n\t to = exports.resolve(to).substr(1);\n\t\n\t function trim(arr) {\n\t var start = 0;\n\t for (; start < arr.length; start++) {\n\t if (arr[start] !== '') break;\n\t }\n\t\n\t var end = arr.length - 1;\n\t for (; end >= 0; end--) {\n\t if (arr[end] !== '') break;\n\t }\n\t\n\t if (start > end) return [];\n\t return arr.slice(start, end - start + 1);\n\t }\n\t\n\t var fromParts = trim(from.split('/'));\n\t var toParts = trim(to.split('/'));\n\t\n\t var length = Math.min(fromParts.length, toParts.length);\n\t var samePartsLength = length;\n\t for (var i = 0; i < length; i++) {\n\t if (fromParts[i] !== toParts[i]) {\n\t samePartsLength = i;\n\t break;\n\t }\n\t }\n\t\n\t var outputParts = [];\n\t for (var i = samePartsLength; i < fromParts.length; i++) {\n\t outputParts.push('..');\n\t }\n\t\n\t outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\t\n\t return outputParts.join('/');\n\t};\n\t\n\texports.sep = '/';\n\texports.delimiter = ':';\n\t\n\texports.dirname = function(path) {\n\t var result = splitPath(path),\n\t root = result[0],\n\t dir = result[1];\n\t\n\t if (!root && !dir) {\n\t // No dirname whatsoever\n\t return '.';\n\t }\n\t\n\t if (dir) {\n\t // It has a dirname, strip trailing slash\n\t dir = dir.substr(0, dir.length - 1);\n\t }\n\t\n\t return root + dir;\n\t};\n\t\n\t\n\texports.basename = function(path, ext) {\n\t var f = splitPath(path)[2];\n\t // TODO: make this comparison case-insensitive on windows?\n\t if (ext && f.substr(-1 * ext.length) === ext) {\n\t f = f.substr(0, f.length - ext.length);\n\t }\n\t return f;\n\t};\n\t\n\t\n\texports.extname = function(path) {\n\t return splitPath(path)[3];\n\t};\n\t\n\tfunction filter (xs, f) {\n\t if (xs.filter) return xs.filter(f);\n\t var res = [];\n\t for (var i = 0; i < xs.length; i++) {\n\t if (f(xs[i], i, xs)) res.push(xs[i]);\n\t }\n\t return res;\n\t}\n\t\n\t// String.prototype.substr - negative index don't work in IE8\n\tvar substr = 'ab'.substr(-1) === 'b'\n\t ? function (str, start, len) { return str.substr(start, len) }\n\t : function (str, start, len) {\n\t if (start < 0) start = str.length + start;\n\t return str.substr(start, len);\n\t }\n\t;\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(31)))\n\n/***/ },\n/* 31 */\n/***/ function(module, exports) {\n\n\t// shim for using process in browser\n\tvar process = module.exports = {};\n\t\n\t// cached from whatever global is present so that test runners that stub it\n\t// don't break things. But we need to wrap it in a try catch in case it is\n\t// wrapped in strict mode code which doesn't define any globals. It's inside a\n\t// function because try/catches deoptimize in certain engines.\n\t\n\tvar cachedSetTimeout;\n\tvar cachedClearTimeout;\n\t\n\t(function () {\n\t try {\n\t cachedSetTimeout = setTimeout;\n\t } catch (e) {\n\t cachedSetTimeout = function () {\n\t throw new Error('setTimeout is not defined');\n\t }\n\t }\n\t try {\n\t cachedClearTimeout = clearTimeout;\n\t } catch (e) {\n\t cachedClearTimeout = function () {\n\t throw new Error('clearTimeout is not defined');\n\t }\n\t }\n\t} ())\n\tfunction runTimeout(fun) {\n\t if (cachedSetTimeout === setTimeout) {\n\t //normal enviroments in sane situations\n\t return setTimeout(fun, 0);\n\t }\n\t try {\n\t // when when somebody has screwed with setTimeout but no I.E. maddness\n\t return cachedSetTimeout(fun, 0);\n\t } catch(e){\n\t try {\n\t // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n\t return cachedSetTimeout.call(null, fun, 0);\n\t } catch(e){\n\t // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n\t return cachedSetTimeout.call(this, fun, 0);\n\t }\n\t }\n\t\n\t\n\t}\n\tfunction runClearTimeout(marker) {\n\t if (cachedClearTimeout === clearTimeout) {\n\t //normal enviroments in sane situations\n\t return clearTimeout(marker);\n\t }\n\t try {\n\t // when when somebody has screwed with setTimeout but no I.E. maddness\n\t return cachedClearTimeout(marker);\n\t } catch (e){\n\t try {\n\t // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n\t return cachedClearTimeout.call(null, marker);\n\t } catch (e){\n\t // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n\t // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n\t return cachedClearTimeout.call(this, marker);\n\t }\n\t }\n\t\n\t\n\t\n\t}\n\tvar queue = [];\n\tvar draining = false;\n\tvar currentQueue;\n\tvar queueIndex = -1;\n\t\n\tfunction cleanUpNextTick() {\n\t if (!draining || !currentQueue) {\n\t return;\n\t }\n\t draining = false;\n\t if (currentQueue.length) {\n\t queue = currentQueue.concat(queue);\n\t } else {\n\t queueIndex = -1;\n\t }\n\t if (queue.length) {\n\t drainQueue();\n\t }\n\t}\n\t\n\tfunction drainQueue() {\n\t if (draining) {\n\t return;\n\t }\n\t var timeout = runTimeout(cleanUpNextTick);\n\t draining = true;\n\t\n\t var len = queue.length;\n\t while(len) {\n\t currentQueue = queue;\n\t queue = [];\n\t while (++queueIndex < len) {\n\t if (currentQueue) {\n\t currentQueue[queueIndex].run();\n\t }\n\t }\n\t queueIndex = -1;\n\t len = queue.length;\n\t }\n\t currentQueue = null;\n\t draining = false;\n\t runClearTimeout(timeout);\n\t}\n\t\n\tprocess.nextTick = function (fun) {\n\t var args = new Array(arguments.length - 1);\n\t if (arguments.length > 1) {\n\t for (var i = 1; i < arguments.length; i++) {\n\t args[i - 1] = arguments[i];\n\t }\n\t }\n\t queue.push(new Item(fun, args));\n\t if (queue.length === 1 && !draining) {\n\t runTimeout(drainQueue);\n\t }\n\t};\n\t\n\t// v8 likes predictible objects\n\tfunction Item(fun, array) {\n\t this.fun = fun;\n\t this.array = array;\n\t}\n\tItem.prototype.run = function () {\n\t this.fun.apply(null, this.array);\n\t};\n\tprocess.title = 'browser';\n\tprocess.browser = true;\n\tprocess.env = {};\n\tprocess.argv = [];\n\tprocess.version = ''; // empty string to avoid regexp issues\n\tprocess.versions = {};\n\t\n\tfunction noop() {}\n\t\n\tprocess.on = noop;\n\tprocess.addListener = noop;\n\tprocess.once = noop;\n\tprocess.off = noop;\n\tprocess.removeListener = noop;\n\tprocess.removeAllListeners = noop;\n\tprocess.emit = noop;\n\t\n\tprocess.binding = function (name) {\n\t throw new Error('process.binding is not supported');\n\t};\n\t\n\tprocess.cwd = function () { return '/' };\n\tprocess.chdir = function (dir) {\n\t throw new Error('process.chdir is not supported');\n\t};\n\tprocess.umask = function() { return 0; };\n\n\n/***/ },\n/* 32 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"isomorphic-fetch\");\n\n/***/ },\n/* 33 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"fetch-jsonp\");\n\n/***/ }\n/******/ ]);\n\n\n/** WEBPACK FOOTER **\n ** blinktrade.min.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 796c750e873e00d67f9b\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport Brokers from './constants/brokers';\nimport BlinkTradeWS from './ws';\nimport BlinkTradeRest from './rest';\n\nexport {\n Brokers,\n BlinkTradeWS,\n BlinkTradeRest,\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/index.js\n **/","export default {\n SURBITCOIN: 1,\n VBTC: 3,\n FOXBIT: 4,\n TESTNET: 5,\n URDUBIT: 8,\n CHILEBIT: 9,\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/brokers.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport _ from 'lodash';\nimport { EventEmitter2 as EventEmitter } from 'eventemitter2';\nimport {\n registerListener,\n generateRequestId,\n registerEventEmitter,\n} from './listener';\n\nimport {\n EVENTS,\n BALANCE,\n ORDER_BOOK,\n DEPOSIT_REFRESH,\n WITHDRAW_REFRESH,\n EXECUTION_REPORT,\n} from './constants/actionTypes';\n\nimport MsgTypes from './constants/requests';\nimport WebSocketTransport from './wsTransport';\n\nclass BlinkTradeWS extends WebSocketTransport {\n\n /**\n * Session to store login information\n */\n session: Object;\n\n constructor(params?: BlinkTradeBase) {\n super(params);\n\n this.session = {};\n }\n\n heartbeat(callback?: Function): Promise {\n const d = new Date();\n const msg: Object = {\n MsgType: MsgTypes.HEARTBEAT,\n TestReqID: d.getTime(),\n SendTime: d.getTime(),\n };\n\n return new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then((data) => {\n return resolve({\n ...data,\n Latency: new Date(Date.now()) - data.SendTime,\n });\n }).catch(reject);\n });\n }\n\n login({ username, password, secondFactor }: {\n username: string;\n password: string;\n secondFactor?: string;\n }, callback?: Function): Promise {\n let userAgent;\n if (!this.isNode) {\n userAgent = {\n UserAgent: window.navigator.userAgent,\n UserAgentLanguage: window.navigator.language,\n UserAgentPlatform: window.navigator.platform,\n UserAgentTimezoneOffset: new Date().getTimezoneOffset(),\n };\n } else {\n const os = require('os');\n userAgent = {\n UserAgent: `${os.type()} ${os.release()}`,\n UserAgentLanguage: 'en_US',\n UserAgentPlatform: `${os.platform()} (${os.arch()})`,\n UserAgentTimezoneOffset: new Date().getTimezoneOffset(),\n };\n }\n\n const msg: Object = {\n MsgType: MsgTypes.LOGIN,\n UserReqID: generateRequestId(),\n BrokerID: this.brokerId,\n Username: username,\n Password: password,\n UserReqTyp: '1',\n ...userAgent,\n };\n\n if (secondFactor) {\n msg.SecondFactor = secondFactor;\n }\n\n return new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then(data => {\n if (data.UserStatus === 1) {\n this.session = data;\n return resolve(data);\n }\n\n return reject(data);\n }).catch(reject);\n });\n }\n\n logout(callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.LOGOUT,\n BrokerID: this.brokerId,\n UserReqID: generateRequestId(),\n Username: this.session.Username,\n UserReqTyp: '2',\n };\n\n return super.sendMessageAsPromise(msg, callback);\n }\n\n profile(callback?: Function): Promise {\n const { VerificationData, ...profile } = this.session.Profile;\n return callback ? callback(profile) : Promise.resolve(profile);\n }\n\n balance(callback?: Function): Promise {\n registerListener('U3', (balance) => {\n callback && callback(null, balance);\n return this.eventEmitter.emit(BALANCE, balance);\n });\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.balance(callback).then(resolve).catch(reject);\n }));\n }\n\n subscribeTicker(symbols: Array, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.SECURITY_STATUS,\n SecurityStatusReqID: generateRequestId(),\n SubscriptionRequestType: '1',\n Instruments: symbols,\n };\n\n const formatTicker = (data) => {\n return {\n ...data,\n SellVolume: data.SellVolume / 1e8,\n LowPx: data.LowPx / 1e8,\n LastPx: data.LastPx / 1e8,\n BestAsk: data.BestAsk / 1e8,\n HighPx: data.HighPx / 1e8,\n BuyVolume: data.BuyVolume / 1e8,\n BestBid: data.BestBid / 1e8,\n };\n };\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then(data => {\n resolve(formatTicker(data));\n registerEventEmitter({ SecurityStatusReqID: data.SecurityStatusReqID }, (ticker) => {\n callback && callback(null, formatTicker(ticker));\n return this.eventEmitter.emit(`BLINK:${ticker.Symbol}`, formatTicker(ticker));\n });\n }).catch(reject);\n }));\n }\n\n unSubscribeTicker(SecurityStatusReqID: number): number {\n const msg = {\n MsgType: MsgTypes.SECURITY_STATUS,\n SecurityStatusReqID,\n SubscriptionRequestType: '2',\n };\n\n super.sendMessage(msg);\n return SecurityStatusReqID;\n }\n\n subscribeOrderbook(symbols: Array, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.MARKET_DATA_FULL_REFRESH,\n MDReqID: generateRequestId(),\n SubscriptionRequestType: '1',\n MarketDepth: 0,\n MDUpdateType: '1', // Incremental refresh\n MDEntryTypes: ['0', '1', '2'],\n Instruments: symbols,\n };\n\n const subscribeEvent = (data) => {\n if (data.MDBkTyp === '3') {\n data.MDIncGrp.map(order => {\n const dataOrder = {\n index: order.MDEntryPositionNo,\n price: order.MDEntryPx / 1e8,\n size: order.MDEntrySize / 1e8,\n side: order.MDEntryType === '0' ? 'buy' : 'sell',\n userId: order.UserID,\n orderId: order.OrderID,\n symbol: order.Symbol,\n time: new Date(`${order.MDEntryDate} ${order.MDEntryTime}`).toString(),\n };\n\n callback && callback(null, dataOrder);\n\n switch (order.MDEntryType) {\n case '0':\n case '1':\n const orderbookEvent = `${ORDER_BOOK}:${EVENTS.ORDERBOOK[order.MDUpdateAction]}`;\n return this.eventEmitter.emit(orderbookEvent, {\n ...dataOrder,\n type: orderbookEvent,\n });\n case '2':\n const tradeEvent = `${ORDER_BOOK}:${EVENTS.TRADES[order.MDUpdateAction]}`;\n return this.eventEmitter.emit(tradeEvent, {\n ...dataOrder,\n type: tradeEvent,\n });\n case '4':\n break;\n default:\n return null;\n }\n return null;\n });\n }\n };\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then(data => {\n if (data.MsgType === 'W') {\n // Split orders in bids and asks\n /* eslint-disable no-param-reassign */\n const { bids, asks } = data.MDFullGrp\n .filter(order => order.MDEntryType === '0' || order.MDEntryType === '1')\n .reduce((prev, order) => {\n const side = order.MDEntryType === '0' ? 'bids' : 'asks';\n (prev[side] || (prev[side] = [])).push([\n order.MDEntryPx / 1e8,\n order.MDEntrySize / 1e8,\n order.UserID,\n ]);\n return prev;\n }, []);\n /* eslint-enable no-param-reassign */\n\n registerEventEmitter({ MDReqID: data.MDReqID }, subscribeEvent);\n\n return resolve({\n ...data,\n MDFullGrp: {\n [data.Symbol]: {\n bids,\n asks,\n },\n },\n });\n }\n }).catch(err => reject(err));\n }));\n }\n\n unSubscribeOrderbook(MDReqID: number): number {\n const msg = {\n MsgType: MsgTypes.MARKET_DATA_UNSUBSCRIBE,\n MDReqID,\n MarketDepth: 0,\n SubscriptionRequestType: '2',\n };\n\n super.sendMessage(msg);\n return MDReqID;\n }\n\n executionReport(callback?: Function): EventEmitter {\n registerListener('8', (data) => {\n callback && callback(data);\n const event = EVENTS.EXECUTION_REPORT[data.ExecType];\n return this.eventEmitter.emit(`${EXECUTION_REPORT}:${event}`, data);\n });\n\n return this.eventEmitter;\n }\n\n tradeHistory({ since, filter, page: Page = 0, pageSize: PageSize = 80 }: {\n since?: string;\n filter?: Array;\n page?: number;\n pageSize?: number;\n } = {}, callback?: Function): Promise {\n const msg: Object = {\n MsgType: MsgTypes.TRADE_HISTORY,\n TradeHistoryReqID: generateRequestId(),\n Page,\n PageSize,\n };\n\n if (filter && filter.length > 0) {\n msg.Filter = filter;\n }\n\n if (since && typeof since === 'number') {\n msg.Since = since;\n }\n\n return new Promise((resolve, reject) => {\n return super.sendMessageAsPromise(msg, callback).then(data => {\n const { Columns, ...trades } = data;\n const TradeHistory = _.groupBy(_.map(data.TradeHistoryGrp, trade => _.zipObject(Columns, trade)), trade => trade.Market);\n return resolve({\n ...trades,\n TradeHistoryGrp: TradeHistory,\n });\n }).catch(reject);\n });\n }\n\n requestDeposit({ currency = 'BTC', value, depositMethodId }: {\n value?: number;\n currency?: string;\n depositMethodId?: number;\n } = {}, callback?: Function): Promise {\n registerListener('U23', (deposit) => {\n callback && callback(null, deposit);\n return this.eventEmitter.emit(DEPOSIT_REFRESH, deposit);\n });\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.requestDeposit({ currency, value, depositMethodId }, callback)\n .then(resolve)\n .catch(reject);\n }));\n }\n\n onDepositRefresh(callback: Function): Promise {\n return new Promise((resolve) => {\n registerListener('U23', (deposit) => {\n callback && callback(deposit);\n return resolve(deposit);\n });\n });\n }\n\n requestWithdraw({ amount, data, currency = 'BTC', method = 'bitcoin' }: {\n data: Object,\n amount: number;\n method?: string;\n currency?: string;\n }, callback: Function): Promise {\n registerListener('U9', (withdraw) => {\n callback && callback(null, withdraw);\n return this.eventEmitter.emit(WITHDRAW_REFRESH, withdraw);\n });\n\n return super.emitterPromise(new Promise((resolve, reject) => {\n return super.requestWithdraw({ amount, data, currency, method }, callback)\n .then(resolve)\n .catch(reject);\n }));\n }\n\n onWithdrawRefresh(callback: Function): Promise {\n return new Promise((resolve) => {\n registerListener('U9', (withdraw) => {\n callback && callback(withdraw);\n return resolve(withdraw);\n });\n });\n }\n}\n\nexport default BlinkTradeWS;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/ws.js\n **/","module.exports = require(\"lodash\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"lodash\"\n ** module id = 3\n ** module chunks = 0\n **/","module.exports = require(\"eventemitter2\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"eventemitter2\"\n ** module id = 4\n ** module chunks = 0\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport lodash from 'lodash';\nimport * as RequestTypes from './constants/requestTypes';\n\nlet requests: Object = {};\nconst listeners: Object = {};\n\nexport function getListeners() {\n return requests;\n}\n\nexport function generateRequestId(): number {\n return parseInt(String(1e7 * Math.random()), 10);\n}\n\nexport function getListener(msgType: string): Function {\n return listeners[msgType];\n}\n\nexport function getRequest(message: Object): ?Request {\n let result;\n lodash.mapKeys(RequestTypes, (key) => {\n if (lodash.has(message, key)) {\n result = lodash.find(requests[key], { ReqId: String(message[key]) });\n }\n });\n\n return result;\n}\n\nexport function registerRequest(message: Object, promise: Request): Object {\n lodash.mapKeys(RequestTypes, (key) => {\n if (lodash.has(message, key)) {\n requests[key] = requests[key] || [];\n requests[key].push({ ReqId: String(message[key]), ...promise });\n }\n });\n\n return requests;\n}\n\nexport function registerEventEmitter(message: Object, callback: Function): Object {\n lodash.mapKeys(RequestTypes, (key) => {\n if (lodash.has(message, key)) {\n if (requests[key] !== []) {\n const index = lodash.findIndex(requests[key], { ReqId: String(message[key]) });\n requests[key][index] = {\n ...requests[key][index],\n resolve: null,\n reject: null,\n callback,\n };\n }\n }\n });\n\n return requests;\n}\n\nexport function registerListener(msgType: string, callback: Function): void {\n listeners[msgType] = listeners[msgType] || [];\n listeners[msgType] = callback;\n}\n\nexport function deleteRequest(key: string): Object {\n requests = lodash.omit(requests, [key]);\n return requests;\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/listener.js\n **/","export const SOCKET_ID = 'SocketID';\nexport const REQUEST_ID = 'ReqID';\nexport const TEST_REQUEST_ID = 'TestReqID';\nexport const USER_REQUEST_ID = 'UserReqID';\nexport const SECURITY_REQUEST_ID = 'SecurityReqID';\nexport const RESET_PASSWORD_REQUEST_ID = 'ResetPasswordReqID';\nexport const DEPOSIT_REQUEST_ID = 'DepositReqID';\nexport const WITHDRAW_REQUEST_ID = 'WithdrawReqID';\nexport const BALANCE_REQUEST_ID = 'BalanceReqID';\nexport const ORDERS_REQUEST_ID = 'OrdersReqID';\nexport const ENABLE_TWO_FACTOR_REQUEST_ID = 'EnableTwoFactorReqID';\nexport const DEPOSIT_METHOD_REQUEST_ID = 'DepositMethodReqID';\nexport const WITHDRAW_LIST_REQUEST_ID = 'WithdrawListReqID';\nexport const BROKER_LIST_REQUEST_ID = 'BrokerListReqID';\nexport const DEPOSIT_LIST_REQUEST_ID = 'DepositListReqID';\nexport const TRADE_HISTORY_REQUEST_ID = 'TradeHistoryReqID';\nexport const LEDGER_LIST_REQUEST_ID = 'LedgerListReqID';\nexport const TRADERS_RANK_REQUEST_ID = 'TradersRankReqID';\nexport const UPDATE_REQUEST_ID = 'UpdateReqID';\nexport const POSITION_REQUEST_ID = 'PositionReqID';\nexport const SECURITY_STATUS_REQUEST_ID = 'SecurityStatusReqID';\nexport const API_KEY_LIST_REQUEST_ID = 'APIKeyListReqID';\nexport const API_KEY_CREATE_REQUEST_ID = 'APIKeyCreateReqID';\nexport const API_KEY_REVOKE_REQUEST_ID = 'APIKeyRevokeReqID';\nexport const PROCESS_DEPOSIT_REQUEST_ID = 'ProcessDepositReqID';\nexport const CUSTOMER_LIST_REQUEST_ID = 'CustomerListReqID';\nexport const CUSTOMER_REQUEST_ID = 'CustomerReqID';\nexport const PROCESS_WITHDRAW_REQUEST_ID = 'ProcessWithdrawReqID';\nexport const VERIFY_CUSTOMER_REQUEST_ID = 'VerifyCustomerReqID';\nexport const MD_REQUEST_ID = 'MDReqID';\nexport const CLIENT_ORDER_ID = 'ClOrdID';\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/requestTypes.js\n **/","export const BALANCE = 'BALANCE';\n\nexport const ORDER_BOOK = 'OB';\nexport const ORDER_BOOK_TRADE_NEW = 'TRADE_NEW';\nexport const ORDER_BOOK_NEW_ORDER = 'NEW_ORDER';\nexport const ORDER_BOOK_UPDATE_ORDER = 'UPDATE_ORDER';\nexport const ORDER_BOOK_DELETE_ORDER = 'DELETE_ORDER';\nexport const ORDER_BOOK_DELETE_ORDERS_THRU = 'DELETE_ORDERS_THRU';\n\nexport const EXECUTION_REPORT = 'EXECUTION_REPORT';\nexport const EXECUTION_REPORT_NEW = 'NEW';\nexport const EXECUTION_REPORT_PARTIAL = 'PARTIAL';\nexport const EXECUTION_REPORT_EXECUTION = 'EXECUTION';\nexport const EXECUTION_REPORT_CANCELED = 'CANCELED';\nexport const EXECUTION_REPORT_REJECTED = 'REJECTED';\n\nexport const DEPOSIT_REFRESH = 'DEPOSIT_REFRESH';\nexport const WITHDRAW_REFRESH = 'WITHDRAW_REFRESH';\n\n/* eslint-disable quote-props */\nexport const EVENTS = {\n ORDERBOOK: {\n '0': ORDER_BOOK_NEW_ORDER,\n '1': ORDER_BOOK_UPDATE_ORDER,\n '2': ORDER_BOOK_DELETE_ORDER,\n '3': ORDER_BOOK_DELETE_ORDERS_THRU,\n },\n TRADES: {\n '0': ORDER_BOOK_TRADE_NEW,\n },\n EXECUTION_REPORT: {\n '0': EXECUTION_REPORT_NEW,\n '1': EXECUTION_REPORT_PARTIAL,\n '2': EXECUTION_REPORT_EXECUTION,\n '4': EXECUTION_REPORT_CANCELED,\n '8': EXECUTION_REPORT_REJECTED,\n },\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/actionTypes.js\n **/","export default {\n HEARTBEAT: '1',\n LOGIN: 'BE',\n LOGOUT: 'BE',\n CHANGE_PASSWORD: 'BE',\n\n MARKET_DATA_FULL_REFRESH: 'V',\n MARKET_DATA_UNSUBSCRIBE: 'V',\n\n ORDER_SEND: 'D',\n ORDER_CANCEL: 'F',\n\n SECURITY_LIST: 'x',\n SECURITY_STATUS: 'e',\n BALANCE: 'U2',\n ORDER_LIST: 'U4',\n BROKER_LIST: 'U28',\n TRADE_HISTORY: 'U32',\n PROFILE_UPDATE: 'U38',\n\n REQUEST_DEPOSIT: 'U18',\n REQUEST_DEPOSIT_LIST: 'U30',\n REQUEST_DEPOSIT_METHODS: 'U20',\n REQUEST_WITHDRAW: 'U6',\n REQUEST_WITHDRAW_LIST: 'U26',\n\n CONFIRM_WITHDRAW: 'U24',\n CANCEL_WITHDRAW: 'U70',\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/requests.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport BaseTransport from './baseTransport';\nimport Fingerprint2 from 'fingerprintjs2';\nimport nodeify from 'nodeify';\nimport { EventEmitter2 as EventEmitter } from 'eventemitter2';\n\nimport {\n getRequest,\n getListener,\n registerRequest,\n} from './listener';\n\n/* eslint-disable global-require */\n\nclass WebSocketTransport extends BaseTransport {\n\n /*\n * WebSocket Instance\n */\n socket: WebSocket;\n\n /*\n * FingerPrint\n */\n fingerPrint: string;\n\n /*\n * Stun object\n */\n stun: Stun;\n\n /*\n * Transport Promise\n */\n request: Request;\n\n /*\n * Event emitter to dispatch websocket updates\n */\n eventEmitter: EventEmitter;\n\n constructor(params?: BlinkTradeBase) {\n super(params, 'ws');\n\n this.stun = { local: null, public: [] };\n\n this.getStun();\n this.getFingerPrint();\n\n this.eventEmitter = new EventEmitter({ wildcard: true, delimiter: ':' });\n }\n\n connect(callback?: Function): Promise {\n return nodeify.extend(new Promise((resolve, reject) => {\n this.request = { resolve, reject };\n\n const WebSocket = this.isNode ? require('ws') : window.WebSocket;\n\n this.socket = new WebSocket(this.endpoint);\n this.socket.onopen = this.onOpen.bind(this);\n this.socket.onclose = this.onClose.bind(this);\n this.socket.onerror = this.onError.bind(this);\n this.socket.onmessage = this.onMessage.bind(this);\n })).nodeify(callback);\n }\n\n disconnect(): void {\n this.socket.close();\n }\n\n onOpen(): void {\n this.request.resolve({ connected: true });\n }\n\n onClose(): void {\n }\n\n onError(): void {\n this.request.reject();\n }\n\n sendMessage(msg: Object): void {\n if (this.socket.readyState === 1) {\n const data = msg;\n\n data.STUNTIP = this.stun;\n data.FingerPrint = this.fingerPrint;\n\n this.socket.send(JSON.stringify(data));\n }\n }\n\n sendMessageAsPromise(msg: Object, callback?: Function): Promise {\n return nodeify.extend(new Promise((resolve, reject) => {\n const promise = { resolve, reject };\n\n if (!msg) {\n return reject('Missing Message');\n }\n\n registerRequest(msg, promise);\n\n // Send promise to sendMessage to we can mock it.\n this.sendMessage(msg, promise);\n })).nodeify(callback);\n }\n\n onMessage(msg: Object): void {\n const data = JSON.parse(msg.data);\n if (data.MsgType === 'ERROR') {\n throw new Error(`Error: ${data.Detail} ${data.Description}`);\n }\n\n const request = getRequest(data);\n const listener = getListener(data.MsgType);\n this.dispatchPromise(request, data);\n this.dispatchListeners(listener, data);\n }\n\n dispatchPromise(request: ?Request, data: Object): any {\n if (request) {\n return request.resolve ? request.resolve(data)\n : request.callback ? request.callback(data)\n : null;\n }\n }\n\n dispatchListeners(listener: Function, data: Object): void {\n return listener && listener(data);\n }\n\n /* eslint-disable no-param-reassign */\n emitterPromise(promise: Promise): Promise {\n promise.on = (event: string, listener: Function) => {\n this.eventEmitter.on(event, listener);\n return promise;\n };\n promise.onAny = (listener: Function) => {\n this.eventEmitter.onAny(listener);\n return promise;\n };\n promise.offAny = (listener: Function) => {\n this.eventEmitter.offAny(listener);\n return promise;\n };\n promise.once = (event: string, listener: Function) => {\n this.eventEmitter.once(event, listener);\n return promise;\n };\n promise.many = (event: string, times: number, listener: Function) => {\n this.eventEmitter.many(event, times, listener);\n return promise;\n };\n promise.removeListener = (event: string, listener: Function) => {\n this.eventEmitter.removeListener(event, listener);\n return promise;\n };\n promise.removeAllListeners = (events: Array) => {\n this.eventEmitter.removeAllListeners(events);\n return promise;\n };\n\n return promise;\n }\n /* eslint-enable no-param-reassign */\n\n getFingerPrint(): void {\n if (this.isNode) {\n return require('./util/macaddress').getMac(macAddress => {\n this.fingerPrint = macAddress;\n });\n }\n return new Fingerprint2().get(fingerPrint => {\n this.fingerPrint = fingerPrint;\n });\n }\n\n getStun(): void {\n if (this.isNode) {\n require('./util/stun').getStun(data => {\n this.stun = data;\n });\n }\n }\n}\n\nexport default WebSocketTransport;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/wsTransport.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport _ from 'lodash';\nimport Base from './base';\nimport MsgTypes from './constants/requests';\nimport * as RequestTypes from './constants/requestTypes';\nimport {\n deleteRequest,\n generateRequestId,\n} from './listener';\n\ntype StatusListType = '1' | '2' | '4' | '8';\n\nclass BaseTransport extends Base {\n\n env: BlinkTradeEnv;\n\n send: Function;\n\n fetchTrade: Function;\n\n sendMessageAsPromise: Function;\n\n constructor(params?: BlinkTradeBase, env: BlinkTradeEnv) {\n super(params, env);\n\n this.send = env === 'ws' ? this.sendMessageAsPromise : this.fetchTrade;\n }\n\n balance(callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.BALANCE,\n BalanceReqID: generateRequestId(),\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n const Available = {};\n const balances = data[this.brokerId];\n Object.keys(balances).map(currency => {\n if (!currency.includes('locked')) {\n Available[currency] = balances[currency] - balances[`${currency}_locked`];\n }\n return Available;\n });\n\n return resolve({ ...data, Available });\n }).catch(reject);\n });\n }\n\n myOrders({ page: Page = 0, pageSize: PageSize = 40 }: {\n page?: number;\n pageSize?: number;\n } = {}, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.ORDER_LIST,\n OrdersReqID: generateRequestId(),\n Page,\n PageSize,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n const { Columns, ...orders } = data;\n const OrdListGrp = _.map(data.OrdListGrp, order => _.zipObject(Columns, order));\n return resolve({\n ...orders,\n OrdListGrp,\n });\n }).catch(reject);\n });\n }\n\n sendOrder({ side, amount, price, symbol }: {\n side: '1' | '2';\n price: number;\n amount: number;\n symbol: string;\n }, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.ORDER_SEND,\n ClOrdID: generateRequestId(),\n Symbol: symbol,\n Side: side,\n OrdType: '2',\n Price: price,\n OrderQty: amount,\n BrokerID: this.brokerId,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n deleteRequest(RequestTypes.CLIENT_ORDER_ID);\n resolve(data);\n }).catch(reject);\n });\n }\n\n cancelOrder(param: number | {\n orderId: number;\n clientId?: number;\n }, callback?: Function): Promise {\n const orderId = param.orderId ? param.orderId : param;\n const msg: Object = {\n MsgType: MsgTypes.ORDER_CANCEL,\n OrderID: orderId,\n };\n\n if (param.clientId) {\n msg.ClOrdID = param.clientId;\n }\n\n return this.send(msg, callback);\n }\n\n /**\n * statusList: 1-Pending, 2-In Progress, 4-Completed, 8-Cancelled\n */\n requestWithdrawList({\n page: Page = 0,\n pageSize: PageSize = 20,\n statusList: StatusList = ['1', '2', '4', '8'],\n }: {\n page?: number;\n pageSize?: number;\n statusList?: Array;\n } = {}, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.REQUEST_WITHDRAW_LIST,\n WithdrawListReqID: generateRequestId(),\n Page,\n PageSize,\n StatusList,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n const { Columns, ...withdrawData } = data;\n const WithdrawListGrp = _.map(data.WithdrawListGrp, withdraw => _.zipObject(Columns, withdraw));\n return resolve({\n ...withdrawData,\n WithdrawListGrp,\n });\n }).catch(reject);\n });\n }\n\n requestWithdraw({ amount, data, currency = 'BTC', method = 'bitcoin' }: {\n data: Object,\n amount: number;\n method?: string;\n currency?: string;\n }, callback: Function): Promise {\n const reqId = generateRequestId();\n const msg = {\n MsgType: MsgTypes.REQUEST_WITHDRAW,\n WithdrawReqID: reqId,\n ClOrdID: reqId,\n Method: method,\n Amount: amount,\n Currency: currency,\n Data: data,\n };\n\n return this.send(msg, callback);\n }\n\n confirmWithdraw({ withdrawId: WithdrawID, confirmationToken, secondFactor }: {\n withdrawId: string;\n confirmationToken?: string;\n secondFactor?: string;\n }, callback: Function): Promise {\n const msg: Object = {\n MsgType: MsgTypes.CONFIRM_WITHDRAW,\n WithdrawReqID: generateRequestId(),\n WithdrawID,\n };\n\n if (confirmationToken) {\n msg.ConfirmationToken = confirmationToken;\n }\n\n if (secondFactor) {\n msg.SecondFactor = secondFactor;\n }\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n return resolve({\n ...data,\n });\n }).catch(reject);\n });\n }\n\n cancelWithdraw(withdrawId: string, callback: Function): Promise {\n const reqId = generateRequestId();\n const msg = {\n MsgType: MsgTypes.CANCEL_WITHDRAW,\n WithdrawCancelReqID: reqId,\n ClOrdID: reqId,\n WithdrawID: withdrawId,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n return resolve({\n ...data,\n });\n }).catch(reject);\n });\n }\n\n requestDepositList({\n page: Page = 0,\n pageSize: PageSize = 20,\n status: StatusList = ['1', '2', '4', '8'],\n }: {\n page: number;\n pageSize: number;\n status: Array;\n } = {}, callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.REQUEST_DEPOSIT_LIST,\n DepositListReqID: generateRequestId(),\n Page,\n PageSize,\n StatusList,\n };\n\n return new Promise((resolve, reject) => {\n return this.send(msg, callback).then(data => {\n const { Columns, ...depositData } = data;\n const DepositListGrp = _.map(data.DepositListGrp, deposit => _.zipObject(Columns, deposit));\n return resolve({\n ...depositData,\n DepositListGrp,\n });\n }).catch(reject);\n });\n }\n\n requestDeposit({ currency = 'BTC', value, depositMethodId }: {\n value?: number;\n currency?: string;\n depositMethodId?: number;\n } = {}, callback?: Function): Promise {\n const reqId = generateRequestId();\n const msg: Object = {\n MsgType: MsgTypes.REQUEST_DEPOSIT,\n DepositReqID: reqId,\n ClOrdID: reqId,\n Currency: currency,\n BrokerID: this.brokerId,\n };\n\n if (currency !== 'BTC') {\n msg.DepositMethodID = depositMethodId;\n msg.Value = value;\n }\n\n return this.send(msg, callback);\n }\n\n requestDepositMethods(callback?: Function): Promise {\n const msg = {\n MsgType: MsgTypes.REQUEST_DEPOSIT_METHODS,\n DepositMethodReqID: generateRequestId(),\n };\n\n return this.send(msg, callback);\n }\n}\n\nexport default BaseTransport;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/baseTransport.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport common from './constants/common';\n\nclass Base {\n\n /*\n * url endpoint.\n */\n endpoint: string;\n\n /*\n * Broker id\n */\n brokerId: number;\n\n /*\n * Is node.js environment.\n */\n isNode: boolean;\n\n constructor(params: BlinkTradeBase = {}, env: BlinkTradeEnv) {\n const endpoint =\n params.url ? params.url\n : params.prod ? common.prod[env]\n : common.testnet[env];\n\n this.brokerId = params.brokerId || 5;\n\n this.endpoint = endpoint;\n\n this.isNode = typeof window === 'undefined';\n }\n}\n\nexport default Base;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/base.js\n **/","export default {\n prod: {\n ws: 'wss://api.blinktrade.com/trade/',\n rest: 'https://api.blinktrade.com/',\n },\n testnet: {\n ws: 'wss://api.testnet.blinktrade.com/trade/',\n rest: 'https://api.testnet.blinktrade.com/',\n },\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/constants/common.js\n **/","module.exports = require(\"fingerprintjs2\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"fingerprintjs2\"\n ** module id = 13\n ** module chunks = 0\n **/","module.exports = require(\"nodeify\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"nodeify\"\n ** module id = 14\n ** module chunks = 0\n **/","module.exports = require(\"ws\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"ws\"\n ** module id = 15\n ** module chunks = 0\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport macaddress from 'macaddress';\n\nexport function getMac(callback: Function): void {\n macaddress.all((err, all) => {\n const hashCode = (str) => {\n let hash = 0;\n if (str.length === 0) return hash;\n for (let i = 0; i < str.length; i++) {\n hash = ((hash << 5) - hash) + str.charCodeAt(i);\n hash = hash & hash; // Convert to 32bit integer\n }\n return hash;\n };\n\n let macAddresses = '';\n Object.keys(all).forEach(iface => {\n macAddresses += all[iface].mac;\n });\n\n let fingerPrint = hashCode(macAddresses);\n if (fingerPrint < 0) {\n fingerPrint *= -1;\n }\n\n callback(fingerPrint);\n });\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/macaddress.js\n **/","module.exports = require(\"macaddress\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"macaddress\"\n ** module id = 17\n ** module chunks = 0\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n/* eslint-disable no-param-reassign */\n\nimport ip from 'ip';\nimport dgram from 'dgram';\n\nconst stunIp = { local: null, public: [] };\n\nfunction addIPAddress(ipAddress) {\n if (ipAddress.match(/^(192\\.168\\.|169\\.254\\.|10\\.|172\\.(1[6-9]|2\\d|3[01]))/)) {\n stunIp.local = ipAddress;\n } else {\n if (stunIp.public.indexOf(ipAddress) === -1) {\n stunIp.public.push(ipAddress);\n }\n }\n}\n\nexport function getStun(callback: Function) {\n const socket = dgram.createSocket('udp4');\n\n const STUN_HEADER_LENGTH = 20;\n const stunRequest = new Buffer(STUN_HEADER_LENGTH);\n\n const STUN_METHOD_REQUEST = 0x000;\n const STUN_BINDING_CLASS = 0x0001;\n const STUN_MAGIC_COOKIE = 0x2112A442;\n const STUN_TID_MAX = Math.pow(2, 32);\n\n const STUN_ATTR_MAPPED_ADDRESS = 0x0001;\n const STUN_ATTR_XOR_MAPPED_ADDRESS = 0x8020;\n const STUN_ATTR_XOR_MAPPED_ADDRESS_ALT = 0x0020;\n\n const stunTxId = (Math.random() * STUN_TID_MAX);\n\n const stunServers = [\n [3478, 'stun.services.mozilla.com'],\n [19302, 'stun.l.google.com'],\n [3478, 'stun.stunprotocol.org'],\n [3478, 'stun.softjoys.com'],\n [3478, 'stun.samsungsmartcam.com'],\n [3478, 'stun.sonetel.com'],\n [3478, 'stun.tagan.ru'],\n [3478, 'stun.voipgain.com'],\n [3478, 'stunserver.org'],\n [3478, 'stun.advfn.com'],\n [3478, 'stun.annatel.net'],\n [3478, 'stun.freevoipdeal.com'],\n ];\n\n stunRequest.writeUInt16BE(((STUN_BINDING_CLASS | STUN_METHOD_REQUEST) & 0x3fff), 0);\n stunRequest.writeUInt16BE(0, 2);\n stunRequest.writeUInt32BE(STUN_MAGIC_COOKIE, 4);\n stunRequest.writeUInt32BE(0, 8);\n stunRequest.writeUInt32BE(0, 12);\n stunRequest.writeUInt32BE(stunTxId, 16);\n\n socket.on('message', (msg) => {\n const xor = (a, b) => {\n const data = [];\n if (b.length > a.length) {\n const tmp = a;\n a = b;\n b = tmp;\n }\n for (let i = 0, len = a.length; i < len; i++) {\n data.push(a[i] ^ b[i]);\n }\n\n return new Buffer(data);\n };\n\n const block = msg.readUInt8(0);\n const bit1 = block & 0x80;\n const bit2 = block & 0x40;\n\n if (!(bit1 === 0 && bit2 === 0)) {\n return;\n }\n\n const msgHeader = msg.slice(0, STUN_HEADER_LENGTH);\n const msgAttrs = msg.slice(STUN_HEADER_LENGTH, msg.length);\n\n let offset = 0;\n\n while (offset < msgAttrs.length) {\n const attrType = msgAttrs.readUInt16BE(offset);\n offset += 2;\n\n let attrBuffLength = msgAttrs.readUInt16BE(offset);\n const blockOut = attrBuffLength % 4;\n if (blockOut > 0) {\n attrBuffLength += 4 - blockOut;\n }\n offset += 2;\n\n const value = msgAttrs.slice(offset, offset + attrBuffLength);\n offset += attrBuffLength;\n\n let family;\n let address;\n switch (attrType) {\n case STUN_ATTR_MAPPED_ADDRESS:\n family = (value.readUInt16BE(0) === 0x02) ? 6 : 4;\n address = ip.toString(value, 4, family);\n addIPAddress(address);\n break;\n\n case STUN_ATTR_XOR_MAPPED_ADDRESS:\n case STUN_ATTR_XOR_MAPPED_ADDRESS_ALT:\n family = (value.readUInt16BE(0) === 0x02) ? 6 : 4;\n const magic = msgHeader.slice(4, 8);\n const tid = msgHeader.slice(8, 20);\n const xaddr = value.slice(4, family === 4 ? 8 : 20);\n const addr = xor(xaddr, family === 4 ? magic : value.concat([magic, tid]));\n address = ip.toString(addr, 0, family);\n addIPAddress(address);\n break;\n default:\n }\n }\n\n callback(stunIp);\n });\n\n stunServers.map(([port, host]) => socket.send(stunRequest, 0, stunRequest.length, port, host));\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/stun.js\n **/","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/buffer/index.js\n ** module id = 19\n ** module chunks = 0\n **/","module.exports = require(\"base64-js\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"base64-js\"\n ** module id = 20\n ** module chunks = 0\n **/","module.exports = require(\"ieee754\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"ieee754\"\n ** module id = 21\n ** module chunks = 0\n **/","module.exports = require(\"isarray\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"isarray\"\n ** module id = 22\n ** module chunks = 0\n **/","module.exports = require(\"ip\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"ip\"\n ** module id = 23\n ** module chunks = 0\n **/","exports.endianness = function () { return 'LE' };\n\nexports.hostname = function () {\n if (typeof location !== 'undefined') {\n return location.hostname\n }\n else return '';\n};\n\nexports.loadavg = function () { return [] };\n\nexports.uptime = function () { return 0 };\n\nexports.freemem = function () {\n return Number.MAX_VALUE;\n};\n\nexports.totalmem = function () {\n return Number.MAX_VALUE;\n};\n\nexports.cpus = function () { return [] };\n\nexports.type = function () { return 'Browser' };\n\nexports.release = function () {\n if (typeof navigator !== 'undefined') {\n return navigator.appVersion;\n }\n return '';\n};\n\nexports.networkInterfaces\n= exports.getNetworkInterfaces\n= function () { return {} };\n\nexports.arch = function () { return 'javascript' };\n\nexports.platform = function () { return 'browser' };\n\nexports.tmpdir = exports.tmpDir = function () {\n return '/tmp';\n};\n\nexports.EOL = '\\n';\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/os-browserify/browser.js\n ** module id = 25\n ** module chunks = 0\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport RestTransport from './restTransport';\n\nclass BlinkTradeRest extends RestTransport {\n ticker(callback?: Function): Promise {\n return super.fetchPublic('ticker', callback);\n }\n\n trades({ limit = 1000, since = '0' }: {\n limit: number;\n since: string;\n } = {}, callback?: Function): Promise {\n return super.fetchPublic(`trades?limit=${limit}&since=${since}`, callback);\n }\n\n orderbook(callback?: Function): Promise {\n return super.fetchPublic('orderbook', callback);\n }\n}\n\nexport default BlinkTradeRest;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/rest.js\n **/","/**\n * BlinkTradeJS SDK\n * (c) 2016-present BlinkTrade, Inc.\n *\n * This file is part of BlinkTradeJS\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n * @flow\n */\n\nimport sjcl from 'sjcl';\nimport nodeify from 'nodeify';\nimport url from 'url';\nimport path from 'path';\nimport BaseTransport from './baseTransport';\n\nclass RestTransport extends BaseTransport {\n\n /**\n * APIKey\n */\n key: string;\n\n /**\n * APISecret\n */\n secret: string;\n\n /**\n * Exchanges currencies available.\n */\n currency: 'USD' | 'BRL' | 'VEF' | 'CLP' | 'VND' | 'PKR';\n\n /**\n * Fetch rest API\n */\n fetchRequest: Function\n\n constructor(params: BlinkTradeRest) {\n super(params, 'rest');\n\n this.key = params.key;\n this.secret = params.secret;\n this.currency = params.currency || 'USD';\n\n this.fetchRequest = this.isNode ? require('isomorphic-fetch') : require('fetch-jsonp');\n }\n\n headers(method: string, body: Object): Object {\n const timeStamp = Date.now().toString();\n const hexKey = sjcl.codec.utf8String.toBits(this.secret);\n const hmac = new sjcl.misc.hmac(hexKey, sjcl.hash.sha256);\n const Signature = sjcl.codec.hex.fromBits(hmac.encrypt(timeStamp));\n return {\n method,\n headers: {\n 'Content-Type': 'application/json',\n Nonce: timeStamp,\n APIKey: this.key,\n Signature,\n },\n body: JSON.stringify(body),\n };\n }\n\n fetch(msg: Object, api: string, headers?: Object = {}): Promise {\n return this.fetchRequest(url.resolve(this.endpoint, api), headers)\n .then(response => response.json());\n }\n\n fetchPublic(api: string, callback?: Function): Promise {\n return nodeify(this.fetch({}, path.join('api/v1', this.currency, api)), callback);\n }\n\n fetchTrade(msg: Object, callback?: Function): Promise {\n const headers = this.headers('POST', msg);\n return nodeify(this.fetch(msg, 'tapi/v1/message', headers, callback)\n .then(response => (response.Status === 500 ? Promise.reject(response) : response.Responses))\n .then(response => (response.length === 1 ? response[0] : response))\n , callback);\n }\n}\n\nexport default RestTransport;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/restTransport.js\n **/","module.exports = require(\"sjcl\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"sjcl\"\n ** module id = 28\n ** module chunks = 0\n **/","module.exports = require(\"url\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"url\"\n ** module id = 29\n ** module chunks = 0\n **/","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nvar splitPathRe =\n /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\nvar splitPath = function(filename) {\n return splitPathRe.exec(filename).slice(1);\n};\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n var isAbsolute = exports.isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isAbsolute).join('/');\n\n if (!path && !isAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return exports.normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n from = exports.resolve(from).substr(1);\n to = exports.resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function(path) {\n var result = splitPath(path),\n root = result[0],\n dir = result[1];\n\n if (!root && !dir) {\n // No dirname whatsoever\n return '.';\n }\n\n if (dir) {\n // It has a dirname, strip trailing slash\n dir = dir.substr(0, dir.length - 1);\n }\n\n return root + dir;\n};\n\n\nexports.basename = function(path, ext) {\n var f = splitPath(path)[2];\n // TODO: make this comparison case-insensitive on windows?\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n};\n\n\nexports.extname = function(path) {\n return splitPath(path)[3];\n};\n\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n ? function (str, start, len) { return str.substr(start, len) }\n : function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/path-browserify/index.js\n ** module id = 30\n ** module chunks = 0\n **/","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\n(function () {\n try {\n cachedSetTimeout = setTimeout;\n } catch (e) {\n cachedSetTimeout = function () {\n throw new Error('setTimeout is not defined');\n }\n }\n try {\n cachedClearTimeout = clearTimeout;\n } catch (e) {\n cachedClearTimeout = function () {\n throw new Error('clearTimeout is not defined');\n }\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/process/browser.js\n ** module id = 31\n ** module chunks = 0\n **/","module.exports = require(\"isomorphic-fetch\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"isomorphic-fetch\"\n ** module id = 32\n ** module chunks = 0\n **/","module.exports = require(\"fetch-jsonp\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"fetch-jsonp\"\n ** module id = 33\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file