text
stringlengths
3
1.05M
import datetime import importlib import json import os import pandas as pd import pytz import time PERIODS = { "1d": 1, "1h": 24, "4h": 6, "6h": 4, "8h": 3 } DATE_FORMAT="%Y-%m-%dT%H:00:00.000Z" def required_months(month, window_size, period): days = window_size / PERIODS[period] months = days / 28 + 2 m = month for i in xrange(months): yield m m = previous_month(m) def month_from_str(s): return pytz.datetime.datetime.strptime(s, "%Y-%m") def date_from_str(s): return pytz.datetime.datetime.strptime(s, "%Y-%m-%d") def ongoing_month(dt): today = pytz.datetime.datetime.utcnow().date() return today.year == dt.year and today.month == dt.month def previous_period(date, period): dt1 = date.replace(minute=0, second=0, microsecond=0) period_length = 24 / PERIODS[period] periods = dt1.hour / period_length dt1 = dt1.replace(hour=periods * period_length) dt1 = dt1 - datetime.timedelta(hours=period_length) return dt1 def latest_full_period(period): return previous_period(pytz.datetime.datetime.utcnow(), period) def previous_month(dt0): dt1 = dt0.replace(day=1) dt2 = dt1 - datetime.timedelta(days=1) dt3 = dt2.replace(day=1) return dt3 def next_month(dt0, inclusive=True): dt1 = (dt0.replace(day=1) + datetime.timedelta(days=32)).replace(day=1) if inclusive: return dt1 return dt1 - datetime.timedelta(days=1) def months(start_d, end_d): m1 = next_month(previous_month(start_d)) m2 = next_month(end_d) while m1 < m2: yield m1 m1 = next_month(m1) def task_type(task): result = [type(task)] for p in task.param_args: if not isinstance(p, datetime.date): result.append(p) return tuple(result) def input_df(task_list): data = {} for r in task_list: t = task_type(r) if t not in data: data[t] = [] new_data = pd.read_csv(r.target.path, index_col=0, parse_dates=True) data[t].append(new_data) result = None for k, v in data.items(): new_data = pd.concat(v) if result is None: result = new_data else: result = pd.merge(result, new_data, left_index=True, right_index=True) result.sort_index(inplace=True) return result def monthly_task(t_params, task_class, start_date, end_date, **kargs): for k, v in kargs.items(): t_params[k] = "{}".format(v) for m in full_months(start_date, end_date): t_params["month"] = "{:%Y-%m}".format(m) yield task_class.from_str_params(t_params) def task_filename(task, ext, suffix=None, exclude=[]): always_exclude = ["pair", "period", "destination_path"] always_exclude.extend(exclude) keys = task.__class__.get_param_names() for key in always_exclude: if key in keys: keys.remove(key) params = ["{}_{}".format("-".join([v[:4] for v in k.split("_")]), task.to_str_params()[k]) for k in keys] params = "{}__{}".format(task.__class__.__name__, "__".join(params)).upper() params = params.replace("/", "-") params = params.replace(".", "-") if suffix is not None: result = "{}-{}.{}".format(params, suffix, ext) else: result = "{}.{}".format(params, ext) if hasattr(task, "pair"): return os.path.join(task.period.upper(), task.pair.upper().replace("/", "-"), result) if hasattr(task, "period"): return os.path.join(task.period.upper(), result) return result def init_class(prefix, row, **params): module_name = getattr(row, "{}_module".format(prefix)) task_name = getattr(row, "{}_task".format(prefix)) parameters = getattr(row, "{}_parameters".format(prefix)) params.update(json.loads(parameters)) mod = importlib.import_module("chrysophylax.{}".format(module_name)) clss = getattr(mod, task_name) task = clss.from_str_params(params) return task
var searchData= [ ['traverse_106',['traverse',['../a05373.html#a4096ce5b5f39c70a978dd0857467e47a',1,'List::dLinkList::traverse()'],['../a05389.html#a69a3ac0477a4f393839bfa406b4d8b20',1,'List::List::traverse()'],['../a05401.html#affba23822064046e5f5dddc1d8eae1e0',1,'List::seqList::traverse()'],['../a05413.html#ad6261c75f8a240869d5a0dcd426e1175',1,'List::sLinkList::traverse()']]] ];
'use strict'; module.exports = app => { const response = app.buildRichResponse(); let format = app.getArgument('ImageDisplay'); if (format === null) { format == 'DEFAULT'; } console.warn(format); response.addSimpleResponse(format); response.addBasicCard( app .buildBasicCard(format) .setImage( 'https://storage.googleapis.com/prj-bot-greeting-cards-staging.appspot.com/out/4ad0pNjSYo0REpBAy_UIU_SbhamXUHg2tWNNX0EiKWcpsHm8ig_7Jksv8GvV-lZB8mYKAl6cE8AAA2AAg1D32p82/Wz71fVpCMn6riuFXyYp7.jpg', 'Your card' ) .setImageDisplay(format) ); return app.ask(response); };
import demo.cards2 # target=//demo/cards2:cards2 import demo.cards2_test # target=//demo/cards2_test:cards2_test import demo.cards2_test # target=//demo/cards2_test:cards2_test ########## End Imports ########## class PileTest(demo.cards2_test.TestCase): """Auto-generated test class for demo.cards2.Pile""" __metaclass__ = PileTestMeta def test_meta(self): """here""" # noop pass ########## Start Harness ########## if __name__ == '__main__': metax.test.main()
"use strict"; /* Generated from: * ap-northeast-1 (https://d33vqc0rt9ld30.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 2.5.0, * ap-northeast-2 (https://d1ane3fvebulky.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 2.5.0, * ap-northeast-3 (https://d2zq80gdmjim8k.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 2.5.0, * ap-south-1 (https://d2senuesg1djtx.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 2.5.0, * ap-southeast-1 (https://doigdx0kgq9el.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 2.5.0, * ap-southeast-2 (https://d2stg8d246z9di.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 2.5.0, * ca-central-1 (https://d2s8ygphhesbe7.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 2.5.0, * eu-central-1 (https://d1mta8qj7i28i2.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 2.5.0, * eu-west-1 (https://d3teyb21fexa9r.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 2.5.0, * eu-west-2 (https://d1742qcu2c1ncx.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 2.5.0, * eu-west-3 (https://d2d0mfegowb3wk.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 2.5.0, * sa-east-1 (https://d3c9jyj3w509b0.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 2.5.0, * us-east-1 (https://d1uauaxba7bl26.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 2.5.0, * us-east-2 (https://dnwj8swjjbsbt.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 2.5.0, * us-west-1 (https://d68hl49wbnanq.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 2.5.0, * us-west-2 (https://d201a2mn26r7lk.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 2.5.0 */ Object.defineProperty(exports, "__esModule", { value: true }); const resource_1 = require("../resource"); class ClusterSecurityGroup extends resource_1.ResourceBase { constructor(properties) { super('AWS::Redshift::ClusterSecurityGroup', properties); } } exports.default = ClusterSecurityGroup;
module.exports={D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0.030635,"26":0,"27":0.006127,"28":0,"29":0,"30":0,"31":0.079651,"32":0.006127,"33":0.018381,"34":0.024508,"35":0,"36":0.012254,"37":0,"38":0.012254,"39":0.006127,"40":0.012254,"41":0,"42":0,"43":0.012254,"44":0.006127,"45":0.055143,"46":0.030635,"47":0.036762,"48":0.024508,"49":0.484033,"50":0.036762,"51":0.055143,"52":0.030635,"53":0.036762,"54":0.116413,"55":1.035463,"56":0.12254,"57":0.140921,"58":0.116413,"59":0.238953,"60":0.189937,"61":0.208318,"62":0.404382,"63":1.127368,"64":1.243781,"65":16.720583,"66":2.132196,"67":0.042889,"68":0,"69":0},C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0.006127,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0.006127,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0.006127,"41":0,"42":0.018381,"43":0.006127,"44":0,"45":0,"46":0,"47":0.012254,"48":0.012254,"49":0,"50":0.018381,"51":0,"52":0.159302,"53":0.006127,"54":0.006127,"55":0.030635,"56":0.049016,"57":0.036762,"58":0.055143,"59":1.825846,"60":0.024508,"61":0,"3.5":0,"3.6":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0.006127,"37":0.012254,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0.006127,"45":0.030635,"46":0,"47":0.006127,"48":0,"49":0,"50":0,"51":0.018381,"52":0.116413,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},E:{"4":0.018381,"5":0.006127,"6":0,"7":0.006127,"8":0.110286,"9":0.091905,"10":0.214445,"11":1.004828,_:"0","3.1":0,"3.2":0,"5.1":0.036762,"6.1":0.024508,"7.1":0,"9.1":0.373747,"10.1":0.30635,"11.1":1.078352},G:{"8":0.0545633430174,"3.2":0.00363755620116,"4.0-4.1":0,"4.2-4.3":0.00727511240232,"5.0-5.1":0.0836637926267,"6.0-6.1":0.0545633430174,"7.0-7.1":0.203703147265,"8.1-8.4":0.331017614306,"9.0-9.2":0.207340703466,"9.3":1.49867315488,"10.0-10.2":1.34953335063,"10.3":3.01189653456,"11.0-11.2":16.2453259944,"11.3":13.2588923532},I:{"3":0,"4":0,_:"62","2.1":0,"2.2":0,"2.3":0,"4.1":0.0868755293351,"4.2-4.3":0.268708032595,"4.4":0.737431818774,"4.4.3-4.4.4":0.456601619296},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0.00644296636771,"7":0,"8":0.180403058296,"9":0.251275688341,"10":0.148188226457,"11":2.28081009417,"5.5":0},B:{"12":0.018381,"13":0.012254,"14":0.049016,"15":0.067397,"16":0.833272,"17":0,_:"18"},P:{"4":0.351920595349,"5":0.127971125581,"6.2":1.74893871628},J:{"7":0,"10":0},N:{"10":0,"11":0},R:{_:"0"},M:{"0":0.092952},Q:{_:"1.2"},O:{"0":1.130916},H:{"0":0.220002371134},L:{"0":20.388947}};
const generatePageNotion = (data, { notionKey, databaseId }) => { const page = { notionkey: notionKey, data: { parent: { database_id: databaseId, }, icon: { type: 'external', external: { url: data.image, }, }, properties: { Status: { select: { name: 'En proceso', }, }, Profesor: { multi_select: [ { name: data.teacherName, }, ], }, 'Link del Curso': { url: data.url, }, 'Nombre del curso': { title: [ { type: 'text', text: { content: data.title, }, }, ], }, }, }, }; return page; }; const createNotionPage = async (data, auth = {}) => { const jsonPage = generatePageNotion(data, auth); const urlBase = 'https://apinotion.herokuapp.com/api/v1/notion/database'; const settings = { method: 'POST', body: JSON.stringify(jsonPage), headers: { Accept: 'application/json', 'Content-Type': 'application/json', }, }; try { const response = await fetch( `${urlBase}/:${auth.databaseId}/createpage/`, settings ); const dataResponse = await response.json(); return dataResponse; } catch (error) { return error.message; } };
/* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ "use strict"; const NullDependency = require("./NullDependency"); const webpackMissingModule = require("./WebpackMissingModule").module; class UnsupportedDependency extends NullDependency { constructor(request, range) { super(); this.request = request; this.range = range; } } UnsupportedDependency.Template = class UnsupportedDependencyTemplate { apply(dep, source, runtime) { source.replace(dep.range[0], dep.range[1], webpackMissingModule(dep.request)); } }; module.exports = UnsupportedDependency;
import baseConfig from './default' import config from './bsc-testnet' import moment from 'moment-with-locales-es6' export default { env: 'development', entry: 'testnet', local: 'online', binance: true, base: `http://${baseConfig.http.host}:${baseConfig.http.port}/`, publicPath: `http://${baseConfig.http.host}:${baseConfig.http.port}${baseConfig.publicPath}`, time: moment(Date.now()).format('LLLL'), ...config, }
"use strict"; /* Generated from: * ap-northeast-1 (https://d33vqc0rt9ld30.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 39.2.0, * eu-west-1 (https://d3teyb21fexa9r.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 39.2.0, * us-east-1 (https://d1uauaxba7bl26.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 39.2.0, * us-east-2 (https://dnwj8swjjbsbt.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 39.2.0, * us-west-2 (https://d201a2mn26r7lk.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json), version 39.2.0 */ Object.defineProperty(exports, "__esModule", { value: true }); const resource_1 = require("../resource"); class CaptureOption { constructor(properties) { Object.assign(this, properties); } } exports.CaptureOption = CaptureOption; class ProductionVariant { constructor(properties) { Object.assign(this, properties); } } exports.ProductionVariant = ProductionVariant; class CaptureContentTypeHeader { constructor(properties) { Object.assign(this, properties); } } exports.CaptureContentTypeHeader = CaptureContentTypeHeader; class DataCaptureConfig { constructor(properties) { Object.assign(this, properties); } } exports.DataCaptureConfig = DataCaptureConfig; class EndpointConfig extends resource_1.ResourceBase { constructor(properties) { super('AWS::SageMaker::EndpointConfig', properties); } } exports.default = EndpointConfig; EndpointConfig.CaptureOption = CaptureOption; EndpointConfig.ProductionVariant = ProductionVariant; EndpointConfig.CaptureContentTypeHeader = CaptureContentTypeHeader; EndpointConfig.DataCaptureConfig = DataCaptureConfig;
var searchData= [ ['next',['next',['../classsf_1_1_utf_3_018_01_4.html#a0365a0b38700baa161843563d083edf6',1,'sf::Utf&lt; 8 &gt;::next()'],['../classsf_1_1_utf_3_0116_01_4.html#ab899108d77ce088eb001588e84d91525',1,'sf::Utf&lt; 16 &gt;::next()'],['../classsf_1_1_utf_3_0132_01_4.html#a788b4ebc728dde2aaba38f3605d4867c',1,'sf::Utf&lt; 32 &gt;::next()']]], ['noncopyable',['NonCopyable',['../classsf_1_1_non_copyable.html#a2110add170580fdb946f887719da6860',1,'sf::NonCopyable::NonCopyable()'],['../classsf_1_1_non_copyable.html#a57729c3045ce03f392ae1ba732224ddb',1,'sf::NonCopyable::NonCopyable(const NonCopyable &amp;)']]] ];
var structorx_c_l_o_c_k___i_n_f_o = [ [ "afModifierList", "structorx_c_l_o_c_k___i_n_f_o.html#a3cbc9ce0ca215192537bf07d51191974", null ], [ "fDT", "structorx_c_l_o_c_k___i_n_f_o.html#adefcf726b9f7e39542f92ca0e5f76655", null ], [ "fTickSize", "structorx_c_l_o_c_k___i_n_f_o.html#abdaa9e19892ffab521b387be34d3ee0a", null ], [ "fTime", "structorx_c_l_o_c_k___i_n_f_o.html#a81d90e078f16fe314687d8578ae3e0b3", null ] ];
/* * Developed by Gleb Iakovlev on 5/3/19 9:09 PM. * Last modified 4/29/19 8:18 PM. * Copyright (c) Cognoteq Software Solutions 2019. * All rights reserved */ import Base from './base'; /** * * @submodule games * */ const INITIAL_DELAY = 2.5; let targets = []; let pressed = {}; let keys = ['y', 'g', 'v']; //Keyboard keys for upper,middle and lower windows let jitterT = 0; // Time jitter (variates from 500 ms to 1500 ms), time between sound start and ball starting to fly let buttonPressDelay = 0; // Media arrays for loading let windowImgs = []; let windowImageURLS = []; let obstrImgs = []; let obstrImageURLS = []; let sounds = []; let soundURLs = []; let imageURls = []; let images = []; let trajectoryParameters = []; let soundTimeStamp = 0; const gameArrayValues = { OBSTRUCTIONS: [1,2,3], VELOCITIES:[1,2,3] }; // Media mapping as Enum const gameSound = { START: 0, LAUNCH: 1, CATCH: 2, FAIL: 3 }; const gameImage = { LAUNCHER: 0, BALL: 1, TARGET: 2, window: { WINDOW1: 0, WINDOW2: 1, WINDOW3: 2 }, shuttle: { SMALL: 0, MIDDLE: 1, LARGE: 2 } }; const gameRandomization = { OBSTRUCTION:0, VELOCITY:1 }; /** * The user will operate with keyboard keys to predict which ball trajectory will hit which window * in the obstruction (shuttle). * The trajectory is randomized with various values in trajectories array * @class DiscreteButtonSpatial * @extends Base */ export default class DiscreteButtonSpatial extends Base { /** * @method constructor * @constructor constructor * @param context * @param document */ constructor(context, document) { super(context, document); imageURls = [super.Utils.slimeMonster, super.Utils.slimeBall, super.Utils.splat]; windowImageURLS = [super.Utils.openWindowYellow, super.Utils.openWindowGreen, super.Utils.openWindowViolet]; obstrImageURLS = [super.Utils.shuttleNarrow, super.Utils.shuttle, super.Utils.shuttleWide]; soundURLs = [super.Utils.monsterGrowl, super.Utils.monsterLaunch, super.Utils.good3MouseSound, super.Utils.bad3MouseSound]; } /** * Get Current window position and align it according to possible obstruction (shuttle) size * @method getWindow * @param index of the target (shuttle) in array of objects * @return {{image: *, position: {x: number, y: number}, radius: number, dimensions: {width: number, height: number}}} */ getWindow(index) { index = index + 1; let top = 1.12; let leftBorder = (1.5450) * super.Utils.SCALE; let windowPosition = gameImage.window.WINDOW1; switch (index) { case 2: top = 1.25; windowPosition = gameImage.window.WINDOW2; leftBorder = (1.555) * super.Utils.SCALE; break; case 3: top = 1.39; windowPosition = gameImage.window.WINDOW3; leftBorder = (1.555) * super.Utils.SCALE; break; } let topBorder = top * super.Utils.SCALE; return { dimensions: {width: 0.10238 * super.Utils.SCALE, height: 0.075 * super.Utils.SCALE}, position: { x: leftBorder, y: topBorder }, radius: 0.00956 * super.Utils.SCALE, image: windowImgs[windowPosition] }; } /** * Draw target according to coordinates * @method createBackground */ createShuttle() { let leftBorder = 0.798 * super.Utils.SCALE; let topBorder = 0.78 * super.Utils.SCALE; let targetParams = { dimensions: {width: 1.19 * super.Utils.SCALE, height: 1.135 * super.Utils.SCALE}, position: {x: leftBorder, y: topBorder} }; this.getShuttle(targetParams); } /** * * Get shuttle image from sources and display according to position parameters * @param targetParams target position parameters * @method getShuttle */ getShuttle(targetParams) { let index = trajectoryParameters[super.currentRounds][gameRandomization.OBSTRUCTION];// Get current shuttle case let shuttle = {}; targetParams.position.x = {}; switch (index) { case 2: targetParams.position.x = 0.798 * super.Utils.SCALE; shuttle = obstrImgs[gameImage.shuttle.MIDDLE]; break; case 3: targetParams.position.x = 0.77 * super.Utils.SCALE; shuttle = obstrImgs[gameImage.shuttle.LARGE]; break; default: targetParams.position.x = 0.81 * super.Utils.SCALE; shuttle = obstrImgs[gameImage.shuttle.SMALL]; break; } super.drawImageObject(targetParams, shuttle); } /** * Create the window in the target * @method createTargetWindow * @param target */ createWindow(target) { super.drawImageObject(target, target.image); } /** * Main point to start the game. * Initialize static parameters and preload sounds here * @method init */ init() { super.gameState.startTime= new Date().getTime(); if(this.context.trialType === 'demo'){ trajectoryParameters = this.context.demoObstructions.map((obstruction,index)=> [obstruction,this.context.demoTrajectories[index]]); }else { trajectoryParameters = super.getTrajectoriesObstacles(gameArrayValues.OBSTRUCTIONS, gameArrayValues.VELOCITIES); } // Randomize trajectory for each obstruction super.fillAudioArray(soundURLs,sounds); super.fillImageArray(imageURls,images); super.fillImageArray(windowImageURLS,windowImgs); super.fillImageArray(obstrImageURLS,obstrImgs); sounds[gameSound.START].addEventListener('onloadeddata', this.initGame(), false); sounds[gameSound.START].addEventListener('playing', super.onSoundEvent); super.init(); } /** * Initialize each game round with initial object parameters * Randomize number of obstructions (obstructions) * Reset the sounds sources for older browser versions * Wait for start sound and start the main game loop * @method initGame */ initGame() { super.exportData = { game_type: 'discreteButtonSpatial', window: [], selected_button: 4 , obstruction_number: [], ball_position_x: [], ball_position_y: [], ball_timestamp: [], trial: [], trialType: '', finalStateTimestamp : 0, timestamp: [] }; pressed = Array(3).fill(false); jitterT = super.trialStartTime(); buttonPressDelay = 0; super.ball = { position: {x: 0, y: 0}, radius: 0.02385 * super.Utils.SCALE, restitution: super.Utils.restitution, timeReached: new Date().getTime() }; super.ballObject(); if(super.currentRounds > 0 ){ sounds[gameSound.START].play(); } targets = Array(3).fill({}).map((_, index) => (this.getWindow(index)) ); if(super.getElapsedTime(super.gameState.startTime) >= 2) { sounds[gameSound.START].play(); } super.initGame(); } /** * Show the ball location in window. * Center the ball location. * @method showBallLocation * @param index Index of the object in array */ showBallLocation(index) { //Put the ball in the center of target once it hits window constraints let target = targets[index]; let splat = { dimensions: {width: 0.09645 * super.Utils.SCALE, height: 0.09107 * super.Utils.SCALE}, position: {x: target.position.x - 0.0238 * super.Utils.SCALE, y: target.position.y} }; super.drawImageObject(splat, images[gameImage.TARGET]); } /** * Set appropriate index value in pressed array, according to index of the key pressed * @method keyDownHandler * @param e {object} event */ keyDownHandler(e) { if (super.ball.state !== 'hit' && super.ball.state !== 'hit target') { pressed = pressed.fill(false); pressed = pressed.map((val, index) => keys[index] === e.key ); } } /** * Display launcher * @method discreteLauncher * @param image of the Launcher */ discreteLauncher(image) { let leftBorder = (0.701) * super.Utils.SCALE; let topBorder = (1.3671) * super.Utils.SCALE; let launcher = { dimensions: {width: 0.19 * super.Utils.SCALE, height: 0.273 * super.Utils.SCALE}, position: {x: leftBorder, y: topBorder} }; super.drawImageObject(launcher, image); } /** * Main loop of the game * Set initial position of the ball in a box and starting sound . * After that start ball trajectory. * If ball hits the target or missed the target(window) show the ball in the window and selected window * clicked by user (indicate the window background with color). * Increase the score if ball hits the window. * Move the ball to initial position. * Wait for some time until rattle sound played. * @method keyDownHandler */ loop() { super.loop(); super.generateTrajectoryParamsDiscreteSpatial(trajectoryParameters[super.currentRounds][gameRandomization.VELOCITY]); this.discreteLauncher(images[gameImage.LAUNCHER]); let index = pressed.findIndex(item => item !== false); if( super.gameState.initialTime === 0 && super.currentRounds === 0 && super.getElapsedTime(super.gameState.startTime) >= INITIAL_DELAY) { sounds[gameSound.START].play(); } if (super.ball.state === 'start') { super.moveBallToStart(images[gameImage.BALL]); if (super.gameState.initialTime > 0 && super.getElapsedTime() > jitterT) { sounds[gameSound.START].pause(); sounds[gameSound.START].currentTime = 0; sounds[gameSound.LAUNCH].play(); soundTimeStamp = super.getElapsedTime(); super.gameState.initialTime = new Date().getTime(); super.ball.state = 'fall'; } } if (super.ball.state === 'fall') { super.trajectory(); super.drawBall(images[gameImage.BALL]); if (super.getElapsedTime() >= 0.5) { super.ball.state = 'hit house'; } } if ((super.ball.state === 'fall' || super.ball.state === 'hit house') && index >= 0) { super.ball.state = 'hit'; } if (super.ball.state === 'hit house') { if (super.getElapsedTime() >= 2.5) { super.gameState.initialTime = new Date().getTime(); super.ball.state = 'hit'; } } if (super.ball.state === 'hit') { super.exportData.finalStateTimestamp = super.getElapsedTime(); if(buttonPressDelay === 0){ buttonPressDelay = new Date().getTime(); } if(buttonPressDelay >0 && super.getElapsedTime(buttonPressDelay) >= 0.5) { this.checkHitState(index); } } this.createShuttle(); if (super.ball.state === 'hit target') { if (index >= 0) { let target = targets[index]; this.createWindow(target); } this.showWindow(index); if (super.getElapsedTime() >= 3) { super.finishGame(false); } } } /** * Show result after button press * @param index index of the selected button */ checkHitState(index) { // Check if current index of the pressed item corresponds to the actual target index if (index === this.getCorrectIndex()) { sounds[gameSound.CATCH].play(); } else { sounds[gameSound.FAIL].play(); } super.ball.state = 'hit target'; } /** * Show correct index for current trajectory * @returns {number} index of trajectory */ getCorrectIndex() { let indexArr = [2, 1, 0]; //reverse index to get value return indexArr[trajectoryParameters[super.currentRounds][gameRandomization.VELOCITY] - 1]; } /** * Show selected window * @method showWindow * @param index */ showWindow(index) { let pressed_target = targets[index]; if (pressed_target) { this.createWindow(pressed_target); } this.showBallLocation(this.getCorrectIndex()); } /** * Columns structure * window: 1,2,3 indicating correct location of where the slime will land - top, middle or bottom * selected_button: 1,2,3,4 indicating no button or which button was clicked. 0 : Y ,1:G , 2: V, 3 : no button * ship: 1,2,3 indicating size of spaceship (from small to bigger) * @method dataCollection */ dataCollection() { if( super.ball.state === 'hit' || super.ball.state === 'fall' || super.ball.state === 'hit target' || super.ball.state === 'hit house') { let target_state = pressed.findIndex(item => item !== false); if(keys[target_state] === undefined){ target_state = 3; } if(super.exportData.selected_button === 4) { super.exportData.window = this.getCorrectIndex() + 1; super.exportData.selected_button = target_state + 1; super.exportData.obstruction_number = trajectoryParameters[super.currentRounds][gameRandomization.OBSTRUCTION]; super.exportData.trial = super.currentRounds; super.exportData.trialType = this.context.trialType; super.exportData.scale = super.Utils.SCALE.toFixed(1); super.exportData.window_height = screen.height; super.exportData.window_width = screen.width; super.exportData.canvas_height = this.canvas.height; super.exportData.canvas_width = this.canvas.width; super.exportData.dpi = window.devicePixelRatio; if(super.getElapsedTime() <= 0.5) { super.exportData.ball_position_x.push(parseFloat(super.convertXvalue(super.ball.position.x))); super.exportData.ball_position_y.push(parseFloat(super.convertYvalue(super.ball.position.y))); super.exportData.ball_timestamp.push(super.ball.timestamp); } super.exportData.timestamp = soundTimeStamp; } } super.dataCollection(); } }
import React from "react" import styled from "styled-components" import gif from "../images/avatar.gif" import Wave from "./Wave" const SectionGroup = styled.div` margin: 100px 0 0; background: url(${props => props.image}); background-size: cover; height: 720px; display: grid; grid-template-rows: 300px auto; grid-gap: 20px; position: relative; @media (max-width: 640px) { height: 820px; } ` const SectionLogo = styled.img` width: 128px; margin: 0 auto; align-self:top; ` const SectionTitleGroup = styled.div` max-width: 800px; margin: 0 auto; display: grid; grid-gap: 40px; grid-template-columns: 320px auto; grid-template-rows: auto 100%; @media (max-width: 720px) { grid-template-columns: 1fr; } ` const SectionTitle = styled.h3` font-weight: 700; background: rgb(26, 3, 42); background: linear-gradient( 90deg, rgba(26, 3, 42, 0.9346113445378151) 0%, rgba(26, 3, 42, 0.6993172268907564) 50%, rgba(26, 3, 42, 0.39119397759103647) 100% ); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: rgba(51, 51, 51, 0.838); font-size: 50px; margin: -180px 0; line-height: 1.2; @media (max-width: 720px) { font-size: 44px; text-align: center; } ` const SectionText = styled.p` color: rgba(51, 51, 51, 0.838); font-size: 22px; line-height: 1.2; margin: -180px 0; @media (max-width: 720px) { margin: -100px 0; padding: 0 20px; font-size: 22px; } ` const WaveBottom = styled.div` position: absolute; width: 100%; bottom: -5px; opacity: 0.25; ` const WaveTop = styled.div` position: absolute; width: 100%; top: -106px; transform: rotate(180deg); opacity: 0.25; ` const Section = props => ( <div id="bio"> <SectionGroup image={props.image}> <SectionLogo src={gif}/> <WaveTop> <Wave /> </WaveTop> <WaveBottom> <Wave /> </WaveBottom> <SectionTitleGroup> <SectionTitle> {props.title} </SectionTitle> <SectionText> {props.text} </SectionText> </SectionTitleGroup> </SectionGroup> </div> ) export default Section
# # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Helper to provide resources via the colab service worker. Example inside Colab: # First, create a resource in Python from google.colab import html ref = html.create_resource(content='hello world') # Next, execute javascript code that uses that resource from IPython.display import display, Javascript display(Javascript(''' var content = {ref.content!r}; var url = {ref.url!r}; fetch(url) .then(r => r.text()) .then(c => console.log("Content matches:", c === content)) '''.format(ref=ref))) """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import abc import collections import mimetypes import uuid import weakref from google.colab.html import _background_server import six import tornado.web @six.add_metaclass(abc.ABCMeta) class _Resource(object): """Abstract resource class to handle content to colab.""" def __init__(self, provider, headers, extension, route): if not isinstance(headers, collections.Mapping): raise ValueError('headers must be a dict') if route and extension: raise ValueError('Should only provide one of route or extension.') self.headers = headers self._route = route if route: self._guid = route else: self._guid = str(uuid.uuid4()) if extension: self._guid += '.' + extension self._provider = provider @abc.abstractmethod def get(self, handler): """Gets the resource using the tornado handler passed in. Args: handler: Tornado handler to be used. """ for key, value in self.headers.items(): handler.set_header(key, value) @property def guid(self): """Unique id used to serve and reference the resource.""" return self._guid @property def url(self): """Url to fetch the resource at.""" return 'https://localhost:{}/{}'.format(self._provider.port, self._guid) class _ContentResource(_Resource): def __init__(self, content, *args, **kwargs): self.content = content super(_ContentResource, self).__init__(*args, **kwargs) def get(self, handler): super(_ContentResource, self).get(handler) handler.write(self.content) class _FileResource(_Resource): """Handle file resources.""" def __init__(self, filepath, *args, **kwargs): self.filepath = filepath super(_FileResource, self).__init__(*args, **kwargs) def get(self, handler): super(_FileResource, self).get(handler) with open(self.filepath) as f: data = f.read() handler.write(data) class _HandlerResource(_Resource): def __init__(self, func, *args, **kwargs): self.func = func super(_HandlerResource, self).__init__(*args, **kwargs) def get(self, handler): super(_HandlerResource, self).get(handler) content = self.func() handler.write(content) class _ResourceHandler(tornado.web.RequestHandler): """Serves the `Resource` objects.""" def initialize(self, resources): self._resources = resources def get(self): path = self.request.path resource = self._resources.get(path.lstrip('/')) if not resource: raise tornado.web.HTTPError(404, 'Resource at %s not found', path) content_type, _ = mimetypes.guess_type(path) if content_type: self.set_header('Content-Type', content_type) resource.get(self) class _Provider(_background_server._BackgroundServer): # pylint: disable=protected-access """Background server which can provide a set of resources.""" def __init__(self): """Initialize the server with a ResourceHandler script.""" resources = weakref.WeakValueDictionary() self._resources = resources app = tornado.web.Application([ (r'.*', _ResourceHandler, dict(resources=self._resources)), ]) super(_Provider, self).__init__(app) def create(self, content=None, filepath=None, handler=None, headers=None, extension=None, route=None): """Creates and provides a new resource to be served. Can only provide one of content, path, or handler. Args: content: The string or byte content to return. filepath: The filepath to a file whose contents should be returned. handler: A function which will be executed and returned on each request. headers: A dict of header values to return. extension: Optional extension to add to the url. route: Optional route to serve on. Returns: The `_Resource` object which will be served and will provide its url. Raises: ValueError: If you don't provide one of content, filepath, or handler. """ sources = sum(map(bool, (content, filepath, handler))) if sources != 1: raise ValueError( 'Must provide exactly one of content, filepath, or handler') if not headers: headers = {} if route: route = route.lstrip('/') if content: resource = _ContentResource( content, headers=headers, extension=extension, provider=self, route=route) elif filepath: resource = _FileResource( filepath, headers=headers, extension=extension, provider=self, route=route) elif handler: resource = _HandlerResource( handler, headers=headers, extension=extension, provider=self, route=route) else: raise ValueError('Must provide one of content, filepath, or handler.') self._resources[resource.guid] = resource if self._server_thread is None: self.start() return resource # Global singleton instance _global_provider = _Provider() create = _global_provider.create
import React from 'react'; import styles from './styles'; import { withStyles } from '@material-ui/core/styles'; class ChatViewComponent extends React.Component { componentDidUpdate = () => { const container = document.getElementById('chatview-container'); if(container) container.scrollTo(0, container.scrollHeight); } render() { const{ classes, chat, user } = this.props; if(chat === undefined) { return(<main id="chatview-container" className={classes.content}> </main>); } else { return( <div> <div className={classes.chatHeader}> Your chat with <b> {chat.users.filter(_usr => _usr !== user)} </b> </div> <main id="chatview-container" className={classes.content}> { chat.messages.map((_msg, _index) => { return( <div key={_index} className={_msg.sender === user ? classes.userSent : classes.friendSent}> { _msg.message} </div> ) }) } </main> </div> ) } return( <div className={classes.content}>Hello from chat view component</div> ); } } export default withStyles(styles)(ChatViewComponent);
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createBookViewSchema = exports.CreateBookView = void 0; const models_1 = require("../../../models"); const api_1 = require("../../../api"); const router_1 = require("../../../router"); class CreateBookView extends models_1.AbstractViewModel { } __decorate([ api_1.viewProp(), __metadata("design:type", String) ], CreateBookView.prototype, "title", void 0); __decorate([ api_1.viewProp(), __metadata("design:type", String) ], CreateBookView.prototype, "description", void 0); exports.CreateBookView = CreateBookView; exports.createBookViewSchema = router_1.buildValidatorAndTransformer(CreateBookView); //# sourceMappingURL=create-book-view.js.map
describe('Vue component that shows dialogs (modal) on a page', () => { it('Opens and closes modals', () => { // make sure we're testing on desktop since the emergency modal isn't a modal on mobile cy.viewport(1300, 750); cy.visit('/portal/BD.1.2-make-a-payment-1.html'); // clicking on the dialog open button in the header should open the emergency contact dialog cy.get('.MainNav__auxiliary .a11y-dialog-open-button').click(); cy.get('#emergency-contact-dialog').should('be.visible'); // let's double check the aria attributes on the parent app are correct for accessibility cy.get('#emergency-contact-dialog').parent().should('not.have.attr', 'aria-hidden', 'true'); // but other DOM elements should have aria-hidden attr cy.get('#emergency-contact-dialog').parent().siblings().should('have.attr', 'aria-hidden', 'true'); // let's close the modal now! cy.get('#emergency-contact-dialog button').click(); cy.get('#emergency-contact-dialog').should('not.be.visible'); // and double check aria attributes are taken off DOM elements cy.get('body').children().should('have.attr', 'aria-hidden', 'false'); // now let's try the check modal cy.get('#pay-from-input').select('new'); cy.get('#account-number-input + button').click(); cy.get('#how-to-read-check-dialog').should('be.visible'); // let's double check the aria attributes on the parent app are correct for accessibility cy.get('#how-to-read-check-dialog').parent().should('not.have.attr', 'aria-hidden', 'true'); // but other DOM elements should have aria-hidden attr cy.get('#how-to-read-check-dialog').parent().siblings().should('have.attr', 'aria-hidden', 'true'); // let's close the modal now (by clicking outside of modal)! cy.get('body').click('topLeft'); cy.get('#how-to-read-check-dialog').should('not.be.visible'); // and double check aria attributes are taken off DOM elements cy.get('body').children().should('have.attr', 'aria-hidden', 'false'); }); it('Opens the terms and conditions dialog for autopay', () => { cy.visit('/portal/BE.1.2-autopay.html'); // Fill out the enrollment cy.get('#pay-from-input').select('2775'); cy.get('.form-actions button:nth-child(2)').click(); // click on terms and conditions cy.get('.terms-and-conditions-button').click(); cy.get('#terms-and-conditions-dialog').should('be.visible'); // let's double check the aria attributes on the parent app are correct for accessibility cy.get('#terms-and-conditions-dialog').parent().should('not.have.attr', 'aria-hidden', 'true'); cy.get('#terms-and-conditions-dialog').parent().siblings().should('have.attr', 'aria-hidden', 'true'); }); it('Opens the terms and conditions dialog for autopay', () => { cy.visit('/portal/BE.1.2-autopay.html'); // Fill out the enrollment cy.get('#pay-from-input').select('2775'); cy.get('.form-actions button:nth-child(2)').click(); // click on terms and conditions cy.get('.terms-and-conditions-button').click(); cy.get('#terms-and-conditions-dialog').should('be.visible'); // let's double check the aria attributes on the parent app are correct for accessibility cy.get('#terms-and-conditions-dialog').parent().should('not.have.attr', 'aria-hidden', 'true'); cy.get('#terms-and-conditions-dialog').parent().siblings().should('have.attr', 'aria-hidden', 'true'); }); it('Opens the terms and conditions dialog for alerts', () => { cy.visit('/portal/BN.1.1-alerts-list.html'); // click on terms and conditions cy.get('.terms-and-conditions-button').click({ multiple: true }); cy.get('#terms-and-conditions-dialog').should('be.visible'); // let's double check the aria attributes on the parent app are correct for accessibility cy.get('#terms-and-conditions-dialog').parent().should('not.have.attr', 'aria-hidden', 'true'); cy.get('#terms-and-conditions-dialog').parent().siblings().should('have.attr', 'aria-hidden', 'true'); }); it('Opens the terms and conditions dialog for paperless', () => { cy.visit('/portal/BF.1.1-ebills-1.html'); // click on terms and conditions cy.get('.terms-and-conditions-button').click(); cy.get('#terms-and-conditions-dialog').should('be.visible'); // let's double check the aria attributes on the parent app are correct for accessibility cy.get('#terms-and-conditions-dialog').parent().should('not.have.attr', 'aria-hidden', 'true'); cy.get('#terms-and-conditions-dialog').parent().siblings().should('have.attr', 'aria-hidden', 'true'); }); it('Opens the terms and conditions dialog for OTP', () => { cy.visit('/portal/BD.1.2-make-a-payment-1.html'); // Fill out the form cy.get('#pay-from-input').select('5789'); cy.get('#specify-amount-input').select('38.49'); cy.get('.form-actions button:nth-child(2)').click(); // click on terms and conditions cy.get('.terms-and-conditions-button').click(); cy.get('#terms-and-conditions-dialog').should('be.visible'); // let's double check the aria attributes on the parent app are correct for accessibility cy.get('#terms-and-conditions-dialog').parent().should('not.have.attr', 'aria-hidden', 'true'); cy.get('#terms-and-conditions-dialog').parent().siblings().should('have.attr', 'aria-hidden', 'true'); }); it('Opens the current password validation for edit profile', () => { cy.visit('/portal/BJ.1.1-profile-edit.html'); // Fill out the form cy.get('#edit-first-name').type('test'); cy.get('#edit-last-name').type('test'); cy.get('#edit-email').type('[email protected]'); cy.get('#confirm-email').type('[email protected]'); cy.get('#edit-password').type('test1234'); cy.get('#confirm-password').type('test1234'); // click on terms and conditions cy.get('.form-actions .btn').click(); cy.get('#verify-password-dialog').should('be.visible'); // let's double check the aria attributes on the parent app are correct for accessibility cy.get('#verify-password-dialog').parent().should('not.have.attr', 'aria-hidden', 'true'); cy.get('#verify-password-dialog').parent().siblings().should('have.attr', 'aria-hidden', 'true'); }); it('Opens the terms and conditions dialog for create account', () => { cy.visit('/account/create'); cy.get('#account-number-input').type('89454700-36'); cy.get('#search-by-account-number').click(); cy.get('#ssn-input').type('4433'); cy.get('#step-1-button').click(); // click on terms and conditions cy.get('.terms-and-conditions-button').click(); cy.get('#termsDialog_register_terms_01').should('be.visible'); // let's double check the aria attributes on the parent app are correct for accessibility cy.get('#termsDialog_register_terms_01').parent().should('not.have.attr', 'aria-hidden', 'true'); cy.get('#termsDialog_register_terms_01').parent().siblings().should('have.attr', 'aria-hidden', 'true'); }); });
/******************************************************************************** * generated by de.acegen ********************************************************************************/ import Action from "../../ace/AsynchronousAction"; import UpdateCardPriorityCommand from "../../../src/box/commands/UpdateCardPriorityCommand"; import * as AppState from "../../../src/AppState"; export default class AbstractUpdateCardPriorityAction extends Action { constructor() { super('box.UpdateCardPriorityAction'); this.postCall = this.postCall.bind(this); } getCommand() { return new UpdateCardPriorityCommand(); } preCall() { AppState.set( {display: true}, ["rootContainer", "spinner", "display"] ) AppState.stateUpdated(); } postCall() { AppState.set( {display: false}, ["rootContainer", "spinner", "display"] ) AppState.stateUpdated(); } } /******* S.D.G. *******/
Object.defineProperty(exports, "__esModule", { value: true }); var frame_1 = require("ui/frame"); var app = require("application"); var platform_1 = require("platform"); var color_1 = require("color"); var ActionBarUtil = (function () { function ActionBarUtil() { } ActionBarUtil.SET_TITLE = function (title) { var actionBar = frame_1.topmost().currentPage.actionBar; actionBar.title = title; }; ActionBarUtil.ADD_BUTTON = function (button) { // NOTE: This MUST be called BEFORE SET_TITLE on start frame_1.topmost().currentPage.actionBar.actionItems.addItem(button); }; ActionBarUtil.HIDE_BACK_BUTTON = function () { if (frame_1.topmost().ios) { frame_1.topmost().ios.controller.visibleViewController.navigationItem.setHidesBackButtonAnimated(true, false); } }; ActionBarUtil.EMPTY_ITEMS = function () { var actionBar = frame_1.topmost().currentPage.actionBar; var actionItems = actionBar.actionItems.getItems(); actionItems.forEach(function (item) { actionBar.actionItems.removeItem(item); }); }; ActionBarUtil.STATUSBAR_STYLE = function (style) { if (frame_1.topmost().ios) { var navigationBar = frame_1.topmost().ios.controller.navigationBar; // 0: default // 1: light navigationBar.barStyle = style; } else if (platform_1.isAndroid) { if (app.android && platform_1.device.sdkVersion >= '21') { try { var LayoutParams = android.view.WindowManager.LayoutParams; var win = void 0; if (app.android.foregroundActivity) { win = app.android.foregroundActivity.getWindow(); } else { win = app.android.startActivity.getWindow(); } win.addFlags(LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); win.setStatusBarColor(new color_1.Color(style || '#3280CF').android); } catch (err) { console.log(err); } } } }; return ActionBarUtil; }()); exports.ActionBarUtil = ActionBarUtil; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWN0aW9uYmFyLnV0aWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJhY3Rpb25iYXIudXRpbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsa0NBQW1DO0FBRW5DLGlDQUFtQztBQUNuQyxxQ0FBNkM7QUFDN0MsK0JBQThCO0FBSzlCO0lBQUE7SUE4Q0EsQ0FBQztJQTdDZSx1QkFBUyxHQUF2QixVQUF3QixLQUFhO1FBQ25DLElBQUksU0FBUyxHQUFHLGVBQU8sRUFBRSxDQUFDLFdBQVcsQ0FBQyxTQUFTLENBQUM7UUFDaEQsU0FBUyxDQUFDLEtBQUssR0FBRyxLQUFLLENBQUM7SUFDMUIsQ0FBQztJQUNhLHdCQUFVLEdBQXhCLFVBQXlCLE1BQWtCO1FBQ3pDLHNEQUFzRDtRQUN0RCxlQUFPLEVBQUUsQ0FBQyxXQUFXLENBQUMsU0FBUyxDQUFDLFdBQVcsQ0FBQyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDOUQsQ0FBQztJQUNhLDhCQUFnQixHQUE5QjtRQUNFLEVBQUUsQ0FBQyxDQUFDLGVBQU8sRUFBRSxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUM7WUFDbEIsZUFBTyxFQUFFLENBQUMsR0FBRyxDQUFDLFVBQVUsQ0FBQyxxQkFBcUIsQ0FBQyxjQUFjLENBQUMsMEJBQTBCLENBQUMsSUFBSSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBQ3hHLENBQUM7SUFDSCxDQUFDO0lBQ2EseUJBQVcsR0FBekI7UUFDRSxJQUFJLFNBQVMsR0FBRyxlQUFPLEVBQUUsQ0FBQyxXQUFXLENBQUMsU0FBUyxDQUFDO1FBQ2hELElBQUksV0FBVyxHQUFHLFNBQVMsQ0FBQyxXQUFXLENBQUMsUUFBUSxFQUFFLENBQUM7UUFDbkQsV0FBVyxDQUFDLE9BQU8sQ0FBQyxVQUFDLElBQUk7WUFDdkIsU0FBUyxDQUFDLFdBQVcsQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLENBQUM7UUFDekMsQ0FBQyxDQUFDLENBQUM7SUFDTCxDQUFDO0lBQ2EsNkJBQWUsR0FBN0IsVUFBOEIsS0FBc0I7UUFDbEQsRUFBRSxDQUFDLENBQUMsZUFBTyxFQUFFLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQztZQUNsQixJQUFJLGFBQWEsR0FBRyxlQUFPLEVBQUUsQ0FBQyxHQUFHLENBQUMsVUFBVSxDQUFDLGFBQWEsQ0FBQztZQUMzRCxhQUFhO1lBQ2IsV0FBVztZQUNYLGFBQWEsQ0FBQyxRQUFRLEdBQUcsS0FBSyxDQUFDO1FBQ2pDLENBQUM7UUFBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUMsb0JBQVMsQ0FBQyxDQUFDLENBQUM7WUFDckIsRUFBRSxDQUFDLENBQUMsR0FBRyxDQUFDLE9BQU8sSUFBSSxpQkFBTSxDQUFDLFVBQVUsSUFBSSxJQUFJLENBQUMsQ0FBQyxDQUFDO2dCQUM3QyxJQUFJLENBQUM7b0JBQ0gsSUFBSSxZQUFZLEdBQVEsT0FBTyxDQUFDLElBQUksQ0FBQyxhQUFhLENBQUMsWUFBWSxDQUFDO29CQUNoRSxJQUFJLEdBQUcsU0FBSyxDQUFDO29CQUNiLEVBQUUsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsa0JBQWtCLENBQUMsQ0FBQyxDQUFDO3dCQUNuQyxHQUFHLEdBQUcsR0FBRyxDQUFDLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxTQUFTLEVBQUUsQ0FBQztvQkFDbkQsQ0FBQztvQkFBQyxJQUFJLENBQUMsQ0FBQzt3QkFDTixHQUFHLEdBQUcsR0FBRyxDQUFDLE9BQU8sQ0FBQyxhQUFhLENBQUMsU0FBUyxFQUFFLENBQUM7b0JBQzlDLENBQUM7b0JBRUQsR0FBRyxDQUFDLFFBQVEsQ0FBQyxZQUFZLENBQUMsaUNBQWlDLENBQUMsQ0FBQztvQkFDN0QsR0FBRyxDQUFDLGlCQUFpQixDQUFDLElBQUksYUFBSyxDQUFTLEtBQUssSUFBSSxTQUFTLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQztnQkFDdkUsQ0FBQztnQkFBQyxLQUFLLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDO29CQUNiLE9BQU8sQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUM7Z0JBQ25CLENBQUM7WUFDSCxDQUFDO1FBQ0gsQ0FBQztJQUNILENBQUM7SUFDSCxvQkFBQztBQUFELENBQUMsQUE5Q0QsSUE4Q0M7QUE5Q1ksc0NBQWEiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyB0b3Btb3N0IH0gZnJvbSAndWkvZnJhbWUnO1xuaW1wb3J0IHsgQWN0aW9uSXRlbSwgQWN0aW9uSXRlbXMgfSBmcm9tICd1aS9hY3Rpb24tYmFyJztcbmltcG9ydCAqIGFzIGFwcCBmcm9tICdhcHBsaWNhdGlvbic7XG5pbXBvcnQgeyBkZXZpY2UsIGlzQW5kcm9pZCB9IGZyb20gJ3BsYXRmb3JtJztcbmltcG9ydCB7IENvbG9yIH0gZnJvbSAnY29sb3InO1xuZGVjbGFyZSB2YXIgYW5kcm9pZDtcblxuZGVjbGFyZSB2YXIgVUlCYXJTdHlsZTogYW55O1xuXG5leHBvcnQgY2xhc3MgQWN0aW9uQmFyVXRpbCB7XG4gIHB1YmxpYyBzdGF0aWMgU0VUX1RJVExFKHRpdGxlOiBzdHJpbmcpIHtcbiAgICB2YXIgYWN0aW9uQmFyID0gdG9wbW9zdCgpLmN1cnJlbnRQYWdlLmFjdGlvbkJhcjtcbiAgICBhY3Rpb25CYXIudGl0bGUgPSB0aXRsZTtcbiAgfVxuICBwdWJsaWMgc3RhdGljIEFERF9CVVRUT04oYnV0dG9uOiBBY3Rpb25JdGVtKSB7XG4gICAgLy8gTk9URTogVGhpcyBNVVNUIGJlIGNhbGxlZCBCRUZPUkUgU0VUX1RJVExFIG9uIHN0YXJ0XG4gICAgdG9wbW9zdCgpLmN1cnJlbnRQYWdlLmFjdGlvbkJhci5hY3Rpb25JdGVtcy5hZGRJdGVtKGJ1dHRvbik7XG4gIH1cbiAgcHVibGljIHN0YXRpYyBISURFX0JBQ0tfQlVUVE9OKCkge1xuICAgIGlmICh0b3Btb3N0KCkuaW9zKSB7XG4gICAgICB0b3Btb3N0KCkuaW9zLmNvbnRyb2xsZXIudmlzaWJsZVZpZXdDb250cm9sbGVyLm5hdmlnYXRpb25JdGVtLnNldEhpZGVzQmFja0J1dHRvbkFuaW1hdGVkKHRydWUsIGZhbHNlKTtcbiAgICB9XG4gIH1cbiAgcHVibGljIHN0YXRpYyBFTVBUWV9JVEVNUygpIHtcbiAgICB2YXIgYWN0aW9uQmFyID0gdG9wbW9zdCgpLmN1cnJlbnRQYWdlLmFjdGlvbkJhcjtcbiAgICB2YXIgYWN0aW9uSXRlbXMgPSBhY3Rpb25CYXIuYWN0aW9uSXRlbXMuZ2V0SXRlbXMoKTtcbiAgICBhY3Rpb25JdGVtcy5mb3JFYWNoKChpdGVtKSA9PiB7XG4gICAgICBhY3Rpb25CYXIuYWN0aW9uSXRlbXMucmVtb3ZlSXRlbShpdGVtKTtcbiAgICB9KTtcbiAgfVxuICBwdWJsaWMgc3RhdGljIFNUQVRVU0JBUl9TVFlMRShzdHlsZTogbnVtYmVyIHwgc3RyaW5nKSB7XG4gICAgaWYgKHRvcG1vc3QoKS5pb3MpIHtcbiAgICAgIGxldCBuYXZpZ2F0aW9uQmFyID0gdG9wbW9zdCgpLmlvcy5jb250cm9sbGVyLm5hdmlnYXRpb25CYXI7XG4gICAgICAvLyAwOiBkZWZhdWx0XG4gICAgICAvLyAxOiBsaWdodFxuICAgICAgbmF2aWdhdGlvbkJhci5iYXJTdHlsZSA9IHN0eWxlO1xuICAgIH0gZWxzZSBpZiAoaXNBbmRyb2lkKSB7XG4gICAgICBpZiAoYXBwLmFuZHJvaWQgJiYgZGV2aWNlLnNka1ZlcnNpb24gPj0gJzIxJykge1xuICAgICAgICB0cnkge1xuICAgICAgICAgIGxldCBMYXlvdXRQYXJhbXMgPSA8YW55PmFuZHJvaWQudmlldy5XaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcztcbiAgICAgICAgICBsZXQgd2luOiBhbnk7XG4gICAgICAgICAgaWYgKGFwcC5hbmRyb2lkLmZvcmVncm91bmRBY3Rpdml0eSkge1xuICAgICAgICAgICAgd2luID0gYXBwLmFuZHJvaWQuZm9yZWdyb3VuZEFjdGl2aXR5LmdldFdpbmRvdygpO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB3aW4gPSBhcHAuYW5kcm9pZC5zdGFydEFjdGl2aXR5LmdldFdpbmRvdygpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHdpbi5hZGRGbGFncyhMYXlvdXRQYXJhbXMuRkxBR19EUkFXU19TWVNURU1fQkFSX0JBQ0tHUk9VTkRTKTtcbiAgICAgICAgICB3aW4uc2V0U3RhdHVzQmFyQ29sb3IobmV3IENvbG9yKDxzdHJpbmc+c3R5bGUgfHwgJyMzMjgwQ0YnKS5hbmRyb2lkKTtcbiAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgY29uc29sZS5sb2coZXJyKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cbiAgfVxufVxuIl19
$(function() { alert("Alert Test"); });
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ethers = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.version = "4.0.0-beta.3"; },{}],2:[function(require,module,exports){ 'use strict'; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var interface_1 = require("./interface"); var abi_coder_1 = require("../utils/abi-coder"); var address_1 = require("../utils/address"); var bignumber_1 = require("../utils/bignumber"); var bytes_1 = require("../utils/bytes"); var properties_1 = require("../utils/properties"); var web_1 = require("../utils/web"); var types_1 = require("../utils/types"); var errors = __importStar(require("../utils/errors")); var allowedTransactionKeys = { data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true }; // Recursively replaces ENS names with promises to resolve the name and // stalls until all promises have returned // @TODO: Expand this to resolve any promises too function resolveAddresses(provider, value, paramType) { if (Array.isArray(paramType)) { var promises = []; paramType.forEach(function (paramType, index) { var v = null; if (Array.isArray(value)) { v = value[index]; } else { v = value[paramType.name]; } promises.push(resolveAddresses(provider, v, paramType)); }); return Promise.all(promises); } if (paramType.type === 'address') { return provider.resolveName(value); } if (paramType.components) { return resolveAddresses(provider, value, paramType.components); } return Promise.resolve(value); } function runMethod(contract, functionName, estimateOnly) { var method = contract.interface.functions[functionName]; return function () { var params = []; for (var _i = 0; _i < arguments.length; _i++) { params[_i] = arguments[_i]; } var tx = {}; // If 1 extra parameter was passed in, it contains overrides if (params.length === method.inputs.length + 1 && typeof (params[params.length - 1]) === 'object') { tx = properties_1.shallowCopy(params.pop()); // Check for unexpected keys (e.g. using "gas" instead of "gasLimit") for (var key in tx) { if (!allowedTransactionKeys[key]) { throw new Error('unknown transaction override ' + key); } } } if (params.length != method.inputs.length) { throw new Error('incorrect number of arguments'); } // Check overrides make sense ['data', 'to'].forEach(function (key) { if (tx[key] != null) { errors.throwError('cannot override ' + key, errors.UNSUPPORTED_OPERATION, { operation: key }); } }); // Send to the contract address tx.to = contract.addressPromise; return resolveAddresses(contract.provider, params, method.inputs).then(function (params) { tx.data = method.encode(params); if (method.type === 'call') { // Call (constant functions) always cost 0 ether if (estimateOnly) { return Promise.resolve(bignumber_1.ConstantZero); } if (!contract.provider) { errors.throwError('call (constant functions) require a provider or a signer with a provider', errors.UNSUPPORTED_OPERATION, { operation: 'call' }); } // Check overrides make sense ['gasLimit', 'gasPrice', 'value'].forEach(function (key) { if (tx[key] != null) { throw new Error('call cannot override ' + key); } }); if (tx.from == null && contract.signer) { tx.from = contract.signer.getAddress(); } return contract.provider.call(tx).then(function (value) { if ((bytes_1.hexDataLength(value) % 32) === 4 && bytes_1.hexDataSlice(value, 0, 4) === '0x08c379a0') { var reason = abi_coder_1.defaultAbiCoder.decode(['string'], bytes_1.hexDataSlice(value, 4)); errors.throwError('call revert exception', errors.CALL_EXCEPTION, { address: contract.address, args: params, method: method.signature, errorSignature: 'Error(string)', errorArgs: [reason], reason: reason, transaction: tx }); } try { var result = method.decode(value); if (method.outputs.length === 1) { result = result[0]; } return result; } catch (error) { if (value === '0x' && method.outputs.length > 0) { errors.throwError('call exception', errors.CALL_EXCEPTION, { address: contract.address, method: method.signature, args: params }); } throw error; } }); } else if (method.type === 'transaction') { // Only computing the transaction estimate if (estimateOnly) { if (!contract.provider) { errors.throwError('estimate gas require a provider or a signer with a provider', errors.UNSUPPORTED_OPERATION, { operation: 'estimateGas' }); } if (tx.from == null && contract.signer) { tx.from = contract.signer.getAddress(); } return contract.provider.estimateGas(tx); } if (!contract.signer) { errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' }); } // Make sure they aren't overriding something they shouldn't if (tx.from != null) { errors.throwError('cannot override from in a transaction', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' }); } return contract.signer.sendTransaction(tx); } throw new Error('invalid type - ' + method.type); return null; }); }; } function getEventTag(filter) { return (filter.address || '') + (filter.topics ? filter.topics.join(':') : ''); } var Contract = /** @class */ (function () { // https://github.com/Microsoft/TypeScript/issues/5453 // Once this issue is resolved (there are open PR) we can do this nicer // by making addressOrName default to null for 2 operand calls. :) function Contract(addressOrName, contractInterface, signerOrProvider) { var _this = this; errors.checkNew(this, Contract); // @TODO: Maybe still check the addressOrName looks like a valid address or name? //address = getAddress(address); if (contractInterface instanceof interface_1.Interface) { properties_1.defineReadOnly(this, 'interface', contractInterface); } else { properties_1.defineReadOnly(this, 'interface', new interface_1.Interface(contractInterface)); } if (signerOrProvider instanceof types_1.Signer) { properties_1.defineReadOnly(this, 'provider', signerOrProvider.provider); properties_1.defineReadOnly(this, 'signer', signerOrProvider); } else if (signerOrProvider instanceof types_1.MinimalProvider) { properties_1.defineReadOnly(this, 'provider', signerOrProvider); properties_1.defineReadOnly(this, 'signer', null); } else { errors.throwError('invalid signer or provider', errors.INVALID_ARGUMENT, { arg: 'signerOrProvider', value: signerOrProvider }); } properties_1.defineReadOnly(this, 'estimate', {}); properties_1.defineReadOnly(this, 'functions', {}); properties_1.defineReadOnly(this, 'filters', {}); Object.keys(this.interface.events).forEach(function (eventName) { var event = _this.interface.events[eventName]; properties_1.defineReadOnly(_this.filters, eventName, function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return { address: _this.address, topics: event.encodeTopics(args) }; }); }); // Not connected to an on-chain instance, so do not connect functions and events if (!addressOrName) { properties_1.defineReadOnly(this, 'address', null); properties_1.defineReadOnly(this, 'addressPromise', Promise.resolve(null)); return; } this._events = []; properties_1.defineReadOnly(this, 'address', addressOrName); if (this.provider) { properties_1.defineReadOnly(this, 'addressPromise', this.provider.resolveName(addressOrName).then(function (address) { if (address == null) { throw new Error('name not found'); } return address; }).catch(function (error) { console.log('ERROR: Cannot find Contract - ' + addressOrName); throw error; })); } else { try { properties_1.defineReadOnly(this, 'addressPromise', Promise.resolve(address_1.getAddress(addressOrName))); } catch (error) { errors.throwError('provider is required to use non-address contract address', errors.INVALID_ARGUMENT, { argument: 'addressOrName', value: addressOrName }); } } Object.keys(this.interface.functions).forEach(function (name) { var run = runMethod(_this, name, false); if (_this[name] == null) { properties_1.defineReadOnly(_this, name, run); } else { console.log('WARNING: Multiple definitions for ' + name); } if (_this.functions[name] == null) { properties_1.defineReadOnly(_this.functions, name, run); properties_1.defineReadOnly(_this.estimate, name, runMethod(_this, name, true)); } }); } // @TODO: Allow timeout? Contract.prototype.deployed = function () { var _this = this; // If we were just deployed, we know the transaction we should occur in if (this.deployTransaction) { return this.deployTransaction.wait().then(function () { return _this; }); } // Otherwise, poll for our code to be deployed return web_1.poll(function () { return _this.provider.getCode(_this.address).then(function (code) { if (code === '0x') { return undefined; } return _this; }); }, { onceBlock: this.provider }); }; // @TODO: // estimateFallback(overrides?: TransactionRequest): Promise<BigNumber> // @TODO: // estimateDeploy(bytecode: string, ...args): Promise<BigNumber> Contract.prototype.fallback = function (overrides) { if (!this.signer) { errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction(fallback)' }); } var tx = properties_1.shallowCopy(overrides || {}); ['from', 'to'].forEach(function (key) { if (tx[key] == null) { return; } errors.throwError('cannot override ' + key, errors.UNSUPPORTED_OPERATION, { operation: key }); }); tx.to = this.addressPromise; return this.signer.sendTransaction(tx); }; // Reconnect to a different signer or provider Contract.prototype.connect = function (signerOrProvider) { return new Contract(this.address, this.interface, signerOrProvider); }; // Re-attach to a different on=chain instance of this contract Contract.prototype.attach = function (addressOrName) { return new Contract(addressOrName, this.interface, this.signer || this.provider); }; // Deploy the contract with the bytecode, resolving to the deployed address. // Use contract.deployTransaction.wait() to wait until the contract has // been mined. Contract.prototype.deploy = function (bytecode) { var _this = this; var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } if (this.signer == null) { throw new Error('missing signer'); // @TODO: errors.throwError } // A lot of common tools do not prefix bytecode with a 0x if (typeof (bytecode) === 'string' && bytecode.match(/^[0-9a-f]*$/i) && (bytecode.length % 2) == 0) { bytecode = '0x' + bytecode; } if (!bytes_1.isHexString(bytecode)) { errors.throwError('bytecode must be a valid hex string', errors.INVALID_ARGUMENT, { arg: 'bytecode', value: bytecode }); } if ((bytecode.length % 2) !== 0) { errors.throwError('bytecode must be valid data (even length)', errors.INVALID_ARGUMENT, { arg: 'bytecode', value: bytecode }); } var tx = {}; if (args.length === this.interface.deployFunction.inputs.length + 1) { tx = properties_1.shallowCopy(args.pop()); for (var key in tx) { if (!allowedTransactionKeys[key]) { throw new Error('unknown transaction override ' + key); } } } ['data', 'from', 'to'].forEach(function (key) { if (tx[key] == null) { return; } errors.throwError('cannot override ' + key, errors.UNSUPPORTED_OPERATION, { operation: key }); }); tx.data = this.interface.deployFunction.encode(bytecode, args); errors.checkArgumentCount(args.length, this.interface.deployFunction.inputs.length, 'in Contract constructor'); // @TODO: overrides of args.length = this.interface.deployFunction.inputs.length + 1 return this.signer.sendTransaction(tx).then(function (tx) { var contract = new Contract(address_1.getContractAddress(tx), _this.interface, _this.signer || _this.provider); properties_1.defineReadOnly(contract, 'deployTransaction', tx); return contract; }); }; Contract.prototype._getEventFilter = function (eventName) { var _this = this; if (typeof (eventName) === 'string') { // Listen for any event if (eventName === '*') { return { decode: function (log) { return [_this.interface.parseLog(log)]; }, eventTag: '*', filter: { address: this.address }, }; } // Normalize the eventName if (eventName.indexOf('(') !== -1) { eventName = abi_coder_1.formatSignature(abi_coder_1.parseSignature('event ' + eventName)); } var event_1 = this.interface.events[eventName]; if (!event_1) { errors.throwError('unknown event - ' + eventName, errors.INVALID_ARGUMENT, { argumnet: 'eventName', value: eventName }); } var filter_1 = { address: this.address, topics: [event_1.topic] }; return { decode: function (log) { return event_1.decode(log.data, log.topics); }, event: event_1, eventTag: getEventTag(filter_1), filter: filter_1 }; } var filter = { address: this.address }; // Find the matching event in the ABI; if none, we still allow filtering // since it may be a filter for an otherwise unknown event var event = null; if (eventName.topics && eventName.topics[0]) { filter.topics = eventName.topics; for (var name in this.interface.events) { if (name.indexOf('(') === -1) { continue; } var e = this.interface.events[name]; if (e.topic === eventName.topics[0].toLowerCase()) { event = e; break; } } } return { decode: function (log) { if (event) { return event.decode(log.data, log.topics); } return [log]; }, event: event, eventTag: getEventTag(filter), filter: filter }; }; Contract.prototype._addEventListener = function (eventFilter, listener, once) { var _this = this; if (!this.provider) { errors.throwError('events require a provider or a signer with a provider', errors.UNSUPPORTED_OPERATION, { operation: 'once' }); } var wrappedListener = function (log) { var decoded = Array.prototype.slice.call(eventFilter.decode(log)); var event = properties_1.jsonCopy(log); event.args = decoded; event.decode = eventFilter.event.decode; event.event = eventFilter.event.name; event.eventSignature = eventFilter.event.signature; event.removeListener = function () { _this.removeListener(eventFilter.filter, listener); }; event.getBlock = function () { return _this.provider.getBlock(log.blockHash); }; event.getTransaction = function () { return _this.provider.getTransactionReceipt(log.transactionHash); }; event.getTransactionReceipt = function () { return _this.provider.getTransactionReceipt(log.transactionHash); }; decoded.push(event); _this.emit.apply(_this, [eventFilter.filter].concat(decoded)); }; this.provider.on(eventFilter.filter, wrappedListener); this._events.push({ eventFilter: eventFilter, listener: listener, wrappedListener: wrappedListener, once: once }); }; Contract.prototype.on = function (event, listener) { this._addEventListener(this._getEventFilter(event), listener, false); return this; }; Contract.prototype.once = function (event, listener) { this._addEventListener(this._getEventFilter(event), listener, true); return this; }; Contract.prototype.addEventLisener = function (eventName, listener) { return this.on(eventName, listener); }; Contract.prototype.emit = function (eventName) { var _this = this; var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } if (!this.provider) { return false; } var result = false; var eventFilter = this._getEventFilter(eventName); this._events = this._events.filter(function (event) { if (event.eventFilter.eventTag !== eventFilter.eventTag) { return true; } setTimeout(function () { event.listener.apply(_this, args); }, 0); result = true; return !(event.once); }); return result; }; Contract.prototype.listenerCount = function (eventName) { if (!this.provider) { return 0; } var eventFilter = this._getEventFilter(eventName); return this._events.filter(function (event) { return event.eventFilter.eventTag === eventFilter.eventTag; }).length; }; Contract.prototype.listeners = function (eventName) { if (!this.provider) { return []; } var eventFilter = this._getEventFilter(eventName); return this._events.filter(function (event) { return event.eventFilter.eventTag === eventFilter.eventTag; }).map(function (event) { return event.listener; }); }; Contract.prototype.removeAllListeners = function (eventName) { if (!this.provider) { return this; } var eventFilter = this._getEventFilter(eventName); this._events = this._events.filter(function (event) { return event.eventFilter.eventTag !== eventFilter.eventTag; }); return this; }; Contract.prototype.removeListener = function (eventName, listener) { var _this = this; if (!this.provider) { return this; } var found = false; var eventFilter = this._getEventFilter(eventName); this._events = this._events.filter(function (event) { // Make sure this event and listener match if (event.eventFilter.eventTag !== eventFilter.eventTag) { return true; } if (event.listener !== listener) { return true; } _this.provider.removeListener(event.eventFilter.filter, event.wrappedListener); // Already found a matching event in a previous loop if (found) { return true; } // REmove this event (returning false filters us out) found = true; return false; }); return this; }; return Contract; }()); exports.Contract = Contract; },{"../utils/abi-coder":56,"../utils/address":57,"../utils/bignumber":59,"../utils/bytes":60,"../utils/errors":61,"../utils/properties":69,"../utils/types":77,"../utils/web":80,"./interface":4}],3:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var contract_1 = require("./contract"); exports.Contract = contract_1.Contract; var interface_1 = require("./interface"); exports.Interface = interface_1.Interface; },{"./contract":2,"./interface":4}],4:[function(require,module,exports){ 'use strict'; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); // See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI var address_1 = require("../utils/address"); var abi_coder_1 = require("../utils/abi-coder"); var bignumber_1 = require("../utils/bignumber"); var bytes_1 = require("../utils/bytes"); var hash_1 = require("../utils/hash"); var keccak256_1 = require("../utils/keccak256"); var properties_1 = require("../utils/properties"); var types_1 = require("../utils/types"); var errors = __importStar(require("../utils/errors")); var Indexed = /** @class */ (function (_super) { __extends(Indexed, _super); function Indexed(hash) { var _this = _super.call(this) || this; properties_1.defineReadOnly(_this, 'hash', hash); return _this; } return Indexed; }(types_1.Indexed)); var Description = /** @class */ (function () { function Description(info) { for (var key in info) { var value = info[key]; if (value != null && typeof (value) === 'object') { properties_1.defineFrozen(this, key, info[key]); } else { properties_1.defineReadOnly(this, key, info[key]); } } } return Description; }()); var DeployDescription = /** @class */ (function (_super) { __extends(DeployDescription, _super); function DeployDescription() { return _super !== null && _super.apply(this, arguments) || this; } DeployDescription.prototype.encode = function (bytecode, params) { if (!bytes_1.isHexString(bytecode)) { errors.throwError('invalid contract bytecode', errors.INVALID_ARGUMENT, { arg: 'bytecode', value: bytecode }); } errors.checkArgumentCount(params.length, this.inputs.length, 'in Interface constructor'); try { return (bytecode + abi_coder_1.defaultAbiCoder.encode(this.inputs, params).substring(2)); } catch (error) { errors.throwError('invalid constructor argument', errors.INVALID_ARGUMENT, { arg: error.arg, reason: error.reason, value: error.value }); } return null; }; return DeployDescription; }(Description)); var FunctionDescription = /** @class */ (function (_super) { __extends(FunctionDescription, _super); function FunctionDescription() { return _super !== null && _super.apply(this, arguments) || this; } FunctionDescription.prototype.encode = function (params) { errors.checkArgumentCount(params.length, this.inputs.length, 'in interface function ' + this.name); try { return this.sighash + abi_coder_1.defaultAbiCoder.encode(this.inputs, params).substring(2); } catch (error) { errors.throwError('invalid input argument', errors.INVALID_ARGUMENT, { arg: error.arg, reason: error.reason, value: error.value }); } return null; }; FunctionDescription.prototype.decode = function (data) { try { return abi_coder_1.defaultAbiCoder.decode(this.outputs, bytes_1.arrayify(data)); } catch (error) { errors.throwError('invalid data for function output', errors.INVALID_ARGUMENT, { arg: 'data', errorArg: error.arg, errorValue: error.value, value: data, reason: error.reason }); } }; return FunctionDescription; }(Description)); var Result = /** @class */ (function (_super) { __extends(Result, _super); function Result() { return _super !== null && _super.apply(this, arguments) || this; } return Result; }(Description)); var EventDescription = /** @class */ (function (_super) { __extends(EventDescription, _super); function EventDescription() { return _super !== null && _super.apply(this, arguments) || this; } EventDescription.prototype.encodeTopics = function (params) { var _this = this; if (params.length > this.inputs.length) { errors.throwError('too many arguments for ' + this.name, errors.UNEXPECTED_ARGUMENT, { maxCount: params.length, expectedCount: this.inputs.length }); } var topics = []; if (!this.anonymous) { topics.push(this.topic); } params.forEach(function (arg, index) { if (arg === null) { topics.push(null); return; } var param = _this.inputs[index]; if (!param.indexed) { errors.throwError('cannot filter non-indexed parameters; must be null', errors.INVALID_ARGUMENT, { argument: (param.name || index), value: arg }); } if (param.type === 'string') { topics.push(hash_1.id(arg)); } else if (param.type === 'bytes') { topics.push(keccak256_1.keccak256(arg)); } else if (param.type.indexOf('[') !== -1 || param.type.substring(0, 5) === 'tuple') { errors.throwError('filtering with tuples or arrays not implemented yet; bug us on GitHub', errors.NOT_IMPLEMENTED, { operation: 'filter(array|tuple)' }); } else { if (param.type === 'address') { address_1.getAddress(arg); } topics.push(bytes_1.hexZeroPad(bytes_1.hexlify(arg), 32).toLowerCase()); } }); // Trim off trailing nulls while (topics.length && topics[topics.length - 1] === null) { topics.pop(); } return topics; }; EventDescription.prototype.decode = function (data, topics) { // Strip the signature off of non-anonymous topics if (topics != null && !this.anonymous) { topics = topics.slice(1); } var inputIndexed = []; var inputNonIndexed = []; var inputDynamic = []; this.inputs.forEach(function (param, index) { if (param.indexed) { if (param.type === 'string' || param.type === 'bytes' || param.type.indexOf('[') >= 0 || param.type.substring(0, 5) === 'tuple') { inputIndexed.push({ type: 'bytes32', name: (param.name || '') }); inputDynamic.push(true); } else { inputIndexed.push(param); inputDynamic.push(false); } } else { inputNonIndexed.push(param); inputDynamic.push(false); } }); if (topics != null) { var resultIndexed = abi_coder_1.defaultAbiCoder.decode(inputIndexed, bytes_1.concat(topics)); } var resultNonIndexed = abi_coder_1.defaultAbiCoder.decode(inputNonIndexed, bytes_1.arrayify(data)); var result = new Result({}); var nonIndexedIndex = 0, indexedIndex = 0; this.inputs.forEach(function (input, index) { if (input.indexed) { if (topics == null) { result[index] = new Indexed(null); } else if (inputDynamic[index]) { result[index] = new Indexed(resultIndexed[indexedIndex++]); } else { result[index] = resultIndexed[indexedIndex++]; } } else { result[index] = resultNonIndexed[nonIndexedIndex++]; } if (input.name) { result[input.name] = result[index]; } }); result.length = this.inputs.length; return result; }; return EventDescription; }(Description)); var TransactionDescription = /** @class */ (function (_super) { __extends(TransactionDescription, _super); function TransactionDescription() { return _super !== null && _super.apply(this, arguments) || this; } return TransactionDescription; }(Description)); var LogDescription = /** @class */ (function (_super) { __extends(LogDescription, _super); function LogDescription() { return _super !== null && _super.apply(this, arguments) || this; } return LogDescription; }(Description)); function addMethod(method) { switch (method.type) { case 'constructor': { var description = new DeployDescription({ inputs: method.inputs, payable: (method.payable == null || !!method.payable) }); if (!this.deployFunction) { this.deployFunction = description; } break; } case 'function': { var signature = abi_coder_1.formatSignature(method).replace(/tuple/g, ''); var sighash = hash_1.id(signature).substring(0, 10); var description = new FunctionDescription({ inputs: method.inputs, outputs: method.outputs, payable: (method.payable == null || !!method.payable), type: ((method.constant) ? 'call' : 'transaction'), signature: signature, sighash: sighash, }); // Expose the first (and hopefully unique named function if (method.name && this.functions[method.name] == null) { properties_1.defineReadOnly(this.functions, method.name, description); } // Expose all methods by their signature, for overloaded functions if (this.functions[description.signature] == null) { properties_1.defineReadOnly(this.functions, description.signature, description); } break; } case 'event': { var signature = abi_coder_1.formatSignature(method).replace(/tuple/g, ''); var description = new EventDescription({ name: method.name, signature: signature, inputs: method.inputs, topic: hash_1.id(signature), anonymous: (!!method.anonymous) }); // Expose the first (and hopefully unique) event name if (method.name && this.events[method.name] == null) { properties_1.defineReadOnly(this.events, method.name, description); } // Expose all events by their signature, for overloaded functions if (this.events[description.signature] == null) { properties_1.defineReadOnly(this.events, description.signature, description); } break; } case 'fallback': // Nothing to do for fallback break; default: console.log('WARNING: unsupported ABI type - ' + method.type); break; } } var Interface = /** @class */ (function () { function Interface(abi) { errors.checkNew(this, Interface); if (typeof (abi) === 'string') { try { abi = JSON.parse(abi); } catch (error) { errors.throwError('could not parse ABI JSON', errors.INVALID_ARGUMENT, { arg: 'abi', errorMessage: error.message, value: abi }); } if (!Array.isArray(abi)) { errors.throwError('invalid abi', errors.INVALID_ARGUMENT, { arg: 'abi', value: abi }); return null; } } properties_1.defineReadOnly(this, 'functions', {}); properties_1.defineReadOnly(this, 'events', {}); // Convert any supported ABI format into a standard ABI format var _abi = []; abi.forEach(function (fragment) { if (typeof (fragment) === 'string') { fragment = abi_coder_1.parseSignature(fragment); } // @TODO: We should probable do some validation; create abiCoder.formatSignature for checking _abi.push(fragment); }); properties_1.defineFrozen(this, 'abi', _abi); _abi.forEach(addMethod, this); // If there wasn't a constructor, create the default constructor if (!this.deployFunction) { addMethod.call(this, { type: 'constructor', inputs: [] }); } } Interface.prototype.parseTransaction = function (tx) { var sighash = tx.data.substring(0, 10).toLowerCase(); for (var name in this.functions) { if (name.indexOf('(') === -1) { continue; } var func = this.functions[name]; if (func.sighash === sighash) { var result = abi_coder_1.defaultAbiCoder.decode(func.inputs, '0x' + tx.data.substring(10)); return new TransactionDescription({ args: result, decode: func.decode, name: name, signature: func.signature, sighash: func.sighash, value: bignumber_1.bigNumberify(tx.value || 0), }); } } return null; }; Interface.prototype.parseLog = function (log) { for (var name in this.events) { if (name.indexOf('(') === -1) { continue; } var event = this.events[name]; if (event.anonymous) { continue; } if (event.topic !== log.topics[0]) { continue; } // @TODO: If anonymous, and the only method, and the input count matches, should we parse and return it? return new LogDescription({ name: event.name, signature: event.signature, topic: event.topic, values: event.decode(log.data, log.topics) }); } return null; }; return Interface; }()); exports.Interface = Interface; },{"../utils/abi-coder":56,"../utils/address":57,"../utils/bignumber":59,"../utils/bytes":60,"../utils/errors":61,"../utils/hash":62,"../utils/keccak256":66,"../utils/properties":69,"../utils/types":77}],5:[function(require,module,exports){ 'use strict'; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); // This is empty in node, and used by browserify to inject extra goodies var shims_1 = require("./utils/shims"); exports.platform = shims_1.platform; var contracts_1 = require("./contracts"); exports.Contract = contracts_1.Contract; exports.Interface = contracts_1.Interface; var providers = __importStar(require("./providers")); exports.providers = providers; var utils = __importStar(require("./utils")); exports.utils = utils; var wallet_1 = require("./wallet"); exports.HDNode = wallet_1.HDNode; exports.SigningKey = wallet_1.SigningKey; exports.Wallet = wallet_1.Wallet; var wordlists = __importStar(require("./wordlists")); exports.wordlists = wordlists; var types = __importStar(require("./utils/types")); exports.types = types; var errors = __importStar(require("./utils/errors")); exports.errors = errors; var _version_1 = require("./_version"); exports.version = _version_1.version; var constants = utils.constants; exports.constants = constants; },{"./_version":1,"./contracts":3,"./providers":50,"./utils":64,"./utils/errors":61,"./utils/shims":74,"./utils/types":77,"./wallet":82,"./wordlists":86}],6:[function(require,module,exports){ "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var ethers = __importStar(require("./ethers")); exports.ethers = ethers; __export(require("./ethers")); },{"./ethers":5}],7:[function(require,module,exports){ "use strict"; (function(root) { function checkInt(value) { return (parseInt(value) === value); } function checkInts(arrayish) { if (!checkInt(arrayish.length)) { return false; } for (var i = 0; i < arrayish.length; i++) { if (!checkInt(arrayish[i]) || arrayish[i] < 0 || arrayish[i] > 255) { return false; } } return true; } function coerceArray(arg, copy) { // ArrayBuffer view if (arg.buffer && ArrayBuffer.isView(arg) && arg.name === 'Uint8Array') { if (copy) { if (arg.slice) { arg = arg.slice(); } else { arg = Array.prototype.slice.call(arg); } } return arg; } // It's an array; check it is a valid representation of a byte if (Array.isArray(arg)) { if (!checkInts(arg)) { throw new Error('Array contains invalid value: ' + arg); } return new Uint8Array(arg); } // Something else, but behaves like an array (maybe a Buffer? Arguments?) if (checkInt(arg.length) && checkInts(arg)) { return new Uint8Array(arg); } throw new Error('unsupported array-like object'); } function createArray(length) { return new Uint8Array(length); } function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) { if (sourceStart != null || sourceEnd != null) { if (sourceArray.slice) { sourceArray = sourceArray.slice(sourceStart, sourceEnd); } else { sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd); } } targetArray.set(sourceArray, targetStart); } var convertUtf8 = (function() { function toBytes(text) { var result = [], i = 0; text = encodeURI(text); while (i < text.length) { var c = text.charCodeAt(i++); // if it is a % sign, encode the following 2 bytes as a hex value if (c === 37) { result.push(parseInt(text.substr(i, 2), 16)) i += 2; // otherwise, just the actual byte } else { result.push(c) } } return coerceArray(result); } function fromBytes(bytes) { var result = [], i = 0; while (i < bytes.length) { var c = bytes[i]; if (c < 128) { result.push(String.fromCharCode(c)); i++; } else if (c > 191 && c < 224) { result.push(String.fromCharCode(((c & 0x1f) << 6) | (bytes[i + 1] & 0x3f))); i += 2; } else { result.push(String.fromCharCode(((c & 0x0f) << 12) | ((bytes[i + 1] & 0x3f) << 6) | (bytes[i + 2] & 0x3f))); i += 3; } } return result.join(''); } return { toBytes: toBytes, fromBytes: fromBytes, } })(); var convertHex = (function() { function toBytes(text) { var result = []; for (var i = 0; i < text.length; i += 2) { result.push(parseInt(text.substr(i, 2), 16)); } return result; } // http://ixti.net/development/javascript/2011/11/11/base64-encodedecode-of-utf8-in-browser-with-js.html var Hex = '0123456789abcdef'; function fromBytes(bytes) { var result = []; for (var i = 0; i < bytes.length; i++) { var v = bytes[i]; result.push(Hex[(v & 0xf0) >> 4] + Hex[v & 0x0f]); } return result.join(''); } return { toBytes: toBytes, fromBytes: fromBytes, } })(); // Number of rounds by keysize var numberOfRounds = {16: 10, 24: 12, 32: 14} // Round constant words var rcon = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91]; // S-box and Inverse S-box (S is for Substitution) var S = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]; var Si =[0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]; // Transformations for encryption var T1 = [0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a]; var T2 = [0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616]; var T3 = [0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16]; var T4 = [0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c]; // Transformations for decryption var T5 = [0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742]; var T6 = [0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857]; var T7 = [0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8]; var T8 = [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0]; // Transformations for decryption key expansion var U1 = [0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]; var U2 = [0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697]; var U3 = [0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46]; var U4 = [0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d]; function convertToInt32(bytes) { var result = []; for (var i = 0; i < bytes.length; i += 4) { result.push( (bytes[i ] << 24) | (bytes[i + 1] << 16) | (bytes[i + 2] << 8) | bytes[i + 3] ); } return result; } var AES = function(key) { if (!(this instanceof AES)) { throw Error('AES must be instanitated with `new`'); } Object.defineProperty(this, 'key', { value: coerceArray(key, true) }); this._prepare(); } AES.prototype._prepare = function() { var rounds = numberOfRounds[this.key.length]; if (rounds == null) { throw new Error('invalid key size (must be 16, 24 or 32 bytes)'); } // encryption round keys this._Ke = []; // decryption round keys this._Kd = []; for (var i = 0; i <= rounds; i++) { this._Ke.push([0, 0, 0, 0]); this._Kd.push([0, 0, 0, 0]); } var roundKeyCount = (rounds + 1) * 4; var KC = this.key.length / 4; // convert the key into ints var tk = convertToInt32(this.key); // copy values into round key arrays var index; for (var i = 0; i < KC; i++) { index = i >> 2; this._Ke[index][i % 4] = tk[i]; this._Kd[rounds - index][i % 4] = tk[i]; } // key expansion (fips-197 section 5.2) var rconpointer = 0; var t = KC, tt; while (t < roundKeyCount) { tt = tk[KC - 1]; tk[0] ^= ((S[(tt >> 16) & 0xFF] << 24) ^ (S[(tt >> 8) & 0xFF] << 16) ^ (S[ tt & 0xFF] << 8) ^ S[(tt >> 24) & 0xFF] ^ (rcon[rconpointer] << 24)); rconpointer += 1; // key expansion (for non-256 bit) if (KC != 8) { for (var i = 1; i < KC; i++) { tk[i] ^= tk[i - 1]; } // key expansion for 256-bit keys is "slightly different" (fips-197) } else { for (var i = 1; i < (KC / 2); i++) { tk[i] ^= tk[i - 1]; } tt = tk[(KC / 2) - 1]; tk[KC / 2] ^= (S[ tt & 0xFF] ^ (S[(tt >> 8) & 0xFF] << 8) ^ (S[(tt >> 16) & 0xFF] << 16) ^ (S[(tt >> 24) & 0xFF] << 24)); for (var i = (KC / 2) + 1; i < KC; i++) { tk[i] ^= tk[i - 1]; } } // copy values into round key arrays var i = 0, r, c; while (i < KC && t < roundKeyCount) { r = t >> 2; c = t % 4; this._Ke[r][c] = tk[i]; this._Kd[rounds - r][c] = tk[i++]; t++; } } // inverse-cipher-ify the decryption round key (fips-197 section 5.3) for (var r = 1; r < rounds; r++) { for (var c = 0; c < 4; c++) { tt = this._Kd[r][c]; this._Kd[r][c] = (U1[(tt >> 24) & 0xFF] ^ U2[(tt >> 16) & 0xFF] ^ U3[(tt >> 8) & 0xFF] ^ U4[ tt & 0xFF]); } } } AES.prototype.encrypt = function(plaintext) { if (plaintext.length != 16) { throw new Error('invalid plaintext size (must be 16 bytes)'); } var rounds = this._Ke.length - 1; var a = [0, 0, 0, 0]; // convert plaintext to (ints ^ key) var t = convertToInt32(plaintext); for (var i = 0; i < 4; i++) { t[i] ^= this._Ke[0][i]; } // apply round transforms for (var r = 1; r < rounds; r++) { for (var i = 0; i < 4; i++) { a[i] = (T1[(t[ i ] >> 24) & 0xff] ^ T2[(t[(i + 1) % 4] >> 16) & 0xff] ^ T3[(t[(i + 2) % 4] >> 8) & 0xff] ^ T4[ t[(i + 3) % 4] & 0xff] ^ this._Ke[r][i]); } t = a.slice(); } // the last round is special var result = createArray(16), tt; for (var i = 0; i < 4; i++) { tt = this._Ke[rounds][i]; result[4 * i ] = (S[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; result[4 * i + 1] = (S[(t[(i + 1) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; result[4 * i + 2] = (S[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; result[4 * i + 3] = (S[ t[(i + 3) % 4] & 0xff] ^ tt ) & 0xff; } return result; } AES.prototype.decrypt = function(ciphertext) { if (ciphertext.length != 16) { throw new Error('invalid ciphertext size (must be 16 bytes)'); } var rounds = this._Kd.length - 1; var a = [0, 0, 0, 0]; // convert plaintext to (ints ^ key) var t = convertToInt32(ciphertext); for (var i = 0; i < 4; i++) { t[i] ^= this._Kd[0][i]; } // apply round transforms for (var r = 1; r < rounds; r++) { for (var i = 0; i < 4; i++) { a[i] = (T5[(t[ i ] >> 24) & 0xff] ^ T6[(t[(i + 3) % 4] >> 16) & 0xff] ^ T7[(t[(i + 2) % 4] >> 8) & 0xff] ^ T8[ t[(i + 1) % 4] & 0xff] ^ this._Kd[r][i]); } t = a.slice(); } // the last round is special var result = createArray(16), tt; for (var i = 0; i < 4; i++) { tt = this._Kd[rounds][i]; result[4 * i ] = (Si[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; result[4 * i + 1] = (Si[(t[(i + 3) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; result[4 * i + 2] = (Si[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; result[4 * i + 3] = (Si[ t[(i + 1) % 4] & 0xff] ^ tt ) & 0xff; } return result; } /** * Mode Of Operation - Electonic Codebook (ECB) */ var ModeOfOperationECB = function(key) { if (!(this instanceof ModeOfOperationECB)) { throw Error('AES must be instanitated with `new`'); } this.description = "Electronic Code Block"; this.name = "ecb"; this._aes = new AES(key); } ModeOfOperationECB.prototype.encrypt = function(plaintext) { plaintext = coerceArray(plaintext); if ((plaintext.length % 16) !== 0) { throw new Error('invalid plaintext size (must be multiple of 16 bytes)'); } var ciphertext = createArray(plaintext.length); var block = createArray(16); for (var i = 0; i < plaintext.length; i += 16) { copyArray(plaintext, block, 0, i, i + 16); block = this._aes.encrypt(block); copyArray(block, ciphertext, i); } return ciphertext; } ModeOfOperationECB.prototype.decrypt = function(ciphertext) { ciphertext = coerceArray(ciphertext); if ((ciphertext.length % 16) !== 0) { throw new Error('invalid ciphertext size (must be multiple of 16 bytes)'); } var plaintext = createArray(ciphertext.length); var block = createArray(16); for (var i = 0; i < ciphertext.length; i += 16) { copyArray(ciphertext, block, 0, i, i + 16); block = this._aes.decrypt(block); copyArray(block, plaintext, i); } return plaintext; } /** * Mode Of Operation - Cipher Block Chaining (CBC) */ var ModeOfOperationCBC = function(key, iv) { if (!(this instanceof ModeOfOperationCBC)) { throw Error('AES must be instanitated with `new`'); } this.description = "Cipher Block Chaining"; this.name = "cbc"; if (!iv) { iv = createArray(16); } else if (iv.length != 16) { throw new Error('invalid initialation vector size (must be 16 bytes)'); } this._lastCipherblock = coerceArray(iv, true); this._aes = new AES(key); } ModeOfOperationCBC.prototype.encrypt = function(plaintext) { plaintext = coerceArray(plaintext); if ((plaintext.length % 16) !== 0) { throw new Error('invalid plaintext size (must be multiple of 16 bytes)'); } var ciphertext = createArray(plaintext.length); var block = createArray(16); for (var i = 0; i < plaintext.length; i += 16) { copyArray(plaintext, block, 0, i, i + 16); for (var j = 0; j < 16; j++) { block[j] ^= this._lastCipherblock[j]; } this._lastCipherblock = this._aes.encrypt(block); copyArray(this._lastCipherblock, ciphertext, i); } return ciphertext; } ModeOfOperationCBC.prototype.decrypt = function(ciphertext) { ciphertext = coerceArray(ciphertext); if ((ciphertext.length % 16) !== 0) { throw new Error('invalid ciphertext size (must be multiple of 16 bytes)'); } var plaintext = createArray(ciphertext.length); var block = createArray(16); for (var i = 0; i < ciphertext.length; i += 16) { copyArray(ciphertext, block, 0, i, i + 16); block = this._aes.decrypt(block); for (var j = 0; j < 16; j++) { plaintext[i + j] = block[j] ^ this._lastCipherblock[j]; } copyArray(ciphertext, this._lastCipherblock, 0, i, i + 16); } return plaintext; } /** * Mode Of Operation - Cipher Feedback (CFB) */ var ModeOfOperationCFB = function(key, iv, segmentSize) { if (!(this instanceof ModeOfOperationCFB)) { throw Error('AES must be instanitated with `new`'); } this.description = "Cipher Feedback"; this.name = "cfb"; if (!iv) { iv = createArray(16); } else if (iv.length != 16) { throw new Error('invalid initialation vector size (must be 16 size)'); } if (!segmentSize) { segmentSize = 1; } this.segmentSize = segmentSize; this._shiftRegister = coerceArray(iv, true); this._aes = new AES(key); } ModeOfOperationCFB.prototype.encrypt = function(plaintext) { if ((plaintext.length % this.segmentSize) != 0) { throw new Error('invalid plaintext size (must be segmentSize bytes)'); } var encrypted = coerceArray(plaintext, true); var xorSegment; for (var i = 0; i < encrypted.length; i += this.segmentSize) { xorSegment = this._aes.encrypt(this._shiftRegister); for (var j = 0; j < this.segmentSize; j++) { encrypted[i + j] ^= xorSegment[j]; } // Shift the register copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize); copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize); } return encrypted; } ModeOfOperationCFB.prototype.decrypt = function(ciphertext) { if ((ciphertext.length % this.segmentSize) != 0) { throw new Error('invalid ciphertext size (must be segmentSize bytes)'); } var plaintext = coerceArray(ciphertext, true); var xorSegment; for (var i = 0; i < plaintext.length; i += this.segmentSize) { xorSegment = this._aes.encrypt(this._shiftRegister); for (var j = 0; j < this.segmentSize; j++) { plaintext[i + j] ^= xorSegment[j]; } // Shift the register copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize); copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize); } return plaintext; } /** * Mode Of Operation - Output Feedback (OFB) */ var ModeOfOperationOFB = function(key, iv) { if (!(this instanceof ModeOfOperationOFB)) { throw Error('AES must be instanitated with `new`'); } this.description = "Output Feedback"; this.name = "ofb"; if (!iv) { iv = createArray(16); } else if (iv.length != 16) { throw new Error('invalid initialation vector size (must be 16 bytes)'); } this._lastPrecipher = coerceArray(iv, true); this._lastPrecipherIndex = 16; this._aes = new AES(key); } ModeOfOperationOFB.prototype.encrypt = function(plaintext) { var encrypted = coerceArray(plaintext, true); for (var i = 0; i < encrypted.length; i++) { if (this._lastPrecipherIndex === 16) { this._lastPrecipher = this._aes.encrypt(this._lastPrecipher); this._lastPrecipherIndex = 0; } encrypted[i] ^= this._lastPrecipher[this._lastPrecipherIndex++]; } return encrypted; } // Decryption is symetric ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt; /** * Counter object for CTR common mode of operation */ var Counter = function(initialValue) { if (!(this instanceof Counter)) { throw Error('Counter must be instanitated with `new`'); } // We allow 0, but anything false-ish uses the default 1 if (initialValue !== 0 && !initialValue) { initialValue = 1; } if (typeof(initialValue) === 'number') { this._counter = createArray(16); this.setValue(initialValue); } else { this.setBytes(initialValue); } } Counter.prototype.setValue = function(value) { if (typeof(value) !== 'number' || parseInt(value) != value) { throw new Error('invalid counter value (must be an integer)'); } for (var index = 15; index >= 0; --index) { this._counter[index] = value % 256; value = value >> 8; } } Counter.prototype.setBytes = function(bytes) { bytes = coerceArray(bytes, true); if (bytes.length != 16) { throw new Error('invalid counter bytes size (must be 16 bytes)'); } this._counter = bytes; }; Counter.prototype.increment = function() { for (var i = 15; i >= 0; i--) { if (this._counter[i] === 255) { this._counter[i] = 0; } else { this._counter[i]++; break; } } } /** * Mode Of Operation - Counter (CTR) */ var ModeOfOperationCTR = function(key, counter) { if (!(this instanceof ModeOfOperationCTR)) { throw Error('AES must be instanitated with `new`'); } this.description = "Counter"; this.name = "ctr"; if (!(counter instanceof Counter)) { counter = new Counter(counter) } this._counter = counter; this._remainingCounter = null; this._remainingCounterIndex = 16; this._aes = new AES(key); } ModeOfOperationCTR.prototype.encrypt = function(plaintext) { var encrypted = coerceArray(plaintext, true); for (var i = 0; i < encrypted.length; i++) { if (this._remainingCounterIndex === 16) { this._remainingCounter = this._aes.encrypt(this._counter._counter); this._remainingCounterIndex = 0; this._counter.increment(); } encrypted[i] ^= this._remainingCounter[this._remainingCounterIndex++]; } return encrypted; } // Decryption is symetric ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt; /////////////////////// // Padding // See:https://tools.ietf.org/html/rfc2315 function pkcs7pad(data) { data = coerceArray(data, true); var padder = 16 - (data.length % 16); var result = createArray(data.length + padder); copyArray(data, result); for (var i = data.length; i < result.length; i++) { result[i] = padder; } return result; } function pkcs7strip(data) { data = coerceArray(data, true); if (data.length < 16) { throw new Error('PKCS#7 invalid length'); } var padder = data[data.length - 1]; if (padder > 16) { throw new Error('PKCS#7 padding byte out of range'); } var length = data.length - padder; for (var i = 0; i < padder; i++) { if (data[length + i] !== padder) { throw new Error('PKCS#7 invalid padding byte'); } } var result = createArray(length); copyArray(data, result, 0, 0, length); return result; } /////////////////////// // Exporting // The block cipher var aesjs = { AES: AES, Counter: Counter, ModeOfOperation: { ecb: ModeOfOperationECB, cbc: ModeOfOperationCBC, cfb: ModeOfOperationCFB, ofb: ModeOfOperationOFB, ctr: ModeOfOperationCTR }, utils: { hex: convertHex, utf8: convertUtf8 }, padding: { pkcs7: { pad: pkcs7pad, strip: pkcs7strip } }, _arrayTest: { coerceArray: coerceArray, createArray: createArray, copyArray: copyArray, } }; // node.js if (typeof exports !== 'undefined') { module.exports = aesjs // RequireJS/AMD // http://www.requirejs.org/docs/api.html // https://github.com/amdjs/amdjs-api/wiki/AMD } else if (typeof(define) === 'function' && define.amd) { define(aesjs); // Web Browsers } else { // If there was an existing library at "aesjs" make sure it's still available if (root.aesjs) { aesjs._aesjs = root.aesjs; } root.aesjs = aesjs; } })(this); },{}],8:[function(require,module,exports){ (function (module, exports) { 'use strict'; // Utils function assert (val, msg) { if (!val) throw new Error(msg || 'Assertion failed'); } // Could use `inherits` module, but don't want to move from single file // architecture yet. function inherits (ctor, superCtor) { ctor.super_ = superCtor; var TempCtor = function () {}; TempCtor.prototype = superCtor.prototype; ctor.prototype = new TempCtor(); ctor.prototype.constructor = ctor; } // BN function BN (number, base, endian) { if (BN.isBN(number)) { return number; } this.negative = 0; this.words = null; this.length = 0; // Reduction context this.red = null; if (number !== null) { if (base === 'le' || base === 'be') { endian = base; base = 10; } this._init(number || 0, base || 10, endian || 'be'); } } if (typeof module === 'object') { module.exports = BN; } else { exports.BN = BN; } BN.BN = BN; BN.wordSize = 26; var Buffer; try { Buffer = require('buffer').Buffer; } catch (e) { } BN.isBN = function isBN (num) { if (num instanceof BN) { return true; } return num !== null && typeof num === 'object' && num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); }; BN.max = function max (left, right) { if (left.cmp(right) > 0) return left; return right; }; BN.min = function min (left, right) { if (left.cmp(right) < 0) return left; return right; }; BN.prototype._init = function init (number, base, endian) { if (typeof number === 'number') { return this._initNumber(number, base, endian); } if (typeof number === 'object') { return this._initArray(number, base, endian); } if (base === 'hex') { base = 16; } assert(base === (base | 0) && base >= 2 && base <= 36); number = number.toString().replace(/\s+/g, ''); var start = 0; if (number[0] === '-') { start++; } if (base === 16) { this._parseHex(number, start); } else { this._parseBase(number, base, start); } if (number[0] === '-') { this.negative = 1; } this.strip(); if (endian !== 'le') return; this._initArray(this.toArray(), base, endian); }; BN.prototype._initNumber = function _initNumber (number, base, endian) { if (number < 0) { this.negative = 1; number = -number; } if (number < 0x4000000) { this.words = [ number & 0x3ffffff ]; this.length = 1; } else if (number < 0x10000000000000) { this.words = [ number & 0x3ffffff, (number / 0x4000000) & 0x3ffffff ]; this.length = 2; } else { assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) this.words = [ number & 0x3ffffff, (number / 0x4000000) & 0x3ffffff, 1 ]; this.length = 3; } if (endian !== 'le') return; // Reverse the bytes this._initArray(this.toArray(), base, endian); }; BN.prototype._initArray = function _initArray (number, base, endian) { // Perhaps a Uint8Array assert(typeof number.length === 'number'); if (number.length <= 0) { this.words = [ 0 ]; this.length = 1; return this; } this.length = Math.ceil(number.length / 3); this.words = new Array(this.length); for (var i = 0; i < this.length; i++) { this.words[i] = 0; } var j, w; var off = 0; if (endian === 'be') { for (i = number.length - 1, j = 0; i >= 0; i -= 3) { w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); this.words[j] |= (w << off) & 0x3ffffff; this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; off += 24; if (off >= 26) { off -= 26; j++; } } } else if (endian === 'le') { for (i = 0, j = 0; i < number.length; i += 3) { w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); this.words[j] |= (w << off) & 0x3ffffff; this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; off += 24; if (off >= 26) { off -= 26; j++; } } } return this.strip(); }; function parseHex (str, start, end) { var r = 0; var len = Math.min(str.length, end); for (var i = start; i < len; i++) { var c = str.charCodeAt(i) - 48; r <<= 4; // 'a' - 'f' if (c >= 49 && c <= 54) { r |= c - 49 + 0xa; // 'A' - 'F' } else if (c >= 17 && c <= 22) { r |= c - 17 + 0xa; // '0' - '9' } else { r |= c & 0xf; } } return r; } BN.prototype._parseHex = function _parseHex (number, start) { // Create possibly bigger array to ensure that it fits the number this.length = Math.ceil((number.length - start) / 6); this.words = new Array(this.length); for (var i = 0; i < this.length; i++) { this.words[i] = 0; } var j, w; // Scan 24-bit chunks and add them to the number var off = 0; for (i = number.length - 6, j = 0; i >= start; i -= 6) { w = parseHex(number, i, i + 6); this.words[j] |= (w << off) & 0x3ffffff; // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; off += 24; if (off >= 26) { off -= 26; j++; } } if (i + 6 !== start) { w = parseHex(number, start, i + 6); this.words[j] |= (w << off) & 0x3ffffff; this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; } this.strip(); }; function parseBase (str, start, end, mul) { var r = 0; var len = Math.min(str.length, end); for (var i = start; i < len; i++) { var c = str.charCodeAt(i) - 48; r *= mul; // 'a' if (c >= 49) { r += c - 49 + 0xa; // 'A' } else if (c >= 17) { r += c - 17 + 0xa; // '0' - '9' } else { r += c; } } return r; } BN.prototype._parseBase = function _parseBase (number, base, start) { // Initialize as zero this.words = [ 0 ]; this.length = 1; // Find length of limb in base for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { limbLen++; } limbLen--; limbPow = (limbPow / base) | 0; var total = number.length - start; var mod = total % limbLen; var end = Math.min(total, total - mod) + start; var word = 0; for (var i = start; i < end; i += limbLen) { word = parseBase(number, i, i + limbLen, base); this.imuln(limbPow); if (this.words[0] + word < 0x4000000) { this.words[0] += word; } else { this._iaddn(word); } } if (mod !== 0) { var pow = 1; word = parseBase(number, i, number.length, base); for (i = 0; i < mod; i++) { pow *= base; } this.imuln(pow); if (this.words[0] + word < 0x4000000) { this.words[0] += word; } else { this._iaddn(word); } } }; BN.prototype.copy = function copy (dest) { dest.words = new Array(this.length); for (var i = 0; i < this.length; i++) { dest.words[i] = this.words[i]; } dest.length = this.length; dest.negative = this.negative; dest.red = this.red; }; BN.prototype.clone = function clone () { var r = new BN(null); this.copy(r); return r; }; BN.prototype._expand = function _expand (size) { while (this.length < size) { this.words[this.length++] = 0; } return this; }; // Remove leading `0` from `this` BN.prototype.strip = function strip () { while (this.length > 1 && this.words[this.length - 1] === 0) { this.length--; } return this._normSign(); }; BN.prototype._normSign = function _normSign () { // -0 = 0 if (this.length === 1 && this.words[0] === 0) { this.negative = 0; } return this; }; BN.prototype.inspect = function inspect () { return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>'; }; /* var zeros = []; var groupSizes = []; var groupBases = []; var s = ''; var i = -1; while (++i < BN.wordSize) { zeros[i] = s; s += '0'; } groupSizes[0] = 0; groupSizes[1] = 0; groupBases[0] = 0; groupBases[1] = 0; var base = 2 - 1; while (++base < 36 + 1) { var groupSize = 0; var groupBase = 1; while (groupBase < (1 << BN.wordSize) / base) { groupBase *= base; groupSize += 1; } groupSizes[base] = groupSize; groupBases[base] = groupBase; } */ var zeros = [ '', '0', '00', '000', '0000', '00000', '000000', '0000000', '00000000', '000000000', '0000000000', '00000000000', '000000000000', '0000000000000', '00000000000000', '000000000000000', '0000000000000000', '00000000000000000', '000000000000000000', '0000000000000000000', '00000000000000000000', '000000000000000000000', '0000000000000000000000', '00000000000000000000000', '000000000000000000000000', '0000000000000000000000000' ]; var groupSizes = [ 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ]; var groupBases = [ 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 ]; BN.prototype.toString = function toString (base, padding) { base = base || 10; padding = padding | 0 || 1; var out; if (base === 16 || base === 'hex') { out = ''; var off = 0; var carry = 0; for (var i = 0; i < this.length; i++) { var w = this.words[i]; var word = (((w << off) | carry) & 0xffffff).toString(16); carry = (w >>> (24 - off)) & 0xffffff; if (carry !== 0 || i !== this.length - 1) { out = zeros[6 - word.length] + word + out; } else { out = word + out; } off += 2; if (off >= 26) { off -= 26; i--; } } if (carry !== 0) { out = carry.toString(16) + out; } while (out.length % padding !== 0) { out = '0' + out; } if (this.negative !== 0) { out = '-' + out; } return out; } if (base === (base | 0) && base >= 2 && base <= 36) { // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); var groupSize = groupSizes[base]; // var groupBase = Math.pow(base, groupSize); var groupBase = groupBases[base]; out = ''; var c = this.clone(); c.negative = 0; while (!c.isZero()) { var r = c.modn(groupBase).toString(base); c = c.idivn(groupBase); if (!c.isZero()) { out = zeros[groupSize - r.length] + r + out; } else { out = r + out; } } if (this.isZero()) { out = '0' + out; } while (out.length % padding !== 0) { out = '0' + out; } if (this.negative !== 0) { out = '-' + out; } return out; } assert(false, 'Base should be between 2 and 36'); }; BN.prototype.toNumber = function toNumber () { var ret = this.words[0]; if (this.length === 2) { ret += this.words[1] * 0x4000000; } else if (this.length === 3 && this.words[2] === 0x01) { // NOTE: at this stage it is known that the top bit is set ret += 0x10000000000000 + (this.words[1] * 0x4000000); } else if (this.length > 2) { assert(false, 'Number can only safely store up to 53 bits'); } return (this.negative !== 0) ? -ret : ret; }; BN.prototype.toJSON = function toJSON () { return this.toString(16); }; BN.prototype.toBuffer = function toBuffer (endian, length) { assert(typeof Buffer !== 'undefined'); return this.toArrayLike(Buffer, endian, length); }; BN.prototype.toArray = function toArray (endian, length) { return this.toArrayLike(Array, endian, length); }; BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { var byteLength = this.byteLength(); var reqLength = length || Math.max(1, byteLength); assert(byteLength <= reqLength, 'byte array longer than desired length'); assert(reqLength > 0, 'Requested array length <= 0'); this.strip(); var littleEndian = endian === 'le'; var res = new ArrayType(reqLength); var b, i; var q = this.clone(); if (!littleEndian) { // Assume big-endian for (i = 0; i < reqLength - byteLength; i++) { res[i] = 0; } for (i = 0; !q.isZero(); i++) { b = q.andln(0xff); q.iushrn(8); res[reqLength - i - 1] = b; } } else { for (i = 0; !q.isZero(); i++) { b = q.andln(0xff); q.iushrn(8); res[i] = b; } for (; i < reqLength; i++) { res[i] = 0; } } return res; }; if (Math.clz32) { BN.prototype._countBits = function _countBits (w) { return 32 - Math.clz32(w); }; } else { BN.prototype._countBits = function _countBits (w) { var t = w; var r = 0; if (t >= 0x1000) { r += 13; t >>>= 13; } if (t >= 0x40) { r += 7; t >>>= 7; } if (t >= 0x8) { r += 4; t >>>= 4; } if (t >= 0x02) { r += 2; t >>>= 2; } return r + t; }; } BN.prototype._zeroBits = function _zeroBits (w) { // Short-cut if (w === 0) return 26; var t = w; var r = 0; if ((t & 0x1fff) === 0) { r += 13; t >>>= 13; } if ((t & 0x7f) === 0) { r += 7; t >>>= 7; } if ((t & 0xf) === 0) { r += 4; t >>>= 4; } if ((t & 0x3) === 0) { r += 2; t >>>= 2; } if ((t & 0x1) === 0) { r++; } return r; }; // Return number of used bits in a BN BN.prototype.bitLength = function bitLength () { var w = this.words[this.length - 1]; var hi = this._countBits(w); return (this.length - 1) * 26 + hi; }; function toBitArray (num) { var w = new Array(num.bitLength()); for (var bit = 0; bit < w.length; bit++) { var off = (bit / 26) | 0; var wbit = bit % 26; w[bit] = (num.words[off] & (1 << wbit)) >>> wbit; } return w; } // Number of trailing zero bits BN.prototype.zeroBits = function zeroBits () { if (this.isZero()) return 0; var r = 0; for (var i = 0; i < this.length; i++) { var b = this._zeroBits(this.words[i]); r += b; if (b !== 26) break; } return r; }; BN.prototype.byteLength = function byteLength () { return Math.ceil(this.bitLength() / 8); }; BN.prototype.toTwos = function toTwos (width) { if (this.negative !== 0) { return this.abs().inotn(width).iaddn(1); } return this.clone(); }; BN.prototype.fromTwos = function fromTwos (width) { if (this.testn(width - 1)) { return this.notn(width).iaddn(1).ineg(); } return this.clone(); }; BN.prototype.isNeg = function isNeg () { return this.negative !== 0; }; // Return negative clone of `this` BN.prototype.neg = function neg () { return this.clone().ineg(); }; BN.prototype.ineg = function ineg () { if (!this.isZero()) { this.negative ^= 1; } return this; }; // Or `num` with `this` in-place BN.prototype.iuor = function iuor (num) { while (this.length < num.length) { this.words[this.length++] = 0; } for (var i = 0; i < num.length; i++) { this.words[i] = this.words[i] | num.words[i]; } return this.strip(); }; BN.prototype.ior = function ior (num) { assert((this.negative | num.negative) === 0); return this.iuor(num); }; // Or `num` with `this` BN.prototype.or = function or (num) { if (this.length > num.length) return this.clone().ior(num); return num.clone().ior(this); }; BN.prototype.uor = function uor (num) { if (this.length > num.length) return this.clone().iuor(num); return num.clone().iuor(this); }; // And `num` with `this` in-place BN.prototype.iuand = function iuand (num) { // b = min-length(num, this) var b; if (this.length > num.length) { b = num; } else { b = this; } for (var i = 0; i < b.length; i++) { this.words[i] = this.words[i] & num.words[i]; } this.length = b.length; return this.strip(); }; BN.prototype.iand = function iand (num) { assert((this.negative | num.negative) === 0); return this.iuand(num); }; // And `num` with `this` BN.prototype.and = function and (num) { if (this.length > num.length) return this.clone().iand(num); return num.clone().iand(this); }; BN.prototype.uand = function uand (num) { if (this.length > num.length) return this.clone().iuand(num); return num.clone().iuand(this); }; // Xor `num` with `this` in-place BN.prototype.iuxor = function iuxor (num) { // a.length > b.length var a; var b; if (this.length > num.length) { a = this; b = num; } else { a = num; b = this; } for (var i = 0; i < b.length; i++) { this.words[i] = a.words[i] ^ b.words[i]; } if (this !== a) { for (; i < a.length; i++) { this.words[i] = a.words[i]; } } this.length = a.length; return this.strip(); }; BN.prototype.ixor = function ixor (num) { assert((this.negative | num.negative) === 0); return this.iuxor(num); }; // Xor `num` with `this` BN.prototype.xor = function xor (num) { if (this.length > num.length) return this.clone().ixor(num); return num.clone().ixor(this); }; BN.prototype.uxor = function uxor (num) { if (this.length > num.length) return this.clone().iuxor(num); return num.clone().iuxor(this); }; // Not ``this`` with ``width`` bitwidth BN.prototype.inotn = function inotn (width) { assert(typeof width === 'number' && width >= 0); var bytesNeeded = Math.ceil(width / 26) | 0; var bitsLeft = width % 26; // Extend the buffer with leading zeroes this._expand(bytesNeeded); if (bitsLeft > 0) { bytesNeeded--; } // Handle complete words for (var i = 0; i < bytesNeeded; i++) { this.words[i] = ~this.words[i] & 0x3ffffff; } // Handle the residue if (bitsLeft > 0) { this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); } // And remove leading zeroes return this.strip(); }; BN.prototype.notn = function notn (width) { return this.clone().inotn(width); }; // Set `bit` of `this` BN.prototype.setn = function setn (bit, val) { assert(typeof bit === 'number' && bit >= 0); var off = (bit / 26) | 0; var wbit = bit % 26; this._expand(off + 1); if (val) { this.words[off] = this.words[off] | (1 << wbit); } else { this.words[off] = this.words[off] & ~(1 << wbit); } return this.strip(); }; // Add `num` to `this` in-place BN.prototype.iadd = function iadd (num) { var r; // negative + positive if (this.negative !== 0 && num.negative === 0) { this.negative = 0; r = this.isub(num); this.negative ^= 1; return this._normSign(); // positive + negative } else if (this.negative === 0 && num.negative !== 0) { num.negative = 0; r = this.isub(num); num.negative = 1; return r._normSign(); } // a.length > b.length var a, b; if (this.length > num.length) { a = this; b = num; } else { a = num; b = this; } var carry = 0; for (var i = 0; i < b.length; i++) { r = (a.words[i] | 0) + (b.words[i] | 0) + carry; this.words[i] = r & 0x3ffffff; carry = r >>> 26; } for (; carry !== 0 && i < a.length; i++) { r = (a.words[i] | 0) + carry; this.words[i] = r & 0x3ffffff; carry = r >>> 26; } this.length = a.length; if (carry !== 0) { this.words[this.length] = carry; this.length++; // Copy the rest of the words } else if (a !== this) { for (; i < a.length; i++) { this.words[i] = a.words[i]; } } return this; }; // Add `num` to `this` BN.prototype.add = function add (num) { var res; if (num.negative !== 0 && this.negative === 0) { num.negative = 0; res = this.sub(num); num.negative ^= 1; return res; } else if (num.negative === 0 && this.negative !== 0) { this.negative = 0; res = num.sub(this); this.negative = 1; return res; } if (this.length > num.length) return this.clone().iadd(num); return num.clone().iadd(this); }; // Subtract `num` from `this` in-place BN.prototype.isub = function isub (num) { // this - (-num) = this + num if (num.negative !== 0) { num.negative = 0; var r = this.iadd(num); num.negative = 1; return r._normSign(); // -this - num = -(this + num) } else if (this.negative !== 0) { this.negative = 0; this.iadd(num); this.negative = 1; return this._normSign(); } // At this point both numbers are positive var cmp = this.cmp(num); // Optimization - zeroify if (cmp === 0) { this.negative = 0; this.length = 1; this.words[0] = 0; return this; } // a > b var a, b; if (cmp > 0) { a = this; b = num; } else { a = num; b = this; } var carry = 0; for (var i = 0; i < b.length; i++) { r = (a.words[i] | 0) - (b.words[i] | 0) + carry; carry = r >> 26; this.words[i] = r & 0x3ffffff; } for (; carry !== 0 && i < a.length; i++) { r = (a.words[i] | 0) + carry; carry = r >> 26; this.words[i] = r & 0x3ffffff; } // Copy rest of the words if (carry === 0 && i < a.length && a !== this) { for (; i < a.length; i++) { this.words[i] = a.words[i]; } } this.length = Math.max(this.length, i); if (a !== this) { this.negative = 1; } return this.strip(); }; // Subtract `num` from `this` BN.prototype.sub = function sub (num) { return this.clone().isub(num); }; function smallMulTo (self, num, out) { out.negative = num.negative ^ self.negative; var len = (self.length + num.length) | 0; out.length = len; len = (len - 1) | 0; // Peel one iteration (compiler can't do it, because of code complexity) var a = self.words[0] | 0; var b = num.words[0] | 0; var r = a * b; var lo = r & 0x3ffffff; var carry = (r / 0x4000000) | 0; out.words[0] = lo; for (var k = 1; k < len; k++) { // Sum all words with the same `i + j = k` and accumulate `ncarry`, // note that ncarry could be >= 0x3ffffff var ncarry = carry >>> 26; var rword = carry & 0x3ffffff; var maxJ = Math.min(k, num.length - 1); for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { var i = (k - j) | 0; a = self.words[i] | 0; b = num.words[j] | 0; r = a * b + rword; ncarry += (r / 0x4000000) | 0; rword = r & 0x3ffffff; } out.words[k] = rword | 0; carry = ncarry | 0; } if (carry !== 0) { out.words[k] = carry | 0; } else { out.length--; } return out.strip(); } // TODO(indutny): it may be reasonable to omit it for users who don't need // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit // multiplication (like elliptic secp256k1). var comb10MulTo = function comb10MulTo (self, num, out) { var a = self.words; var b = num.words; var o = out.words; var c = 0; var lo; var mid; var hi; var a0 = a[0] | 0; var al0 = a0 & 0x1fff; var ah0 = a0 >>> 13; var a1 = a[1] | 0; var al1 = a1 & 0x1fff; var ah1 = a1 >>> 13; var a2 = a[2] | 0; var al2 = a2 & 0x1fff; var ah2 = a2 >>> 13; var a3 = a[3] | 0; var al3 = a3 & 0x1fff; var ah3 = a3 >>> 13; var a4 = a[4] | 0; var al4 = a4 & 0x1fff; var ah4 = a4 >>> 13; var a5 = a[5] | 0; var al5 = a5 & 0x1fff; var ah5 = a5 >>> 13; var a6 = a[6] | 0; var al6 = a6 & 0x1fff; var ah6 = a6 >>> 13; var a7 = a[7] | 0; var al7 = a7 & 0x1fff; var ah7 = a7 >>> 13; var a8 = a[8] | 0; var al8 = a8 & 0x1fff; var ah8 = a8 >>> 13; var a9 = a[9] | 0; var al9 = a9 & 0x1fff; var ah9 = a9 >>> 13; var b0 = b[0] | 0; var bl0 = b0 & 0x1fff; var bh0 = b0 >>> 13; var b1 = b[1] | 0; var bl1 = b1 & 0x1fff; var bh1 = b1 >>> 13; var b2 = b[2] | 0; var bl2 = b2 & 0x1fff; var bh2 = b2 >>> 13; var b3 = b[3] | 0; var bl3 = b3 & 0x1fff; var bh3 = b3 >>> 13; var b4 = b[4] | 0; var bl4 = b4 & 0x1fff; var bh4 = b4 >>> 13; var b5 = b[5] | 0; var bl5 = b5 & 0x1fff; var bh5 = b5 >>> 13; var b6 = b[6] | 0; var bl6 = b6 & 0x1fff; var bh6 = b6 >>> 13; var b7 = b[7] | 0; var bl7 = b7 & 0x1fff; var bh7 = b7 >>> 13; var b8 = b[8] | 0; var bl8 = b8 & 0x1fff; var bh8 = b8 >>> 13; var b9 = b[9] | 0; var bl9 = b9 & 0x1fff; var bh9 = b9 >>> 13; out.negative = self.negative ^ num.negative; out.length = 19; /* k = 0 */ lo = Math.imul(al0, bl0); mid = Math.imul(al0, bh0); mid = (mid + Math.imul(ah0, bl0)) | 0; hi = Math.imul(ah0, bh0); var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; w0 &= 0x3ffffff; /* k = 1 */ lo = Math.imul(al1, bl0); mid = Math.imul(al1, bh0); mid = (mid + Math.imul(ah1, bl0)) | 0; hi = Math.imul(ah1, bh0); lo = (lo + Math.imul(al0, bl1)) | 0; mid = (mid + Math.imul(al0, bh1)) | 0; mid = (mid + Math.imul(ah0, bl1)) | 0; hi = (hi + Math.imul(ah0, bh1)) | 0; var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; w1 &= 0x3ffffff; /* k = 2 */ lo = Math.imul(al2, bl0); mid = Math.imul(al2, bh0); mid = (mid + Math.imul(ah2, bl0)) | 0; hi = Math.imul(ah2, bh0); lo = (lo + Math.imul(al1, bl1)) | 0; mid = (mid + Math.imul(al1, bh1)) | 0; mid = (mid + Math.imul(ah1, bl1)) | 0; hi = (hi + Math.imul(ah1, bh1)) | 0; lo = (lo + Math.imul(al0, bl2)) | 0; mid = (mid + Math.imul(al0, bh2)) | 0; mid = (mid + Math.imul(ah0, bl2)) | 0; hi = (hi + Math.imul(ah0, bh2)) | 0; var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; w2 &= 0x3ffffff; /* k = 3 */ lo = Math.imul(al3, bl0); mid = Math.imul(al3, bh0); mid = (mid + Math.imul(ah3, bl0)) | 0; hi = Math.imul(ah3, bh0); lo = (lo + Math.imul(al2, bl1)) | 0; mid = (mid + Math.imul(al2, bh1)) | 0; mid = (mid + Math.imul(ah2, bl1)) | 0; hi = (hi + Math.imul(ah2, bh1)) | 0; lo = (lo + Math.imul(al1, bl2)) | 0; mid = (mid + Math.imul(al1, bh2)) | 0; mid = (mid + Math.imul(ah1, bl2)) | 0; hi = (hi + Math.imul(ah1, bh2)) | 0; lo = (lo + Math.imul(al0, bl3)) | 0; mid = (mid + Math.imul(al0, bh3)) | 0; mid = (mid + Math.imul(ah0, bl3)) | 0; hi = (hi + Math.imul(ah0, bh3)) | 0; var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; w3 &= 0x3ffffff; /* k = 4 */ lo = Math.imul(al4, bl0); mid = Math.imul(al4, bh0); mid = (mid + Math.imul(ah4, bl0)) | 0; hi = Math.imul(ah4, bh0); lo = (lo + Math.imul(al3, bl1)) | 0; mid = (mid + Math.imul(al3, bh1)) | 0; mid = (mid + Math.imul(ah3, bl1)) | 0; hi = (hi + Math.imul(ah3, bh1)) | 0; lo = (lo + Math.imul(al2, bl2)) | 0; mid = (mid + Math.imul(al2, bh2)) | 0; mid = (mid + Math.imul(ah2, bl2)) | 0; hi = (hi + Math.imul(ah2, bh2)) | 0; lo = (lo + Math.imul(al1, bl3)) | 0; mid = (mid + Math.imul(al1, bh3)) | 0; mid = (mid + Math.imul(ah1, bl3)) | 0; hi = (hi + Math.imul(ah1, bh3)) | 0; lo = (lo + Math.imul(al0, bl4)) | 0; mid = (mid + Math.imul(al0, bh4)) | 0; mid = (mid + Math.imul(ah0, bl4)) | 0; hi = (hi + Math.imul(ah0, bh4)) | 0; var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; w4 &= 0x3ffffff; /* k = 5 */ lo = Math.imul(al5, bl0); mid = Math.imul(al5, bh0); mid = (mid + Math.imul(ah5, bl0)) | 0; hi = Math.imul(ah5, bh0); lo = (lo + Math.imul(al4, bl1)) | 0; mid = (mid + Math.imul(al4, bh1)) | 0; mid = (mid + Math.imul(ah4, bl1)) | 0; hi = (hi + Math.imul(ah4, bh1)) | 0; lo = (lo + Math.imul(al3, bl2)) | 0; mid = (mid + Math.imul(al3, bh2)) | 0; mid = (mid + Math.imul(ah3, bl2)) | 0; hi = (hi + Math.imul(ah3, bh2)) | 0; lo = (lo + Math.imul(al2, bl3)) | 0; mid = (mid + Math.imul(al2, bh3)) | 0; mid = (mid + Math.imul(ah2, bl3)) | 0; hi = (hi + Math.imul(ah2, bh3)) | 0; lo = (lo + Math.imul(al1, bl4)) | 0; mid = (mid + Math.imul(al1, bh4)) | 0; mid = (mid + Math.imul(ah1, bl4)) | 0; hi = (hi + Math.imul(ah1, bh4)) | 0; lo = (lo + Math.imul(al0, bl5)) | 0; mid = (mid + Math.imul(al0, bh5)) | 0; mid = (mid + Math.imul(ah0, bl5)) | 0; hi = (hi + Math.imul(ah0, bh5)) | 0; var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; w5 &= 0x3ffffff; /* k = 6 */ lo = Math.imul(al6, bl0); mid = Math.imul(al6, bh0); mid = (mid + Math.imul(ah6, bl0)) | 0; hi = Math.imul(ah6, bh0); lo = (lo + Math.imul(al5, bl1)) | 0; mid = (mid + Math.imul(al5, bh1)) | 0; mid = (mid + Math.imul(ah5, bl1)) | 0; hi = (hi + Math.imul(ah5, bh1)) | 0; lo = (lo + Math.imul(al4, bl2)) | 0; mid = (mid + Math.imul(al4, bh2)) | 0; mid = (mid + Math.imul(ah4, bl2)) | 0; hi = (hi + Math.imul(ah4, bh2)) | 0; lo = (lo + Math.imul(al3, bl3)) | 0; mid = (mid + Math.imul(al3, bh3)) | 0; mid = (mid + Math.imul(ah3, bl3)) | 0; hi = (hi + Math.imul(ah3, bh3)) | 0; lo = (lo + Math.imul(al2, bl4)) | 0; mid = (mid + Math.imul(al2, bh4)) | 0; mid = (mid + Math.imul(ah2, bl4)) | 0; hi = (hi + Math.imul(ah2, bh4)) | 0; lo = (lo + Math.imul(al1, bl5)) | 0; mid = (mid + Math.imul(al1, bh5)) | 0; mid = (mid + Math.imul(ah1, bl5)) | 0; hi = (hi + Math.imul(ah1, bh5)) | 0; lo = (lo + Math.imul(al0, bl6)) | 0; mid = (mid + Math.imul(al0, bh6)) | 0; mid = (mid + Math.imul(ah0, bl6)) | 0; hi = (hi + Math.imul(ah0, bh6)) | 0; var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; w6 &= 0x3ffffff; /* k = 7 */ lo = Math.imul(al7, bl0); mid = Math.imul(al7, bh0); mid = (mid + Math.imul(ah7, bl0)) | 0; hi = Math.imul(ah7, bh0); lo = (lo + Math.imul(al6, bl1)) | 0; mid = (mid + Math.imul(al6, bh1)) | 0; mid = (mid + Math.imul(ah6, bl1)) | 0; hi = (hi + Math.imul(ah6, bh1)) | 0; lo = (lo + Math.imul(al5, bl2)) | 0; mid = (mid + Math.imul(al5, bh2)) | 0; mid = (mid + Math.imul(ah5, bl2)) | 0; hi = (hi + Math.imul(ah5, bh2)) | 0; lo = (lo + Math.imul(al4, bl3)) | 0; mid = (mid + Math.imul(al4, bh3)) | 0; mid = (mid + Math.imul(ah4, bl3)) | 0; hi = (hi + Math.imul(ah4, bh3)) | 0; lo = (lo + Math.imul(al3, bl4)) | 0; mid = (mid + Math.imul(al3, bh4)) | 0; mid = (mid + Math.imul(ah3, bl4)) | 0; hi = (hi + Math.imul(ah3, bh4)) | 0; lo = (lo + Math.imul(al2, bl5)) | 0; mid = (mid + Math.imul(al2, bh5)) | 0; mid = (mid + Math.imul(ah2, bl5)) | 0; hi = (hi + Math.imul(ah2, bh5)) | 0; lo = (lo + Math.imul(al1, bl6)) | 0; mid = (mid + Math.imul(al1, bh6)) | 0; mid = (mid + Math.imul(ah1, bl6)) | 0; hi = (hi + Math.imul(ah1, bh6)) | 0; lo = (lo + Math.imul(al0, bl7)) | 0; mid = (mid + Math.imul(al0, bh7)) | 0; mid = (mid + Math.imul(ah0, bl7)) | 0; hi = (hi + Math.imul(ah0, bh7)) | 0; var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; w7 &= 0x3ffffff; /* k = 8 */ lo = Math.imul(al8, bl0); mid = Math.imul(al8, bh0); mid = (mid + Math.imul(ah8, bl0)) | 0; hi = Math.imul(ah8, bh0); lo = (lo + Math.imul(al7, bl1)) | 0; mid = (mid + Math.imul(al7, bh1)) | 0; mid = (mid + Math.imul(ah7, bl1)) | 0; hi = (hi + Math.imul(ah7, bh1)) | 0; lo = (lo + Math.imul(al6, bl2)) | 0; mid = (mid + Math.imul(al6, bh2)) | 0; mid = (mid + Math.imul(ah6, bl2)) | 0; hi = (hi + Math.imul(ah6, bh2)) | 0; lo = (lo + Math.imul(al5, bl3)) | 0; mid = (mid + Math.imul(al5, bh3)) | 0; mid = (mid + Math.imul(ah5, bl3)) | 0; hi = (hi + Math.imul(ah5, bh3)) | 0; lo = (lo + Math.imul(al4, bl4)) | 0; mid = (mid + Math.imul(al4, bh4)) | 0; mid = (mid + Math.imul(ah4, bl4)) | 0; hi = (hi + Math.imul(ah4, bh4)) | 0; lo = (lo + Math.imul(al3, bl5)) | 0; mid = (mid + Math.imul(al3, bh5)) | 0; mid = (mid + Math.imul(ah3, bl5)) | 0; hi = (hi + Math.imul(ah3, bh5)) | 0; lo = (lo + Math.imul(al2, bl6)) | 0; mid = (mid + Math.imul(al2, bh6)) | 0; mid = (mid + Math.imul(ah2, bl6)) | 0; hi = (hi + Math.imul(ah2, bh6)) | 0; lo = (lo + Math.imul(al1, bl7)) | 0; mid = (mid + Math.imul(al1, bh7)) | 0; mid = (mid + Math.imul(ah1, bl7)) | 0; hi = (hi + Math.imul(ah1, bh7)) | 0; lo = (lo + Math.imul(al0, bl8)) | 0; mid = (mid + Math.imul(al0, bh8)) | 0; mid = (mid + Math.imul(ah0, bl8)) | 0; hi = (hi + Math.imul(ah0, bh8)) | 0; var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; w8 &= 0x3ffffff; /* k = 9 */ lo = Math.imul(al9, bl0); mid = Math.imul(al9, bh0); mid = (mid + Math.imul(ah9, bl0)) | 0; hi = Math.imul(ah9, bh0); lo = (lo + Math.imul(al8, bl1)) | 0; mid = (mid + Math.imul(al8, bh1)) | 0; mid = (mid + Math.imul(ah8, bl1)) | 0; hi = (hi + Math.imul(ah8, bh1)) | 0; lo = (lo + Math.imul(al7, bl2)) | 0; mid = (mid + Math.imul(al7, bh2)) | 0; mid = (mid + Math.imul(ah7, bl2)) | 0; hi = (hi + Math.imul(ah7, bh2)) | 0; lo = (lo + Math.imul(al6, bl3)) | 0; mid = (mid + Math.imul(al6, bh3)) | 0; mid = (mid + Math.imul(ah6, bl3)) | 0; hi = (hi + Math.imul(ah6, bh3)) | 0; lo = (lo + Math.imul(al5, bl4)) | 0; mid = (mid + Math.imul(al5, bh4)) | 0; mid = (mid + Math.imul(ah5, bl4)) | 0; hi = (hi + Math.imul(ah5, bh4)) | 0; lo = (lo + Math.imul(al4, bl5)) | 0; mid = (mid + Math.imul(al4, bh5)) | 0; mid = (mid + Math.imul(ah4, bl5)) | 0; hi = (hi + Math.imul(ah4, bh5)) | 0; lo = (lo + Math.imul(al3, bl6)) | 0; mid = (mid + Math.imul(al3, bh6)) | 0; mid = (mid + Math.imul(ah3, bl6)) | 0; hi = (hi + Math.imul(ah3, bh6)) | 0; lo = (lo + Math.imul(al2, bl7)) | 0; mid = (mid + Math.imul(al2, bh7)) | 0; mid = (mid + Math.imul(ah2, bl7)) | 0; hi = (hi + Math.imul(ah2, bh7)) | 0; lo = (lo + Math.imul(al1, bl8)) | 0; mid = (mid + Math.imul(al1, bh8)) | 0; mid = (mid + Math.imul(ah1, bl8)) | 0; hi = (hi + Math.imul(ah1, bh8)) | 0; lo = (lo + Math.imul(al0, bl9)) | 0; mid = (mid + Math.imul(al0, bh9)) | 0; mid = (mid + Math.imul(ah0, bl9)) | 0; hi = (hi + Math.imul(ah0, bh9)) | 0; var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; w9 &= 0x3ffffff; /* k = 10 */ lo = Math.imul(al9, bl1); mid = Math.imul(al9, bh1); mid = (mid + Math.imul(ah9, bl1)) | 0; hi = Math.imul(ah9, bh1); lo = (lo + Math.imul(al8, bl2)) | 0; mid = (mid + Math.imul(al8, bh2)) | 0; mid = (mid + Math.imul(ah8, bl2)) | 0; hi = (hi + Math.imul(ah8, bh2)) | 0; lo = (lo + Math.imul(al7, bl3)) | 0; mid = (mid + Math.imul(al7, bh3)) | 0; mid = (mid + Math.imul(ah7, bl3)) | 0; hi = (hi + Math.imul(ah7, bh3)) | 0; lo = (lo + Math.imul(al6, bl4)) | 0; mid = (mid + Math.imul(al6, bh4)) | 0; mid = (mid + Math.imul(ah6, bl4)) | 0; hi = (hi + Math.imul(ah6, bh4)) | 0; lo = (lo + Math.imul(al5, bl5)) | 0; mid = (mid + Math.imul(al5, bh5)) | 0; mid = (mid + Math.imul(ah5, bl5)) | 0; hi = (hi + Math.imul(ah5, bh5)) | 0; lo = (lo + Math.imul(al4, bl6)) | 0; mid = (mid + Math.imul(al4, bh6)) | 0; mid = (mid + Math.imul(ah4, bl6)) | 0; hi = (hi + Math.imul(ah4, bh6)) | 0; lo = (lo + Math.imul(al3, bl7)) | 0; mid = (mid + Math.imul(al3, bh7)) | 0; mid = (mid + Math.imul(ah3, bl7)) | 0; hi = (hi + Math.imul(ah3, bh7)) | 0; lo = (lo + Math.imul(al2, bl8)) | 0; mid = (mid + Math.imul(al2, bh8)) | 0; mid = (mid + Math.imul(ah2, bl8)) | 0; hi = (hi + Math.imul(ah2, bh8)) | 0; lo = (lo + Math.imul(al1, bl9)) | 0; mid = (mid + Math.imul(al1, bh9)) | 0; mid = (mid + Math.imul(ah1, bl9)) | 0; hi = (hi + Math.imul(ah1, bh9)) | 0; var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; w10 &= 0x3ffffff; /* k = 11 */ lo = Math.imul(al9, bl2); mid = Math.imul(al9, bh2); mid = (mid + Math.imul(ah9, bl2)) | 0; hi = Math.imul(ah9, bh2); lo = (lo + Math.imul(al8, bl3)) | 0; mid = (mid + Math.imul(al8, bh3)) | 0; mid = (mid + Math.imul(ah8, bl3)) | 0; hi = (hi + Math.imul(ah8, bh3)) | 0; lo = (lo + Math.imul(al7, bl4)) | 0; mid = (mid + Math.imul(al7, bh4)) | 0; mid = (mid + Math.imul(ah7, bl4)) | 0; hi = (hi + Math.imul(ah7, bh4)) | 0; lo = (lo + Math.imul(al6, bl5)) | 0; mid = (mid + Math.imul(al6, bh5)) | 0; mid = (mid + Math.imul(ah6, bl5)) | 0; hi = (hi + Math.imul(ah6, bh5)) | 0; lo = (lo + Math.imul(al5, bl6)) | 0; mid = (mid + Math.imul(al5, bh6)) | 0; mid = (mid + Math.imul(ah5, bl6)) | 0; hi = (hi + Math.imul(ah5, bh6)) | 0; lo = (lo + Math.imul(al4, bl7)) | 0; mid = (mid + Math.imul(al4, bh7)) | 0; mid = (mid + Math.imul(ah4, bl7)) | 0; hi = (hi + Math.imul(ah4, bh7)) | 0; lo = (lo + Math.imul(al3, bl8)) | 0; mid = (mid + Math.imul(al3, bh8)) | 0; mid = (mid + Math.imul(ah3, bl8)) | 0; hi = (hi + Math.imul(ah3, bh8)) | 0; lo = (lo + Math.imul(al2, bl9)) | 0; mid = (mid + Math.imul(al2, bh9)) | 0; mid = (mid + Math.imul(ah2, bl9)) | 0; hi = (hi + Math.imul(ah2, bh9)) | 0; var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; w11 &= 0x3ffffff; /* k = 12 */ lo = Math.imul(al9, bl3); mid = Math.imul(al9, bh3); mid = (mid + Math.imul(ah9, bl3)) | 0; hi = Math.imul(ah9, bh3); lo = (lo + Math.imul(al8, bl4)) | 0; mid = (mid + Math.imul(al8, bh4)) | 0; mid = (mid + Math.imul(ah8, bl4)) | 0; hi = (hi + Math.imul(ah8, bh4)) | 0; lo = (lo + Math.imul(al7, bl5)) | 0; mid = (mid + Math.imul(al7, bh5)) | 0; mid = (mid + Math.imul(ah7, bl5)) | 0; hi = (hi + Math.imul(ah7, bh5)) | 0; lo = (lo + Math.imul(al6, bl6)) | 0; mid = (mid + Math.imul(al6, bh6)) | 0; mid = (mid + Math.imul(ah6, bl6)) | 0; hi = (hi + Math.imul(ah6, bh6)) | 0; lo = (lo + Math.imul(al5, bl7)) | 0; mid = (mid + Math.imul(al5, bh7)) | 0; mid = (mid + Math.imul(ah5, bl7)) | 0; hi = (hi + Math.imul(ah5, bh7)) | 0; lo = (lo + Math.imul(al4, bl8)) | 0; mid = (mid + Math.imul(al4, bh8)) | 0; mid = (mid + Math.imul(ah4, bl8)) | 0; hi = (hi + Math.imul(ah4, bh8)) | 0; lo = (lo + Math.imul(al3, bl9)) | 0; mid = (mid + Math.imul(al3, bh9)) | 0; mid = (mid + Math.imul(ah3, bl9)) | 0; hi = (hi + Math.imul(ah3, bh9)) | 0; var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; w12 &= 0x3ffffff; /* k = 13 */ lo = Math.imul(al9, bl4); mid = Math.imul(al9, bh4); mid = (mid + Math.imul(ah9, bl4)) | 0; hi = Math.imul(ah9, bh4); lo = (lo + Math.imul(al8, bl5)) | 0; mid = (mid + Math.imul(al8, bh5)) | 0; mid = (mid + Math.imul(ah8, bl5)) | 0; hi = (hi + Math.imul(ah8, bh5)) | 0; lo = (lo + Math.imul(al7, bl6)) | 0; mid = (mid + Math.imul(al7, bh6)) | 0; mid = (mid + Math.imul(ah7, bl6)) | 0; hi = (hi + Math.imul(ah7, bh6)) | 0; lo = (lo + Math.imul(al6, bl7)) | 0; mid = (mid + Math.imul(al6, bh7)) | 0; mid = (mid + Math.imul(ah6, bl7)) | 0; hi = (hi + Math.imul(ah6, bh7)) | 0; lo = (lo + Math.imul(al5, bl8)) | 0; mid = (mid + Math.imul(al5, bh8)) | 0; mid = (mid + Math.imul(ah5, bl8)) | 0; hi = (hi + Math.imul(ah5, bh8)) | 0; lo = (lo + Math.imul(al4, bl9)) | 0; mid = (mid + Math.imul(al4, bh9)) | 0; mid = (mid + Math.imul(ah4, bl9)) | 0; hi = (hi + Math.imul(ah4, bh9)) | 0; var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; w13 &= 0x3ffffff; /* k = 14 */ lo = Math.imul(al9, bl5); mid = Math.imul(al9, bh5); mid = (mid + Math.imul(ah9, bl5)) | 0; hi = Math.imul(ah9, bh5); lo = (lo + Math.imul(al8, bl6)) | 0; mid = (mid + Math.imul(al8, bh6)) | 0; mid = (mid + Math.imul(ah8, bl6)) | 0; hi = (hi + Math.imul(ah8, bh6)) | 0; lo = (lo + Math.imul(al7, bl7)) | 0; mid = (mid + Math.imul(al7, bh7)) | 0; mid = (mid + Math.imul(ah7, bl7)) | 0; hi = (hi + Math.imul(ah7, bh7)) | 0; lo = (lo + Math.imul(al6, bl8)) | 0; mid = (mid + Math.imul(al6, bh8)) | 0; mid = (mid + Math.imul(ah6, bl8)) | 0; hi = (hi + Math.imul(ah6, bh8)) | 0; lo = (lo + Math.imul(al5, bl9)) | 0; mid = (mid + Math.imul(al5, bh9)) | 0; mid = (mid + Math.imul(ah5, bl9)) | 0; hi = (hi + Math.imul(ah5, bh9)) | 0; var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; w14 &= 0x3ffffff; /* k = 15 */ lo = Math.imul(al9, bl6); mid = Math.imul(al9, bh6); mid = (mid + Math.imul(ah9, bl6)) | 0; hi = Math.imul(ah9, bh6); lo = (lo + Math.imul(al8, bl7)) | 0; mid = (mid + Math.imul(al8, bh7)) | 0; mid = (mid + Math.imul(ah8, bl7)) | 0; hi = (hi + Math.imul(ah8, bh7)) | 0; lo = (lo + Math.imul(al7, bl8)) | 0; mid = (mid + Math.imul(al7, bh8)) | 0; mid = (mid + Math.imul(ah7, bl8)) | 0; hi = (hi + Math.imul(ah7, bh8)) | 0; lo = (lo + Math.imul(al6, bl9)) | 0; mid = (mid + Math.imul(al6, bh9)) | 0; mid = (mid + Math.imul(ah6, bl9)) | 0; hi = (hi + Math.imul(ah6, bh9)) | 0; var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; w15 &= 0x3ffffff; /* k = 16 */ lo = Math.imul(al9, bl7); mid = Math.imul(al9, bh7); mid = (mid + Math.imul(ah9, bl7)) | 0; hi = Math.imul(ah9, bh7); lo = (lo + Math.imul(al8, bl8)) | 0; mid = (mid + Math.imul(al8, bh8)) | 0; mid = (mid + Math.imul(ah8, bl8)) | 0; hi = (hi + Math.imul(ah8, bh8)) | 0; lo = (lo + Math.imul(al7, bl9)) | 0; mid = (mid + Math.imul(al7, bh9)) | 0; mid = (mid + Math.imul(ah7, bl9)) | 0; hi = (hi + Math.imul(ah7, bh9)) | 0; var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; w16 &= 0x3ffffff; /* k = 17 */ lo = Math.imul(al9, bl8); mid = Math.imul(al9, bh8); mid = (mid + Math.imul(ah9, bl8)) | 0; hi = Math.imul(ah9, bh8); lo = (lo + Math.imul(al8, bl9)) | 0; mid = (mid + Math.imul(al8, bh9)) | 0; mid = (mid + Math.imul(ah8, bl9)) | 0; hi = (hi + Math.imul(ah8, bh9)) | 0; var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; w17 &= 0x3ffffff; /* k = 18 */ lo = Math.imul(al9, bl9); mid = Math.imul(al9, bh9); mid = (mid + Math.imul(ah9, bl9)) | 0; hi = Math.imul(ah9, bh9); var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; w18 &= 0x3ffffff; o[0] = w0; o[1] = w1; o[2] = w2; o[3] = w3; o[4] = w4; o[5] = w5; o[6] = w6; o[7] = w7; o[8] = w8; o[9] = w9; o[10] = w10; o[11] = w11; o[12] = w12; o[13] = w13; o[14] = w14; o[15] = w15; o[16] = w16; o[17] = w17; o[18] = w18; if (c !== 0) { o[19] = c; out.length++; } return out; }; // Polyfill comb if (!Math.imul) { comb10MulTo = smallMulTo; } function bigMulTo (self, num, out) { out.negative = num.negative ^ self.negative; out.length = self.length + num.length; var carry = 0; var hncarry = 0; for (var k = 0; k < out.length - 1; k++) { // Sum all words with the same `i + j = k` and accumulate `ncarry`, // note that ncarry could be >= 0x3ffffff var ncarry = hncarry; hncarry = 0; var rword = carry & 0x3ffffff; var maxJ = Math.min(k, num.length - 1); for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { var i = k - j; var a = self.words[i] | 0; var b = num.words[j] | 0; var r = a * b; var lo = r & 0x3ffffff; ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; lo = (lo + rword) | 0; rword = lo & 0x3ffffff; ncarry = (ncarry + (lo >>> 26)) | 0; hncarry += ncarry >>> 26; ncarry &= 0x3ffffff; } out.words[k] = rword; carry = ncarry; ncarry = hncarry; } if (carry !== 0) { out.words[k] = carry; } else { out.length--; } return out.strip(); } function jumboMulTo (self, num, out) { var fftm = new FFTM(); return fftm.mulp(self, num, out); } BN.prototype.mulTo = function mulTo (num, out) { var res; var len = this.length + num.length; if (this.length === 10 && num.length === 10) { res = comb10MulTo(this, num, out); } else if (len < 63) { res = smallMulTo(this, num, out); } else if (len < 1024) { res = bigMulTo(this, num, out); } else { res = jumboMulTo(this, num, out); } return res; }; // Cooley-Tukey algorithm for FFT // slightly revisited to rely on looping instead of recursion function FFTM (x, y) { this.x = x; this.y = y; } FFTM.prototype.makeRBT = function makeRBT (N) { var t = new Array(N); var l = BN.prototype._countBits(N) - 1; for (var i = 0; i < N; i++) { t[i] = this.revBin(i, l, N); } return t; }; // Returns binary-reversed representation of `x` FFTM.prototype.revBin = function revBin (x, l, N) { if (x === 0 || x === N - 1) return x; var rb = 0; for (var i = 0; i < l; i++) { rb |= (x & 1) << (l - i - 1); x >>= 1; } return rb; }; // Performs "tweedling" phase, therefore 'emulating' // behaviour of the recursive algorithm FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { for (var i = 0; i < N; i++) { rtws[i] = rws[rbt[i]]; itws[i] = iws[rbt[i]]; } }; FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { this.permute(rbt, rws, iws, rtws, itws, N); for (var s = 1; s < N; s <<= 1) { var l = s << 1; var rtwdf = Math.cos(2 * Math.PI / l); var itwdf = Math.sin(2 * Math.PI / l); for (var p = 0; p < N; p += l) { var rtwdf_ = rtwdf; var itwdf_ = itwdf; for (var j = 0; j < s; j++) { var re = rtws[p + j]; var ie = itws[p + j]; var ro = rtws[p + j + s]; var io = itws[p + j + s]; var rx = rtwdf_ * ro - itwdf_ * io; io = rtwdf_ * io + itwdf_ * ro; ro = rx; rtws[p + j] = re + ro; itws[p + j] = ie + io; rtws[p + j + s] = re - ro; itws[p + j + s] = ie - io; /* jshint maxdepth : false */ if (j !== l) { rx = rtwdf * rtwdf_ - itwdf * itwdf_; itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; rtwdf_ = rx; } } } } }; FFTM.prototype.guessLen13b = function guessLen13b (n, m) { var N = Math.max(m, n) | 1; var odd = N & 1; var i = 0; for (N = N / 2 | 0; N; N = N >>> 1) { i++; } return 1 << i + 1 + odd; }; FFTM.prototype.conjugate = function conjugate (rws, iws, N) { if (N <= 1) return; for (var i = 0; i < N / 2; i++) { var t = rws[i]; rws[i] = rws[N - i - 1]; rws[N - i - 1] = t; t = iws[i]; iws[i] = -iws[N - i - 1]; iws[N - i - 1] = -t; } }; FFTM.prototype.normalize13b = function normalize13b (ws, N) { var carry = 0; for (var i = 0; i < N / 2; i++) { var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + Math.round(ws[2 * i] / N) + carry; ws[i] = w & 0x3ffffff; if (w < 0x4000000) { carry = 0; } else { carry = w / 0x4000000 | 0; } } return ws; }; FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { var carry = 0; for (var i = 0; i < len; i++) { carry = carry + (ws[i] | 0); rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; } // Pad with zeroes for (i = 2 * len; i < N; ++i) { rws[i] = 0; } assert(carry === 0); assert((carry & ~0x1fff) === 0); }; FFTM.prototype.stub = function stub (N) { var ph = new Array(N); for (var i = 0; i < N; i++) { ph[i] = 0; } return ph; }; FFTM.prototype.mulp = function mulp (x, y, out) { var N = 2 * this.guessLen13b(x.length, y.length); var rbt = this.makeRBT(N); var _ = this.stub(N); var rws = new Array(N); var rwst = new Array(N); var iwst = new Array(N); var nrws = new Array(N); var nrwst = new Array(N); var niwst = new Array(N); var rmws = out.words; rmws.length = N; this.convert13b(x.words, x.length, rws, N); this.convert13b(y.words, y.length, nrws, N); this.transform(rws, _, rwst, iwst, N, rbt); this.transform(nrws, _, nrwst, niwst, N, rbt); for (var i = 0; i < N; i++) { var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; rwst[i] = rx; } this.conjugate(rwst, iwst, N); this.transform(rwst, iwst, rmws, _, N, rbt); this.conjugate(rmws, _, N); this.normalize13b(rmws, N); out.negative = x.negative ^ y.negative; out.length = x.length + y.length; return out.strip(); }; // Multiply `this` by `num` BN.prototype.mul = function mul (num) { var out = new BN(null); out.words = new Array(this.length + num.length); return this.mulTo(num, out); }; // Multiply employing FFT BN.prototype.mulf = function mulf (num) { var out = new BN(null); out.words = new Array(this.length + num.length); return jumboMulTo(this, num, out); }; // In-place Multiplication BN.prototype.imul = function imul (num) { return this.clone().mulTo(num, this); }; BN.prototype.imuln = function imuln (num) { assert(typeof num === 'number'); assert(num < 0x4000000); // Carry var carry = 0; for (var i = 0; i < this.length; i++) { var w = (this.words[i] | 0) * num; var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); carry >>= 26; carry += (w / 0x4000000) | 0; // NOTE: lo is 27bit maximum carry += lo >>> 26; this.words[i] = lo & 0x3ffffff; } if (carry !== 0) { this.words[i] = carry; this.length++; } return this; }; BN.prototype.muln = function muln (num) { return this.clone().imuln(num); }; // `this` * `this` BN.prototype.sqr = function sqr () { return this.mul(this); }; // `this` * `this` in-place BN.prototype.isqr = function isqr () { return this.imul(this.clone()); }; // Math.pow(`this`, `num`) BN.prototype.pow = function pow (num) { var w = toBitArray(num); if (w.length === 0) return new BN(1); // Skip leading zeroes var res = this; for (var i = 0; i < w.length; i++, res = res.sqr()) { if (w[i] !== 0) break; } if (++i < w.length) { for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { if (w[i] === 0) continue; res = res.mul(q); } } return res; }; // Shift-left in-place BN.prototype.iushln = function iushln (bits) { assert(typeof bits === 'number' && bits >= 0); var r = bits % 26; var s = (bits - r) / 26; var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); var i; if (r !== 0) { var carry = 0; for (i = 0; i < this.length; i++) { var newCarry = this.words[i] & carryMask; var c = ((this.words[i] | 0) - newCarry) << r; this.words[i] = c | carry; carry = newCarry >>> (26 - r); } if (carry) { this.words[i] = carry; this.length++; } } if (s !== 0) { for (i = this.length - 1; i >= 0; i--) { this.words[i + s] = this.words[i]; } for (i = 0; i < s; i++) { this.words[i] = 0; } this.length += s; } return this.strip(); }; BN.prototype.ishln = function ishln (bits) { // TODO(indutny): implement me assert(this.negative === 0); return this.iushln(bits); }; // Shift-right in-place // NOTE: `hint` is a lowest bit before trailing zeroes // NOTE: if `extended` is present - it will be filled with destroyed bits BN.prototype.iushrn = function iushrn (bits, hint, extended) { assert(typeof bits === 'number' && bits >= 0); var h; if (hint) { h = (hint - (hint % 26)) / 26; } else { h = 0; } var r = bits % 26; var s = Math.min((bits - r) / 26, this.length); var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); var maskedWords = extended; h -= s; h = Math.max(0, h); // Extended mode, copy masked part if (maskedWords) { for (var i = 0; i < s; i++) { maskedWords.words[i] = this.words[i]; } maskedWords.length = s; } if (s === 0) { // No-op, we should not move anything at all } else if (this.length > s) { this.length -= s; for (i = 0; i < this.length; i++) { this.words[i] = this.words[i + s]; } } else { this.words[0] = 0; this.length = 1; } var carry = 0; for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { var word = this.words[i] | 0; this.words[i] = (carry << (26 - r)) | (word >>> r); carry = word & mask; } // Push carried bits as a mask if (maskedWords && carry !== 0) { maskedWords.words[maskedWords.length++] = carry; } if (this.length === 0) { this.words[0] = 0; this.length = 1; } return this.strip(); }; BN.prototype.ishrn = function ishrn (bits, hint, extended) { // TODO(indutny): implement me assert(this.negative === 0); return this.iushrn(bits, hint, extended); }; // Shift-left BN.prototype.shln = function shln (bits) { return this.clone().ishln(bits); }; BN.prototype.ushln = function ushln (bits) { return this.clone().iushln(bits); }; // Shift-right BN.prototype.shrn = function shrn (bits) { return this.clone().ishrn(bits); }; BN.prototype.ushrn = function ushrn (bits) { return this.clone().iushrn(bits); }; // Test if n bit is set BN.prototype.testn = function testn (bit) { assert(typeof bit === 'number' && bit >= 0); var r = bit % 26; var s = (bit - r) / 26; var q = 1 << r; // Fast case: bit is much higher than all existing words if (this.length <= s) return false; // Check bit and return var w = this.words[s]; return !!(w & q); }; // Return only lowers bits of number (in-place) BN.prototype.imaskn = function imaskn (bits) { assert(typeof bits === 'number' && bits >= 0); var r = bits % 26; var s = (bits - r) / 26; assert(this.negative === 0, 'imaskn works only with positive numbers'); if (this.length <= s) { return this; } if (r !== 0) { s++; } this.length = Math.min(s, this.length); if (r !== 0) { var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); this.words[this.length - 1] &= mask; } return this.strip(); }; // Return only lowers bits of number BN.prototype.maskn = function maskn (bits) { return this.clone().imaskn(bits); }; // Add plain number `num` to `this` BN.prototype.iaddn = function iaddn (num) { assert(typeof num === 'number'); assert(num < 0x4000000); if (num < 0) return this.isubn(-num); // Possible sign change if (this.negative !== 0) { if (this.length === 1 && (this.words[0] | 0) < num) { this.words[0] = num - (this.words[0] | 0); this.negative = 0; return this; } this.negative = 0; this.isubn(num); this.negative = 1; return this; } // Add without checks return this._iaddn(num); }; BN.prototype._iaddn = function _iaddn (num) { this.words[0] += num; // Carry for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { this.words[i] -= 0x4000000; if (i === this.length - 1) { this.words[i + 1] = 1; } else { this.words[i + 1]++; } } this.length = Math.max(this.length, i + 1); return this; }; // Subtract plain number `num` from `this` BN.prototype.isubn = function isubn (num) { assert(typeof num === 'number'); assert(num < 0x4000000); if (num < 0) return this.iaddn(-num); if (this.negative !== 0) { this.negative = 0; this.iaddn(num); this.negative = 1; return this; } this.words[0] -= num; if (this.length === 1 && this.words[0] < 0) { this.words[0] = -this.words[0]; this.negative = 1; } else { // Carry for (var i = 0; i < this.length && this.words[i] < 0; i++) { this.words[i] += 0x4000000; this.words[i + 1] -= 1; } } return this.strip(); }; BN.prototype.addn = function addn (num) { return this.clone().iaddn(num); }; BN.prototype.subn = function subn (num) { return this.clone().isubn(num); }; BN.prototype.iabs = function iabs () { this.negative = 0; return this; }; BN.prototype.abs = function abs () { return this.clone().iabs(); }; BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { var len = num.length + shift; var i; this._expand(len); var w; var carry = 0; for (i = 0; i < num.length; i++) { w = (this.words[i + shift] | 0) + carry; var right = (num.words[i] | 0) * mul; w -= right & 0x3ffffff; carry = (w >> 26) - ((right / 0x4000000) | 0); this.words[i + shift] = w & 0x3ffffff; } for (; i < this.length - shift; i++) { w = (this.words[i + shift] | 0) + carry; carry = w >> 26; this.words[i + shift] = w & 0x3ffffff; } if (carry === 0) return this.strip(); // Subtraction overflow assert(carry === -1); carry = 0; for (i = 0; i < this.length; i++) { w = -(this.words[i] | 0) + carry; carry = w >> 26; this.words[i] = w & 0x3ffffff; } this.negative = 1; return this.strip(); }; BN.prototype._wordDiv = function _wordDiv (num, mode) { var shift = this.length - num.length; var a = this.clone(); var b = num; // Normalize var bhi = b.words[b.length - 1] | 0; var bhiBits = this._countBits(bhi); shift = 26 - bhiBits; if (shift !== 0) { b = b.ushln(shift); a.iushln(shift); bhi = b.words[b.length - 1] | 0; } // Initialize quotient var m = a.length - b.length; var q; if (mode !== 'mod') { q = new BN(null); q.length = m + 1; q.words = new Array(q.length); for (var i = 0; i < q.length; i++) { q.words[i] = 0; } } var diff = a.clone()._ishlnsubmul(b, 1, m); if (diff.negative === 0) { a = diff; if (q) { q.words[m] = 1; } } for (var j = m - 1; j >= 0; j--) { var qj = (a.words[b.length + j] | 0) * 0x4000000 + (a.words[b.length + j - 1] | 0); // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max // (0x7ffffff) qj = Math.min((qj / bhi) | 0, 0x3ffffff); a._ishlnsubmul(b, qj, j); while (a.negative !== 0) { qj--; a.negative = 0; a._ishlnsubmul(b, 1, j); if (!a.isZero()) { a.negative ^= 1; } } if (q) { q.words[j] = qj; } } if (q) { q.strip(); } a.strip(); // Denormalize if (mode !== 'div' && shift !== 0) { a.iushrn(shift); } return { div: q || null, mod: a }; }; // NOTE: 1) `mode` can be set to `mod` to request mod only, // to `div` to request div only, or be absent to // request both div & mod // 2) `positive` is true if unsigned mod is requested BN.prototype.divmod = function divmod (num, mode, positive) { assert(!num.isZero()); if (this.isZero()) { return { div: new BN(0), mod: new BN(0) }; } var div, mod, res; if (this.negative !== 0 && num.negative === 0) { res = this.neg().divmod(num, mode); if (mode !== 'mod') { div = res.div.neg(); } if (mode !== 'div') { mod = res.mod.neg(); if (positive && mod.negative !== 0) { mod.iadd(num); } } return { div: div, mod: mod }; } if (this.negative === 0 && num.negative !== 0) { res = this.divmod(num.neg(), mode); if (mode !== 'mod') { div = res.div.neg(); } return { div: div, mod: res.mod }; } if ((this.negative & num.negative) !== 0) { res = this.neg().divmod(num.neg(), mode); if (mode !== 'div') { mod = res.mod.neg(); if (positive && mod.negative !== 0) { mod.isub(num); } } return { div: res.div, mod: mod }; } // Both numbers are positive at this point // Strip both numbers to approximate shift value if (num.length > this.length || this.cmp(num) < 0) { return { div: new BN(0), mod: this }; } // Very short reduction if (num.length === 1) { if (mode === 'div') { return { div: this.divn(num.words[0]), mod: null }; } if (mode === 'mod') { return { div: null, mod: new BN(this.modn(num.words[0])) }; } return { div: this.divn(num.words[0]), mod: new BN(this.modn(num.words[0])) }; } return this._wordDiv(num, mode); }; // Find `this` / `num` BN.prototype.div = function div (num) { return this.divmod(num, 'div', false).div; }; // Find `this` % `num` BN.prototype.mod = function mod (num) { return this.divmod(num, 'mod', false).mod; }; BN.prototype.umod = function umod (num) { return this.divmod(num, 'mod', true).mod; }; // Find Round(`this` / `num`) BN.prototype.divRound = function divRound (num) { var dm = this.divmod(num); // Fast case - exact division if (dm.mod.isZero()) return dm.div; var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; var half = num.ushrn(1); var r2 = num.andln(1); var cmp = mod.cmp(half); // Round down if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; // Round up return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); }; BN.prototype.modn = function modn (num) { assert(num <= 0x3ffffff); var p = (1 << 26) % num; var acc = 0; for (var i = this.length - 1; i >= 0; i--) { acc = (p * acc + (this.words[i] | 0)) % num; } return acc; }; // In-place division by number BN.prototype.idivn = function idivn (num) { assert(num <= 0x3ffffff); var carry = 0; for (var i = this.length - 1; i >= 0; i--) { var w = (this.words[i] | 0) + carry * 0x4000000; this.words[i] = (w / num) | 0; carry = w % num; } return this.strip(); }; BN.prototype.divn = function divn (num) { return this.clone().idivn(num); }; BN.prototype.egcd = function egcd (p) { assert(p.negative === 0); assert(!p.isZero()); var x = this; var y = p.clone(); if (x.negative !== 0) { x = x.umod(p); } else { x = x.clone(); } // A * x + B * y = x var A = new BN(1); var B = new BN(0); // C * x + D * y = y var C = new BN(0); var D = new BN(1); var g = 0; while (x.isEven() && y.isEven()) { x.iushrn(1); y.iushrn(1); ++g; } var yp = y.clone(); var xp = x.clone(); while (!x.isZero()) { for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); if (i > 0) { x.iushrn(i); while (i-- > 0) { if (A.isOdd() || B.isOdd()) { A.iadd(yp); B.isub(xp); } A.iushrn(1); B.iushrn(1); } } for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); if (j > 0) { y.iushrn(j); while (j-- > 0) { if (C.isOdd() || D.isOdd()) { C.iadd(yp); D.isub(xp); } C.iushrn(1); D.iushrn(1); } } if (x.cmp(y) >= 0) { x.isub(y); A.isub(C); B.isub(D); } else { y.isub(x); C.isub(A); D.isub(B); } } return { a: C, b: D, gcd: y.iushln(g) }; }; // This is reduced incarnation of the binary EEA // above, designated to invert members of the // _prime_ fields F(p) at a maximal speed BN.prototype._invmp = function _invmp (p) { assert(p.negative === 0); assert(!p.isZero()); var a = this; var b = p.clone(); if (a.negative !== 0) { a = a.umod(p); } else { a = a.clone(); } var x1 = new BN(1); var x2 = new BN(0); var delta = b.clone(); while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); if (i > 0) { a.iushrn(i); while (i-- > 0) { if (x1.isOdd()) { x1.iadd(delta); } x1.iushrn(1); } } for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); if (j > 0) { b.iushrn(j); while (j-- > 0) { if (x2.isOdd()) { x2.iadd(delta); } x2.iushrn(1); } } if (a.cmp(b) >= 0) { a.isub(b); x1.isub(x2); } else { b.isub(a); x2.isub(x1); } } var res; if (a.cmpn(1) === 0) { res = x1; } else { res = x2; } if (res.cmpn(0) < 0) { res.iadd(p); } return res; }; BN.prototype.gcd = function gcd (num) { if (this.isZero()) return num.abs(); if (num.isZero()) return this.abs(); var a = this.clone(); var b = num.clone(); a.negative = 0; b.negative = 0; // Remove common factor of two for (var shift = 0; a.isEven() && b.isEven(); shift++) { a.iushrn(1); b.iushrn(1); } do { while (a.isEven()) { a.iushrn(1); } while (b.isEven()) { b.iushrn(1); } var r = a.cmp(b); if (r < 0) { // Swap `a` and `b` to make `a` always bigger than `b` var t = a; a = b; b = t; } else if (r === 0 || b.cmpn(1) === 0) { break; } a.isub(b); } while (true); return b.iushln(shift); }; // Invert number in the field F(num) BN.prototype.invm = function invm (num) { return this.egcd(num).a.umod(num); }; BN.prototype.isEven = function isEven () { return (this.words[0] & 1) === 0; }; BN.prototype.isOdd = function isOdd () { return (this.words[0] & 1) === 1; }; // And first word and num BN.prototype.andln = function andln (num) { return this.words[0] & num; }; // Increment at the bit position in-line BN.prototype.bincn = function bincn (bit) { assert(typeof bit === 'number'); var r = bit % 26; var s = (bit - r) / 26; var q = 1 << r; // Fast case: bit is much higher than all existing words if (this.length <= s) { this._expand(s + 1); this.words[s] |= q; return this; } // Add bit and propagate, if needed var carry = q; for (var i = s; carry !== 0 && i < this.length; i++) { var w = this.words[i] | 0; w += carry; carry = w >>> 26; w &= 0x3ffffff; this.words[i] = w; } if (carry !== 0) { this.words[i] = carry; this.length++; } return this; }; BN.prototype.isZero = function isZero () { return this.length === 1 && this.words[0] === 0; }; BN.prototype.cmpn = function cmpn (num) { var negative = num < 0; if (this.negative !== 0 && !negative) return -1; if (this.negative === 0 && negative) return 1; this.strip(); var res; if (this.length > 1) { res = 1; } else { if (negative) { num = -num; } assert(num <= 0x3ffffff, 'Number is too big'); var w = this.words[0] | 0; res = w === num ? 0 : w < num ? -1 : 1; } if (this.negative !== 0) return -res | 0; return res; }; // Compare two numbers and return: // 1 - if `this` > `num` // 0 - if `this` == `num` // -1 - if `this` < `num` BN.prototype.cmp = function cmp (num) { if (this.negative !== 0 && num.negative === 0) return -1; if (this.negative === 0 && num.negative !== 0) return 1; var res = this.ucmp(num); if (this.negative !== 0) return -res | 0; return res; }; // Unsigned comparison BN.prototype.ucmp = function ucmp (num) { // At this point both numbers have the same sign if (this.length > num.length) return 1; if (this.length < num.length) return -1; var res = 0; for (var i = this.length - 1; i >= 0; i--) { var a = this.words[i] | 0; var b = num.words[i] | 0; if (a === b) continue; if (a < b) { res = -1; } else if (a > b) { res = 1; } break; } return res; }; BN.prototype.gtn = function gtn (num) { return this.cmpn(num) === 1; }; BN.prototype.gt = function gt (num) { return this.cmp(num) === 1; }; BN.prototype.gten = function gten (num) { return this.cmpn(num) >= 0; }; BN.prototype.gte = function gte (num) { return this.cmp(num) >= 0; }; BN.prototype.ltn = function ltn (num) { return this.cmpn(num) === -1; }; BN.prototype.lt = function lt (num) { return this.cmp(num) === -1; }; BN.prototype.lten = function lten (num) { return this.cmpn(num) <= 0; }; BN.prototype.lte = function lte (num) { return this.cmp(num) <= 0; }; BN.prototype.eqn = function eqn (num) { return this.cmpn(num) === 0; }; BN.prototype.eq = function eq (num) { return this.cmp(num) === 0; }; // // A reduce context, could be using montgomery or something better, depending // on the `m` itself. // BN.red = function red (num) { return new Red(num); }; BN.prototype.toRed = function toRed (ctx) { assert(!this.red, 'Already a number in reduction context'); assert(this.negative === 0, 'red works only with positives'); return ctx.convertTo(this)._forceRed(ctx); }; BN.prototype.fromRed = function fromRed () { assert(this.red, 'fromRed works only with numbers in reduction context'); return this.red.convertFrom(this); }; BN.prototype._forceRed = function _forceRed (ctx) { this.red = ctx; return this; }; BN.prototype.forceRed = function forceRed (ctx) { assert(!this.red, 'Already a number in reduction context'); return this._forceRed(ctx); }; BN.prototype.redAdd = function redAdd (num) { assert(this.red, 'redAdd works only with red numbers'); return this.red.add(this, num); }; BN.prototype.redIAdd = function redIAdd (num) { assert(this.red, 'redIAdd works only with red numbers'); return this.red.iadd(this, num); }; BN.prototype.redSub = function redSub (num) { assert(this.red, 'redSub works only with red numbers'); return this.red.sub(this, num); }; BN.prototype.redISub = function redISub (num) { assert(this.red, 'redISub works only with red numbers'); return this.red.isub(this, num); }; BN.prototype.redShl = function redShl (num) { assert(this.red, 'redShl works only with red numbers'); return this.red.shl(this, num); }; BN.prototype.redMul = function redMul (num) { assert(this.red, 'redMul works only with red numbers'); this.red._verify2(this, num); return this.red.mul(this, num); }; BN.prototype.redIMul = function redIMul (num) { assert(this.red, 'redMul works only with red numbers'); this.red._verify2(this, num); return this.red.imul(this, num); }; BN.prototype.redSqr = function redSqr () { assert(this.red, 'redSqr works only with red numbers'); this.red._verify1(this); return this.red.sqr(this); }; BN.prototype.redISqr = function redISqr () { assert(this.red, 'redISqr works only with red numbers'); this.red._verify1(this); return this.red.isqr(this); }; // Square root over p BN.prototype.redSqrt = function redSqrt () { assert(this.red, 'redSqrt works only with red numbers'); this.red._verify1(this); return this.red.sqrt(this); }; BN.prototype.redInvm = function redInvm () { assert(this.red, 'redInvm works only with red numbers'); this.red._verify1(this); return this.red.invm(this); }; // Return negative clone of `this` % `red modulo` BN.prototype.redNeg = function redNeg () { assert(this.red, 'redNeg works only with red numbers'); this.red._verify1(this); return this.red.neg(this); }; BN.prototype.redPow = function redPow (num) { assert(this.red && !num.red, 'redPow(normalNum)'); this.red._verify1(this); return this.red.pow(this, num); }; // Prime numbers with efficient reduction var primes = { k256: null, p224: null, p192: null, p25519: null }; // Pseudo-Mersenne prime function MPrime (name, p) { // P = 2 ^ N - K this.name = name; this.p = new BN(p, 16); this.n = this.p.bitLength(); this.k = new BN(1).iushln(this.n).isub(this.p); this.tmp = this._tmp(); } MPrime.prototype._tmp = function _tmp () { var tmp = new BN(null); tmp.words = new Array(Math.ceil(this.n / 13)); return tmp; }; MPrime.prototype.ireduce = function ireduce (num) { // Assumes that `num` is less than `P^2` // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) var r = num; var rlen; do { this.split(r, this.tmp); r = this.imulK(r); r = r.iadd(this.tmp); rlen = r.bitLength(); } while (rlen > this.n); var cmp = rlen < this.n ? -1 : r.ucmp(this.p); if (cmp === 0) { r.words[0] = 0; r.length = 1; } else if (cmp > 0) { r.isub(this.p); } else { r.strip(); } return r; }; MPrime.prototype.split = function split (input, out) { input.iushrn(this.n, 0, out); }; MPrime.prototype.imulK = function imulK (num) { return num.imul(this.k); }; function K256 () { MPrime.call( this, 'k256', 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); } inherits(K256, MPrime); K256.prototype.split = function split (input, output) { // 256 = 9 * 26 + 22 var mask = 0x3fffff; var outLen = Math.min(input.length, 9); for (var i = 0; i < outLen; i++) { output.words[i] = input.words[i]; } output.length = outLen; if (input.length <= 9) { input.words[0] = 0; input.length = 1; return; } // Shift by 9 limbs var prev = input.words[9]; output.words[output.length++] = prev & mask; for (i = 10; i < input.length; i++) { var next = input.words[i] | 0; input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); prev = next; } prev >>>= 22; input.words[i - 10] = prev; if (prev === 0 && input.length > 10) { input.length -= 10; } else { input.length -= 9; } }; K256.prototype.imulK = function imulK (num) { // K = 0x1000003d1 = [ 0x40, 0x3d1 ] num.words[num.length] = 0; num.words[num.length + 1] = 0; num.length += 2; // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 var lo = 0; for (var i = 0; i < num.length; i++) { var w = num.words[i] | 0; lo += w * 0x3d1; num.words[i] = lo & 0x3ffffff; lo = w * 0x40 + ((lo / 0x4000000) | 0); } // Fast length reduction if (num.words[num.length - 1] === 0) { num.length--; if (num.words[num.length - 1] === 0) { num.length--; } } return num; }; function P224 () { MPrime.call( this, 'p224', 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); } inherits(P224, MPrime); function P192 () { MPrime.call( this, 'p192', 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); } inherits(P192, MPrime); function P25519 () { // 2 ^ 255 - 19 MPrime.call( this, '25519', '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); } inherits(P25519, MPrime); P25519.prototype.imulK = function imulK (num) { // K = 0x13 var carry = 0; for (var i = 0; i < num.length; i++) { var hi = (num.words[i] | 0) * 0x13 + carry; var lo = hi & 0x3ffffff; hi >>>= 26; num.words[i] = lo; carry = hi; } if (carry !== 0) { num.words[num.length++] = carry; } return num; }; // Exported mostly for testing purposes, use plain name instead BN._prime = function prime (name) { // Cached version of prime if (primes[name]) return primes[name]; var prime; if (name === 'k256') { prime = new K256(); } else if (name === 'p224') { prime = new P224(); } else if (name === 'p192') { prime = new P192(); } else if (name === 'p25519') { prime = new P25519(); } else { throw new Error('Unknown prime ' + name); } primes[name] = prime; return prime; }; // // Base reduction engine // function Red (m) { if (typeof m === 'string') { var prime = BN._prime(m); this.m = prime.p; this.prime = prime; } else { assert(m.gtn(1), 'modulus must be greater than 1'); this.m = m; this.prime = null; } } Red.prototype._verify1 = function _verify1 (a) { assert(a.negative === 0, 'red works only with positives'); assert(a.red, 'red works only with red numbers'); }; Red.prototype._verify2 = function _verify2 (a, b) { assert((a.negative | b.negative) === 0, 'red works only with positives'); assert(a.red && a.red === b.red, 'red works only with red numbers'); }; Red.prototype.imod = function imod (a) { if (this.prime) return this.prime.ireduce(a)._forceRed(this); return a.umod(this.m)._forceRed(this); }; Red.prototype.neg = function neg (a) { if (a.isZero()) { return a.clone(); } return this.m.sub(a)._forceRed(this); }; Red.prototype.add = function add (a, b) { this._verify2(a, b); var res = a.add(b); if (res.cmp(this.m) >= 0) { res.isub(this.m); } return res._forceRed(this); }; Red.prototype.iadd = function iadd (a, b) { this._verify2(a, b); var res = a.iadd(b); if (res.cmp(this.m) >= 0) { res.isub(this.m); } return res; }; Red.prototype.sub = function sub (a, b) { this._verify2(a, b); var res = a.sub(b); if (res.cmpn(0) < 0) { res.iadd(this.m); } return res._forceRed(this); }; Red.prototype.isub = function isub (a, b) { this._verify2(a, b); var res = a.isub(b); if (res.cmpn(0) < 0) { res.iadd(this.m); } return res; }; Red.prototype.shl = function shl (a, num) { this._verify1(a); return this.imod(a.ushln(num)); }; Red.prototype.imul = function imul (a, b) { this._verify2(a, b); return this.imod(a.imul(b)); }; Red.prototype.mul = function mul (a, b) { this._verify2(a, b); return this.imod(a.mul(b)); }; Red.prototype.isqr = function isqr (a) { return this.imul(a, a.clone()); }; Red.prototype.sqr = function sqr (a) { return this.mul(a, a); }; Red.prototype.sqrt = function sqrt (a) { if (a.isZero()) return a.clone(); var mod3 = this.m.andln(3); assert(mod3 % 2 === 1); // Fast case if (mod3 === 3) { var pow = this.m.add(new BN(1)).iushrn(2); return this.pow(a, pow); } // Tonelli-Shanks algorithm (Totally unoptimized and slow) // // Find Q and S, that Q * 2 ^ S = (P - 1) var q = this.m.subn(1); var s = 0; while (!q.isZero() && q.andln(1) === 0) { s++; q.iushrn(1); } assert(!q.isZero()); var one = new BN(1).toRed(this); var nOne = one.redNeg(); // Find quadratic non-residue // NOTE: Max is such because of generalized Riemann hypothesis. var lpow = this.m.subn(1).iushrn(1); var z = this.m.bitLength(); z = new BN(2 * z * z).toRed(this); while (this.pow(z, lpow).cmp(nOne) !== 0) { z.redIAdd(nOne); } var c = this.pow(z, q); var r = this.pow(a, q.addn(1).iushrn(1)); var t = this.pow(a, q); var m = s; while (t.cmp(one) !== 0) { var tmp = t; for (var i = 0; tmp.cmp(one) !== 0; i++) { tmp = tmp.redSqr(); } assert(i < m); var b = this.pow(c, new BN(1).iushln(m - i - 1)); r = r.redMul(b); c = b.redSqr(); t = t.redMul(c); m = i; } return r; }; Red.prototype.invm = function invm (a) { var inv = a._invmp(this.m); if (inv.negative !== 0) { inv.negative = 0; return this.imod(inv).redNeg(); } else { return this.imod(inv); } }; Red.prototype.pow = function pow (a, num) { if (num.isZero()) return new BN(1).toRed(this); if (num.cmpn(1) === 0) return a.clone(); var windowSize = 4; var wnd = new Array(1 << windowSize); wnd[0] = new BN(1).toRed(this); wnd[1] = a; for (var i = 2; i < wnd.length; i++) { wnd[i] = this.mul(wnd[i - 1], a); } var res = wnd[0]; var current = 0; var currentLen = 0; var start = num.bitLength() % 26; if (start === 0) { start = 26; } for (i = num.length - 1; i >= 0; i--) { var word = num.words[i]; for (var j = start - 1; j >= 0; j--) { var bit = (word >> j) & 1; if (res !== wnd[0]) { res = this.sqr(res); } if (bit === 0 && current === 0) { currentLen = 0; continue; } current <<= 1; current |= bit; currentLen++; if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; res = this.mul(res, wnd[current]); currentLen = 0; current = 0; } start = 26; } return res; }; Red.prototype.convertTo = function convertTo (num) { var r = num.umod(this.m); return r === num ? r.clone() : r; }; Red.prototype.convertFrom = function convertFrom (num) { var res = num.clone(); res.red = null; return res; }; // // Montgomery method engine // BN.mont = function mont (num) { return new Mont(num); }; function Mont (m) { Red.call(this, m); this.shift = this.m.bitLength(); if (this.shift % 26 !== 0) { this.shift += 26 - (this.shift % 26); } this.r = new BN(1).iushln(this.shift); this.r2 = this.imod(this.r.sqr()); this.rinv = this.r._invmp(this.m); this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); this.minv = this.minv.umod(this.r); this.minv = this.r.sub(this.minv); } inherits(Mont, Red); Mont.prototype.convertTo = function convertTo (num) { return this.imod(num.ushln(this.shift)); }; Mont.prototype.convertFrom = function convertFrom (num) { var r = this.imod(num.mul(this.rinv)); r.red = null; return r; }; Mont.prototype.imul = function imul (a, b) { if (a.isZero() || b.isZero()) { a.words[0] = 0; a.length = 1; return a; } var t = a.imul(b); var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); var u = t.isub(c).iushrn(this.shift); var res = u; if (u.cmp(this.m) >= 0) { res = u.isub(this.m); } else if (u.cmpn(0) < 0) { res = u.iadd(this.m); } return res._forceRed(this); }; Mont.prototype.mul = function mul (a, b) { if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); var t = a.mul(b); var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); var u = t.isub(c).iushrn(this.shift); var res = u; if (u.cmp(this.m) >= 0) { res = u.isub(this.m); } else if (u.cmpn(0) < 0) { res = u.iadd(this.m); } return res._forceRed(this); }; Mont.prototype.invm = function invm (a) { // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R var res = this.imod(a._invmp(this.m).mul(this.r2)); return res._forceRed(this); }; })(typeof module === 'undefined' || module, this); },{"buffer":10}],9:[function(require,module,exports){ var randomBytes = require('../../utils').randomBytes; module.exports = function(length) { return randomBytes(length); }; },{"../../utils":64}],10:[function(require,module,exports){ },{}],11:[function(require,module,exports){ 'use strict'; var elliptic = exports; elliptic.version = require('../package.json').version; elliptic.utils = require('./elliptic/utils'); elliptic.rand = require('brorand'); elliptic.hmacDRBG = require('./elliptic/hmac-drbg'); elliptic.curve = require('./elliptic/curve'); elliptic.curves = require('./elliptic/curves'); // Protocols elliptic.ec = require('./elliptic/ec'); elliptic.eddsa = require('./elliptic/eddsa'); },{"../package.json":25,"./elliptic/curve":14,"./elliptic/curves":17,"./elliptic/ec":18,"./elliptic/eddsa":21,"./elliptic/hmac-drbg":22,"./elliptic/utils":24,"brorand":9}],12:[function(require,module,exports){ 'use strict'; var BN = require('bn.js'); var elliptic = require('../../elliptic'); var utils = elliptic.utils; var getNAF = utils.getNAF; var getJSF = utils.getJSF; var assert = utils.assert; function BaseCurve(type, conf) { this.type = type; this.p = new BN(conf.p, 16); // Use Montgomery, when there is no fast reduction for the prime this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p); // Useful for many curves this.zero = new BN(0).toRed(this.red); this.one = new BN(1).toRed(this.red); this.two = new BN(2).toRed(this.red); // Curve configuration, optional this.n = conf.n && new BN(conf.n, 16); this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed); // Temporary arrays this._wnafT1 = new Array(4); this._wnafT2 = new Array(4); this._wnafT3 = new Array(4); this._wnafT4 = new Array(4); // Generalized Greg Maxwell's trick var adjustCount = this.n && this.p.div(this.n); if (!adjustCount || adjustCount.cmpn(100) > 0) { this.redN = null; } else { this._maxwellTrick = true; this.redN = this.n.toRed(this.red); } } module.exports = BaseCurve; BaseCurve.prototype.point = function point() { throw new Error('Not implemented'); }; BaseCurve.prototype.validate = function validate() { throw new Error('Not implemented'); }; BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) { assert(p.precomputed); var doubles = p._getDoubles(); var naf = getNAF(k, 1); var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1); I /= 3; // Translate into more windowed form var repr = []; for (var j = 0; j < naf.length; j += doubles.step) { var nafW = 0; for (var k = j + doubles.step - 1; k >= j; k--) nafW = (nafW << 1) + naf[k]; repr.push(nafW); } var a = this.jpoint(null, null, null); var b = this.jpoint(null, null, null); for (var i = I; i > 0; i--) { for (var j = 0; j < repr.length; j++) { var nafW = repr[j]; if (nafW === i) b = b.mixedAdd(doubles.points[j]); else if (nafW === -i) b = b.mixedAdd(doubles.points[j].neg()); } a = a.add(b); } return a.toP(); }; BaseCurve.prototype._wnafMul = function _wnafMul(p, k) { var w = 4; // Precompute window var nafPoints = p._getNAFPoints(w); w = nafPoints.wnd; var wnd = nafPoints.points; // Get NAF form var naf = getNAF(k, w); // Add `this`*(N+1) for every w-NAF index var acc = this.jpoint(null, null, null); for (var i = naf.length - 1; i >= 0; i--) { // Count zeroes for (var k = 0; i >= 0 && naf[i] === 0; i--) k++; if (i >= 0) k++; acc = acc.dblp(k); if (i < 0) break; var z = naf[i]; assert(z !== 0); if (p.type === 'affine') { // J +- P if (z > 0) acc = acc.mixedAdd(wnd[(z - 1) >> 1]); else acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg()); } else { // J +- J if (z > 0) acc = acc.add(wnd[(z - 1) >> 1]); else acc = acc.add(wnd[(-z - 1) >> 1].neg()); } } return p.type === 'affine' ? acc.toP() : acc; }; BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, points, coeffs, len, jacobianResult) { var wndWidth = this._wnafT1; var wnd = this._wnafT2; var naf = this._wnafT3; // Fill all arrays var max = 0; for (var i = 0; i < len; i++) { var p = points[i]; var nafPoints = p._getNAFPoints(defW); wndWidth[i] = nafPoints.wnd; wnd[i] = nafPoints.points; } // Comb small window NAFs for (var i = len - 1; i >= 1; i -= 2) { var a = i - 1; var b = i; if (wndWidth[a] !== 1 || wndWidth[b] !== 1) { naf[a] = getNAF(coeffs[a], wndWidth[a]); naf[b] = getNAF(coeffs[b], wndWidth[b]); max = Math.max(naf[a].length, max); max = Math.max(naf[b].length, max); continue; } var comb = [ points[a], /* 1 */ null, /* 3 */ null, /* 5 */ points[b] /* 7 */ ]; // Try to avoid Projective points, if possible if (points[a].y.cmp(points[b].y) === 0) { comb[1] = points[a].add(points[b]); comb[2] = points[a].toJ().mixedAdd(points[b].neg()); } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) { comb[1] = points[a].toJ().mixedAdd(points[b]); comb[2] = points[a].add(points[b].neg()); } else { comb[1] = points[a].toJ().mixedAdd(points[b]); comb[2] = points[a].toJ().mixedAdd(points[b].neg()); } var index = [ -3, /* -1 -1 */ -1, /* -1 0 */ -5, /* -1 1 */ -7, /* 0 -1 */ 0, /* 0 0 */ 7, /* 0 1 */ 5, /* 1 -1 */ 1, /* 1 0 */ 3 /* 1 1 */ ]; var jsf = getJSF(coeffs[a], coeffs[b]); max = Math.max(jsf[0].length, max); naf[a] = new Array(max); naf[b] = new Array(max); for (var j = 0; j < max; j++) { var ja = jsf[0][j] | 0; var jb = jsf[1][j] | 0; naf[a][j] = index[(ja + 1) * 3 + (jb + 1)]; naf[b][j] = 0; wnd[a] = comb; } } var acc = this.jpoint(null, null, null); var tmp = this._wnafT4; for (var i = max; i >= 0; i--) { var k = 0; while (i >= 0) { var zero = true; for (var j = 0; j < len; j++) { tmp[j] = naf[j][i] | 0; if (tmp[j] !== 0) zero = false; } if (!zero) break; k++; i--; } if (i >= 0) k++; acc = acc.dblp(k); if (i < 0) break; for (var j = 0; j < len; j++) { var z = tmp[j]; var p; if (z === 0) continue; else if (z > 0) p = wnd[j][(z - 1) >> 1]; else if (z < 0) p = wnd[j][(-z - 1) >> 1].neg(); if (p.type === 'affine') acc = acc.mixedAdd(p); else acc = acc.add(p); } } // Zeroify references for (var i = 0; i < len; i++) wnd[i] = null; if (jacobianResult) return acc; else return acc.toP(); }; function BasePoint(curve, type) { this.curve = curve; this.type = type; this.precomputed = null; } BaseCurve.BasePoint = BasePoint; BasePoint.prototype.eq = function eq(/*other*/) { throw new Error('Not implemented'); }; BasePoint.prototype.validate = function validate() { return this.curve.validate(this); }; BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) { bytes = utils.toArray(bytes, enc); var len = this.p.byteLength(); // uncompressed, hybrid-odd, hybrid-even if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) && bytes.length - 1 === 2 * len) { if (bytes[0] === 0x06) assert(bytes[bytes.length - 1] % 2 === 0); else if (bytes[0] === 0x07) assert(bytes[bytes.length - 1] % 2 === 1); var res = this.point(bytes.slice(1, 1 + len), bytes.slice(1 + len, 1 + 2 * len)); return res; } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) && bytes.length - 1 === len) { return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03); } throw new Error('Unknown point format'); }; BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) { return this.encode(enc, true); }; BasePoint.prototype._encode = function _encode(compact) { var len = this.curve.p.byteLength(); var x = this.getX().toArray('be', len); if (compact) return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x); return [ 0x04 ].concat(x, this.getY().toArray('be', len)) ; }; BasePoint.prototype.encode = function encode(enc, compact) { return utils.encode(this._encode(compact), enc); }; BasePoint.prototype.precompute = function precompute(power) { if (this.precomputed) return this; var precomputed = { doubles: null, naf: null, beta: null }; precomputed.naf = this._getNAFPoints(8); precomputed.doubles = this._getDoubles(4, power); precomputed.beta = this._getBeta(); this.precomputed = precomputed; return this; }; BasePoint.prototype._hasDoubles = function _hasDoubles(k) { if (!this.precomputed) return false; var doubles = this.precomputed.doubles; if (!doubles) return false; return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step); }; BasePoint.prototype._getDoubles = function _getDoubles(step, power) { if (this.precomputed && this.precomputed.doubles) return this.precomputed.doubles; var doubles = [ this ]; var acc = this; for (var i = 0; i < power; i += step) { for (var j = 0; j < step; j++) acc = acc.dbl(); doubles.push(acc); } return { step: step, points: doubles }; }; BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) { if (this.precomputed && this.precomputed.naf) return this.precomputed.naf; var res = [ this ]; var max = (1 << wnd) - 1; var dbl = max === 1 ? null : this.dbl(); for (var i = 1; i < max; i++) res[i] = res[i - 1].add(dbl); return { wnd: wnd, points: res }; }; BasePoint.prototype._getBeta = function _getBeta() { return null; }; BasePoint.prototype.dblp = function dblp(k) { var r = this; for (var i = 0; i < k; i++) r = r.dbl(); return r; }; },{"../../elliptic":11,"bn.js":8}],13:[function(require,module,exports){ module.exports = {}; },{}],14:[function(require,module,exports){ 'use strict'; var curve = exports; curve.base = require('./base'); curve.short = require('./short'); curve.mont = require('./mont'); curve.edwards = require('./edwards'); },{"./base":12,"./edwards":13,"./mont":15,"./short":16}],15:[function(require,module,exports){ arguments[4][13][0].apply(exports,arguments) },{"dup":13}],16:[function(require,module,exports){ 'use strict'; var curve = require('../curve'); var elliptic = require('../../elliptic'); var BN = require('bn.js'); var inherits = require('inherits'); var Base = curve.base; var assert = elliptic.utils.assert; function ShortCurve(conf) { Base.call(this, 'short', conf); this.a = new BN(conf.a, 16).toRed(this.red); this.b = new BN(conf.b, 16).toRed(this.red); this.tinv = this.two.redInvm(); this.zeroA = this.a.fromRed().cmpn(0) === 0; this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0; // If the curve is endomorphic, precalculate beta and lambda this.endo = this._getEndomorphism(conf); this._endoWnafT1 = new Array(4); this._endoWnafT2 = new Array(4); } inherits(ShortCurve, Base); module.exports = ShortCurve; ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) { // No efficient endomorphism if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1) return; // Compute beta and lambda, that lambda * P = (beta * Px; Py) var beta; var lambda; if (conf.beta) { beta = new BN(conf.beta, 16).toRed(this.red); } else { var betas = this._getEndoRoots(this.p); // Choose the smallest beta beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]; beta = beta.toRed(this.red); } if (conf.lambda) { lambda = new BN(conf.lambda, 16); } else { // Choose the lambda that is matching selected beta var lambdas = this._getEndoRoots(this.n); if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) { lambda = lambdas[0]; } else { lambda = lambdas[1]; assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0); } } // Get basis vectors, used for balanced length-two representation var basis; if (conf.basis) { basis = conf.basis.map(function(vec) { return { a: new BN(vec.a, 16), b: new BN(vec.b, 16) }; }); } else { basis = this._getEndoBasis(lambda); } return { beta: beta, lambda: lambda, basis: basis }; }; ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) { // Find roots of for x^2 + x + 1 in F // Root = (-1 +- Sqrt(-3)) / 2 // var red = num === this.p ? this.red : BN.mont(num); var tinv = new BN(2).toRed(red).redInvm(); var ntinv = tinv.redNeg(); var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv); var l1 = ntinv.redAdd(s).fromRed(); var l2 = ntinv.redSub(s).fromRed(); return [ l1, l2 ]; }; ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) { // aprxSqrt >= sqrt(this.n) var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)); // 3.74 // Run EGCD, until r(L + 1) < aprxSqrt var u = lambda; var v = this.n.clone(); var x1 = new BN(1); var y1 = new BN(0); var x2 = new BN(0); var y2 = new BN(1); // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n) var a0; var b0; // First vector var a1; var b1; // Second vector var a2; var b2; var prevR; var i = 0; var r; var x; while (u.cmpn(0) !== 0) { var q = v.div(u); r = v.sub(q.mul(u)); x = x2.sub(q.mul(x1)); var y = y2.sub(q.mul(y1)); if (!a1 && r.cmp(aprxSqrt) < 0) { a0 = prevR.neg(); b0 = x1; a1 = r.neg(); b1 = x; } else if (a1 && ++i === 2) { break; } prevR = r; v = u; u = r; x2 = x1; x1 = x; y2 = y1; y1 = y; } a2 = r.neg(); b2 = x; var len1 = a1.sqr().add(b1.sqr()); var len2 = a2.sqr().add(b2.sqr()); if (len2.cmp(len1) >= 0) { a2 = a0; b2 = b0; } // Normalize signs if (a1.negative) { a1 = a1.neg(); b1 = b1.neg(); } if (a2.negative) { a2 = a2.neg(); b2 = b2.neg(); } return [ { a: a1, b: b1 }, { a: a2, b: b2 } ]; }; ShortCurve.prototype._endoSplit = function _endoSplit(k) { var basis = this.endo.basis; var v1 = basis[0]; var v2 = basis[1]; var c1 = v2.b.mul(k).divRound(this.n); var c2 = v1.b.neg().mul(k).divRound(this.n); var p1 = c1.mul(v1.a); var p2 = c2.mul(v2.a); var q1 = c1.mul(v1.b); var q2 = c2.mul(v2.b); // Calculate answer var k1 = k.sub(p1).sub(p2); var k2 = q1.add(q2).neg(); return { k1: k1, k2: k2 }; }; ShortCurve.prototype.pointFromX = function pointFromX(x, odd) { x = new BN(x, 16); if (!x.red) x = x.toRed(this.red); var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b); var y = y2.redSqrt(); if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) throw new Error('invalid point'); // XXX Is there any way to tell if the number is odd without converting it // to non-red form? var isOdd = y.fromRed().isOdd(); if (odd && !isOdd || !odd && isOdd) y = y.redNeg(); return this.point(x, y); }; ShortCurve.prototype.validate = function validate(point) { if (point.inf) return true; var x = point.x; var y = point.y; var ax = this.a.redMul(x); var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b); return y.redSqr().redISub(rhs).cmpn(0) === 0; }; ShortCurve.prototype._endoWnafMulAdd = function _endoWnafMulAdd(points, coeffs, jacobianResult) { var npoints = this._endoWnafT1; var ncoeffs = this._endoWnafT2; for (var i = 0; i < points.length; i++) { var split = this._endoSplit(coeffs[i]); var p = points[i]; var beta = p._getBeta(); if (split.k1.negative) { split.k1.ineg(); p = p.neg(true); } if (split.k2.negative) { split.k2.ineg(); beta = beta.neg(true); } npoints[i * 2] = p; npoints[i * 2 + 1] = beta; ncoeffs[i * 2] = split.k1; ncoeffs[i * 2 + 1] = split.k2; } var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult); // Clean-up references to points and coefficients for (var j = 0; j < i * 2; j++) { npoints[j] = null; ncoeffs[j] = null; } return res; }; function Point(curve, x, y, isRed) { Base.BasePoint.call(this, curve, 'affine'); if (x === null && y === null) { this.x = null; this.y = null; this.inf = true; } else { this.x = new BN(x, 16); this.y = new BN(y, 16); // Force redgomery representation when loading from JSON if (isRed) { this.x.forceRed(this.curve.red); this.y.forceRed(this.curve.red); } if (!this.x.red) this.x = this.x.toRed(this.curve.red); if (!this.y.red) this.y = this.y.toRed(this.curve.red); this.inf = false; } } inherits(Point, Base.BasePoint); ShortCurve.prototype.point = function point(x, y, isRed) { return new Point(this, x, y, isRed); }; ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) { return Point.fromJSON(this, obj, red); }; Point.prototype._getBeta = function _getBeta() { if (!this.curve.endo) return; var pre = this.precomputed; if (pre && pre.beta) return pre.beta; var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); if (pre) { var curve = this.curve; var endoMul = function(p) { return curve.point(p.x.redMul(curve.endo.beta), p.y); }; pre.beta = beta; beta.precomputed = { beta: null, naf: pre.naf && { wnd: pre.naf.wnd, points: pre.naf.points.map(endoMul) }, doubles: pre.doubles && { step: pre.doubles.step, points: pre.doubles.points.map(endoMul) } }; } return beta; }; Point.prototype.toJSON = function toJSON() { if (!this.precomputed) return [ this.x, this.y ]; return [ this.x, this.y, this.precomputed && { doubles: this.precomputed.doubles && { step: this.precomputed.doubles.step, points: this.precomputed.doubles.points.slice(1) }, naf: this.precomputed.naf && { wnd: this.precomputed.naf.wnd, points: this.precomputed.naf.points.slice(1) } } ]; }; Point.fromJSON = function fromJSON(curve, obj, red) { if (typeof obj === 'string') obj = JSON.parse(obj); var res = curve.point(obj[0], obj[1], red); if (!obj[2]) return res; function obj2point(obj) { return curve.point(obj[0], obj[1], red); } var pre = obj[2]; res.precomputed = { beta: null, doubles: pre.doubles && { step: pre.doubles.step, points: [ res ].concat(pre.doubles.points.map(obj2point)) }, naf: pre.naf && { wnd: pre.naf.wnd, points: [ res ].concat(pre.naf.points.map(obj2point)) } }; return res; }; Point.prototype.inspect = function inspect() { if (this.isInfinity()) return '<EC Point Infinity>'; return '<EC Point x: ' + this.x.fromRed().toString(16, 2) + ' y: ' + this.y.fromRed().toString(16, 2) + '>'; }; Point.prototype.isInfinity = function isInfinity() { return this.inf; }; Point.prototype.add = function add(p) { // O + P = P if (this.inf) return p; // P + O = P if (p.inf) return this; // P + P = 2P if (this.eq(p)) return this.dbl(); // P + (-P) = O if (this.neg().eq(p)) return this.curve.point(null, null); // P + Q = O if (this.x.cmp(p.x) === 0) return this.curve.point(null, null); var c = this.y.redSub(p.y); if (c.cmpn(0) !== 0) c = c.redMul(this.x.redSub(p.x).redInvm()); var nx = c.redSqr().redISub(this.x).redISub(p.x); var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); return this.curve.point(nx, ny); }; Point.prototype.dbl = function dbl() { if (this.inf) return this; // 2P = O var ys1 = this.y.redAdd(this.y); if (ys1.cmpn(0) === 0) return this.curve.point(null, null); var a = this.curve.a; var x2 = this.x.redSqr(); var dyinv = ys1.redInvm(); var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv); var nx = c.redSqr().redISub(this.x.redAdd(this.x)); var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); return this.curve.point(nx, ny); }; Point.prototype.getX = function getX() { return this.x.fromRed(); }; Point.prototype.getY = function getY() { return this.y.fromRed(); }; Point.prototype.mul = function mul(k) { k = new BN(k, 16); if (this._hasDoubles(k)) return this.curve._fixedNafMul(this, k); else if (this.curve.endo) return this.curve._endoWnafMulAdd([ this ], [ k ]); else return this.curve._wnafMul(this, k); }; Point.prototype.mulAdd = function mulAdd(k1, p2, k2) { var points = [ this, p2 ]; var coeffs = [ k1, k2 ]; if (this.curve.endo) return this.curve._endoWnafMulAdd(points, coeffs); else return this.curve._wnafMulAdd(1, points, coeffs, 2); }; Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) { var points = [ this, p2 ]; var coeffs = [ k1, k2 ]; if (this.curve.endo) return this.curve._endoWnafMulAdd(points, coeffs, true); else return this.curve._wnafMulAdd(1, points, coeffs, 2, true); }; Point.prototype.eq = function eq(p) { return this === p || this.inf === p.inf && (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0); }; Point.prototype.neg = function neg(_precompute) { if (this.inf) return this; var res = this.curve.point(this.x, this.y.redNeg()); if (_precompute && this.precomputed) { var pre = this.precomputed; var negate = function(p) { return p.neg(); }; res.precomputed = { naf: pre.naf && { wnd: pre.naf.wnd, points: pre.naf.points.map(negate) }, doubles: pre.doubles && { step: pre.doubles.step, points: pre.doubles.points.map(negate) } }; } return res; }; Point.prototype.toJ = function toJ() { if (this.inf) return this.curve.jpoint(null, null, null); var res = this.curve.jpoint(this.x, this.y, this.curve.one); return res; }; function JPoint(curve, x, y, z) { Base.BasePoint.call(this, curve, 'jacobian'); if (x === null && y === null && z === null) { this.x = this.curve.one; this.y = this.curve.one; this.z = new BN(0); } else { this.x = new BN(x, 16); this.y = new BN(y, 16); this.z = new BN(z, 16); } if (!this.x.red) this.x = this.x.toRed(this.curve.red); if (!this.y.red) this.y = this.y.toRed(this.curve.red); if (!this.z.red) this.z = this.z.toRed(this.curve.red); this.zOne = this.z === this.curve.one; } inherits(JPoint, Base.BasePoint); ShortCurve.prototype.jpoint = function jpoint(x, y, z) { return new JPoint(this, x, y, z); }; JPoint.prototype.toP = function toP() { if (this.isInfinity()) return this.curve.point(null, null); var zinv = this.z.redInvm(); var zinv2 = zinv.redSqr(); var ax = this.x.redMul(zinv2); var ay = this.y.redMul(zinv2).redMul(zinv); return this.curve.point(ax, ay); }; JPoint.prototype.neg = function neg() { return this.curve.jpoint(this.x, this.y.redNeg(), this.z); }; JPoint.prototype.add = function add(p) { // O + P = P if (this.isInfinity()) return p; // P + O = P if (p.isInfinity()) return this; // 12M + 4S + 7A var pz2 = p.z.redSqr(); var z2 = this.z.redSqr(); var u1 = this.x.redMul(pz2); var u2 = p.x.redMul(z2); var s1 = this.y.redMul(pz2.redMul(p.z)); var s2 = p.y.redMul(z2.redMul(this.z)); var h = u1.redSub(u2); var r = s1.redSub(s2); if (h.cmpn(0) === 0) { if (r.cmpn(0) !== 0) return this.curve.jpoint(null, null, null); else return this.dbl(); } var h2 = h.redSqr(); var h3 = h2.redMul(h); var v = u1.redMul(h2); var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); var nz = this.z.redMul(p.z).redMul(h); return this.curve.jpoint(nx, ny, nz); }; JPoint.prototype.mixedAdd = function mixedAdd(p) { // O + P = P if (this.isInfinity()) return p.toJ(); // P + O = P if (p.isInfinity()) return this; // 8M + 3S + 7A var z2 = this.z.redSqr(); var u1 = this.x; var u2 = p.x.redMul(z2); var s1 = this.y; var s2 = p.y.redMul(z2).redMul(this.z); var h = u1.redSub(u2); var r = s1.redSub(s2); if (h.cmpn(0) === 0) { if (r.cmpn(0) !== 0) return this.curve.jpoint(null, null, null); else return this.dbl(); } var h2 = h.redSqr(); var h3 = h2.redMul(h); var v = u1.redMul(h2); var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); var nz = this.z.redMul(h); return this.curve.jpoint(nx, ny, nz); }; JPoint.prototype.dblp = function dblp(pow) { if (pow === 0) return this; if (this.isInfinity()) return this; if (!pow) return this.dbl(); if (this.curve.zeroA || this.curve.threeA) { var r = this; for (var i = 0; i < pow; i++) r = r.dbl(); return r; } // 1M + 2S + 1A + N * (4S + 5M + 8A) // N = 1 => 6M + 6S + 9A var a = this.curve.a; var tinv = this.curve.tinv; var jx = this.x; var jy = this.y; var jz = this.z; var jz4 = jz.redSqr().redSqr(); // Reuse results var jyd = jy.redAdd(jy); for (var i = 0; i < pow; i++) { var jx2 = jx.redSqr(); var jyd2 = jyd.redSqr(); var jyd4 = jyd2.redSqr(); var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); var t1 = jx.redMul(jyd2); var nx = c.redSqr().redISub(t1.redAdd(t1)); var t2 = t1.redISub(nx); var dny = c.redMul(t2); dny = dny.redIAdd(dny).redISub(jyd4); var nz = jyd.redMul(jz); if (i + 1 < pow) jz4 = jz4.redMul(jyd4); jx = nx; jz = nz; jyd = dny; } return this.curve.jpoint(jx, jyd.redMul(tinv), jz); }; JPoint.prototype.dbl = function dbl() { if (this.isInfinity()) return this; if (this.curve.zeroA) return this._zeroDbl(); else if (this.curve.threeA) return this._threeDbl(); else return this._dbl(); }; JPoint.prototype._zeroDbl = function _zeroDbl() { var nx; var ny; var nz; // Z = 1 if (this.zOne) { // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html // #doubling-mdbl-2007-bl // 1M + 5S + 14A // XX = X1^2 var xx = this.x.redSqr(); // YY = Y1^2 var yy = this.y.redSqr(); // YYYY = YY^2 var yyyy = yy.redSqr(); // S = 2 * ((X1 + YY)^2 - XX - YYYY) var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); s = s.redIAdd(s); // M = 3 * XX + a; a = 0 var m = xx.redAdd(xx).redIAdd(xx); // T = M ^ 2 - 2*S var t = m.redSqr().redISub(s).redISub(s); // 8 * YYYY var yyyy8 = yyyy.redIAdd(yyyy); yyyy8 = yyyy8.redIAdd(yyyy8); yyyy8 = yyyy8.redIAdd(yyyy8); // X3 = T nx = t; // Y3 = M * (S - T) - 8 * YYYY ny = m.redMul(s.redISub(t)).redISub(yyyy8); // Z3 = 2*Y1 nz = this.y.redAdd(this.y); } else { // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html // #doubling-dbl-2009-l // 2M + 5S + 13A // A = X1^2 var a = this.x.redSqr(); // B = Y1^2 var b = this.y.redSqr(); // C = B^2 var c = b.redSqr(); // D = 2 * ((X1 + B)^2 - A - C) var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c); d = d.redIAdd(d); // E = 3 * A var e = a.redAdd(a).redIAdd(a); // F = E^2 var f = e.redSqr(); // 8 * C var c8 = c.redIAdd(c); c8 = c8.redIAdd(c8); c8 = c8.redIAdd(c8); // X3 = F - 2 * D nx = f.redISub(d).redISub(d); // Y3 = E * (D - X3) - 8 * C ny = e.redMul(d.redISub(nx)).redISub(c8); // Z3 = 2 * Y1 * Z1 nz = this.y.redMul(this.z); nz = nz.redIAdd(nz); } return this.curve.jpoint(nx, ny, nz); }; JPoint.prototype._threeDbl = function _threeDbl() { var nx; var ny; var nz; // Z = 1 if (this.zOne) { // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html // #doubling-mdbl-2007-bl // 1M + 5S + 15A // XX = X1^2 var xx = this.x.redSqr(); // YY = Y1^2 var yy = this.y.redSqr(); // YYYY = YY^2 var yyyy = yy.redSqr(); // S = 2 * ((X1 + YY)^2 - XX - YYYY) var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); s = s.redIAdd(s); // M = 3 * XX + a var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); // T = M^2 - 2 * S var t = m.redSqr().redISub(s).redISub(s); // X3 = T nx = t; // Y3 = M * (S - T) - 8 * YYYY var yyyy8 = yyyy.redIAdd(yyyy); yyyy8 = yyyy8.redIAdd(yyyy8); yyyy8 = yyyy8.redIAdd(yyyy8); ny = m.redMul(s.redISub(t)).redISub(yyyy8); // Z3 = 2 * Y1 nz = this.y.redAdd(this.y); } else { // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b // 3M + 5S // delta = Z1^2 var delta = this.z.redSqr(); // gamma = Y1^2 var gamma = this.y.redSqr(); // beta = X1 * gamma var beta = this.x.redMul(gamma); // alpha = 3 * (X1 - delta) * (X1 + delta) var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta)); alpha = alpha.redAdd(alpha).redIAdd(alpha); // X3 = alpha^2 - 8 * beta var beta4 = beta.redIAdd(beta); beta4 = beta4.redIAdd(beta4); var beta8 = beta4.redAdd(beta4); nx = alpha.redSqr().redISub(beta8); // Z3 = (Y1 + Z1)^2 - gamma - delta nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta); // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2 var ggamma8 = gamma.redSqr(); ggamma8 = ggamma8.redIAdd(ggamma8); ggamma8 = ggamma8.redIAdd(ggamma8); ggamma8 = ggamma8.redIAdd(ggamma8); ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8); } return this.curve.jpoint(nx, ny, nz); }; JPoint.prototype._dbl = function _dbl() { var a = this.curve.a; // 4M + 6S + 10A var jx = this.x; var jy = this.y; var jz = this.z; var jz4 = jz.redSqr().redSqr(); var jx2 = jx.redSqr(); var jy2 = jy.redSqr(); var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); var jxd4 = jx.redAdd(jx); jxd4 = jxd4.redIAdd(jxd4); var t1 = jxd4.redMul(jy2); var nx = c.redSqr().redISub(t1.redAdd(t1)); var t2 = t1.redISub(nx); var jyd8 = jy2.redSqr(); jyd8 = jyd8.redIAdd(jyd8); jyd8 = jyd8.redIAdd(jyd8); jyd8 = jyd8.redIAdd(jyd8); var ny = c.redMul(t2).redISub(jyd8); var nz = jy.redAdd(jy).redMul(jz); return this.curve.jpoint(nx, ny, nz); }; JPoint.prototype.trpl = function trpl() { if (!this.curve.zeroA) return this.dbl().add(this); // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl // 5M + 10S + ... // XX = X1^2 var xx = this.x.redSqr(); // YY = Y1^2 var yy = this.y.redSqr(); // ZZ = Z1^2 var zz = this.z.redSqr(); // YYYY = YY^2 var yyyy = yy.redSqr(); // M = 3 * XX + a * ZZ2; a = 0 var m = xx.redAdd(xx).redIAdd(xx); // MM = M^2 var mm = m.redSqr(); // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); e = e.redIAdd(e); e = e.redAdd(e).redIAdd(e); e = e.redISub(mm); // EE = E^2 var ee = e.redSqr(); // T = 16*YYYY var t = yyyy.redIAdd(yyyy); t = t.redIAdd(t); t = t.redIAdd(t); t = t.redIAdd(t); // U = (M + E)^2 - MM - EE - T var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t); // X3 = 4 * (X1 * EE - 4 * YY * U) var yyu4 = yy.redMul(u); yyu4 = yyu4.redIAdd(yyu4); yyu4 = yyu4.redIAdd(yyu4); var nx = this.x.redMul(ee).redISub(yyu4); nx = nx.redIAdd(nx); nx = nx.redIAdd(nx); // Y3 = 8 * Y1 * (U * (T - U) - E * EE) var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee))); ny = ny.redIAdd(ny); ny = ny.redIAdd(ny); ny = ny.redIAdd(ny); // Z3 = (Z1 + E)^2 - ZZ - EE var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee); return this.curve.jpoint(nx, ny, nz); }; JPoint.prototype.mul = function mul(k, kbase) { k = new BN(k, kbase); return this.curve._wnafMul(this, k); }; JPoint.prototype.eq = function eq(p) { if (p.type === 'affine') return this.eq(p.toJ()); if (this === p) return true; // x1 * z2^2 == x2 * z1^2 var z2 = this.z.redSqr(); var pz2 = p.z.redSqr(); if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0) return false; // y1 * z2^3 == y2 * z1^3 var z3 = z2.redMul(this.z); var pz3 = pz2.redMul(p.z); return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0; }; JPoint.prototype.eqXToP = function eqXToP(x) { var zs = this.z.redSqr(); var rx = x.toRed(this.curve.red).redMul(zs); if (this.x.cmp(rx) === 0) return true; var xc = x.clone(); var t = this.curve.redN.redMul(zs); for (;;) { xc.iadd(this.curve.n); if (xc.cmp(this.curve.p) >= 0) return false; rx.redIAdd(t); if (this.x.cmp(rx) === 0) return true; } return false; }; JPoint.prototype.inspect = function inspect() { if (this.isInfinity()) return '<EC JPoint Infinity>'; return '<EC JPoint x: ' + this.x.toString(16, 2) + ' y: ' + this.y.toString(16, 2) + ' z: ' + this.z.toString(16, 2) + '>'; }; JPoint.prototype.isInfinity = function isInfinity() { // XXX This code assumes that zero is always zero in red return this.z.cmpn(0) === 0; }; },{"../../elliptic":11,"../curve":14,"bn.js":8,"inherits":38}],17:[function(require,module,exports){ 'use strict'; var curves = exports; var hash = require('hash.js'); var elliptic = require('../elliptic'); var assert = elliptic.utils.assert; function PresetCurve(options) { if (options.type === 'short') this.curve = new elliptic.curve.short(options); else if (options.type === 'edwards') this.curve = new elliptic.curve.edwards(options); else this.curve = new elliptic.curve.mont(options); this.g = this.curve.g; this.n = this.curve.n; this.hash = options.hash; assert(this.g.validate(), 'Invalid curve'); assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O'); } curves.PresetCurve = PresetCurve; function defineCurve(name, options) { Object.defineProperty(curves, name, { configurable: true, enumerable: true, get: function() { var curve = new PresetCurve(options); Object.defineProperty(curves, name, { configurable: true, enumerable: true, value: curve }); return curve; } }); } defineCurve('p192', { type: 'short', prime: 'p192', p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff', a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc', b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1', n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831', hash: hash.sha256, gRed: false, g: [ '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012', '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811' ] }); defineCurve('p224', { type: 'short', prime: 'p224', p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001', a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe', b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4', n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d', hash: hash.sha256, gRed: false, g: [ 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21', 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34' ] }); defineCurve('p256', { type: 'short', prime: null, p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff', a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc', b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b', n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551', hash: hash.sha256, gRed: false, g: [ '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296', '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5' ] }); defineCurve('p384', { type: 'short', prime: null, p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'fffffffe ffffffff 00000000 00000000 ffffffff', a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'fffffffe ffffffff 00000000 00000000 fffffffc', b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' + '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef', n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' + 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973', hash: hash.sha384, gRed: false, g: [ 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' + '5502f25d bf55296c 3a545e38 72760ab7', '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' + '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f' ] }); defineCurve('p521', { type: 'short', prime: null, p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff', a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff fffffffc', b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' + '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' + '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00', n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' + 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409', hash: hash.sha512, gRed: false, g: [ '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' + '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' + 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66', '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' + '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' + '3fad0761 353c7086 a272c240 88be9476 9fd16650' ] }); defineCurve('curve25519', { type: 'mont', prime: 'p25519', p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', a: '76d06', b: '1', n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', hash: hash.sha256, gRed: false, g: [ '9' ] }); defineCurve('ed25519', { type: 'edwards', prime: 'p25519', p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', a: '-1', c: '1', // -121665 * (121666^(-1)) (mod P) d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3', n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', hash: hash.sha256, gRed: false, g: [ '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a', // 4/5 '6666666666666666666666666666666666666666666666666666666666666658' ] }); var pre; try { pre = require('./precomputed/secp256k1'); } catch (e) { pre = undefined; } defineCurve('secp256k1', { type: 'short', prime: 'k256', p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f', a: '0', b: '7', n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141', h: '1', hash: hash.sha256, // Precomputed endomorphism beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee', lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72', basis: [ { a: '3086d221a7d46bcde86c90e49284eb15', b: '-e4437ed6010e88286f547fa90abfe4c3' }, { a: '114ca50f7a8e2f3f657c1108d9d44cfd8', b: '3086d221a7d46bcde86c90e49284eb15' } ], gRed: false, g: [ '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', pre ] }); },{"../elliptic":11,"./precomputed/secp256k1":23,"hash.js":26}],18:[function(require,module,exports){ 'use strict'; var BN = require('bn.js'); var elliptic = require('../../elliptic'); var utils = elliptic.utils; var assert = utils.assert; var KeyPair = require('./key'); var Signature = require('./signature'); function EC(options) { if (!(this instanceof EC)) return new EC(options); // Shortcut `elliptic.ec(curve-name)` if (typeof options === 'string') { assert(elliptic.curves.hasOwnProperty(options), 'Unknown curve ' + options); options = elliptic.curves[options]; } // Shortcut for `elliptic.ec(elliptic.curves.curveName)` if (options instanceof elliptic.curves.PresetCurve) options = { curve: options }; this.curve = options.curve.curve; this.n = this.curve.n; this.nh = this.n.ushrn(1); this.g = this.curve.g; // Point on curve this.g = options.curve.g; this.g.precompute(options.curve.n.bitLength() + 1); // Hash for function for DRBG this.hash = options.hash || options.curve.hash; } module.exports = EC; EC.prototype.keyPair = function keyPair(options) { return new KeyPair(this, options); }; EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) { return KeyPair.fromPrivate(this, priv, enc); }; EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) { return KeyPair.fromPublic(this, pub, enc); }; EC.prototype.genKeyPair = function genKeyPair(options) { if (!options) options = {}; // Instantiate Hmac_DRBG var drbg = new elliptic.hmacDRBG({ hash: this.hash, pers: options.pers, entropy: options.entropy || elliptic.rand(this.hash.hmacStrength), nonce: this.n.toArray() }); var bytes = this.n.byteLength(); var ns2 = this.n.sub(new BN(2)); do { var priv = new BN(drbg.generate(bytes)); if (priv.cmp(ns2) > 0) continue; priv.iaddn(1); return this.keyFromPrivate(priv); } while (true); }; EC.prototype._truncateToN = function truncateToN(msg, truncOnly) { var delta = msg.byteLength() * 8 - this.n.bitLength(); if (delta > 0) msg = msg.ushrn(delta); if (!truncOnly && msg.cmp(this.n) >= 0) return msg.sub(this.n); else return msg; }; EC.prototype.sign = function sign(msg, key, enc, options) { if (typeof enc === 'object') { options = enc; enc = null; } if (!options) options = {}; key = this.keyFromPrivate(key, enc); msg = this._truncateToN(new BN(msg, 16)); // Zero-extend key to provide enough entropy var bytes = this.n.byteLength(); var bkey = key.getPrivate().toArray('be', bytes); // Zero-extend nonce to have the same byte size as N var nonce = msg.toArray('be', bytes); // Instantiate Hmac_DRBG var drbg = new elliptic.hmacDRBG({ hash: this.hash, entropy: bkey, nonce: nonce, pers: options.pers, persEnc: options.persEnc }); // Number of bytes to generate var ns1 = this.n.sub(new BN(1)); for (var iter = 0; true; iter++) { var k = options.k ? options.k(iter) : new BN(drbg.generate(this.n.byteLength())); k = this._truncateToN(k, true); if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0) continue; var kp = this.g.mul(k); if (kp.isInfinity()) continue; var kpX = kp.getX(); var r = kpX.umod(this.n); if (r.cmpn(0) === 0) continue; var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg)); s = s.umod(this.n); if (s.cmpn(0) === 0) continue; var recoveryParam = (kp.getY().isOdd() ? 1 : 0) | (kpX.cmp(r) !== 0 ? 2 : 0); // Use complement of `s`, if it is > `n / 2` if (options.canonical && s.cmp(this.nh) > 0) { s = this.n.sub(s); recoveryParam ^= 1; } return new Signature({ r: r, s: s, recoveryParam: recoveryParam }); } }; EC.prototype.verify = function verify(msg, signature, key, enc) { msg = this._truncateToN(new BN(msg, 16)); key = this.keyFromPublic(key, enc); signature = new Signature(signature, 'hex'); // Perform primitive values validation var r = signature.r; var s = signature.s; if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0) return false; if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0) return false; // Validate signature var sinv = s.invm(this.n); var u1 = sinv.mul(msg).umod(this.n); var u2 = sinv.mul(r).umod(this.n); if (!this.curve._maxwellTrick) { var p = this.g.mulAdd(u1, key.getPublic(), u2); if (p.isInfinity()) return false; return p.getX().umod(this.n).cmp(r) === 0; } // NOTE: Greg Maxwell's trick, inspired by: // https://git.io/vad3K var p = this.g.jmulAdd(u1, key.getPublic(), u2); if (p.isInfinity()) return false; // Compare `p.x` of Jacobian point with `r`, // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the // inverse of `p.z^2` return p.eqXToP(r); }; EC.prototype.recoverPubKey = function(msg, signature, j, enc) { assert((3 & j) === j, 'The recovery param is more than two bits'); signature = new Signature(signature, enc); var n = this.n; var e = new BN(msg); var r = signature.r; var s = signature.s; // A set LSB signifies that the y-coordinate is odd var isYOdd = j & 1; var isSecondKey = j >> 1; if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey) throw new Error('Unable to find sencond key candinate'); // 1.1. Let x = r + jn. if (isSecondKey) r = this.curve.pointFromX(r.add(this.curve.n), isYOdd); else r = this.curve.pointFromX(r, isYOdd); var rInv = signature.r.invm(n); var s1 = n.sub(e).mul(rInv).umod(n); var s2 = s.mul(rInv).umod(n); // 1.6.1 Compute Q = r^-1 (sR - eG) // Q = r^-1 (sR + -eG) return this.g.mulAdd(s1, r, s2); }; EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) { signature = new Signature(signature, enc); if (signature.recoveryParam !== null) return signature.recoveryParam; for (var i = 0; i < 4; i++) { var Qprime; try { Qprime = this.recoverPubKey(e, signature, i); } catch (e) { continue; } if (Qprime.eq(Q)) return i; } throw new Error('Unable to find valid recovery factor'); }; },{"../../elliptic":11,"./key":19,"./signature":20,"bn.js":8}],19:[function(require,module,exports){ 'use strict'; var BN = require('bn.js'); var elliptic = require('../../elliptic'); var utils = elliptic.utils; var assert = utils.assert; function KeyPair(ec, options) { this.ec = ec; this.priv = null; this.pub = null; // KeyPair(ec, { priv: ..., pub: ... }) if (options.priv) this._importPrivate(options.priv, options.privEnc); if (options.pub) this._importPublic(options.pub, options.pubEnc); } module.exports = KeyPair; KeyPair.fromPublic = function fromPublic(ec, pub, enc) { if (pub instanceof KeyPair) return pub; return new KeyPair(ec, { pub: pub, pubEnc: enc }); }; KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) { if (priv instanceof KeyPair) return priv; return new KeyPair(ec, { priv: priv, privEnc: enc }); }; KeyPair.prototype.validate = function validate() { var pub = this.getPublic(); if (pub.isInfinity()) return { result: false, reason: 'Invalid public key' }; if (!pub.validate()) return { result: false, reason: 'Public key is not a point' }; if (!pub.mul(this.ec.curve.n).isInfinity()) return { result: false, reason: 'Public key * N != O' }; return { result: true, reason: null }; }; KeyPair.prototype.getPublic = function getPublic(compact, enc) { // compact is optional argument if (typeof compact === 'string') { enc = compact; compact = null; } if (!this.pub) this.pub = this.ec.g.mul(this.priv); if (!enc) return this.pub; return this.pub.encode(enc, compact); }; KeyPair.prototype.getPrivate = function getPrivate(enc) { if (enc === 'hex') return this.priv.toString(16, 2); else return this.priv; }; KeyPair.prototype._importPrivate = function _importPrivate(key, enc) { this.priv = new BN(key, enc || 16); // Ensure that the priv won't be bigger than n, otherwise we may fail // in fixed multiplication method this.priv = this.priv.umod(this.ec.curve.n); }; KeyPair.prototype._importPublic = function _importPublic(key, enc) { if (key.x || key.y) { // Montgomery points only have an `x` coordinate. // Weierstrass/Edwards points on the other hand have both `x` and // `y` coordinates. if (this.ec.curve.type === 'mont') { assert(key.x, 'Need x coordinate'); } else if (this.ec.curve.type === 'short' || this.ec.curve.type === 'edwards') { assert(key.x && key.y, 'Need both x and y coordinate'); } this.pub = this.ec.curve.point(key.x, key.y); return; } this.pub = this.ec.curve.decodePoint(key, enc); }; // ECDH KeyPair.prototype.derive = function derive(pub) { return pub.mul(this.priv).getX(); }; // ECDSA KeyPair.prototype.sign = function sign(msg, enc, options) { return this.ec.sign(msg, this, enc, options); }; KeyPair.prototype.verify = function verify(msg, signature) { return this.ec.verify(msg, signature, this); }; KeyPair.prototype.inspect = function inspect() { return '<Key priv: ' + (this.priv && this.priv.toString(16, 2)) + ' pub: ' + (this.pub && this.pub.inspect()) + ' >'; }; },{"../../elliptic":11,"bn.js":8}],20:[function(require,module,exports){ 'use strict'; var BN = require('bn.js'); var elliptic = require('../../elliptic'); var utils = elliptic.utils; var assert = utils.assert; function Signature(options, enc) { if (options instanceof Signature) return options; if (this._importDER(options, enc)) return; assert(options.r && options.s, 'Signature without r or s'); this.r = new BN(options.r, 16); this.s = new BN(options.s, 16); if (options.recoveryParam === undefined) this.recoveryParam = null; else this.recoveryParam = options.recoveryParam; } module.exports = Signature; function Position() { this.place = 0; } function getLength(buf, p) { var initial = buf[p.place++]; if (!(initial & 0x80)) { return initial; } var octetLen = initial & 0xf; var val = 0; for (var i = 0, off = p.place; i < octetLen; i++, off++) { val <<= 8; val |= buf[off]; } p.place = off; return val; } function rmPadding(buf) { var i = 0; var len = buf.length - 1; while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) { i++; } if (i === 0) { return buf; } return buf.slice(i); } Signature.prototype._importDER = function _importDER(data, enc) { data = utils.toArray(data, enc); var p = new Position(); if (data[p.place++] !== 0x30) { return false; } var len = getLength(data, p); if ((len + p.place) !== data.length) { return false; } if (data[p.place++] !== 0x02) { return false; } var rlen = getLength(data, p); var r = data.slice(p.place, rlen + p.place); p.place += rlen; if (data[p.place++] !== 0x02) { return false; } var slen = getLength(data, p); if (data.length !== slen + p.place) { return false; } var s = data.slice(p.place, slen + p.place); if (r[0] === 0 && (r[1] & 0x80)) { r = r.slice(1); } if (s[0] === 0 && (s[1] & 0x80)) { s = s.slice(1); } this.r = new BN(r); this.s = new BN(s); this.recoveryParam = null; return true; }; function constructLength(arr, len) { if (len < 0x80) { arr.push(len); return; } var octets = 1 + (Math.log(len) / Math.LN2 >>> 3); arr.push(octets | 0x80); while (--octets) { arr.push((len >>> (octets << 3)) & 0xff); } arr.push(len); } Signature.prototype.toDER = function toDER(enc) { var r = this.r.toArray(); var s = this.s.toArray(); // Pad values if (r[0] & 0x80) r = [ 0 ].concat(r); // Pad values if (s[0] & 0x80) s = [ 0 ].concat(s); r = rmPadding(r); s = rmPadding(s); while (!s[0] && !(s[1] & 0x80)) { s = s.slice(1); } var arr = [ 0x02 ]; constructLength(arr, r.length); arr = arr.concat(r); arr.push(0x02); constructLength(arr, s.length); var backHalf = arr.concat(s); var res = [ 0x30 ]; constructLength(res, backHalf.length); res = res.concat(backHalf); return utils.encode(res, enc); }; },{"../../elliptic":11,"bn.js":8}],21:[function(require,module,exports){ arguments[4][13][0].apply(exports,arguments) },{"dup":13}],22:[function(require,module,exports){ 'use strict'; var hash = require('hash.js'); var elliptic = require('../elliptic'); var utils = elliptic.utils; var assert = utils.assert; function HmacDRBG(options) { if (!(this instanceof HmacDRBG)) return new HmacDRBG(options); this.hash = options.hash; this.predResist = !!options.predResist; this.outLen = this.hash.outSize; this.minEntropy = options.minEntropy || this.hash.hmacStrength; this.reseed = null; this.reseedInterval = null; this.K = null; this.V = null; var entropy = utils.toArray(options.entropy, options.entropyEnc); var nonce = utils.toArray(options.nonce, options.nonceEnc); var pers = utils.toArray(options.pers, options.persEnc); assert(entropy.length >= (this.minEntropy / 8), 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); this._init(entropy, nonce, pers); } module.exports = HmacDRBG; HmacDRBG.prototype._init = function init(entropy, nonce, pers) { var seed = entropy.concat(nonce).concat(pers); this.K = new Array(this.outLen / 8); this.V = new Array(this.outLen / 8); for (var i = 0; i < this.V.length; i++) { this.K[i] = 0x00; this.V[i] = 0x01; } this._update(seed); this.reseed = 1; this.reseedInterval = 0x1000000000000; // 2^48 }; HmacDRBG.prototype._hmac = function hmac() { return new hash.hmac(this.hash, this.K); }; HmacDRBG.prototype._update = function update(seed) { var kmac = this._hmac() .update(this.V) .update([ 0x00 ]); if (seed) kmac = kmac.update(seed); this.K = kmac.digest(); this.V = this._hmac().update(this.V).digest(); if (!seed) return; this.K = this._hmac() .update(this.V) .update([ 0x01 ]) .update(seed) .digest(); this.V = this._hmac().update(this.V).digest(); }; HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) { // Optional entropy enc if (typeof entropyEnc !== 'string') { addEnc = add; add = entropyEnc; entropyEnc = null; } entropy = utils.toBuffer(entropy, entropyEnc); add = utils.toBuffer(add, addEnc); assert(entropy.length >= (this.minEntropy / 8), 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); this._update(entropy.concat(add || [])); this.reseed = 1; }; HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) { if (this.reseed > this.reseedInterval) throw new Error('Reseed is required'); // Optional encoding if (typeof enc !== 'string') { addEnc = add; add = enc; enc = null; } // Optional additional data if (add) { add = utils.toArray(add, addEnc); this._update(add); } var temp = []; while (temp.length < len) { this.V = this._hmac().update(this.V).digest(); temp = temp.concat(this.V); } var res = temp.slice(0, len); this._update(add); this.reseed++; return utils.encode(res, enc); }; },{"../elliptic":11,"hash.js":26}],23:[function(require,module,exports){ module.exports = undefined; },{}],24:[function(require,module,exports){ 'use strict'; var utils = exports; var BN = require('bn.js'); utils.assert = function assert(val, msg) { if (!val) throw new Error(msg || 'Assertion failed'); }; function toArray(msg, enc) { if (Array.isArray(msg)) return msg.slice(); if (!msg) return []; var res = []; if (typeof msg !== 'string') { for (var i = 0; i < msg.length; i++) res[i] = msg[i] | 0; return res; } if (!enc) { for (var i = 0; i < msg.length; i++) { var c = msg.charCodeAt(i); var hi = c >> 8; var lo = c & 0xff; if (hi) res.push(hi, lo); else res.push(lo); } } else if (enc === 'hex') { msg = msg.replace(/[^a-z0-9]+/ig, ''); if (msg.length % 2 !== 0) msg = '0' + msg; for (var i = 0; i < msg.length; i += 2) res.push(parseInt(msg[i] + msg[i + 1], 16)); } return res; } utils.toArray = toArray; function zero2(word) { if (word.length === 1) return '0' + word; else return word; } utils.zero2 = zero2; function toHex(msg) { var res = ''; for (var i = 0; i < msg.length; i++) res += zero2(msg[i].toString(16)); return res; } utils.toHex = toHex; utils.encode = function encode(arr, enc) { if (enc === 'hex') return toHex(arr); else return arr; }; // Represent num in a w-NAF form function getNAF(num, w) { var naf = []; var ws = 1 << (w + 1); var k = num.clone(); while (k.cmpn(1) >= 0) { var z; if (k.isOdd()) { var mod = k.andln(ws - 1); if (mod > (ws >> 1) - 1) z = (ws >> 1) - mod; else z = mod; k.isubn(z); } else { z = 0; } naf.push(z); // Optimization, shift by word if possible var shift = (k.cmpn(0) !== 0 && k.andln(ws - 1) === 0) ? (w + 1) : 1; for (var i = 1; i < shift; i++) naf.push(0); k.iushrn(shift); } return naf; } utils.getNAF = getNAF; // Represent k1, k2 in a Joint Sparse Form function getJSF(k1, k2) { var jsf = [ [], [] ]; k1 = k1.clone(); k2 = k2.clone(); var d1 = 0; var d2 = 0; while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) { // First phase var m14 = (k1.andln(3) + d1) & 3; var m24 = (k2.andln(3) + d2) & 3; if (m14 === 3) m14 = -1; if (m24 === 3) m24 = -1; var u1; if ((m14 & 1) === 0) { u1 = 0; } else { var m8 = (k1.andln(7) + d1) & 7; if ((m8 === 3 || m8 === 5) && m24 === 2) u1 = -m14; else u1 = m14; } jsf[0].push(u1); var u2; if ((m24 & 1) === 0) { u2 = 0; } else { var m8 = (k2.andln(7) + d2) & 7; if ((m8 === 3 || m8 === 5) && m14 === 2) u2 = -m24; else u2 = m24; } jsf[1].push(u2); // Second phase if (2 * d1 === u1 + 1) d1 = 1 - d1; if (2 * d2 === u2 + 1) d2 = 1 - d2; k1.iushrn(1); k2.iushrn(1); } return jsf; } utils.getJSF = getJSF; function cachedProperty(obj, name, computer) { var key = '_' + name; obj.prototype[name] = function cachedProperty() { return this[key] !== undefined ? this[key] : this[key] = computer.call(this); }; } utils.cachedProperty = cachedProperty; function parseBytes(bytes) { return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') : bytes; } utils.parseBytes = parseBytes; function intFromLE(bytes) { return new BN(bytes, 'hex', 'le'); } utils.intFromLE = intFromLE; },{"bn.js":8}],25:[function(require,module,exports){ module.exports={"version":"6.3.3"} },{}],26:[function(require,module,exports){ var hash = exports; hash.utils = require('./hash/utils'); hash.common = require('./hash/common'); hash.sha = require('./hash/sha'); hash.ripemd = require('./hash/ripemd'); hash.hmac = require('./hash/hmac'); // Proxy hash functions to the main object hash.sha1 = hash.sha.sha1; hash.sha256 = hash.sha.sha256; hash.sha224 = hash.sha.sha224; hash.sha384 = hash.sha.sha384; hash.sha512 = hash.sha.sha512; hash.ripemd160 = hash.ripemd.ripemd160; },{"./hash/common":27,"./hash/hmac":28,"./hash/ripemd":29,"./hash/sha":30,"./hash/utils":37}],27:[function(require,module,exports){ 'use strict'; var utils = require('./utils'); var assert = require('minimalistic-assert'); function BlockHash() { this.pending = null; this.pendingTotal = 0; this.blockSize = this.constructor.blockSize; this.outSize = this.constructor.outSize; this.hmacStrength = this.constructor.hmacStrength; this.padLength = this.constructor.padLength / 8; this.endian = 'big'; this._delta8 = this.blockSize / 8; this._delta32 = this.blockSize / 32; } exports.BlockHash = BlockHash; BlockHash.prototype.update = function update(msg, enc) { // Convert message to array, pad it, and join into 32bit blocks msg = utils.toArray(msg, enc); if (!this.pending) this.pending = msg; else this.pending = this.pending.concat(msg); this.pendingTotal += msg.length; // Enough data, try updating if (this.pending.length >= this._delta8) { msg = this.pending; // Process pending data in blocks var r = msg.length % this._delta8; this.pending = msg.slice(msg.length - r, msg.length); if (this.pending.length === 0) this.pending = null; msg = utils.join32(msg, 0, msg.length - r, this.endian); for (var i = 0; i < msg.length; i += this._delta32) this._update(msg, i, i + this._delta32); } return this; }; BlockHash.prototype.digest = function digest(enc) { this.update(this._pad()); assert(this.pending === null); return this._digest(enc); }; BlockHash.prototype._pad = function pad() { var len = this.pendingTotal; var bytes = this._delta8; var k = bytes - ((len + this.padLength) % bytes); var res = new Array(k + this.padLength); res[0] = 0x80; for (var i = 1; i < k; i++) res[i] = 0; // Append length len <<= 3; if (this.endian === 'big') { for (var t = 8; t < this.padLength; t++) res[i++] = 0; res[i++] = 0; res[i++] = 0; res[i++] = 0; res[i++] = 0; res[i++] = (len >>> 24) & 0xff; res[i++] = (len >>> 16) & 0xff; res[i++] = (len >>> 8) & 0xff; res[i++] = len & 0xff; } else { res[i++] = len & 0xff; res[i++] = (len >>> 8) & 0xff; res[i++] = (len >>> 16) & 0xff; res[i++] = (len >>> 24) & 0xff; res[i++] = 0; res[i++] = 0; res[i++] = 0; res[i++] = 0; for (t = 8; t < this.padLength; t++) res[i++] = 0; } return res; }; },{"./utils":37,"minimalistic-assert":40}],28:[function(require,module,exports){ 'use strict'; var utils = require('./utils'); var assert = require('minimalistic-assert'); function Hmac(hash, key, enc) { if (!(this instanceof Hmac)) return new Hmac(hash, key, enc); this.Hash = hash; this.blockSize = hash.blockSize / 8; this.outSize = hash.outSize / 8; this.inner = null; this.outer = null; this._init(utils.toArray(key, enc)); } module.exports = Hmac; Hmac.prototype._init = function init(key) { // Shorten key, if needed if (key.length > this.blockSize) key = new this.Hash().update(key).digest(); assert(key.length <= this.blockSize); // Add padding to key for (var i = key.length; i < this.blockSize; i++) key.push(0); for (i = 0; i < key.length; i++) key[i] ^= 0x36; this.inner = new this.Hash().update(key); // 0x36 ^ 0x5c = 0x6a for (i = 0; i < key.length; i++) key[i] ^= 0x6a; this.outer = new this.Hash().update(key); }; Hmac.prototype.update = function update(msg, enc) { this.inner.update(msg, enc); return this; }; Hmac.prototype.digest = function digest(enc) { this.outer.update(this.inner.digest()); return this.outer.digest(enc); }; },{"./utils":37,"minimalistic-assert":40}],29:[function(require,module,exports){ module.exports = {ripemd160: null} },{}],30:[function(require,module,exports){ 'use strict'; exports.sha1 = require('./sha/1'); exports.sha224 = require('./sha/224'); exports.sha256 = require('./sha/256'); exports.sha384 = require('./sha/384'); exports.sha512 = require('./sha/512'); },{"./sha/1":31,"./sha/224":32,"./sha/256":33,"./sha/384":34,"./sha/512":35}],31:[function(require,module,exports){ arguments[4][13][0].apply(exports,arguments) },{"dup":13}],32:[function(require,module,exports){ arguments[4][13][0].apply(exports,arguments) },{"dup":13}],33:[function(require,module,exports){ 'use strict'; var utils = require('../utils'); var common = require('../common'); var shaCommon = require('./common'); var assert = require('minimalistic-assert'); var sum32 = utils.sum32; var sum32_4 = utils.sum32_4; var sum32_5 = utils.sum32_5; var ch32 = shaCommon.ch32; var maj32 = shaCommon.maj32; var s0_256 = shaCommon.s0_256; var s1_256 = shaCommon.s1_256; var g0_256 = shaCommon.g0_256; var g1_256 = shaCommon.g1_256; var BlockHash = common.BlockHash; var sha256_K = [ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 ]; function SHA256() { if (!(this instanceof SHA256)) return new SHA256(); BlockHash.call(this); this.h = [ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 ]; this.k = sha256_K; this.W = new Array(64); } utils.inherits(SHA256, BlockHash); module.exports = SHA256; SHA256.blockSize = 512; SHA256.outSize = 256; SHA256.hmacStrength = 192; SHA256.padLength = 64; SHA256.prototype._update = function _update(msg, start) { var W = this.W; for (var i = 0; i < 16; i++) W[i] = msg[start + i]; for (; i < W.length; i++) W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]); var a = this.h[0]; var b = this.h[1]; var c = this.h[2]; var d = this.h[3]; var e = this.h[4]; var f = this.h[5]; var g = this.h[6]; var h = this.h[7]; assert(this.k.length === W.length); for (i = 0; i < W.length; i++) { var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]); var T2 = sum32(s0_256(a), maj32(a, b, c)); h = g; g = f; f = e; e = sum32(d, T1); d = c; c = b; b = a; a = sum32(T1, T2); } this.h[0] = sum32(this.h[0], a); this.h[1] = sum32(this.h[1], b); this.h[2] = sum32(this.h[2], c); this.h[3] = sum32(this.h[3], d); this.h[4] = sum32(this.h[4], e); this.h[5] = sum32(this.h[5], f); this.h[6] = sum32(this.h[6], g); this.h[7] = sum32(this.h[7], h); }; SHA256.prototype._digest = function digest(enc) { if (enc === 'hex') return utils.toHex32(this.h, 'big'); else return utils.split32(this.h, 'big'); }; },{"../common":27,"../utils":37,"./common":36,"minimalistic-assert":40}],34:[function(require,module,exports){ arguments[4][13][0].apply(exports,arguments) },{"dup":13}],35:[function(require,module,exports){ 'use strict'; var utils = require('../utils'); var common = require('../common'); var assert = require('minimalistic-assert'); var rotr64_hi = utils.rotr64_hi; var rotr64_lo = utils.rotr64_lo; var shr64_hi = utils.shr64_hi; var shr64_lo = utils.shr64_lo; var sum64 = utils.sum64; var sum64_hi = utils.sum64_hi; var sum64_lo = utils.sum64_lo; var sum64_4_hi = utils.sum64_4_hi; var sum64_4_lo = utils.sum64_4_lo; var sum64_5_hi = utils.sum64_5_hi; var sum64_5_lo = utils.sum64_5_lo; var BlockHash = common.BlockHash; var sha512_K = [ 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 ]; function SHA512() { if (!(this instanceof SHA512)) return new SHA512(); BlockHash.call(this); this.h = [ 0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1, 0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179 ]; this.k = sha512_K; this.W = new Array(160); } utils.inherits(SHA512, BlockHash); module.exports = SHA512; SHA512.blockSize = 1024; SHA512.outSize = 512; SHA512.hmacStrength = 192; SHA512.padLength = 128; SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) { var W = this.W; // 32 x 32bit words for (var i = 0; i < 32; i++) W[i] = msg[start + i]; for (; i < W.length; i += 2) { var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2 var c0_lo = g1_512_lo(W[i - 4], W[i - 3]); var c1_hi = W[i - 14]; // i - 7 var c1_lo = W[i - 13]; var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15 var c2_lo = g0_512_lo(W[i - 30], W[i - 29]); var c3_hi = W[i - 32]; // i - 16 var c3_lo = W[i - 31]; W[i] = sum64_4_hi( c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo); W[i + 1] = sum64_4_lo( c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo); } }; SHA512.prototype._update = function _update(msg, start) { this._prepareBlock(msg, start); var W = this.W; var ah = this.h[0]; var al = this.h[1]; var bh = this.h[2]; var bl = this.h[3]; var ch = this.h[4]; var cl = this.h[5]; var dh = this.h[6]; var dl = this.h[7]; var eh = this.h[8]; var el = this.h[9]; var fh = this.h[10]; var fl = this.h[11]; var gh = this.h[12]; var gl = this.h[13]; var hh = this.h[14]; var hl = this.h[15]; assert(this.k.length === W.length); for (var i = 0; i < W.length; i += 2) { var c0_hi = hh; var c0_lo = hl; var c1_hi = s1_512_hi(eh, el); var c1_lo = s1_512_lo(eh, el); var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl); var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl); var c3_hi = this.k[i]; var c3_lo = this.k[i + 1]; var c4_hi = W[i]; var c4_lo = W[i + 1]; var T1_hi = sum64_5_hi( c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo); var T1_lo = sum64_5_lo( c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo); c0_hi = s0_512_hi(ah, al); c0_lo = s0_512_lo(ah, al); c1_hi = maj64_hi(ah, al, bh, bl, ch, cl); c1_lo = maj64_lo(ah, al, bh, bl, ch, cl); var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo); var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo); hh = gh; hl = gl; gh = fh; gl = fl; fh = eh; fl = el; eh = sum64_hi(dh, dl, T1_hi, T1_lo); el = sum64_lo(dl, dl, T1_hi, T1_lo); dh = ch; dl = cl; ch = bh; cl = bl; bh = ah; bl = al; ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo); al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo); } sum64(this.h, 0, ah, al); sum64(this.h, 2, bh, bl); sum64(this.h, 4, ch, cl); sum64(this.h, 6, dh, dl); sum64(this.h, 8, eh, el); sum64(this.h, 10, fh, fl); sum64(this.h, 12, gh, gl); sum64(this.h, 14, hh, hl); }; SHA512.prototype._digest = function digest(enc) { if (enc === 'hex') return utils.toHex32(this.h, 'big'); else return utils.split32(this.h, 'big'); }; function ch64_hi(xh, xl, yh, yl, zh) { var r = (xh & yh) ^ ((~xh) & zh); if (r < 0) r += 0x100000000; return r; } function ch64_lo(xh, xl, yh, yl, zh, zl) { var r = (xl & yl) ^ ((~xl) & zl); if (r < 0) r += 0x100000000; return r; } function maj64_hi(xh, xl, yh, yl, zh) { var r = (xh & yh) ^ (xh & zh) ^ (yh & zh); if (r < 0) r += 0x100000000; return r; } function maj64_lo(xh, xl, yh, yl, zh, zl) { var r = (xl & yl) ^ (xl & zl) ^ (yl & zl); if (r < 0) r += 0x100000000; return r; } function s0_512_hi(xh, xl) { var c0_hi = rotr64_hi(xh, xl, 28); var c1_hi = rotr64_hi(xl, xh, 2); // 34 var c2_hi = rotr64_hi(xl, xh, 7); // 39 var r = c0_hi ^ c1_hi ^ c2_hi; if (r < 0) r += 0x100000000; return r; } function s0_512_lo(xh, xl) { var c0_lo = rotr64_lo(xh, xl, 28); var c1_lo = rotr64_lo(xl, xh, 2); // 34 var c2_lo = rotr64_lo(xl, xh, 7); // 39 var r = c0_lo ^ c1_lo ^ c2_lo; if (r < 0) r += 0x100000000; return r; } function s1_512_hi(xh, xl) { var c0_hi = rotr64_hi(xh, xl, 14); var c1_hi = rotr64_hi(xh, xl, 18); var c2_hi = rotr64_hi(xl, xh, 9); // 41 var r = c0_hi ^ c1_hi ^ c2_hi; if (r < 0) r += 0x100000000; return r; } function s1_512_lo(xh, xl) { var c0_lo = rotr64_lo(xh, xl, 14); var c1_lo = rotr64_lo(xh, xl, 18); var c2_lo = rotr64_lo(xl, xh, 9); // 41 var r = c0_lo ^ c1_lo ^ c2_lo; if (r < 0) r += 0x100000000; return r; } function g0_512_hi(xh, xl) { var c0_hi = rotr64_hi(xh, xl, 1); var c1_hi = rotr64_hi(xh, xl, 8); var c2_hi = shr64_hi(xh, xl, 7); var r = c0_hi ^ c1_hi ^ c2_hi; if (r < 0) r += 0x100000000; return r; } function g0_512_lo(xh, xl) { var c0_lo = rotr64_lo(xh, xl, 1); var c1_lo = rotr64_lo(xh, xl, 8); var c2_lo = shr64_lo(xh, xl, 7); var r = c0_lo ^ c1_lo ^ c2_lo; if (r < 0) r += 0x100000000; return r; } function g1_512_hi(xh, xl) { var c0_hi = rotr64_hi(xh, xl, 19); var c1_hi = rotr64_hi(xl, xh, 29); // 61 var c2_hi = shr64_hi(xh, xl, 6); var r = c0_hi ^ c1_hi ^ c2_hi; if (r < 0) r += 0x100000000; return r; } function g1_512_lo(xh, xl) { var c0_lo = rotr64_lo(xh, xl, 19); var c1_lo = rotr64_lo(xl, xh, 29); // 61 var c2_lo = shr64_lo(xh, xl, 6); var r = c0_lo ^ c1_lo ^ c2_lo; if (r < 0) r += 0x100000000; return r; } },{"../common":27,"../utils":37,"minimalistic-assert":40}],36:[function(require,module,exports){ 'use strict'; var utils = require('../utils'); var rotr32 = utils.rotr32; function ft_1(s, x, y, z) { if (s === 0) return ch32(x, y, z); if (s === 1 || s === 3) return p32(x, y, z); if (s === 2) return maj32(x, y, z); } exports.ft_1 = ft_1; function ch32(x, y, z) { return (x & y) ^ ((~x) & z); } exports.ch32 = ch32; function maj32(x, y, z) { return (x & y) ^ (x & z) ^ (y & z); } exports.maj32 = maj32; function p32(x, y, z) { return x ^ y ^ z; } exports.p32 = p32; function s0_256(x) { return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22); } exports.s0_256 = s0_256; function s1_256(x) { return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25); } exports.s1_256 = s1_256; function g0_256(x) { return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3); } exports.g0_256 = g0_256; function g1_256(x) { return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10); } exports.g1_256 = g1_256; },{"../utils":37}],37:[function(require,module,exports){ 'use strict'; var assert = require('minimalistic-assert'); var inherits = require('inherits'); exports.inherits = inherits; function toArray(msg, enc) { if (Array.isArray(msg)) return msg.slice(); if (!msg) return []; var res = []; if (typeof msg === 'string') { if (!enc) { for (var i = 0; i < msg.length; i++) { var c = msg.charCodeAt(i); var hi = c >> 8; var lo = c & 0xff; if (hi) res.push(hi, lo); else res.push(lo); } } else if (enc === 'hex') { msg = msg.replace(/[^a-z0-9]+/ig, ''); if (msg.length % 2 !== 0) msg = '0' + msg; for (i = 0; i < msg.length; i += 2) res.push(parseInt(msg[i] + msg[i + 1], 16)); } } else { for (i = 0; i < msg.length; i++) res[i] = msg[i] | 0; } return res; } exports.toArray = toArray; function toHex(msg) { var res = ''; for (var i = 0; i < msg.length; i++) res += zero2(msg[i].toString(16)); return res; } exports.toHex = toHex; function htonl(w) { var res = (w >>> 24) | ((w >>> 8) & 0xff00) | ((w << 8) & 0xff0000) | ((w & 0xff) << 24); return res >>> 0; } exports.htonl = htonl; function toHex32(msg, endian) { var res = ''; for (var i = 0; i < msg.length; i++) { var w = msg[i]; if (endian === 'little') w = htonl(w); res += zero8(w.toString(16)); } return res; } exports.toHex32 = toHex32; function zero2(word) { if (word.length === 1) return '0' + word; else return word; } exports.zero2 = zero2; function zero8(word) { if (word.length === 7) return '0' + word; else if (word.length === 6) return '00' + word; else if (word.length === 5) return '000' + word; else if (word.length === 4) return '0000' + word; else if (word.length === 3) return '00000' + word; else if (word.length === 2) return '000000' + word; else if (word.length === 1) return '0000000' + word; else return word; } exports.zero8 = zero8; function join32(msg, start, end, endian) { var len = end - start; assert(len % 4 === 0); var res = new Array(len / 4); for (var i = 0, k = start; i < res.length; i++, k += 4) { var w; if (endian === 'big') w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3]; else w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k]; res[i] = w >>> 0; } return res; } exports.join32 = join32; function split32(msg, endian) { var res = new Array(msg.length * 4); for (var i = 0, k = 0; i < msg.length; i++, k += 4) { var m = msg[i]; if (endian === 'big') { res[k] = m >>> 24; res[k + 1] = (m >>> 16) & 0xff; res[k + 2] = (m >>> 8) & 0xff; res[k + 3] = m & 0xff; } else { res[k + 3] = m >>> 24; res[k + 2] = (m >>> 16) & 0xff; res[k + 1] = (m >>> 8) & 0xff; res[k] = m & 0xff; } } return res; } exports.split32 = split32; function rotr32(w, b) { return (w >>> b) | (w << (32 - b)); } exports.rotr32 = rotr32; function rotl32(w, b) { return (w << b) | (w >>> (32 - b)); } exports.rotl32 = rotl32; function sum32(a, b) { return (a + b) >>> 0; } exports.sum32 = sum32; function sum32_3(a, b, c) { return (a + b + c) >>> 0; } exports.sum32_3 = sum32_3; function sum32_4(a, b, c, d) { return (a + b + c + d) >>> 0; } exports.sum32_4 = sum32_4; function sum32_5(a, b, c, d, e) { return (a + b + c + d + e) >>> 0; } exports.sum32_5 = sum32_5; function sum64(buf, pos, ah, al) { var bh = buf[pos]; var bl = buf[pos + 1]; var lo = (al + bl) >>> 0; var hi = (lo < al ? 1 : 0) + ah + bh; buf[pos] = hi >>> 0; buf[pos + 1] = lo; } exports.sum64 = sum64; function sum64_hi(ah, al, bh, bl) { var lo = (al + bl) >>> 0; var hi = (lo < al ? 1 : 0) + ah + bh; return hi >>> 0; } exports.sum64_hi = sum64_hi; function sum64_lo(ah, al, bh, bl) { var lo = al + bl; return lo >>> 0; } exports.sum64_lo = sum64_lo; function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) { var carry = 0; var lo = al; lo = (lo + bl) >>> 0; carry += lo < al ? 1 : 0; lo = (lo + cl) >>> 0; carry += lo < cl ? 1 : 0; lo = (lo + dl) >>> 0; carry += lo < dl ? 1 : 0; var hi = ah + bh + ch + dh + carry; return hi >>> 0; } exports.sum64_4_hi = sum64_4_hi; function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) { var lo = al + bl + cl + dl; return lo >>> 0; } exports.sum64_4_lo = sum64_4_lo; function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { var carry = 0; var lo = al; lo = (lo + bl) >>> 0; carry += lo < al ? 1 : 0; lo = (lo + cl) >>> 0; carry += lo < cl ? 1 : 0; lo = (lo + dl) >>> 0; carry += lo < dl ? 1 : 0; lo = (lo + el) >>> 0; carry += lo < el ? 1 : 0; var hi = ah + bh + ch + dh + eh + carry; return hi >>> 0; } exports.sum64_5_hi = sum64_5_hi; function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { var lo = al + bl + cl + dl + el; return lo >>> 0; } exports.sum64_5_lo = sum64_5_lo; function rotr64_hi(ah, al, num) { var r = (al << (32 - num)) | (ah >>> num); return r >>> 0; } exports.rotr64_hi = rotr64_hi; function rotr64_lo(ah, al, num) { var r = (ah << (32 - num)) | (al >>> num); return r >>> 0; } exports.rotr64_lo = rotr64_lo; function shr64_hi(ah, al, num) { return ah >>> num; } exports.shr64_hi = shr64_hi; function shr64_lo(ah, al, num) { var r = (ah << (32 - num)) | (al >>> num); return r >>> 0; } exports.shr64_lo = shr64_lo; },{"inherits":38,"minimalistic-assert":40}],38:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { ctor.super_ = superCtor ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true } }); }; } else { // old school shim for old browsers module.exports = function inherits(ctor, superCtor) { ctor.super_ = superCtor var TempCtor = function () {} TempCtor.prototype = superCtor.prototype ctor.prototype = new TempCtor() ctor.prototype.constructor = ctor } } },{}],39:[function(require,module,exports){ (function (process,global){ /** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.5.7 * @author Chen, Yi-Cyuan [[email protected]] * @copyright Chen, Yi-Cyuan 2015-2016 * @license MIT */ /*jslint bitwise: true */ (function () { 'use strict'; var root = typeof window === 'object' ? window : {}; var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node; if (NODE_JS) { root = global; } var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && typeof module === 'object' && module.exports; var HEX_CHARS = '0123456789abcdef'.split(''); var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; var KECCAK_PADDING = [1, 256, 65536, 16777216]; var PADDING = [6, 1536, 393216, 100663296]; var SHIFT = [0, 8, 16, 24]; var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; var BITS = [224, 256, 384, 512]; var SHAKE_BITS = [128, 256]; var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array']; var createOutputMethod = function (bits, padding, outputType) { return function (message) { return new Keccak(bits, padding, bits).update(message)[outputType](); }; }; var createShakeOutputMethod = function (bits, padding, outputType) { return function (message, outputBits) { return new Keccak(bits, padding, outputBits).update(message)[outputType](); }; }; var createMethod = function (bits, padding) { var method = createOutputMethod(bits, padding, 'hex'); method.create = function () { return new Keccak(bits, padding, bits); }; method.update = function (message) { return method.create().update(message); }; for (var i = 0; i < OUTPUT_TYPES.length; ++i) { var type = OUTPUT_TYPES[i]; method[type] = createOutputMethod(bits, padding, type); } return method; }; var createShakeMethod = function (bits, padding) { var method = createShakeOutputMethod(bits, padding, 'hex'); method.create = function (outputBits) { return new Keccak(bits, padding, outputBits); }; method.update = function (message, outputBits) { return method.create(outputBits).update(message); }; for (var i = 0; i < OUTPUT_TYPES.length; ++i) { var type = OUTPUT_TYPES[i]; method[type] = createShakeOutputMethod(bits, padding, type); } return method; }; var algorithms = [ {name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod}, {name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod}, {name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod} ]; var methods = {}, methodNames = []; for (var i = 0; i < algorithms.length; ++i) { var algorithm = algorithms[i]; var bits = algorithm.bits; for (var j = 0; j < bits.length; ++j) { var methodName = algorithm.name +'_' + bits[j]; methodNames.push(methodName); methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); } } function Keccak(bits, padding, outputBits) { this.blocks = []; this.s = []; this.padding = padding; this.outputBits = outputBits; this.reset = true; this.block = 0; this.start = 0; this.blockCount = (1600 - (bits << 1)) >> 5; this.byteCount = this.blockCount << 2; this.outputBlocks = outputBits >> 5; this.extraBytes = (outputBits & 31) >> 3; for (var i = 0; i < 50; ++i) { this.s[i] = 0; } } Keccak.prototype.update = function (message) { var notString = typeof message !== 'string'; if (notString && message.constructor === ArrayBuffer) { message = new Uint8Array(message); } var length = message.length, blocks = this.blocks, byteCount = this.byteCount, blockCount = this.blockCount, index = 0, s = this.s, i, code; while (index < length) { if (this.reset) { this.reset = false; blocks[0] = this.block; for (i = 1; i < blockCount + 1; ++i) { blocks[i] = 0; } } if (notString) { for (i = this.start; index < length && i < byteCount; ++index) { blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; } } else { for (i = this.start; index < length && i < byteCount; ++index) { code = message.charCodeAt(index); if (code < 0x80) { blocks[i >> 2] |= code << SHIFT[i++ & 3]; } else if (code < 0x800) { blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; } else if (code < 0xd800 || code >= 0xe000) { blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; } else { code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; } } } this.lastByteIndex = i; if (i >= byteCount) { this.start = i - byteCount; this.block = blocks[blockCount]; for (i = 0; i < blockCount; ++i) { s[i] ^= blocks[i]; } f(s); this.reset = true; } else { this.start = i; } } return this; }; Keccak.prototype.finalize = function () { var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s; blocks[i >> 2] |= this.padding[i & 3]; if (this.lastByteIndex === this.byteCount) { blocks[0] = blocks[blockCount]; for (i = 1; i < blockCount + 1; ++i) { blocks[i] = 0; } } blocks[blockCount - 1] |= 0x80000000; for (i = 0; i < blockCount; ++i) { s[i] ^= blocks[i]; } f(s); }; Keccak.prototype.toString = Keccak.prototype.hex = function () { this.finalize(); var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i = 0, j = 0; var hex = '', block; while (j < outputBlocks) { for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { block = s[i]; hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] + HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] + HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] + HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F]; } if (j % blockCount === 0) { f(s); i = 0; } } if (extraBytes) { block = s[i]; if (extraBytes > 0) { hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F]; } if (extraBytes > 1) { hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F]; } if (extraBytes > 2) { hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F]; } } return hex; }; Keccak.prototype.arrayBuffer = function () { this.finalize(); var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i = 0, j = 0; var bytes = this.outputBits >> 3; var buffer; if (extraBytes) { buffer = new ArrayBuffer((outputBlocks + 1) << 2); } else { buffer = new ArrayBuffer(bytes); } var array = new Uint32Array(buffer); while (j < outputBlocks) { for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { array[j] = s[i]; } if (j % blockCount === 0) { f(s); } } if (extraBytes) { array[i] = s[i]; buffer = buffer.slice(0, bytes); } return buffer; }; Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; Keccak.prototype.digest = Keccak.prototype.array = function () { this.finalize(); var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i = 0, j = 0; var array = [], offset, block; while (j < outputBlocks) { for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { offset = j << 2; block = s[i]; array[offset] = block & 0xFF; array[offset + 1] = (block >> 8) & 0xFF; array[offset + 2] = (block >> 16) & 0xFF; array[offset + 3] = (block >> 24) & 0xFF; } if (j % blockCount === 0) { f(s); } } if (extraBytes) { offset = j << 2; block = s[i]; if (extraBytes > 0) { array[offset] = block & 0xFF; } if (extraBytes > 1) { array[offset + 1] = (block >> 8) & 0xFF; } if (extraBytes > 2) { array[offset + 2] = (block >> 16) & 0xFF; } } return array; }; var f = function (s) { var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; for (n = 0; n < 48; n += 2) { c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; h = c8 ^ ((c2 << 1) | (c3 >>> 31)); l = c9 ^ ((c3 << 1) | (c2 >>> 31)); s[0] ^= h; s[1] ^= l; s[10] ^= h; s[11] ^= l; s[20] ^= h; s[21] ^= l; s[30] ^= h; s[31] ^= l; s[40] ^= h; s[41] ^= l; h = c0 ^ ((c4 << 1) | (c5 >>> 31)); l = c1 ^ ((c5 << 1) | (c4 >>> 31)); s[2] ^= h; s[3] ^= l; s[12] ^= h; s[13] ^= l; s[22] ^= h; s[23] ^= l; s[32] ^= h; s[33] ^= l; s[42] ^= h; s[43] ^= l; h = c2 ^ ((c6 << 1) | (c7 >>> 31)); l = c3 ^ ((c7 << 1) | (c6 >>> 31)); s[4] ^= h; s[5] ^= l; s[14] ^= h; s[15] ^= l; s[24] ^= h; s[25] ^= l; s[34] ^= h; s[35] ^= l; s[44] ^= h; s[45] ^= l; h = c4 ^ ((c8 << 1) | (c9 >>> 31)); l = c5 ^ ((c9 << 1) | (c8 >>> 31)); s[6] ^= h; s[7] ^= l; s[16] ^= h; s[17] ^= l; s[26] ^= h; s[27] ^= l; s[36] ^= h; s[37] ^= l; s[46] ^= h; s[47] ^= l; h = c6 ^ ((c0 << 1) | (c1 >>> 31)); l = c7 ^ ((c1 << 1) | (c0 >>> 31)); s[8] ^= h; s[9] ^= l; s[18] ^= h; s[19] ^= l; s[28] ^= h; s[29] ^= l; s[38] ^= h; s[39] ^= l; s[48] ^= h; s[49] ^= l; b0 = s[0]; b1 = s[1]; b32 = (s[11] << 4) | (s[10] >>> 28); b33 = (s[10] << 4) | (s[11] >>> 28); b14 = (s[20] << 3) | (s[21] >>> 29); b15 = (s[21] << 3) | (s[20] >>> 29); b46 = (s[31] << 9) | (s[30] >>> 23); b47 = (s[30] << 9) | (s[31] >>> 23); b28 = (s[40] << 18) | (s[41] >>> 14); b29 = (s[41] << 18) | (s[40] >>> 14); b20 = (s[2] << 1) | (s[3] >>> 31); b21 = (s[3] << 1) | (s[2] >>> 31); b2 = (s[13] << 12) | (s[12] >>> 20); b3 = (s[12] << 12) | (s[13] >>> 20); b34 = (s[22] << 10) | (s[23] >>> 22); b35 = (s[23] << 10) | (s[22] >>> 22); b16 = (s[33] << 13) | (s[32] >>> 19); b17 = (s[32] << 13) | (s[33] >>> 19); b48 = (s[42] << 2) | (s[43] >>> 30); b49 = (s[43] << 2) | (s[42] >>> 30); b40 = (s[5] << 30) | (s[4] >>> 2); b41 = (s[4] << 30) | (s[5] >>> 2); b22 = (s[14] << 6) | (s[15] >>> 26); b23 = (s[15] << 6) | (s[14] >>> 26); b4 = (s[25] << 11) | (s[24] >>> 21); b5 = (s[24] << 11) | (s[25] >>> 21); b36 = (s[34] << 15) | (s[35] >>> 17); b37 = (s[35] << 15) | (s[34] >>> 17); b18 = (s[45] << 29) | (s[44] >>> 3); b19 = (s[44] << 29) | (s[45] >>> 3); b10 = (s[6] << 28) | (s[7] >>> 4); b11 = (s[7] << 28) | (s[6] >>> 4); b42 = (s[17] << 23) | (s[16] >>> 9); b43 = (s[16] << 23) | (s[17] >>> 9); b24 = (s[26] << 25) | (s[27] >>> 7); b25 = (s[27] << 25) | (s[26] >>> 7); b6 = (s[36] << 21) | (s[37] >>> 11); b7 = (s[37] << 21) | (s[36] >>> 11); b38 = (s[47] << 24) | (s[46] >>> 8); b39 = (s[46] << 24) | (s[47] >>> 8); b30 = (s[8] << 27) | (s[9] >>> 5); b31 = (s[9] << 27) | (s[8] >>> 5); b12 = (s[18] << 20) | (s[19] >>> 12); b13 = (s[19] << 20) | (s[18] >>> 12); b44 = (s[29] << 7) | (s[28] >>> 25); b45 = (s[28] << 7) | (s[29] >>> 25); b26 = (s[38] << 8) | (s[39] >>> 24); b27 = (s[39] << 8) | (s[38] >>> 24); b8 = (s[48] << 14) | (s[49] >>> 18); b9 = (s[49] << 14) | (s[48] >>> 18); s[0] = b0 ^ (~b2 & b4); s[1] = b1 ^ (~b3 & b5); s[10] = b10 ^ (~b12 & b14); s[11] = b11 ^ (~b13 & b15); s[20] = b20 ^ (~b22 & b24); s[21] = b21 ^ (~b23 & b25); s[30] = b30 ^ (~b32 & b34); s[31] = b31 ^ (~b33 & b35); s[40] = b40 ^ (~b42 & b44); s[41] = b41 ^ (~b43 & b45); s[2] = b2 ^ (~b4 & b6); s[3] = b3 ^ (~b5 & b7); s[12] = b12 ^ (~b14 & b16); s[13] = b13 ^ (~b15 & b17); s[22] = b22 ^ (~b24 & b26); s[23] = b23 ^ (~b25 & b27); s[32] = b32 ^ (~b34 & b36); s[33] = b33 ^ (~b35 & b37); s[42] = b42 ^ (~b44 & b46); s[43] = b43 ^ (~b45 & b47); s[4] = b4 ^ (~b6 & b8); s[5] = b5 ^ (~b7 & b9); s[14] = b14 ^ (~b16 & b18); s[15] = b15 ^ (~b17 & b19); s[24] = b24 ^ (~b26 & b28); s[25] = b25 ^ (~b27 & b29); s[34] = b34 ^ (~b36 & b38); s[35] = b35 ^ (~b37 & b39); s[44] = b44 ^ (~b46 & b48); s[45] = b45 ^ (~b47 & b49); s[6] = b6 ^ (~b8 & b0); s[7] = b7 ^ (~b9 & b1); s[16] = b16 ^ (~b18 & b10); s[17] = b17 ^ (~b19 & b11); s[26] = b26 ^ (~b28 & b20); s[27] = b27 ^ (~b29 & b21); s[36] = b36 ^ (~b38 & b30); s[37] = b37 ^ (~b39 & b31); s[46] = b46 ^ (~b48 & b40); s[47] = b47 ^ (~b49 & b41); s[8] = b8 ^ (~b0 & b2); s[9] = b9 ^ (~b1 & b3); s[18] = b18 ^ (~b10 & b12); s[19] = b19 ^ (~b11 & b13); s[28] = b28 ^ (~b20 & b22); s[29] = b29 ^ (~b21 & b23); s[38] = b38 ^ (~b30 & b32); s[39] = b39 ^ (~b31 & b33); s[48] = b48 ^ (~b40 & b42); s[49] = b49 ^ (~b41 & b43); s[0] ^= RC[n]; s[1] ^= RC[n + 1]; } }; if (COMMON_JS) { module.exports = methods; } else { for (var i = 0; i < methodNames.length; ++i) { root[methodNames[i]] = methods[methodNames[i]]; } } })(); }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"_process":41}],40:[function(require,module,exports){ module.exports = assert; function assert(val, msg) { if (!val) throw new Error(msg || 'Assertion failed'); } assert.equal = function assertEqual(l, r, msg) { if (l != r) throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r)); }; },{}],41:[function(require,module,exports){ module.exports = { browser: true }; },{}],42:[function(require,module,exports){ (function (setImmediate){ "use strict"; (function(root) { var MAX_VALUE = 0x7fffffff; // The SHA256 and PBKDF2 implementation are from scrypt-async-js: // See: https://github.com/dchest/scrypt-async-js function SHA256(m) { var K = [ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 ]; var h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a; var h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19; var w = new Array(64); function blocks(p) { var off = 0, len = p.length; while (len >= 64) { var a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, u, i, j, t1, t2; for (i = 0; i < 16; i++) { j = off + i*4; w[i] = ((p[j] & 0xff)<<24) | ((p[j+1] & 0xff)<<16) | ((p[j+2] & 0xff)<<8) | (p[j+3] & 0xff); } for (i = 16; i < 64; i++) { u = w[i-2]; t1 = ((u>>>17) | (u<<(32-17))) ^ ((u>>>19) | (u<<(32-19))) ^ (u>>>10); u = w[i-15]; t2 = ((u>>>7) | (u<<(32-7))) ^ ((u>>>18) | (u<<(32-18))) ^ (u>>>3); w[i] = (((t1 + w[i-7]) | 0) + ((t2 + w[i-16]) | 0)) | 0; } for (i = 0; i < 64; i++) { t1 = ((((((e>>>6) | (e<<(32-6))) ^ ((e>>>11) | (e<<(32-11))) ^ ((e>>>25) | (e<<(32-25)))) + ((e & f) ^ (~e & g))) | 0) + ((h + ((K[i] + w[i]) | 0)) | 0)) | 0; t2 = ((((a>>>2) | (a<<(32-2))) ^ ((a>>>13) | (a<<(32-13))) ^ ((a>>>22) | (a<<(32-22)))) + ((a & b) ^ (a & c) ^ (b & c))) | 0; h = g; g = f; f = e; e = (d + t1) | 0; d = c; c = b; b = a; a = (t1 + t2) | 0; } h0 = (h0 + a) | 0; h1 = (h1 + b) | 0; h2 = (h2 + c) | 0; h3 = (h3 + d) | 0; h4 = (h4 + e) | 0; h5 = (h5 + f) | 0; h6 = (h6 + g) | 0; h7 = (h7 + h) | 0; off += 64; len -= 64; } } blocks(m); var i, bytesLeft = m.length % 64, bitLenHi = (m.length / 0x20000000) | 0, bitLenLo = m.length << 3, numZeros = (bytesLeft < 56) ? 56 : 120, p = m.slice(m.length - bytesLeft, m.length); p.push(0x80); for (i = bytesLeft + 1; i < numZeros; i++) { p.push(0); } p.push((bitLenHi>>>24) & 0xff); p.push((bitLenHi>>>16) & 0xff); p.push((bitLenHi>>>8) & 0xff); p.push((bitLenHi>>>0) & 0xff); p.push((bitLenLo>>>24) & 0xff); p.push((bitLenLo>>>16) & 0xff); p.push((bitLenLo>>>8) & 0xff); p.push((bitLenLo>>>0) & 0xff); blocks(p); return [ (h0>>>24) & 0xff, (h0>>>16) & 0xff, (h0>>>8) & 0xff, (h0>>>0) & 0xff, (h1>>>24) & 0xff, (h1>>>16) & 0xff, (h1>>>8) & 0xff, (h1>>>0) & 0xff, (h2>>>24) & 0xff, (h2>>>16) & 0xff, (h2>>>8) & 0xff, (h2>>>0) & 0xff, (h3>>>24) & 0xff, (h3>>>16) & 0xff, (h3>>>8) & 0xff, (h3>>>0) & 0xff, (h4>>>24) & 0xff, (h4>>>16) & 0xff, (h4>>>8) & 0xff, (h4>>>0) & 0xff, (h5>>>24) & 0xff, (h5>>>16) & 0xff, (h5>>>8) & 0xff, (h5>>>0) & 0xff, (h6>>>24) & 0xff, (h6>>>16) & 0xff, (h6>>>8) & 0xff, (h6>>>0) & 0xff, (h7>>>24) & 0xff, (h7>>>16) & 0xff, (h7>>>8) & 0xff, (h7>>>0) & 0xff ]; } function PBKDF2_HMAC_SHA256_OneIter(password, salt, dkLen) { // compress password if it's longer than hash block length password = password.length <= 64 ? password : SHA256(password); var i; var innerLen = 64 + salt.length + 4; var inner = new Array(innerLen); var outerKey = new Array(64); var dk = []; // inner = (password ^ ipad) || salt || counter for (i = 0; i < 64; i++) inner[i] = 0x36; for (i = 0; i < password.length; i++) inner[i] ^= password[i]; for (i = 0; i < salt.length; i++) inner[64+i] = salt[i]; for (i = innerLen - 4; i < innerLen; i++) inner[i] = 0; // outerKey = password ^ opad for (i = 0; i < 64; i++) outerKey[i] = 0x5c; for (i = 0; i < password.length; i++) outerKey[i] ^= password[i]; // increments counter inside inner function incrementCounter() { for (var i = innerLen-1; i >= innerLen-4; i--) { inner[i]++; if (inner[i] <= 0xff) return; inner[i] = 0; } } // output blocks = SHA256(outerKey || SHA256(inner)) ... while (dkLen >= 32) { incrementCounter(); dk = dk.concat(SHA256(outerKey.concat(SHA256(inner)))); dkLen -= 32; } if (dkLen > 0) { incrementCounter(); dk = dk.concat(SHA256(outerKey.concat(SHA256(inner))).slice(0, dkLen)); } return dk; } // The following is an adaptation of scryptsy // See: https://www.npmjs.com/package/scryptsy function blockmix_salsa8(BY, Yi, r, x, _X) { var i; arraycopy(BY, (2 * r - 1) * 16, _X, 0, 16); for (i = 0; i < 2 * r; i++) { blockxor(BY, i * 16, _X, 16); salsa20_8(_X, x); arraycopy(_X, 0, BY, Yi + (i * 16), 16); } for (i = 0; i < r; i++) { arraycopy(BY, Yi + (i * 2) * 16, BY, (i * 16), 16); } for (i = 0; i < r; i++) { arraycopy(BY, Yi + (i * 2 + 1) * 16, BY, (i + r) * 16, 16); } } function R(a, b) { return (a << b) | (a >>> (32 - b)); } function salsa20_8(B, x) { arraycopy(B, 0, x, 0, 16); for (var i = 8; i > 0; i -= 2) { x[ 4] ^= R(x[ 0] + x[12], 7); x[ 8] ^= R(x[ 4] + x[ 0], 9); x[12] ^= R(x[ 8] + x[ 4], 13); x[ 0] ^= R(x[12] + x[ 8], 18); x[ 9] ^= R(x[ 5] + x[ 1], 7); x[13] ^= R(x[ 9] + x[ 5], 9); x[ 1] ^= R(x[13] + x[ 9], 13); x[ 5] ^= R(x[ 1] + x[13], 18); x[14] ^= R(x[10] + x[ 6], 7); x[ 2] ^= R(x[14] + x[10], 9); x[ 6] ^= R(x[ 2] + x[14], 13); x[10] ^= R(x[ 6] + x[ 2], 18); x[ 3] ^= R(x[15] + x[11], 7); x[ 7] ^= R(x[ 3] + x[15], 9); x[11] ^= R(x[ 7] + x[ 3], 13); x[15] ^= R(x[11] + x[ 7], 18); x[ 1] ^= R(x[ 0] + x[ 3], 7); x[ 2] ^= R(x[ 1] + x[ 0], 9); x[ 3] ^= R(x[ 2] + x[ 1], 13); x[ 0] ^= R(x[ 3] + x[ 2], 18); x[ 6] ^= R(x[ 5] + x[ 4], 7); x[ 7] ^= R(x[ 6] + x[ 5], 9); x[ 4] ^= R(x[ 7] + x[ 6], 13); x[ 5] ^= R(x[ 4] + x[ 7], 18); x[11] ^= R(x[10] + x[ 9], 7); x[ 8] ^= R(x[11] + x[10], 9); x[ 9] ^= R(x[ 8] + x[11], 13); x[10] ^= R(x[ 9] + x[ 8], 18); x[12] ^= R(x[15] + x[14], 7); x[13] ^= R(x[12] + x[15], 9); x[14] ^= R(x[13] + x[12], 13); x[15] ^= R(x[14] + x[13], 18); } for (i = 0; i < 16; ++i) { B[i] += x[i]; } } // naive approach... going back to loop unrolling may yield additional performance function blockxor(S, Si, D, len) { for (var i = 0; i < len; i++) { D[i] ^= S[Si + i] } } function arraycopy(src, srcPos, dest, destPos, length) { while (length--) { dest[destPos++] = src[srcPos++]; } } function checkBufferish(o) { if (!o || typeof(o.length) !== 'number') { return false; } for (var i = 0; i < o.length; i++) { if (typeof(o[i]) !== 'number') { return false; } var v = parseInt(o[i]); if (v != o[i] || v < 0 || v >= 256) { return false; } } return true; } function ensureInteger(value, name) { var intValue = parseInt(value); if (value != intValue) { throw new Error('invalid ' + name); } return intValue; } // N = Cpu cost, r = Memory cost, p = parallelization cost // callback(error, progress, key) function scrypt(password, salt, N, r, p, dkLen, callback) { if (!callback) { throw new Error('missing callback'); } N = ensureInteger(N, 'N'); r = ensureInteger(r, 'r'); p = ensureInteger(p, 'p'); dkLen = ensureInteger(dkLen, 'dkLen'); if (N === 0 || (N & (N - 1)) !== 0) { throw new Error('N must be power of 2'); } if (N > MAX_VALUE / 128 / r) { throw new Error('N too large'); } if (r > MAX_VALUE / 128 / p) { throw new Error('r too large'); } if (!checkBufferish(password)) { throw new Error('password must be an array or buffer'); } if (!checkBufferish(salt)) { throw new Error('salt must be an array or buffer'); } var b = PBKDF2_HMAC_SHA256_OneIter(password, salt, p * 128 * r); var B = new Uint32Array(p * 32 * r) for (var i = 0; i < B.length; i++) { var j = i * 4; B[i] = ((b[j + 3] & 0xff) << 24) | ((b[j + 2] & 0xff) << 16) | ((b[j + 1] & 0xff) << 8) | ((b[j + 0] & 0xff) << 0); } var XY = new Uint32Array(64 * r); var V = new Uint32Array(32 * r * N); var Yi = 32 * r; // scratch space var x = new Uint32Array(16); // salsa20_8 var _X = new Uint32Array(16); // blockmix_salsa8 var totalOps = p * N * 2; var currentOp = 0; var lastPercent10 = null; // Set this to true to abandon the scrypt on the next step var stop = false; // State information var state = 0; var i0 = 0, i1; var Bi; // How many blockmix_salsa8 can we do per step? var limit = parseInt(1000 / r); // Trick from scrypt-async; if there is a setImmediate shim in place, use it var nextTick = (typeof(setImmediate) !== 'undefined') ? setImmediate : setTimeout; // This is really all I changed; making scryptsy a state machine so we occasionally // stop and give other evnts on the evnt loop a chance to run. ~RicMoo var incrementalSMix = function() { if (stop) { return callback(new Error('cancelled'), currentOp / totalOps); } switch (state) { case 0: // for (var i = 0; i < p; i++)... Bi = i0 * 32 * r; arraycopy(B, Bi, XY, 0, Yi); // ROMix - 1 state = 1; // Move to ROMix 2 i1 = 0; // Fall through case 1: // Run up to 1000 steps of the first inner smix loop var steps = N - i1; if (steps > limit) { steps = limit; } for (var i = 0; i < steps; i++) { // ROMix - 2 arraycopy(XY, 0, V, (i1 + i) * Yi, Yi) // ROMix - 3 blockmix_salsa8(XY, Yi, r, x, _X); // ROMix - 4 } // for (var i = 0; i < N; i++) i1 += steps; currentOp += steps; // Call the callback with the progress (optionally stopping us) var percent10 = parseInt(1000 * currentOp / totalOps); if (percent10 !== lastPercent10) { stop = callback(null, currentOp / totalOps); if (stop) { break; } lastPercent10 = percent10; } if (i1 < N) { break; } i1 = 0; // Move to ROMix 6 state = 2; // Fall through case 2: // Run up to 1000 steps of the second inner smix loop var steps = N - i1; if (steps > limit) { steps = limit; } for (var i = 0; i < steps; i++) { // ROMix - 6 var offset = (2 * r - 1) * 16; // ROMix - 7 var j = XY[offset] & (N - 1); blockxor(V, j * Yi, XY, Yi); // ROMix - 8 (inner) blockmix_salsa8(XY, Yi, r, x, _X); // ROMix - 9 (outer) } // for (var i = 0; i < N; i++)... i1 += steps; currentOp += steps; // Call the callback with the progress (optionally stopping us) var percent10 = parseInt(1000 * currentOp / totalOps); if (percent10 !== lastPercent10) { stop = callback(null, currentOp / totalOps); if (stop) { break; } lastPercent10 = percent10; } if (i1 < N) { break; } arraycopy(XY, 0, B, Bi, Yi); // ROMix - 10 // for (var i = 0; i < p; i++)... i0++; if (i0 < p) { state = 0; break; } b = []; for (var i = 0; i < B.length; i++) { b.push((B[i] >> 0) & 0xff); b.push((B[i] >> 8) & 0xff); b.push((B[i] >> 16) & 0xff); b.push((B[i] >> 24) & 0xff); } var derivedKey = PBKDF2_HMAC_SHA256_OneIter(password, b, dkLen); // Done; don't break (which would reschedule) return callback(null, 1.0, derivedKey); } // Schedule the next steps nextTick(incrementalSMix); } // Bootstrap the incremental smix incrementalSMix(); } // node.js if (typeof(exports) !== 'undefined') { module.exports = scrypt; // RequireJS/AMD // http://www.requirejs.org/docs/api.html // https://github.com/amdjs/amdjs-api/wiki/AMD } else if (typeof(define) === 'function' && define.amd) { define(scrypt); // Web Browsers } else if (root) { // If there was an existing library "scrypt", make sure it is still available if (root.scrypt) { root._scrypt = root.scrypt; } root.scrypt = scrypt; } })(this); }).call(this,require("timers").setImmediate) },{"timers":44}],43:[function(require,module,exports){ (function (process,global){ (function (global, undefined) { "use strict"; if (global.setImmediate) { return; } var nextHandle = 1; // Spec says greater than zero var tasksByHandle = {}; var currentlyRunningATask = false; var doc = global.document; var setImmediate; function addFromSetImmediateArguments(args) { tasksByHandle[nextHandle] = partiallyApplied.apply(undefined, args); return nextHandle++; } // This function accepts the same arguments as setImmediate, but // returns a function that requires no arguments. function partiallyApplied(handler) { var args = [].slice.call(arguments, 1); return function() { if (typeof handler === "function") { handler.apply(undefined, args); } else { (new Function("" + handler))(); } }; } function runIfPresent(handle) { // From the spec: "Wait until any invocations of this algorithm started before this one have completed." // So if we're currently running a task, we'll need to delay this invocation. if (currentlyRunningATask) { // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a // "too much recursion" error. setTimeout(partiallyApplied(runIfPresent, handle), 0); } else { var task = tasksByHandle[handle]; if (task) { currentlyRunningATask = true; try { task(); } finally { clearImmediate(handle); currentlyRunningATask = false; } } } } function clearImmediate(handle) { delete tasksByHandle[handle]; } function installNextTickImplementation() { setImmediate = function() { var handle = addFromSetImmediateArguments(arguments); process.nextTick(partiallyApplied(runIfPresent, handle)); return handle; }; } function canUsePostMessage() { // The test against `importScripts` prevents this implementation from being installed inside a web worker, // where `global.postMessage` means something completely different and can't be used for this purpose. if (global.postMessage && !global.importScripts) { var postMessageIsAsynchronous = true; var oldOnMessage = global.onmessage; global.onmessage = function() { postMessageIsAsynchronous = false; }; global.postMessage("", "*"); global.onmessage = oldOnMessage; return postMessageIsAsynchronous; } } function installPostMessageImplementation() { // Installs an event handler on `global` for the `message` event: see // * https://developer.mozilla.org/en/DOM/window.postMessage // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages var messagePrefix = "setImmediate$" + Math.random() + "$"; var onGlobalMessage = function(event) { if (event.source === global && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) { runIfPresent(+event.data.slice(messagePrefix.length)); } }; if (global.addEventListener) { global.addEventListener("message", onGlobalMessage, false); } else { global.attachEvent("onmessage", onGlobalMessage); } setImmediate = function() { var handle = addFromSetImmediateArguments(arguments); global.postMessage(messagePrefix + handle, "*"); return handle; }; } function installMessageChannelImplementation() { var channel = new MessageChannel(); channel.port1.onmessage = function(event) { var handle = event.data; runIfPresent(handle); }; setImmediate = function() { var handle = addFromSetImmediateArguments(arguments); channel.port2.postMessage(handle); return handle; }; } function installReadyStateChangeImplementation() { var html = doc.documentElement; setImmediate = function() { var handle = addFromSetImmediateArguments(arguments); // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called. var script = doc.createElement("script"); script.onreadystatechange = function () { runIfPresent(handle); script.onreadystatechange = null; html.removeChild(script); script = null; }; html.appendChild(script); return handle; }; } function installSetTimeoutImplementation() { setImmediate = function() { var handle = addFromSetImmediateArguments(arguments); setTimeout(partiallyApplied(runIfPresent, handle), 0); return handle; }; } // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global); attachTo = attachTo && attachTo.setTimeout ? attachTo : global; // Don't get fooled by e.g. browserify environments. if ({}.toString.call(global.process) === "[object process]") { // For Node.js before 0.9 installNextTickImplementation(); } else if (canUsePostMessage()) { // For non-IE10 modern browsers installPostMessageImplementation(); } else if (global.MessageChannel) { // For web workers, where supported installMessageChannelImplementation(); } else if (doc && "onreadystatechange" in doc.createElement("script")) { // For IE 6–8 installReadyStateChangeImplementation(); } else { // For older browsers installSetTimeoutImplementation(); } attachTo.setImmediate = setImmediate; attachTo.clearImmediate = clearImmediate; }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self)); }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"_process":41}],44:[function(require,module,exports){ (function (global){ module.exports = { setImmediate: global.setImmediate }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],45:[function(require,module,exports){ (function (global){ var rng; if (global.crypto && crypto.getRandomValues) { // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto // Moderately fast, high quality var _rnds8 = new Uint8Array(16); rng = function whatwgRNG() { crypto.getRandomValues(_rnds8); return _rnds8; }; } if (!rng) { // Math.random()-based (RNG) // // If all else fails, use Math.random(). It's fast, but is of unspecified // quality. var _rnds = new Array(16); rng = function() { for (var i = 0, r; i < 16; i++) { if ((i & 0x03) === 0) r = Math.random() * 0x100000000; _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff; } return _rnds; }; } module.exports = rng; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],46:[function(require,module,exports){ // uuid.js // // Copyright (c) 2010-2012 Robert Kieffer // MIT License - http://opensource.org/licenses/mit-license.php // Unique ID creation requires a high quality random # generator. We feature // detect to determine the best RNG source, normalizing to a function that // returns 128-bits of randomness, since that's what's usually required var _rng = require('./rng'); // Maps for number <-> hex string conversion var _byteToHex = []; var _hexToByte = {}; for (var i = 0; i < 256; i++) { _byteToHex[i] = (i + 0x100).toString(16).substr(1); _hexToByte[_byteToHex[i]] = i; } // **`parse()` - Parse a UUID into it's component bytes** function parse(s, buf, offset) { var i = (buf && offset) || 0, ii = 0; buf = buf || []; s.toLowerCase().replace(/[0-9a-f]{2}/g, function(oct) { if (ii < 16) { // Don't overflow! buf[i + ii++] = _hexToByte[oct]; } }); // Zero out remaining bytes if string was short while (ii < 16) { buf[i + ii++] = 0; } return buf; } // **`unparse()` - Convert UUID byte array (ala parse()) into a string** function unparse(buf, offset) { var i = offset || 0, bth = _byteToHex; return bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]]; } // **`v1()` - Generate time-based UUID** // // Inspired by https://github.com/LiosK/UUID.js // and http://docs.python.org/library/uuid.html // random #'s we need to init node and clockseq var _seedBytes = _rng(); // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) var _nodeId = [ _seedBytes[0] | 0x01, _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5] ]; // Per 4.2.2, randomize (14 bit) clockseq var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff; // Previous uuid creation time var _lastMSecs = 0, _lastNSecs = 0; // See https://github.com/broofa/node-uuid for API details function v1(options, buf, offset) { var i = buf && offset || 0; var b = buf || []; options = options || {}; var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // UUID timestamps are 100 nano-second units since the Gregorian epoch, // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime(); // Per 4.2.1.2, use count of uuid's generated during the current clock // cycle to simulate higher resolution clock var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000; // Per 4.2.1.2, Bump clockseq on clock regression if (dt < 0 && options.clockseq === undefined) { clockseq = clockseq + 1 & 0x3fff; } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new // time interval if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { nsecs = 0; } // Per 4.2.1.2 Throw error if too many uuids are requested if (nsecs >= 10000) { throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec'); } _lastMSecs = msecs; _lastNSecs = nsecs; _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch msecs += 12219292800000; // `time_low` var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; b[i++] = tl >>> 24 & 0xff; b[i++] = tl >>> 16 & 0xff; b[i++] = tl >>> 8 & 0xff; b[i++] = tl & 0xff; // `time_mid` var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff; b[i++] = tmh >>> 8 & 0xff; b[i++] = tmh & 0xff; // `time_high_and_version` b[i++] = tmh >>> 24 & 0xf | 0x10; // include version b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` b[i++] = clockseq & 0xff; // `node` var node = options.node || _nodeId; for (var n = 0; n < 6; n++) { b[i + n] = node[n]; } return buf ? buf : unparse(b); } // **`v4()` - Generate random UUID** // See https://github.com/broofa/node-uuid for API details function v4(options, buf, offset) { // Deprecated - 'format' argument, as supported in v1.2 var i = buf && offset || 0; if (typeof(options) == 'string') { buf = options == 'binary' ? new Array(16) : null; options = null; } options = options || {}; var rnds = options.random || (options.rng || _rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = (rnds[6] & 0x0f) | 0x40; rnds[8] = (rnds[8] & 0x3f) | 0x80; // Copy bytes to buffer, if provided if (buf) { for (var ii = 0; ii < 16; ii++) { buf[i + ii] = rnds[ii]; } } return buf || unparse(rnds); } // Export public API var uuid = v4; uuid.v1 = v1; uuid.v4 = v4; uuid.parse = parse; uuid.unparse = unparse; module.exports = uuid; },{"./rng":45}],47:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); try { module.exports.XMLHttpRequest = XMLHttpRequest; } catch (error) { console.log('Warning: XMLHttpRequest is not defined'); module.exports.XMLHttpRequest = null; } },{}],48:[function(require,module,exports){ "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var provider_1 = require("./provider"); var bytes_1 = require("../utils/bytes"); var properties_1 = require("../utils/properties"); var web_1 = require("../utils/web"); var errors = __importStar(require("../utils/errors")); // The transaction has already been sanitized by the calls in Provider function getTransactionString(transaction) { var result = []; for (var key in transaction) { if (transaction[key] == null) { continue; } var value = bytes_1.hexlify(transaction[key]); if ({ gasLimit: true, gasPrice: true, nonce: true, value: true }[key]) { value = bytes_1.hexStripZeros(value); } result.push(key + '=' + value); } return result.join('&'); } function getResult(result) { // getLogs, getHistory have weird success responses if (result.status == 0 && (result.message === 'No records found' || result.message === 'No transactions found')) { return result.result; } if (result.status != 1 || result.message != 'OK') { // @TODO: not any var error = new Error('invalid response'); error.result = JSON.stringify(result); throw error; } return result.result; } function getJsonResult(result) { if (result.jsonrpc != '2.0') { // @TODO: not any var error = new Error('invalid response'); error.result = JSON.stringify(result); throw error; } if (result.error) { // @TODO: not any var error = new Error(result.error.message || 'unknown error'); if (result.error.code) { error.code = result.error.code; } if (result.error.data) { error.data = result.error.data; } throw error; } return result.result; } // The blockTag was normalized as a string by the Provider pre-perform operations function checkLogTag(blockTag) { if (blockTag === 'pending') { throw new Error('pending not supported'); } if (blockTag === 'latest') { return blockTag; } return parseInt(blockTag.substring(2), 16); } var EtherscanProvider = /** @class */ (function (_super) { __extends(EtherscanProvider, _super); function EtherscanProvider(network, apiKey) { var _this = _super.call(this, network) || this; errors.checkNew(_this, EtherscanProvider); var name = 'invalid'; if (_this.network) { name = _this.network.name; } var baseUrl = null; switch (name) { case 'homestead': baseUrl = 'https://api.etherscan.io'; break; case 'ropsten': baseUrl = 'https://api-ropsten.etherscan.io'; break; case 'rinkeby': baseUrl = 'https://api-rinkeby.etherscan.io'; break; case 'kovan': baseUrl = 'https://api-kovan.etherscan.io'; break; default: throw new Error('unsupported network'); } properties_1.defineReadOnly(_this, 'baseUrl', baseUrl); properties_1.defineReadOnly(_this, 'apiKey', apiKey); return _this; } EtherscanProvider.prototype.perform = function (method, params) { //if (!params) { params = {}; } var url = this.baseUrl; var apiKey = ''; if (this.apiKey) { apiKey += '&apikey=' + this.apiKey; } switch (method) { case 'getBlockNumber': url += '/api?module=proxy&action=eth_blockNumber' + apiKey; return web_1.fetchJson(url, null, getJsonResult); case 'getGasPrice': url += '/api?module=proxy&action=eth_gasPrice' + apiKey; return web_1.fetchJson(url, null, getJsonResult); case 'getBalance': // Returns base-10 result url += '/api?module=account&action=balance&address=' + params.address; url += '&tag=' + params.blockTag + apiKey; return web_1.fetchJson(url, null, getResult); case 'getTransactionCount': url += '/api?module=proxy&action=eth_getTransactionCount&address=' + params.address; url += '&tag=' + params.blockTag + apiKey; return web_1.fetchJson(url, null, getJsonResult); case 'getCode': url += '/api?module=proxy&action=eth_getCode&address=' + params.address; url += '&tag=' + params.blockTag + apiKey; return web_1.fetchJson(url, null, getJsonResult); case 'getStorageAt': url += '/api?module=proxy&action=eth_getStorageAt&address=' + params.address; url += '&position=' + params.position; url += '&tag=' + params.blockTag + apiKey; return web_1.fetchJson(url, null, getJsonResult); case 'sendTransaction': url += '/api?module=proxy&action=eth_sendRawTransaction&hex=' + params.signedTransaction; url += apiKey; return web_1.fetchJson(url, null, getJsonResult); case 'getBlock': if (params.blockTag) { url += '/api?module=proxy&action=eth_getBlockByNumber&tag=' + params.blockTag; url += '&boolean=false'; url += apiKey; return web_1.fetchJson(url, null, getJsonResult); } throw new Error('getBlock by blockHash not implmeneted'); case 'getTransaction': url += '/api?module=proxy&action=eth_getTransactionByHash&txhash=' + params.transactionHash; url += apiKey; return web_1.fetchJson(url, null, getJsonResult); case 'getTransactionReceipt': url += '/api?module=proxy&action=eth_getTransactionReceipt&txhash=' + params.transactionHash; url += apiKey; return web_1.fetchJson(url, null, getJsonResult); case 'call': var transaction = getTransactionString(params.transaction); if (transaction) { transaction = '&' + transaction; } url += '/api?module=proxy&action=eth_call' + transaction; url += apiKey; return web_1.fetchJson(url, null, getJsonResult); case 'estimateGas': var transaction = getTransactionString(params.transaction); if (transaction) { transaction = '&' + transaction; } url += '/api?module=proxy&action=eth_estimateGas&' + transaction; url += apiKey; return web_1.fetchJson(url, null, getJsonResult); case 'getLogs': url += '/api?module=logs&action=getLogs'; try { if (params.filter.fromBlock) { url += '&fromBlock=' + checkLogTag(params.filter.fromBlock); } if (params.filter.toBlock) { url += '&toBlock=' + checkLogTag(params.filter.toBlock); } if (params.filter.address) { url += '&address=' + params.filter.address; } // @TODO: We can handle slightly more complicated logs using the logs API if (params.filter.topics && params.filter.topics.length > 0) { if (params.filter.topics.length > 1) { throw new Error('unsupported topic format'); } var topic0 = params.filter.topics[0]; if (typeof (topic0) !== 'string' || topic0.length !== 66) { throw new Error('unsupported topic0 format'); } url += '&topic0=' + topic0; } } catch (error) { return Promise.reject(error); } url += apiKey; var self = this; return web_1.fetchJson(url, null, getResult).then(function (logs) { var txs = {}; var seq = Promise.resolve(); logs.forEach(function (log) { seq = seq.then(function () { if (log.blockHash != null) { return null; } log.blockHash = txs[log.transactionHash]; if (log.blockHash == null) { return self.getTransaction(log.transactionHash).then(function (tx) { txs[log.transactionHash] = tx.blockHash; log.blockHash = tx.blockHash; return null; }); } return null; }); }); return seq.then(function () { return logs; }); }); case 'getEtherPrice': if (this.network.name !== 'homestead') { return Promise.resolve(0.0); } url += '/api?module=stats&action=ethprice'; url += apiKey; return web_1.fetchJson(url, null, getResult).then(function (result) { return parseFloat(result.ethusd); }); default: break; } return _super.prototype.perform.call(this, method, params); }; // @TODO: Allow startBlock and endBlock to be Promises EtherscanProvider.prototype.getHistory = function (addressOrName, startBlock, endBlock) { var url = this.baseUrl; var apiKey = ''; if (this.apiKey) { apiKey += '&apikey=' + this.apiKey; } if (startBlock == null) { startBlock = 0; } if (endBlock == null) { endBlock = 99999999; } return this.resolveName(addressOrName).then(function (address) { url += '/api?module=account&action=txlist&address=' + address; url += '&startblock=' + startBlock; url += '&endblock=' + endBlock; url += '&sort=asc' + apiKey; return web_1.fetchJson(url, null, getResult).then(function (result) { var output = []; result.forEach(function (tx) { ['contractAddress', 'to'].forEach(function (key) { if (tx[key] == '') { delete tx[key]; } }); if (tx.creates == null && tx.contractAddress != null) { tx.creates = tx.contractAddress; } var item = provider_1.Provider.checkTransactionResponse(tx); if (tx.timeStamp) { item.timestamp = parseInt(tx.timeStamp); } output.push(item); }); return output; }); }); }; return EtherscanProvider; }(provider_1.Provider)); exports.EtherscanProvider = EtherscanProvider; },{"../utils/bytes":60,"../utils/errors":61,"../utils/properties":69,"../utils/web":80,"./provider":54}],49:[function(require,module,exports){ 'use strict'; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var provider_1 = require("./provider"); var errors = __importStar(require("../utils/errors")); // Returns: // - true is all networks match // - false if any network is null // - throws if any 2 networks do not match function checkNetworks(networks) { var result = true; var check = null; networks.forEach(function (network) { // Null if (network == null) { result = false; return; } // Have nothing to compre to yet if (check == null) { check = network; return; } // Matches! if (check.name === network.name && check.chainId === network.chainId && check.ensAddress === network.ensAddress) { return; } errors.throwError('provider mismatch', errors.INVALID_ARGUMENT, { arg: 'networks', value: networks }); }); return result; } var FallbackProvider = /** @class */ (function (_super) { __extends(FallbackProvider, _super); function FallbackProvider(providers) { var _this = this; if (providers.length === 0) { throw new Error('no providers'); } // All networks are ready, we can know the network for certain var ready = checkNetworks(providers.map(function (p) { return p.network; })); if (ready) { _this = _super.call(this, providers[0].network) || this; } else { // The network won't be known until all child providers know var ready_1 = Promise.all(providers.map(function (p) { return p.getNetwork(); })).then(function (networks) { if (!checkNetworks(networks)) { errors.throwError('getNetwork returned null', errors.UNKNOWN_ERROR, {}); } return networks[0]; }); _this = _super.call(this, ready_1) || this; } errors.checkNew(_this, FallbackProvider); // Preserve a copy, so we don't get mutated _this._providers = providers.slice(0); return _this; } Object.defineProperty(FallbackProvider.prototype, "providers", { get: function () { // Return a copy, so we don't get mutated return this._providers.slice(0); }, enumerable: true, configurable: true }); FallbackProvider.prototype.perform = function (method, params) { // Creates a copy of the providers array var providers = this.providers; return new Promise(function (resolve, reject) { var firstError = null; function next() { if (!providers.length) { reject(firstError); return; } var provider = providers.shift(); provider.perform(method, params).then(function (result) { return resolve(result); }).catch(function (error) { if (!firstError) { firstError = error; } setTimeout(next, 0); }); } next(); }); }; return FallbackProvider; }(provider_1.Provider)); exports.FallbackProvider = FallbackProvider; },{"../utils/errors":61,"./provider":54}],50:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var provider_1 = require("./provider"); exports.Provider = provider_1.Provider; var etherscan_provider_1 = require("./etherscan-provider"); exports.EtherscanProvider = etherscan_provider_1.EtherscanProvider; var fallback_provider_1 = require("./fallback-provider"); exports.FallbackProvider = fallback_provider_1.FallbackProvider; var ipc_provider_1 = require("./ipc-provider"); exports.IpcProvider = ipc_provider_1.IpcProvider; var infura_provider_1 = require("./infura-provider"); exports.InfuraProvider = infura_provider_1.InfuraProvider; var json_rpc_provider_1 = require("./json-rpc-provider"); exports.JsonRpcProvider = json_rpc_provider_1.JsonRpcProvider; exports.JsonRpcSigner = json_rpc_provider_1.JsonRpcSigner; var web3_provider_1 = require("./web3-provider"); exports.Web3Provider = web3_provider_1.Web3Provider; function getDefaultProvider(network) { return new fallback_provider_1.FallbackProvider([ new infura_provider_1.InfuraProvider(network), new etherscan_provider_1.EtherscanProvider(network), ]); } exports.getDefaultProvider = getDefaultProvider; },{"./etherscan-provider":48,"./fallback-provider":49,"./infura-provider":51,"./ipc-provider":52,"./json-rpc-provider":53,"./provider":54,"./web3-provider":55}],51:[function(require,module,exports){ 'use strict'; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var json_rpc_provider_1 = require("./json-rpc-provider"); var networks_1 = require("../utils/networks"); var properties_1 = require("../utils/properties"); var errors = __importStar(require("../utils/errors")); var InfuraProvider = /** @class */ (function (_super) { __extends(InfuraProvider, _super); function InfuraProvider(network, apiAccessToken) { var _this = this; network = networks_1.getNetwork((network == null) ? 'homestead' : network); var host = null; switch (network.name) { case 'homestead': host = 'mainnet.infura.io'; break; case 'ropsten': host = 'ropsten.infura.io'; break; case 'rinkeby': host = 'rinkeby.infura.io'; break; case 'kovan': host = 'kovan.infura.io'; break; default: throw new Error('unsupported network'); } _this = _super.call(this, 'https://' + host + '/' + (apiAccessToken || ''), network) || this; errors.checkNew(_this, InfuraProvider); properties_1.defineReadOnly(_this, 'apiAccessToken', apiAccessToken || null); return _this; } InfuraProvider.prototype._startPending = function () { console.log('WARNING: INFURA does not support pending filters'); }; InfuraProvider.prototype.getSigner = function (address) { errors.throwError('INFURA does not support signing', errors.UNSUPPORTED_OPERATION, { operation: 'getSigner' }); return null; }; InfuraProvider.prototype.listAccounts = function () { return Promise.resolve([]); }; return InfuraProvider; }(json_rpc_provider_1.JsonRpcProvider)); exports.InfuraProvider = InfuraProvider; },{"../utils/errors":61,"../utils/networks":67,"../utils/properties":69,"./json-rpc-provider":53}],52:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); },{}],53:[function(require,module,exports){ 'use strict'; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); // See: https://github.com/ethereum/wiki/wiki/JSON-RPC var provider_1 = require("./provider"); var address_1 = require("../utils/address"); var bytes_1 = require("../utils/bytes"); var networks_1 = require("../utils/networks"); var properties_1 = require("../utils/properties"); var utf8_1 = require("../utils/utf8"); var web_1 = require("../utils/web"); var types_1 = require("../utils/types"); var errors = __importStar(require("../utils/errors")); function timer(timeout) { return new Promise(function (resolve) { setTimeout(function () { resolve(); }, timeout); }); } function getResult(payload) { if (payload.error) { // @TODO: not any var error = new Error(payload.error.message); error.code = payload.error.code; error.data = payload.error.data; throw error; } return payload.result; } function getLowerCase(value) { if (value) { return value.toLowerCase(); } return value; } var JsonRpcSigner = /** @class */ (function (_super) { __extends(JsonRpcSigner, _super); function JsonRpcSigner(provider, address) { var _this = _super.call(this) || this; errors.checkNew(_this, JsonRpcSigner); properties_1.defineReadOnly(_this, 'provider', provider); // Statically attach to a given address if (address) { properties_1.defineReadOnly(_this, '_address', address); } return _this; } Object.defineProperty(JsonRpcSigner.prototype, "address", { get: function () { if (!this._address) { errors.throwError('no sync sync address available; use getAddress', errors.UNSUPPORTED_OPERATION, { operation: 'address' }); } return this._address; }, enumerable: true, configurable: true }); JsonRpcSigner.prototype.getAddress = function () { if (this._address) { return Promise.resolve(this._address); } return this.provider.send('eth_accounts', []).then(function (accounts) { if (accounts.length === 0) { errors.throwError('no accounts', errors.UNSUPPORTED_OPERATION, { operation: 'getAddress' }); } return address_1.getAddress(accounts[0]); }); }; JsonRpcSigner.prototype.getBalance = function (blockTag) { return this.provider.getBalance(this.getAddress(), blockTag); }; JsonRpcSigner.prototype.getTransactionCount = function (blockTag) { return this.provider.getTransactionCount(this.getAddress(), blockTag); }; JsonRpcSigner.prototype.sendTransaction = function (transaction) { var _this = this; var tx = properties_1.shallowCopy(transaction); if (tx.from == null) { tx.from = this.getAddress().then(function (address) { if (!address) { return null; } return address.toLowerCase(); }); } return properties_1.resolveProperties(tx).then(function (tx) { tx = JsonRpcProvider.hexlifyTransaction(tx); return _this.provider.send('eth_sendTransaction', [tx]).then(function (hash) { return web_1.poll(function () { return _this.provider.getTransaction(hash).then(function (tx) { if (tx === null) { return undefined; } return _this.provider._wrapTransaction(tx, hash); }); }, { onceBlock: _this.provider }).catch(function (error) { error.transactionHash = hash; throw error; }); }); }); }; JsonRpcSigner.prototype.signMessage = function (message) { var _this = this; var data = ((typeof (message) === 'string') ? utf8_1.toUtf8Bytes(message) : message); return this.getAddress().then(function (address) { // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign return _this.provider.send('eth_sign', [address.toLowerCase(), bytes_1.hexlify(data)]); }); }; JsonRpcSigner.prototype.unlock = function (password) { var provider = this.provider; return this.getAddress().then(function (address) { return provider.send('personal_unlockAccount', [address.toLowerCase(), password, null]); }); }; return JsonRpcSigner; }(types_1.Signer)); exports.JsonRpcSigner = JsonRpcSigner; var JsonRpcProvider = /** @class */ (function (_super) { __extends(JsonRpcProvider, _super); function JsonRpcProvider(url, network) { var _this = this; // One parameter, but it is a network name, so swap it with the URL if (typeof (url) === 'string') { if (network === null && networks_1.getNetwork(url)) { network = url; url = null; } } if (network) { // The network has been specified explicitly, we can use it _this = _super.call(this, network) || this; } else { // The network is unknown, query the JSON-RPC for it var ready = new Promise(function (resolve, reject) { setTimeout(function () { _this.send('net_version', []).then(function (result) { return resolve(networks_1.getNetwork(parseInt(result))); }).catch(function (error) { reject(error); }); }); }); _this = _super.call(this, ready) || this; } errors.checkNew(_this, JsonRpcProvider); // Default URL if (!url) { url = 'http://localhost:8545'; } if (typeof (url) === 'string') { _this.connection = { url: url }; } else { _this.connection = url; } return _this; } JsonRpcProvider.prototype.getSigner = function (address) { return new JsonRpcSigner(this, address); }; JsonRpcProvider.prototype.listAccounts = function () { return this.send('eth_accounts', []).then(function (accounts) { return accounts.map(function (a) { return address_1.getAddress(a); }); }); }; JsonRpcProvider.prototype.send = function (method, params) { var request = { method: method, params: params, id: 42, jsonrpc: "2.0" }; return web_1.fetchJson(this.connection, JSON.stringify(request), getResult); }; JsonRpcProvider.prototype.perform = function (method, params) { switch (method) { case 'getBlockNumber': return this.send('eth_blockNumber', []); case 'getGasPrice': return this.send('eth_gasPrice', []); case 'getBalance': return this.send('eth_getBalance', [getLowerCase(params.address), params.blockTag]); case 'getTransactionCount': return this.send('eth_getTransactionCount', [getLowerCase(params.address), params.blockTag]); case 'getCode': return this.send('eth_getCode', [getLowerCase(params.address), params.blockTag]); case 'getStorageAt': return this.send('eth_getStorageAt', [getLowerCase(params.address), params.position, params.blockTag]); case 'sendTransaction': return this.send('eth_sendRawTransaction', [params.signedTransaction]); case 'getBlock': if (params.blockTag) { return this.send('eth_getBlockByNumber', [params.blockTag, false]); } else if (params.blockHash) { return this.send('eth_getBlockByHash', [params.blockHash, false]); } return Promise.reject(new Error('invalid block tag or block hash')); case 'getTransaction': return this.send('eth_getTransactionByHash', [params.transactionHash]); case 'getTransactionReceipt': return this.send('eth_getTransactionReceipt', [params.transactionHash]); case 'call': return this.send('eth_call', [JsonRpcProvider.hexlifyTransaction(params.transaction), 'latest']); case 'estimateGas': return this.send('eth_estimateGas', [JsonRpcProvider.hexlifyTransaction(params.transaction)]); case 'getLogs': if (params.filter && params.filter.address != null) { params.filter.address = getLowerCase(params.filter.address); } return this.send('eth_getLogs', [params.filter]); default: break; } errors.throwError(method + ' not implemented', errors.NOT_IMPLEMENTED, { operation: method }); return null; }; JsonRpcProvider.prototype._startPending = function () { if (this._pendingFilter != null) { return; } var self = this; var pendingFilter = this.send('eth_newPendingTransactionFilter', []); this._pendingFilter = pendingFilter; pendingFilter.then(function (filterId) { function poll() { self.send('eth_getFilterChanges', [filterId]).then(function (hashes) { if (self._pendingFilter != pendingFilter) { return null; } var seq = Promise.resolve(); hashes.forEach(function (hash) { self._emitted['t:' + hash.toLowerCase()] = 'pending'; seq = seq.then(function () { return self.getTransaction(hash).then(function (tx) { self.emit('pending', tx); return null; }); }); }); return seq.then(function () { return timer(1000); }); }).then(function () { if (self._pendingFilter != pendingFilter) { self.send('eth_uninstallFilter', [filterId]); return; } setTimeout(function () { poll(); }, 0); return null; }).catch(function (error) { }); } poll(); return filterId; }).catch(function (error) { }); }; JsonRpcProvider.prototype._stopPending = function () { this._pendingFilter = null; }; // Convert an ethers.js transaction into a JSON-RPC transaction // - gasLimit => gas // - All values hexlified // - All numeric values zero-striped // @TODO: Not any, a dictionary of string to strings JsonRpcProvider.hexlifyTransaction = function (transaction) { var result = {}; // Some nodes (INFURA ropsten; INFURA mainnet is fine) don't like extra zeros. ['gasLimit', 'gasPrice', 'nonce', 'value'].forEach(function (key) { if (transaction[key] == null) { return; } var value = bytes_1.hexStripZeros(bytes_1.hexlify(transaction[key])); if (key === 'gasLimit') { key = 'gas'; } result[key] = value; }); ['from', 'to', 'data'].forEach(function (key) { if (transaction[key] == null) { return; } result[key] = bytes_1.hexlify(transaction[key]); }); return result; }; return JsonRpcProvider; }(provider_1.Provider)); exports.JsonRpcProvider = JsonRpcProvider; },{"../utils/address":57,"../utils/bytes":60,"../utils/errors":61,"../utils/networks":67,"../utils/properties":69,"../utils/types":77,"../utils/utf8":79,"../utils/web":80,"./provider":54}],54:[function(require,module,exports){ 'use strict'; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var address_1 = require("../utils/address"); var bignumber_1 = require("../utils/bignumber"); var bytes_1 = require("../utils/bytes"); var hash_1 = require("../utils/hash"); var networks_1 = require("../utils/networks"); var properties_1 = require("../utils/properties"); var rlp_1 = require("../utils/rlp"); var transaction_1 = require("../utils/transaction"); var utf8_1 = require("../utils/utf8"); var web_1 = require("../utils/web"); var types_1 = require("../utils/types"); var errors = __importStar(require("../utils/errors")); ////////////////////////////// // Request and Response Checking // @TODO: not any? function check(format, object) { var result = {}; for (var key in format) { try { var value = format[key](object[key]); if (value !== undefined) { result[key] = value; } } catch (error) { error.checkKey = key; error.checkValue = object[key]; throw error; } } return result; } function allowNull(check, nullValue) { return (function (value) { if (value == null) { return nullValue; } return check(value); }); } function allowFalsish(check, replaceValue) { return (function (value) { if (!value) { return replaceValue; } return check(value); }); } function arrayOf(check) { return (function (array) { if (!Array.isArray(array)) { throw new Error('not an array'); } var result = []; array.forEach(function (value) { result.push(check(value)); }); return result; }); } function checkHash(hash) { if (typeof (hash) === 'string' && bytes_1.hexDataLength(hash) === 32) { return hash.toLowerCase(); } errors.throwError('invalid hash', errors.INVALID_ARGUMENT, { arg: 'hash', value: hash }); return null; } function checkNumber(number) { return bignumber_1.bigNumberify(number).toNumber(); } // Returns the difficulty as a number, or if too large (i.e. PoA network) null function checkDifficulty(value) { var v = bignumber_1.bigNumberify(value); try { return v.toNumber(); } catch (error) { } return null; } function checkBoolean(value) { if (typeof (value) === 'boolean') { return value; } if (typeof (value) === 'string') { if (value === 'true') { return true; } if (value === 'false') { return false; } } throw new Error('invaid boolean - ' + value); } function checkUint256(uint256) { if (!bytes_1.isHexString(uint256)) { throw new Error('invalid uint256'); } while (uint256.length < 66) { uint256 = '0x0' + uint256.substring(2); } return uint256; } /* function checkString(string) { if (typeof(string) !== 'string') { throw new Error('invalid string'); } return string; } */ function checkBlockTag(blockTag) { if (blockTag == null) { return 'latest'; } if (blockTag === 'earliest') { return '0x0'; } if (blockTag === 'latest' || blockTag === 'pending') { return blockTag; } if (typeof (blockTag) === 'number') { return bytes_1.hexStripZeros(bytes_1.hexlify(blockTag)); } if (bytes_1.isHexString(blockTag)) { return bytes_1.hexStripZeros(blockTag); } throw new Error('invalid blockTag'); } var formatBlock = { hash: checkHash, parentHash: checkHash, number: checkNumber, timestamp: checkNumber, nonce: allowNull(bytes_1.hexlify), difficulty: checkDifficulty, gasLimit: bignumber_1.bigNumberify, gasUsed: bignumber_1.bigNumberify, miner: address_1.getAddress, extraData: bytes_1.hexlify, //transactions: allowNull(arrayOf(checkTransaction)), transactions: allowNull(arrayOf(checkHash)), }; function checkBlock(block) { if (block.author != null && block.miner == null) { block.miner = block.author; } return check(formatBlock, block); } var formatTransaction = { hash: checkHash, blockHash: allowNull(checkHash, null), blockNumber: allowNull(checkNumber, null), transactionIndex: allowNull(checkNumber, null), from: address_1.getAddress, gasPrice: bignumber_1.bigNumberify, gasLimit: bignumber_1.bigNumberify, to: allowNull(address_1.getAddress, null), value: bignumber_1.bigNumberify, nonce: checkNumber, data: bytes_1.hexlify, r: allowNull(checkUint256), s: allowNull(checkUint256), v: allowNull(checkNumber), creates: allowNull(address_1.getAddress, null), raw: allowNull(bytes_1.hexlify), }; function checkTransactionResponse(transaction) { // Rename gas to gasLimit if (transaction.gas != null && transaction.gasLimit == null) { transaction.gasLimit = transaction.gas; } // Some clients (TestRPC) do strange things like return 0x0 for the // 0 address; correct this to be a real address if (transaction.to && bignumber_1.bigNumberify(transaction.to).isZero()) { transaction.to = '0x0000000000000000000000000000000000000000'; } // Rename input to data if (transaction.input != null && transaction.data == null) { transaction.data = transaction.input; } // If to and creates are empty, populate the creates from the transaction if (transaction.to == null && transaction.creates == null) { transaction.creates = address_1.getContractAddress(transaction); } // @TODO: use transaction.serialize? Have to add support for including v, r, and s... if (!transaction.raw) { // Very loose providers (e.g. TestRPC) don't provide a signature or raw if (transaction.v && transaction.r && transaction.s) { var raw = [ bytes_1.stripZeros(bytes_1.hexlify(transaction.nonce)), bytes_1.stripZeros(bytes_1.hexlify(transaction.gasPrice)), bytes_1.stripZeros(bytes_1.hexlify(transaction.gasLimit)), (transaction.to || "0x"), bytes_1.stripZeros(bytes_1.hexlify(transaction.value || '0x')), bytes_1.hexlify(transaction.data || '0x'), bytes_1.stripZeros(bytes_1.hexlify(transaction.v || '0x')), bytes_1.stripZeros(bytes_1.hexlify(transaction.r)), bytes_1.stripZeros(bytes_1.hexlify(transaction.s)), ]; transaction.raw = rlp_1.encode(raw); } } var result = check(formatTransaction, transaction); var networkId = transaction.networkId; if (bytes_1.isHexString(networkId)) { networkId = bignumber_1.bigNumberify(networkId).toNumber(); } if (typeof (networkId) !== 'number' && result.v != null) { networkId = (result.v - 35) / 2; if (networkId < 0) { networkId = 0; } networkId = parseInt(networkId); } if (typeof (networkId) !== 'number') { networkId = 0; } result.networkId = networkId; // 0x0000... should actually be null if (result.blockHash && result.blockHash.replace(/0/g, '') === 'x') { result.blockHash = null; } return result; } var formatTransactionRequest = { from: allowNull(address_1.getAddress), nonce: allowNull(checkNumber), gasLimit: allowNull(bignumber_1.bigNumberify), gasPrice: allowNull(bignumber_1.bigNumberify), to: allowNull(address_1.getAddress), value: allowNull(bignumber_1.bigNumberify), data: allowNull(bytes_1.hexlify), }; function checkTransactionRequest(transaction) { return check(formatTransactionRequest, transaction); } var formatTransactionReceiptLog = { transactionLogIndex: allowNull(checkNumber), transactionIndex: checkNumber, blockNumber: checkNumber, transactionHash: checkHash, address: address_1.getAddress, topics: arrayOf(checkHash), data: bytes_1.hexlify, logIndex: checkNumber, blockHash: checkHash, }; function checkTransactionReceiptLog(log) { return check(formatTransactionReceiptLog, log); } var formatTransactionReceipt = { contractAddress: allowNull(address_1.getAddress, null), transactionIndex: checkNumber, root: allowNull(checkHash), gasUsed: bignumber_1.bigNumberify, logsBloom: allowNull(bytes_1.hexlify), blockHash: checkHash, transactionHash: checkHash, logs: arrayOf(checkTransactionReceiptLog), blockNumber: checkNumber, cumulativeGasUsed: bignumber_1.bigNumberify, status: allowNull(checkNumber) }; function checkTransactionReceipt(transactionReceipt) { //var status = transactionReceipt.status; //var root = transactionReceipt.root; var result = check(formatTransactionReceipt, transactionReceipt); result.logs.forEach(function (entry, index) { if (entry.transactionLogIndex == null) { entry.transactionLogIndex = index; } }); if (transactionReceipt.status != null) { result.byzantium = true; } return result; } function checkTopics(topics) { if (Array.isArray(topics)) { topics.forEach(function (topic) { checkTopics(topic); }); } else if (topics != null) { checkHash(topics); } return topics; } var formatFilter = { fromBlock: allowNull(checkBlockTag, undefined), toBlock: allowNull(checkBlockTag, undefined), address: allowNull(address_1.getAddress, undefined), topics: allowNull(checkTopics, undefined), }; function checkFilter(filter) { return check(formatFilter, filter); } var formatLog = { blockNumber: allowNull(checkNumber), blockHash: allowNull(checkHash), transactionIndex: checkNumber, removed: allowNull(checkBoolean), address: address_1.getAddress, data: allowFalsish(bytes_1.hexlify, '0x'), topics: arrayOf(checkHash), transactionHash: checkHash, logIndex: checkNumber, }; function checkLog(log) { return check(formatLog, log); } ////////////////////////////// // Event Serializeing function serializeTopics(topics) { return topics.map(function (topic) { if (typeof (topic) === 'string') { return topic; } else if (Array.isArray(topic)) { topic.forEach(function (topic) { if (topic !== null && bytes_1.hexDataLength(topic) !== 32) { errors.throwError('invalid topic', errors.INVALID_ARGUMENT, { argument: 'topic', value: topic }); } }); return topic.join(','); } return errors.throwError('invalid topic value', errors.INVALID_ARGUMENT, { argument: 'topic', value: topic }); }).join('&'); } function deserializeTopics(data) { return data.split(/&/g).map(function (topic) { var comps = topic.split(','); if (comps.length === 1) { if (comps[0] === '') { return null; } return topic; } return comps; }); } function getEventTag(eventName) { if (typeof (eventName) === 'string') { if (bytes_1.hexDataLength(eventName) === 20) { return 'address:' + address_1.getAddress(eventName); } eventName = eventName.toLowerCase(); if (eventName === 'block' || eventName === 'pending' || eventName === 'error') { return eventName; } else if (bytes_1.hexDataLength(eventName) === 32) { return 'tx:' + eventName; } } else if (Array.isArray(eventName)) { return 'filter::' + serializeTopics(eventName); } else if (eventName && typeof (eventName) === 'object') { return 'filter:' + (eventName.address || '') + ':' + serializeTopics(eventName.topics || []); } throw new Error('invalid event - ' + eventName); } var Provider = /** @class */ (function (_super) { __extends(Provider, _super); function Provider(network) { var _this = _super.call(this) || this; errors.checkNew(_this, Provider); if (network instanceof Promise) { properties_1.defineReadOnly(_this, 'ready', network.then(function (network) { properties_1.defineReadOnly(_this, '_network', network); return network; })); } else { var knownNetwork = networks_1.getNetwork((network == null) ? 'homestead' : network); if (knownNetwork) { properties_1.defineReadOnly(_this, '_network', knownNetwork); properties_1.defineReadOnly(_this, 'ready', Promise.resolve(_this._network)); } else { errors.throwError('invalid network', errors.INVALID_ARGUMENT, { arg: 'network', value: network }); } } _this._lastBlockNumber = -2; // Balances being watched for changes _this._balances = {}; // Events being listened to _this._events = []; _this._pollingInterval = 4000; // We use this to track recent emitted events; for example, if we emit a "block" of 100 // and we get a `getBlock(100)` request which would result in null, we should retry // until we get a response. This provides devs with a consistent view. Similarly for // transaction hashes. _this._emitted = { block: _this._lastBlockNumber }; return _this; } Provider.prototype._doPoll = function () { var _this = this; this.getBlockNumber().then(function (blockNumber) { // If the block hasn't changed, meh. if (blockNumber === _this._lastBlockNumber) { return; } if (_this._lastBlockNumber === -2) { _this._lastBlockNumber = blockNumber - 1; } // Notify all listener for each block that has passed for (var i = _this._lastBlockNumber + 1; i <= blockNumber; i++) { if (_this._emitted.block < i) { _this._emitted.block = i; // Evict any transaction hashes or block hashes over 12 blocks // old, since they should not return null anyways Object.keys(_this._emitted).forEach(function (key) { if (key === 'block') { return; } if (_this._emitted[key] > i + 12) { delete _this._emitted[key]; } }); } _this.emit('block', i); } // Sweep balances and remove addresses we no longer have events for var newBalances = {}; // Find all transaction hashes we are waiting on _this._events.forEach(function (event) { var comps = event.tag.split(':'); switch (comps[0]) { case 'tx': { var hash_2 = comps[1]; _this.getTransactionReceipt(hash_2).then(function (receipt) { if (!receipt || receipt.blockNumber == null) { return null; } _this._emitted['t:' + hash_2] = receipt.blockNumber; _this.emit(hash_2, receipt); return null; }).catch(function (error) { _this.emit('error', error); }); break; } case 'address': { var address_2 = comps[1]; if (_this._balances[address_2]) { newBalances[address_2] = _this._balances[address_2]; } _this.getBalance(address_2, 'latest').then(function (balance) { var lastBalance = this._balances[address_2]; if (lastBalance && balance.eq(lastBalance)) { return; } this._balances[address_2] = balance; this.emit(address_2, balance); return null; }).catch(function (error) { _this.emit('error', error); }); break; } case 'filter': { var address = comps[1]; var topics = deserializeTopics(comps[2]); var filter_1 = { address: address, fromBlock: _this._lastBlockNumber + 1, toBlock: blockNumber, topics: topics }; _this.getLogs(filter_1).then(function (logs) { if (logs.length === 0) { return; } logs.forEach(function (log) { _this._emitted['b:' + log.blockHash] = log.blockNumber; _this._emitted['t:' + log.transactionHash] = log.blockNumber; _this.emit(filter_1, log); }); return null; }).catch(function (error) { _this.emit('error', error); }); break; } } }); _this._lastBlockNumber = blockNumber; _this._balances = newBalances; return null; }).catch(function (error) { }); this.doPoll(); }; Provider.prototype.resetEventsBlock = function (blockNumber) { this._lastBlockNumber = blockNumber; this._doPoll(); }; Object.defineProperty(Provider.prototype, "network", { get: function () { return this._network; }, enumerable: true, configurable: true }); Provider.prototype.getNetwork = function () { return this.ready; }; Object.defineProperty(Provider.prototype, "blockNumber", { get: function () { if (this._lastBlockNumber < 0) { return null; } return this._lastBlockNumber; }, enumerable: true, configurable: true }); Object.defineProperty(Provider.prototype, "polling", { get: function () { return (this._poller != null); }, set: function (value) { var _this = this; setTimeout(function () { if (value && !_this._poller) { _this._poller = setInterval(_this._doPoll.bind(_this), _this.pollingInterval); } else if (!value && _this._poller) { clearInterval(_this._poller); _this._poller = null; } }, 0); }, enumerable: true, configurable: true }); Object.defineProperty(Provider.prototype, "pollingInterval", { get: function () { return this._pollingInterval; }, set: function (value) { var _this = this; if (typeof (value) !== 'number' || value <= 0 || parseInt(String(value)) != value) { throw new Error('invalid polling interval'); } this._pollingInterval = value; if (this._poller) { clearInterval(this._poller); this._poller = setInterval(function () { _this._doPoll(); }, this._pollingInterval); } }, enumerable: true, configurable: true }); // @TODO: Add .poller which must be an event emitter with a 'start', 'stop' and 'block' event; // this will be used once we move to the WebSocket or other alternatives to polling Provider.prototype.waitForTransaction = function (transactionHash, timeout) { var _this = this; return web_1.poll(function () { return _this.getTransactionReceipt(transactionHash).then(function (receipt) { if (receipt == null) { return undefined; } return receipt; }); }, { onceBlock: this }); }; Provider.prototype.getBlockNumber = function () { var _this = this; return this.ready.then(function () { return _this.perform('getBlockNumber', {}).then(function (result) { var value = parseInt(result); if (value != result) { throw new Error('invalid response - getBlockNumber'); } return value; }); }); }; Provider.prototype.getGasPrice = function () { var _this = this; return this.ready.then(function () { return _this.perform('getGasPrice', {}).then(function (result) { return bignumber_1.bigNumberify(result); }); }); }; Provider.prototype.getBalance = function (addressOrName, blockTag) { var _this = this; return this.ready.then(function () { return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) { var addressOrName = _a.addressOrName, blockTag = _a.blockTag; return _this.resolveName(addressOrName).then(function (address) { var params = { address: address, blockTag: checkBlockTag(blockTag) }; return _this.perform('getBalance', params).then(function (result) { return bignumber_1.bigNumberify(result); }); }); }); }); }; Provider.prototype.getTransactionCount = function (addressOrName, blockTag) { var _this = this; return this.ready.then(function () { return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) { var addressOrName = _a.addressOrName, blockTag = _a.blockTag; return _this.resolveName(addressOrName).then(function (address) { var params = { address: address, blockTag: checkBlockTag(blockTag) }; return _this.perform('getTransactionCount', params).then(function (result) { return bignumber_1.bigNumberify(result).toNumber(); }); }); }); }); }; Provider.prototype.getCode = function (addressOrName, blockTag) { var _this = this; return this.ready.then(function () { return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) { var addressOrName = _a.addressOrName, blockTag = _a.blockTag; return _this.resolveName(addressOrName).then(function (address) { var params = { address: address, blockTag: checkBlockTag(blockTag) }; return _this.perform('getCode', params).then(function (result) { return bytes_1.hexlify(result); }); }); }); }); }; Provider.prototype.getStorageAt = function (addressOrName, position, blockTag) { var _this = this; return this.ready.then(function () { return properties_1.resolveProperties({ addressOrName: addressOrName, position: position, blockTag: blockTag }).then(function (_a) { var addressOrName = _a.addressOrName, position = _a.position, blockTag = _a.blockTag; return _this.resolveName(addressOrName).then(function (address) { var params = { address: address, blockTag: checkBlockTag(blockTag), position: bytes_1.hexStripZeros(bytes_1.hexlify(position)), }; return _this.perform('getStorageAt', params).then(function (result) { return bytes_1.hexlify(result); }); }); }); }); }; Provider.prototype.sendTransaction = function (signedTransaction) { var _this = this; return this.ready.then(function () { return properties_1.resolveProperties({ signedTransaction: signedTransaction }).then(function (_a) { var signedTransaction = _a.signedTransaction; var params = { signedTransaction: bytes_1.hexlify(signedTransaction) }; return _this.perform('sendTransaction', params).then(function (hash) { return _this._wrapTransaction(transaction_1.parse(signedTransaction), hash); }, function (error) { var tx = transaction_1.parse(signedTransaction); if (tx.hash) { error.transactionHash = tx.hash; } throw error; }); }); }); }; // This should be called by any subclass wrapping a TransactionResponse Provider.prototype._wrapTransaction = function (tx, hash) { var _this = this; if (bytes_1.hexDataLength(hash) !== 32) { throw new Error('invalid response - sendTransaction'); } var result = tx; // Check the hash we expect is the same as the hash the server reported if (hash != null && tx.hash !== hash) { errors.throwError('Transaction hash mismatch from Proivder.sendTransaction.', errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash }); } this._emitted['t:' + tx.hash] = 'pending'; result.wait = function (timeout) { return _this.waitForTransaction(hash, timeout).then(function (receipt) { if (receipt.status === 0) { errors.throwError('transaction failed', errors.CALL_EXCEPTION, { transaction: tx }); } return receipt; }); }; return result; }; Provider.prototype.call = function (transaction) { var _this = this; var tx = properties_1.shallowCopy(transaction); return this.ready.then(function () { return properties_1.resolveProperties(tx).then(function (tx) { return _this._resolveNames(tx, ['to', 'from']).then(function (tx) { var params = { transaction: checkTransactionRequest(tx) }; return _this.perform('call', params).then(function (result) { return bytes_1.hexlify(result); }); }); }); }); }; Provider.prototype.estimateGas = function (transaction) { var _this = this; var tx = { to: transaction.to, from: transaction.from, data: transaction.data }; return this.ready.then(function () { return properties_1.resolveProperties(tx).then(function (tx) { return _this._resolveNames(tx, ['to', 'from']).then(function (tx) { var params = { transaction: checkTransactionRequest(tx) }; return _this.perform('estimateGas', params).then(function (result) { return bignumber_1.bigNumberify(result); }); }); }); }); }; Provider.prototype.getBlock = function (blockHashOrBlockTag) { var _this = this; return this.ready.then(function () { return properties_1.resolveProperties({ blockHashOrBlockTag: blockHashOrBlockTag }).then(function (_a) { var blockHashOrBlockTag = _a.blockHashOrBlockTag; try { var blockHash = bytes_1.hexlify(blockHashOrBlockTag); if (bytes_1.hexDataLength(blockHash) === 32) { return web_1.poll(function () { return _this.perform('getBlock', { blockHash: blockHash }).then(function (block) { if (block == null) { if (_this._emitted['b:' + blockHash] == null) { return null; } return undefined; } return checkBlock(block); }); }, { onceBlock: _this }); } } catch (error) { } try { var blockNumber_1 = -128; var blockTag_1 = checkBlockTag(blockHashOrBlockTag); if (bytes_1.isHexString(blockTag_1)) { blockNumber_1 = parseInt(blockTag_1.substring(2), 16); } return web_1.poll(function () { return _this.perform('getBlock', { blockTag: blockTag_1 }).then(function (block) { if (block == null) { if (blockNumber_1 > _this._emitted.block) { return undefined; } return null; } return checkBlock(block); }); }, { onceBlock: _this }); } catch (error) { } throw new Error('invalid block hash or block tag'); }); }); }; Provider.prototype.getTransaction = function (transactionHash) { var _this = this; return this.ready.then(function () { return properties_1.resolveProperties({ transactionHash: transactionHash }).then(function (_a) { var transactionHash = _a.transactionHash; var params = { transactionHash: checkHash(transactionHash) }; return web_1.poll(function () { return _this.perform('getTransaction', params).then(function (result) { if (result == null) { if (_this._emitted['t:' + transactionHash] == null) { return null; } return undefined; } return Provider.checkTransactionResponse(result); }); }, { onceBlock: _this }); }); }); }; Provider.prototype.getTransactionReceipt = function (transactionHash) { var _this = this; return this.ready.then(function () { return properties_1.resolveProperties({ transactionHash: transactionHash }).then(function (_a) { var transactionHash = _a.transactionHash; var params = { transactionHash: checkHash(transactionHash) }; return web_1.poll(function () { return _this.perform('getTransactionReceipt', params).then(function (result) { if (result == null) { if (_this._emitted['t:' + transactionHash] == null) { return null; } return undefined; } return checkTransactionReceipt(result); }); }, { onceBlock: _this }); }); }); }; Provider.prototype.getLogs = function (filter) { var _this = this; return this.ready.then(function () { return properties_1.resolveProperties(filter).then(function (filter) { return _this._resolveNames(filter, ['address']).then(function (filter) { var params = { filter: checkFilter(filter) }; return _this.perform('getLogs', params).then(function (result) { return arrayOf(checkLog)(result); }); }); }); }); }; Provider.prototype.getEtherPrice = function () { var _this = this; return this.ready.then(function () { return _this.perform('getEtherPrice', {}).then(function (result) { // @TODO: Check valid float return result; }); }); }; // @TODO: Could probably use resolveProperties instead? Provider.prototype._resolveNames = function (object, keys) { var promises = []; var result = properties_1.shallowCopy(object); keys.forEach(function (key) { if (result[key] == null) { return; } promises.push(this.resolveName(result[key]).then(function (address) { result[key] = address; return; })); }, this); return Promise.all(promises).then(function () { return result; }); }; Provider.prototype._getResolver = function (name) { var _this = this; // Get the resolver from the blockchain return this.getNetwork().then(function (network) { // No ENS... if (!network.ensAddress) { errors.throwError('network does support ENS', errors.UNSUPPORTED_OPERATION, { operation: 'ENS', network: network.name }); } // keccak256('resolver(bytes32)') var data = '0x0178b8bf' + hash_1.namehash(name).substring(2); var transaction = { to: network.ensAddress, data: data }; return _this.call(transaction).then(function (data) { // extract the address from the data if (bytes_1.hexDataLength(data) !== 32) { return null; } return address_1.getAddress(bytes_1.hexDataSlice(data, 12)); }); }); }; Provider.prototype.resolveName = function (name) { var _this = this; // If it is a promise, resolve it then recurse if (name instanceof Promise) { return name.then(function (addressOrName) { return _this.resolveName(addressOrName); }); } // If it is already an address, nothing to resolve try { return Promise.resolve(address_1.getAddress(name)); } catch (error) { } var self = this; var nodeHash = hash_1.namehash(name); // Get the addr from the resovler return this._getResolver(name).then(function (resolverAddress) { // keccak256('addr(bytes32)') var data = '0x3b3b57de' + nodeHash.substring(2); var transaction = { to: resolverAddress, data: data }; return self.call(transaction); // extract the address from the data }).then(function (data) { if (bytes_1.hexDataLength(data) !== 32) { return null; } var address = address_1.getAddress(bytes_1.hexDataSlice(data, 12)); if (address === '0x0000000000000000000000000000000000000000') { return null; } return address; }); }; Provider.prototype.lookupAddress = function (address) { var _this = this; if (address instanceof Promise) { return address.then(function (address) { return _this.lookupAddress(address); }); } address = address_1.getAddress(address); var name = address.substring(2) + '.addr.reverse'; var nodehash = hash_1.namehash(name); var self = this; return this._getResolver(name).then(function (resolverAddress) { if (!resolverAddress) { return null; } // keccak('name(bytes32)') var data = '0x691f3431' + nodehash.substring(2); var transaction = { to: resolverAddress, data: data }; return self.call(transaction); }).then(function (data) { // Strip off the "0x" data = data.substring(2); // Strip off the dynamic string pointer (0x20) if (data.length < 64) { return null; } data = data.substring(64); if (data.length < 64) { return null; } var length = bignumber_1.bigNumberify('0x' + data.substring(0, 64)).toNumber(); data = data.substring(64); if (2 * length > data.length) { return null; } var name = utf8_1.toUtf8String('0x' + data.substring(0, 2 * length)); // Make sure the reverse record matches the foward record return self.resolveName(name).then(function (addr) { if (addr != address) { return null; } return name; }); }); }; Provider.checkTransactionResponse = function (transaction) { return checkTransactionResponse(transaction); }; Provider.prototype.doPoll = function () { }; Provider.prototype.perform = function (method, params) { errors.throwError(method + ' not implemented', errors.NOT_IMPLEMENTED, { operation: method }); return null; }; Provider.prototype._startPending = function () { console.log('WARNING: this provider does not support pending events'); }; Provider.prototype._stopPending = function () { }; Provider.prototype._addEventListener = function (eventName, listener, once) { this._events.push({ tag: getEventTag(eventName), listener: listener, once: once, }); if (eventName === 'pending') { this._startPending(); } this.polling = true; }; Provider.prototype.on = function (eventName, listener) { this._addEventListener(eventName, listener, false); return this; }; Provider.prototype.once = function (eventName, listener) { this._addEventListener(eventName, listener, true); return this; }; Provider.prototype.addEventListener = function (eventName, listener) { return this.on(eventName, listener); }; Provider.prototype.emit = function (eventName) { var _this = this; var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } var result = false; var eventTag = getEventTag(eventName); this._events = this._events.filter(function (event) { if (event.tag !== eventTag) { return true; } setTimeout(function () { event.listener.apply(_this, args); }, 0); result = true; return !(event.once); }); return result; }; Provider.prototype.listenerCount = function (eventName) { if (!eventName) { return this._events.length; } var eventTag = getEventTag(eventName); return this._events.filter(function (event) { return (event.tag === eventTag); }).length; }; Provider.prototype.listeners = function (eventName) { var eventTag = getEventTag(eventName); return this._events.filter(function (event) { return (event.tag === eventTag); }).map(function (event) { return event.listener; }); }; Provider.prototype.removeAllListeners = function (eventName) { var eventTag = getEventTag(eventName); this._events = this._events.filter(function (event) { return (event.tag !== eventTag); }); if (eventName === 'pending') { this._stopPending(); } if (this._events.length === 0) { this.polling = false; } return this; }; Provider.prototype.removeListener = function (eventName, listener) { var found = false; var eventTag = getEventTag(eventName); this._events = this._events.filter(function (event) { if (event.tag !== eventTag) { return true; } if (found) { return true; } found = false; return false; }); if (eventName === 'pending' && this.listenerCount('pending') === 0) { this._stopPending(); } if (this.listenerCount() === 0) { this.polling = false; } return this; }; return Provider; }(types_1.MinimalProvider)); exports.Provider = Provider; // See: https://github.com/isaacs/inherits/blob/master/inherits_browser.js function inherits(ctor, superCtor) { ctor.super_ = superCtor; ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true } }); } function inheritable(parent) { return function (child) { inherits(child, parent); properties_1.defineReadOnly(child, 'inherits', inheritable(child)); }; } properties_1.defineReadOnly(Provider, 'inherits', inheritable(Provider)); },{"../utils/address":57,"../utils/bignumber":59,"../utils/bytes":60,"../utils/errors":61,"../utils/hash":62,"../utils/networks":67,"../utils/properties":69,"../utils/rlp":71,"../utils/transaction":76,"../utils/types":77,"../utils/utf8":79,"../utils/web":80}],55:[function(require,module,exports){ 'use strict'; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var json_rpc_provider_1 = require("./json-rpc-provider"); var properties_1 = require("../utils/properties"); var errors = __importStar(require("../utils/errors")); /* @TODO utils.defineProperty(Web3Signer, 'onchange', { }); */ var Web3Provider = /** @class */ (function (_super) { __extends(Web3Provider, _super); function Web3Provider(web3Provider, network) { var _this = this; if (!web3Provider || !web3Provider.sendAsync) { errors.throwError('invalid web3Provider', errors.INVALID_ARGUMENT, { arg: 'web3Provider', value: web3Provider }); } // HTTP has a host; IPC has a path. var url = web3Provider.host || web3Provider.path || ''; _this = _super.call(this, url, network) || this; errors.checkNew(_this, Web3Provider); properties_1.defineReadOnly(_this, '_web3Provider', web3Provider); return _this; } Web3Provider.prototype.send = function (method, params) { var _this = this; // Metamask complains about eth_sign (and on some versions hangs) if (method == 'eth_sign' && this._web3Provider.isMetaMask) { // https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign method = 'personal_sign'; params = [params[1], params[0]]; } return new Promise(function (resolve, reject) { var request = { method: method, params: params, id: 42, jsonrpc: "2.0" }; _this._web3Provider.sendAsync(request, function (error, result) { if (error) { reject(error); return; } if (result.error) { // @TODO: not any var error = new Error(result.error.message); error.code = result.error.code; error.data = result.error.data; reject(error); return; } resolve(result.result); }); }); }; return Web3Provider; }(json_rpc_provider_1.JsonRpcProvider)); exports.Web3Provider = Web3Provider; },{"../utils/errors":61,"../utils/properties":69,"./json-rpc-provider":53}],56:[function(require,module,exports){ 'use strict'; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); // See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI var address_1 = require("./address"); var bignumber_1 = require("./bignumber"); var bytes_1 = require("./bytes"); var utf8_1 = require("./utf8"); var properties_1 = require("./properties"); var errors = __importStar(require("./errors")); var paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); var paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); var paramTypeArray = new RegExp(/^(.*)\[([0-9]*)\]$/); exports.defaultCoerceFunc = function (type, value) { var match = type.match(paramTypeNumber); if (match && parseInt(match[2]) <= 48) { return value.toNumber(); } return value; }; /////////////////////////////////// // Parsing for Solidity Signatures var regexParen = new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"); var regexIdentifier = new RegExp("^[A-Za-z_][A-Za-z0-9_]*$"); function verifyType(type) { // These need to be transformed to their full description if (type.match(/^uint($|[^1-9])/)) { type = 'uint256' + type.substring(4); } else if (type.match(/^int($|[^1-9])/)) { type = 'int256' + type.substring(3); } return type; } function parseParam(param, allowIndexed) { function throwError(i) { throw new Error('unexpected character "' + param[i] + '" at position ' + i + ' in "' + param + '"'); } var parent = { type: '', name: '', state: { allowType: true } }; var node = parent; for (var i = 0; i < param.length; i++) { var c = param[i]; switch (c) { case '(': if (!node.state.allowParams) { throwError(i); } node.state.allowType = false; node.type = verifyType(node.type); node.components = [{ type: '', name: '', parent: node, state: { allowType: true } }]; node = node.components[0]; break; case ')': delete node.state; if (allowIndexed && node.name === 'indexed') { node.indexed = true; node.name = ''; } node.type = verifyType(node.type); var child = node; node = node.parent; if (!node) { throwError(i); } delete child.parent; node.state.allowParams = false; node.state.allowName = true; node.state.allowArray = true; break; case ',': delete node.state; if (allowIndexed && node.name === 'indexed') { node.indexed = true; node.name = ''; } node.type = verifyType(node.type); var sibling = { type: '', name: '', parent: node.parent, state: { allowType: true } }; node.parent.components.push(sibling); delete node.parent; node = sibling; break; // Hit a space... case ' ': // If reading type, the type is done and may read a param or name if (node.state.allowType) { if (node.type !== '') { node.type = verifyType(node.type); delete node.state.allowType; node.state.allowName = true; node.state.allowParams = true; } } // If reading name, the name is done if (node.state.allowName) { if (node.name !== '') { if (allowIndexed && node.name === 'indexed') { node.indexed = true; node.name = ''; } else { node.state.allowName = false; } } } break; case '[': if (!node.state.allowArray) { throwError(i); } node.type += c; node.state.allowArray = false; node.state.allowName = false; node.state.readArray = true; break; case ']': if (!node.state.readArray) { throwError(i); } node.type += c; node.state.readArray = false; node.state.allowArray = true; node.state.allowName = true; break; default: if (node.state.allowType) { node.type += c; node.state.allowParams = true; node.state.allowArray = true; } else if (node.state.allowName) { node.name += c; delete node.state.allowArray; } else if (node.state.readArray) { node.type += c; } else { throwError(i); } } } if (node.parent) { throw new Error("unexpected eof"); } delete parent.state; if (allowIndexed && node.name === 'indexed') { node.indexed = true; node.name = ''; } parent.type = verifyType(parent.type); return parent; } // @TODO: Better return type function parseSignatureEvent(fragment) { var abi = { anonymous: false, inputs: [], name: '', type: 'event' }; var match = fragment.match(regexParen); if (!match) { throw new Error('invalid event: ' + fragment); } abi.name = match[1].trim(); splitNesting(match[2]).forEach(function (param) { param = parseParam(param, true); param.indexed = !!param.indexed; abi.inputs.push(param); }); match[3].split(' ').forEach(function (modifier) { switch (modifier) { case 'anonymous': abi.anonymous = true; break; case '': break; default: console.log('unknown modifier: ' + modifier); } }); if (abi.name && !abi.name.match(regexIdentifier)) { throw new Error('invalid identifier: "' + abi.name + '"'); } return abi; } function parseSignatureFunction(fragment) { var abi = { constant: false, inputs: [], name: '', outputs: [], payable: false, stateMutability: null, type: 'function' }; var comps = fragment.split(' returns '); var left = comps[0].match(regexParen); if (!left) { throw new Error('invalid signature'); } abi.name = left[1].trim(); if (!abi.name.match(regexIdentifier)) { throw new Error('invalid identifier: "' + left[1] + '"'); } splitNesting(left[2]).forEach(function (param) { abi.inputs.push(parseParam(param)); }); left[3].split(' ').forEach(function (modifier) { switch (modifier) { case 'constant': abi.constant = true; break; case 'payable': abi.payable = true; break; case 'pure': abi.constant = true; abi.stateMutability = 'pure'; break; case 'view': abi.constant = true; abi.stateMutability = 'view'; break; case '': break; default: console.log('unknown modifier: ' + modifier); } }); // We have outputs if (comps.length > 1) { var right = comps[1].match(regexParen); if (right[1].trim() != '' || right[3].trim() != '') { throw new Error('unexpected tokens'); } splitNesting(right[2]).forEach(function (param) { abi.outputs.push(parseParam(param)); }); } return abi; } function parseParamType(type) { return parseParam(type, true); } exports.parseParamType = parseParamType; // @TODO: Allow a second boolean to expose names function formatParamType(paramType) { return getParamCoder(exports.defaultCoerceFunc, paramType).type; } exports.formatParamType = formatParamType; // @TODO: Allow a second boolean to expose names and modifiers function formatSignature(fragment) { return fragment.name + '(' + fragment.inputs.map(function (i) { return formatParamType(i); }).join(',') + ')'; } exports.formatSignature = formatSignature; function parseSignature(fragment) { if (typeof (fragment) === 'string') { // Make sure the "returns" is surrounded by a space and all whitespace is exactly one space fragment = fragment.replace(/\(/g, ' (').replace(/\)/g, ') ').replace(/\s+/g, ' '); fragment = fragment.trim(); if (fragment.substring(0, 6) === 'event ') { return parseSignatureEvent(fragment.substring(6).trim()); } else { if (fragment.substring(0, 9) === 'function ') { fragment = fragment.substring(9); } return parseSignatureFunction(fragment.trim()); } } throw new Error('unknown signature'); } exports.parseSignature = parseSignature; var Coder = /** @class */ (function () { function Coder(coerceFunc, name, type, localName, dynamic) { this.coerceFunc = coerceFunc; this.name = name; this.type = type; this.localName = localName; this.dynamic = dynamic; } return Coder; }()); // Clones the functionality of an existing Coder, but without a localName var CoderAnonymous = /** @class */ (function (_super) { __extends(CoderAnonymous, _super); function CoderAnonymous(coder) { var _this = _super.call(this, coder.coerceFunc, coder.name, coder.type, undefined, coder.dynamic) || this; properties_1.defineReadOnly(_this, 'coder', coder); return _this; } CoderAnonymous.prototype.encode = function (value) { return this.coder.encode(value); }; CoderAnonymous.prototype.decode = function (data, offset) { return this.coder.decode(data, offset); }; return CoderAnonymous; }(Coder)); var CoderNull = /** @class */ (function (_super) { __extends(CoderNull, _super); function CoderNull(coerceFunc, localName) { return _super.call(this, coerceFunc, 'null', '', localName, false) || this; } CoderNull.prototype.encode = function (value) { return bytes_1.arrayify([]); }; CoderNull.prototype.decode = function (data, offset) { if (offset > data.length) { throw new Error('invalid null'); } return { consumed: 0, value: this.coerceFunc('null', undefined) }; }; return CoderNull; }(Coder)); var CoderNumber = /** @class */ (function (_super) { __extends(CoderNumber, _super); function CoderNumber(coerceFunc, size, signed, localName) { var _this = this; var name = ((signed ? 'int' : 'uint') + (size * 8)); _this = _super.call(this, coerceFunc, name, name, localName, false) || this; _this.size = size; _this.signed = signed; return _this; } CoderNumber.prototype.encode = function (value) { try { var v = bignumber_1.bigNumberify(value); v = v.toTwos(this.size * 8).maskn(this.size * 8); //value = value.toTwos(size * 8).maskn(size * 8); if (this.signed) { v = v.fromTwos(this.size * 8).toTwos(256); } return bytes_1.padZeros(bytes_1.arrayify(v), 32); } catch (error) { errors.throwError('invalid number value', errors.INVALID_ARGUMENT, { arg: this.localName, coderType: this.name, value: value }); } return null; }; CoderNumber.prototype.decode = function (data, offset) { if (data.length < offset + 32) { errors.throwError('insufficient data for ' + this.name + ' type', errors.INVALID_ARGUMENT, { arg: this.localName, coderType: this.name, value: bytes_1.hexlify(data.slice(offset, offset + 32)) }); } var junkLength = 32 - this.size; var value = bignumber_1.bigNumberify(data.slice(offset + junkLength, offset + 32)); if (this.signed) { value = value.fromTwos(this.size * 8); } else { value = value.maskn(this.size * 8); } return { consumed: 32, value: this.coerceFunc(this.name, value), }; }; return CoderNumber; }(Coder)); var uint256Coder = new CoderNumber(function (type, value) { return value; }, 32, false, 'none'); var CoderBoolean = /** @class */ (function (_super) { __extends(CoderBoolean, _super); function CoderBoolean(coerceFunc, localName) { return _super.call(this, coerceFunc, 'bool', 'bool', localName, false) || this; } CoderBoolean.prototype.encode = function (value) { return uint256Coder.encode(!!value ? 1 : 0); }; CoderBoolean.prototype.decode = function (data, offset) { try { var result = uint256Coder.decode(data, offset); } catch (error) { if (error.reason === 'insufficient data for uint256 type') { errors.throwError('insufficient data for boolean type', errors.INVALID_ARGUMENT, { arg: this.localName, coderType: 'boolean', value: error.value }); } throw error; } return { consumed: result.consumed, value: this.coerceFunc('bool', !result.value.isZero()) }; }; return CoderBoolean; }(Coder)); var CoderFixedBytes = /** @class */ (function (_super) { __extends(CoderFixedBytes, _super); function CoderFixedBytes(coerceFunc, length, localName) { var _this = this; var name = ('bytes' + length); _this = _super.call(this, coerceFunc, name, name, localName, false) || this; _this.length = length; return _this; } CoderFixedBytes.prototype.encode = function (value) { var result = new Uint8Array(32); try { var data = bytes_1.arrayify(value); if (data.length > 32) { throw new Error(); } result.set(data); } catch (error) { errors.throwError('invalid ' + this.name + ' value', errors.INVALID_ARGUMENT, { arg: this.localName, coderType: this.name, value: (error.value || value) }); } return result; }; CoderFixedBytes.prototype.decode = function (data, offset) { if (data.length < offset + 32) { errors.throwError('insufficient data for ' + name + ' type', errors.INVALID_ARGUMENT, { arg: this.localName, coderType: this.name, value: bytes_1.hexlify(data.slice(offset, offset + 32)) }); } return { consumed: 32, value: this.coerceFunc(this.name, bytes_1.hexlify(data.slice(offset, offset + this.length))) }; }; return CoderFixedBytes; }(Coder)); var CoderAddress = /** @class */ (function (_super) { __extends(CoderAddress, _super); function CoderAddress(coerceFunc, localName) { return _super.call(this, coerceFunc, 'address', 'address', localName, false) || this; } CoderAddress.prototype.encode = function (value) { var result = new Uint8Array(32); try { result.set(bytes_1.arrayify(address_1.getAddress(value)), 12); } catch (error) { errors.throwError('invalid address', errors.INVALID_ARGUMENT, { arg: this.localName, coderType: 'address', value: value }); } return result; }; CoderAddress.prototype.decode = function (data, offset) { if (data.length < offset + 32) { errors.throwError('insufficuent data for address type', errors.INVALID_ARGUMENT, { arg: this.localName, coderType: 'address', value: bytes_1.hexlify(data.slice(offset, offset + 32)) }); } return { consumed: 32, value: this.coerceFunc('address', address_1.getAddress(bytes_1.hexlify(data.slice(offset + 12, offset + 32)))) }; }; return CoderAddress; }(Coder)); function _encodeDynamicBytes(value) { var dataLength = 32 * Math.ceil(value.length / 32); var padding = new Uint8Array(dataLength - value.length); return bytes_1.concat([ uint256Coder.encode(value.length), value, padding ]); } function _decodeDynamicBytes(data, offset, localName) { if (data.length < offset + 32) { errors.throwError('insufficient data for dynamicBytes length', errors.INVALID_ARGUMENT, { arg: localName, coderType: 'dynamicBytes', value: bytes_1.hexlify(data.slice(offset, offset + 32)) }); } var length = uint256Coder.decode(data, offset).value; try { length = length.toNumber(); } catch (error) { errors.throwError('dynamic bytes count too large', errors.INVALID_ARGUMENT, { arg: localName, coderType: 'dynamicBytes', value: length.toString() }); } if (data.length < offset + 32 + length) { errors.throwError('insufficient data for dynamicBytes type', errors.INVALID_ARGUMENT, { arg: localName, coderType: 'dynamicBytes', value: bytes_1.hexlify(data.slice(offset, offset + 32 + length)) }); } return { consumed: 32 + 32 * Math.ceil(length / 32), value: data.slice(offset + 32, offset + 32 + length), }; } var CoderDynamicBytes = /** @class */ (function (_super) { __extends(CoderDynamicBytes, _super); function CoderDynamicBytes(coerceFunc, localName) { return _super.call(this, coerceFunc, 'bytes', 'bytes', localName, true) || this; } CoderDynamicBytes.prototype.encode = function (value) { try { return _encodeDynamicBytes(bytes_1.arrayify(value)); } catch (error) { errors.throwError('invalid bytes value', errors.INVALID_ARGUMENT, { arg: this.localName, coderType: 'bytes', value: error.value }); } return null; }; CoderDynamicBytes.prototype.decode = function (data, offset) { var result = _decodeDynamicBytes(data, offset, this.localName); result.value = this.coerceFunc('bytes', bytes_1.hexlify(result.value)); return result; }; return CoderDynamicBytes; }(Coder)); var CoderString = /** @class */ (function (_super) { __extends(CoderString, _super); function CoderString(coerceFunc, localName) { return _super.call(this, coerceFunc, 'string', 'string', localName, true) || this; } CoderString.prototype.encode = function (value) { if (typeof (value) !== 'string') { errors.throwError('invalid string value', errors.INVALID_ARGUMENT, { arg: this.localName, coderType: 'string', value: value }); } return _encodeDynamicBytes(utf8_1.toUtf8Bytes(value)); }; CoderString.prototype.decode = function (data, offset) { var result = _decodeDynamicBytes(data, offset, this.localName); result.value = this.coerceFunc('string', utf8_1.toUtf8String(result.value)); return result; }; return CoderString; }(Coder)); function alignSize(size) { return 32 * Math.ceil(size / 32); } function pack(coders, values) { if (Array.isArray(values)) { // do nothing } else if (values && typeof (values) === 'object') { var arrayValues = []; coders.forEach(function (coder) { arrayValues.push(values[coder.localName]); }); values = arrayValues; } else { errors.throwError('invalid tuple value', errors.INVALID_ARGUMENT, { coderType: 'tuple', value: values }); } if (coders.length !== values.length) { errors.throwError('types/value length mismatch', errors.INVALID_ARGUMENT, { coderType: 'tuple', value: values }); } var parts = []; coders.forEach(function (coder, index) { parts.push({ dynamic: coder.dynamic, value: coder.encode(values[index]) }); }); var staticSize = 0, dynamicSize = 0; parts.forEach(function (part) { if (part.dynamic) { staticSize += 32; dynamicSize += alignSize(part.value.length); } else { staticSize += alignSize(part.value.length); } }); var offset = 0, dynamicOffset = staticSize; var data = new Uint8Array(staticSize + dynamicSize); parts.forEach(function (part) { if (part.dynamic) { //uint256Coder.encode(dynamicOffset).copy(data, offset); data.set(uint256Coder.encode(dynamicOffset), offset); offset += 32; //part.value.copy(data, dynamicOffset); @TODO data.set(part.value, dynamicOffset); dynamicOffset += alignSize(part.value.length); } else { //part.value.copy(data, offset); @TODO data.set(part.value, offset); offset += alignSize(part.value.length); } }); return data; } function unpack(coders, data, offset) { var baseOffset = offset; var consumed = 0; var value = []; coders.forEach(function (coder) { if (coder.dynamic) { var dynamicOffset = uint256Coder.decode(data, offset); var result = coder.decode(data, baseOffset + dynamicOffset.value.toNumber()); // The dynamic part is leap-frogged somewhere else; doesn't count towards size result.consumed = dynamicOffset.consumed; } else { var result = coder.decode(data, offset); } if (result.value != undefined) { value.push(result.value); } offset += result.consumed; consumed += result.consumed; }); coders.forEach(function (coder, index) { var name = coder.localName; if (!name) { return; } if (name === 'length') { name = '_length'; } if (value[name] != null) { return; } value[name] = value[index]; }); return { value: value, consumed: consumed }; } var CoderArray = /** @class */ (function (_super) { __extends(CoderArray, _super); function CoderArray(coerceFunc, coder, length, localName) { var _this = this; var type = (coder.type + '[' + (length >= 0 ? length : '') + ']'); var dynamic = (length === -1 || coder.dynamic); _this = _super.call(this, coerceFunc, 'array', type, localName, dynamic) || this; _this.coder = coder; _this.length = length; return _this; } CoderArray.prototype.encode = function (value) { if (!Array.isArray(value)) { errors.throwError('expected array value', errors.INVALID_ARGUMENT, { arg: this.localName, coderType: 'array', value: value }); } var count = this.length; var result = new Uint8Array(0); if (count === -1) { count = value.length; result = uint256Coder.encode(count); } errors.checkArgumentCount(count, value.length, 'in coder array' + (this.localName ? (" " + this.localName) : "")); var coders = []; for (var i = 0; i < value.length; i++) { coders.push(this.coder); } return bytes_1.concat([result, pack(coders, value)]); }; CoderArray.prototype.decode = function (data, offset) { // @TODO: //if (data.length < offset + length * 32) { throw new Error('invalid array'); } var consumed = 0; var count = this.length; if (count === -1) { try { var decodedLength = uint256Coder.decode(data, offset); } catch (error) { errors.throwError('insufficient data for dynamic array length', errors.INVALID_ARGUMENT, { arg: this.localName, coderType: 'array', value: error.value }); } try { count = decodedLength.value.toNumber(); } catch (error) { errors.throwError('array count too large', errors.INVALID_ARGUMENT, { arg: this.localName, coderType: 'array', value: decodedLength.value.toString() }); } consumed += decodedLength.consumed; offset += decodedLength.consumed; } var coders = []; for (var i = 0; i < count; i++) { coders.push(new CoderAnonymous(this.coder)); } var result = unpack(coders, data, offset); result.consumed += consumed; result.value = this.coerceFunc(this.type, result.value); return result; }; return CoderArray; }(Coder)); var CoderTuple = /** @class */ (function (_super) { __extends(CoderTuple, _super); function CoderTuple(coerceFunc, coders, localName) { var _this = this; var dynamic = false; var types = []; coders.forEach(function (coder) { if (coder.dynamic) { dynamic = true; } types.push(coder.type); }); var type = ('tuple(' + types.join(',') + ')'); _this = _super.call(this, coerceFunc, 'tuple', type, localName, dynamic) || this; _this.coders = coders; return _this; } CoderTuple.prototype.encode = function (value) { return pack(this.coders, value); }; CoderTuple.prototype.decode = function (data, offset) { var result = unpack(this.coders, data, offset); result.value = this.coerceFunc(this.type, result.value); return result; }; return CoderTuple; }(Coder)); /* function getTypes(coders) { var type = coderTuple(coders).type; return type.substring(6, type.length - 1); } */ function splitNesting(value) { var result = []; var accum = ''; var depth = 0; for (var offset = 0; offset < value.length; offset++) { var c = value[offset]; if (c === ',' && depth === 0) { result.push(accum); accum = ''; } else { accum += c; if (c === '(') { depth++; } else if (c === ')') { depth--; if (depth === -1) { throw new Error('unbalanced parenthsis'); } } } } result.push(accum); return result; } // @TODO: Is there a way to return "class"? var paramTypeSimple = { address: CoderAddress, bool: CoderBoolean, string: CoderString, bytes: CoderDynamicBytes, }; function getTupleParamCoder(coerceFunc, components, localName) { if (!components) { components = []; } var coders = []; components.forEach(function (component) { coders.push(getParamCoder(coerceFunc, component)); }); return new CoderTuple(coerceFunc, coders, localName); } function getParamCoder(coerceFunc, param) { var coder = paramTypeSimple[param.type]; if (coder) { return new coder(coerceFunc, param.name); } var match = param.type.match(paramTypeNumber); if (match) { var size = parseInt(match[2] || "256"); if (size === 0 || size > 256 || (size % 8) !== 0) { errors.throwError('invalid ' + match[1] + ' bit length', errors.INVALID_ARGUMENT, { arg: 'param', value: param }); } return new CoderNumber(coerceFunc, size / 8, (match[1] === 'int'), param.name); } var match = param.type.match(paramTypeBytes); if (match) { var size = parseInt(match[1]); if (size === 0 || size > 32) { errors.throwError('invalid bytes length', errors.INVALID_ARGUMENT, { arg: 'param', value: param }); } return new CoderFixedBytes(coerceFunc, size, param.name); } var match = param.type.match(paramTypeArray); if (match) { var size = parseInt(match[2] || "-1"); param = properties_1.jsonCopy(param); param.type = match[1]; return new CoderArray(coerceFunc, getParamCoder(coerceFunc, param), size, param.name); } if (param.type.substring(0, 5) === 'tuple') { return getTupleParamCoder(coerceFunc, param.components, param.name); } if (param.type === '') { return new CoderNull(coerceFunc, param.name); } errors.throwError('invalid type', errors.INVALID_ARGUMENT, { arg: 'type', value: param.type }); return null; } var AbiCoder = /** @class */ (function () { function AbiCoder(coerceFunc) { errors.checkNew(this, AbiCoder); if (!coerceFunc) { coerceFunc = exports.defaultCoerceFunc; } properties_1.defineReadOnly(this, 'coerceFunc', coerceFunc); } AbiCoder.prototype.encode = function (types, values) { if (types.length !== values.length) { errors.throwError('types/values length mismatch', errors.INVALID_ARGUMENT, { count: { types: types.length, values: values.length }, value: { types: types, values: values } }); } var coders = []; types.forEach(function (type) { // Convert types to type objects // - "uint foo" => { type: "uint", name: "foo" } // - "tuple(uint, uint)" => { type: "tuple", components: [ { type: "uint" }, { type: "uint" }, ] } var typeObject = null; if (typeof (type) === 'string') { typeObject = parseParam(type); } else { typeObject = type; } coders.push(getParamCoder(this.coerceFunc, typeObject)); }, this); return bytes_1.hexlify(new CoderTuple(this.coerceFunc, coders, '_').encode(values)); }; AbiCoder.prototype.decode = function (types, data) { var coders = []; types.forEach(function (type) { // See encode for details var typeObject = null; if (typeof (type) === 'string') { typeObject = parseParam(type); } else { typeObject = properties_1.jsonCopy(type); } coders.push(getParamCoder(this.coerceFunc, typeObject)); }, this); return new CoderTuple(this.coerceFunc, coders, '_').decode(bytes_1.arrayify(data), 0).value; }; return AbiCoder; }()); exports.AbiCoder = AbiCoder; exports.defaultAbiCoder = new AbiCoder(); },{"./address":57,"./bignumber":59,"./bytes":60,"./errors":61,"./properties":69,"./utf8":79}],57:[function(require,module,exports){ 'use strict'; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); // We use this for base 36 maths var bn_js_1 = __importDefault(require("bn.js")); var bytes_1 = require("./bytes"); var keccak256_1 = require("./keccak256"); var rlp_1 = require("./rlp"); var errors = require("./errors"); function getChecksumAddress(address) { if (typeof (address) !== 'string' || !address.match(/^0x[0-9A-Fa-f]{40}$/)) { errors.throwError('invalid address', errors.INVALID_ARGUMENT, { arg: 'address', value: address }); } address = address.toLowerCase(); var chars = address.substring(2).split(''); var hashed = new Uint8Array(40); for (var i_1 = 0; i_1 < 40; i_1++) { hashed[i_1] = chars[i_1].charCodeAt(0); } hashed = bytes_1.arrayify(keccak256_1.keccak256(hashed)); for (var i = 0; i < 40; i += 2) { if ((hashed[i >> 1] >> 4) >= 8) { chars[i] = chars[i].toUpperCase(); } if ((hashed[i >> 1] & 0x0f) >= 8) { chars[i + 1] = chars[i + 1].toUpperCase(); } } return '0x' + chars.join(''); } // Shims for environments that are missing some required constants and functions var MAX_SAFE_INTEGER = 0x1fffffffffffff; function log10(x) { if (Math.log10) { return Math.log10(x); } return Math.log(x) / Math.LN10; } // See: https://en.wikipedia.org/wiki/International_Bank_Account_Number // Create lookup table var ibanLookup = {}; for (var i = 0; i < 10; i++) { ibanLookup[String(i)] = String(i); } for (var i = 0; i < 26; i++) { ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); } // How many decimal digits can we process? (for 64-bit float, this is 15) var safeDigits = Math.floor(log10(MAX_SAFE_INTEGER)); function ibanChecksum(address) { address = address.toUpperCase(); address = address.substring(4) + address.substring(0, 2) + '00'; var expanded = ''; address.split('').forEach(function (c) { expanded += ibanLookup[c]; }); // Javascript can handle integers safely up to 15 (decimal) digits while (expanded.length >= safeDigits) { var block = expanded.substring(0, safeDigits); expanded = parseInt(block, 10) % 97 + expanded.substring(block.length); } var checksum = String(98 - (parseInt(expanded, 10) % 97)); while (checksum.length < 2) { checksum = '0' + checksum; } return checksum; } ; function getAddress(address) { var result = null; if (typeof (address) !== 'string') { errors.throwError('invalid address', errors.INVALID_ARGUMENT, { arg: 'address', value: address }); } if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { // Missing the 0x prefix if (address.substring(0, 2) !== '0x') { address = '0x' + address; } result = getChecksumAddress(address); // It is a checksummed address with a bad checksum if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) { errors.throwError('bad address checksum', errors.INVALID_ARGUMENT, { arg: 'address', value: address }); } // Maybe ICAP? (we only support direct mode) } else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { // It is an ICAP address with a bad checksum if (address.substring(2, 4) !== ibanChecksum(address)) { errors.throwError('bad icap checksum', errors.INVALID_ARGUMENT, { arg: 'address', value: address }); } result = (new bn_js_1.default.BN(address.substring(4), 36)).toString(16); while (result.length < 40) { result = '0' + result; } result = getChecksumAddress('0x' + result); } else { errors.throwError('invalid address', errors.INVALID_ARGUMENT, { arg: 'address', value: address }); } return result; } exports.getAddress = getAddress; function getIcapAddress(address) { var base36 = (new bn_js_1.default.BN(getAddress(address).substring(2), 16)).toString(36).toUpperCase(); while (base36.length < 30) { base36 = '0' + base36; } return 'XE' + ibanChecksum('XE00' + base36) + base36; } exports.getIcapAddress = getIcapAddress; // http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed function getContractAddress(transaction) { if (!transaction.from) { throw new Error('missing from address'); } var nonce = transaction.nonce; return getAddress('0x' + keccak256_1.keccak256(rlp_1.encode([ getAddress(transaction.from), bytes_1.stripZeros(bytes_1.hexlify(nonce)) ])).substring(26)); } exports.getContractAddress = getContractAddress; },{"./bytes":60,"./errors":61,"./keccak256":66,"./rlp":71,"bn.js":8}],58:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var bytes_1 = require("../utils/bytes"); module.exports = { decode: function (textData) { textData = atob(textData); var data = []; for (var i = 0; i < textData.length; i++) { data.push(textData.charCodeAt(i)); } return bytes_1.arrayify(data); }, encode: function (data) { data = bytes_1.arrayify(data); var textData = ''; for (var i = 0; i < data.length; i++) { textData += String.fromCharCode(data[i]); } return btoa(textData); } }; },{"../utils/bytes":60}],59:[function(require,module,exports){ 'use strict'; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); /** * BigNumber * * A wrapper around the BN.js object. We use the BN.js library * because it is used by elliptic, so it is required regardles. * */ var bn_js_1 = __importDefault(require("bn.js")); var bytes_1 = require("./bytes"); var properties_1 = require("./properties"); var types_1 = require("./types"); var errors = __importStar(require("./errors")); var BN_1 = new bn_js_1.default.BN(-1); function toHex(bn) { var value = bn.toString(16); if (value[0] === '-') { if ((value.length % 2) === 0) { return '-0x0' + value.substring(1); } return "-0x" + value.substring(1); } if ((value.length % 2) === 1) { return '0x0' + value; } return '0x' + value; } function toBN(value) { return bigNumberify(value)._bn; } function toBigNumber(bn) { return new BigNumber(toHex(bn)); } var BigNumber = /** @class */ (function (_super) { __extends(BigNumber, _super); function BigNumber(value) { var _this = _super.call(this) || this; errors.checkNew(_this, BigNumber); if (typeof (value) === 'string') { if (bytes_1.isHexString(value)) { if (value == '0x') { value = '0x0'; } properties_1.defineReadOnly(_this, '_hex', value); } else if (value[0] === '-' && bytes_1.isHexString(value.substring(1))) { properties_1.defineReadOnly(_this, '_hex', value); } else if (value.match(/^-?[0-9]*$/)) { if (value == '') { value = '0'; } properties_1.defineReadOnly(_this, '_hex', toHex(new bn_js_1.default.BN(value))); } else { errors.throwError('invalid BigNumber string value', errors.INVALID_ARGUMENT, { arg: 'value', value: value }); } } else if (typeof (value) === 'number') { if (parseInt(String(value)) !== value) { errors.throwError('underflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'underflow', value: value, outputValue: parseInt(String(value)) }); } try { properties_1.defineReadOnly(_this, '_hex', toHex(new bn_js_1.default.BN(value))); } catch (error) { errors.throwError('overflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'overflow', details: error.message }); } } else if (value instanceof BigNumber) { properties_1.defineReadOnly(_this, '_hex', value._hex); } else if (value.toHexString) { properties_1.defineReadOnly(_this, '_hex', toHex(toBN(value.toHexString()))); } else if (bytes_1.isArrayish(value)) { properties_1.defineReadOnly(_this, '_hex', toHex(new bn_js_1.default.BN(bytes_1.hexlify(value).substring(2), 16))); } else { errors.throwError('invalid BigNumber value', errors.INVALID_ARGUMENT, { arg: 'value', value: value }); } return _this; } Object.defineProperty(BigNumber.prototype, "_bn", { get: function () { if (this._hex[0] === '-') { return (new bn_js_1.default.BN(this._hex.substring(3), 16)).mul(BN_1); } return new bn_js_1.default.BN(this._hex.substring(2), 16); }, enumerable: true, configurable: true }); BigNumber.prototype.fromTwos = function (value) { return toBigNumber(this._bn.fromTwos(value)); }; BigNumber.prototype.toTwos = function (value) { return toBigNumber(this._bn.toTwos(value)); }; BigNumber.prototype.add = function (other) { return toBigNumber(this._bn.add(toBN(other))); }; BigNumber.prototype.sub = function (other) { return toBigNumber(this._bn.sub(toBN(other))); }; BigNumber.prototype.div = function (other) { var o = bigNumberify(other); if (o.isZero()) { errors.throwError('division by zero', errors.NUMERIC_FAULT, { operation: 'divide', fault: 'division by zero' }); } return toBigNumber(this._bn.div(toBN(other))); }; BigNumber.prototype.mul = function (other) { return toBigNumber(this._bn.mul(toBN(other))); }; BigNumber.prototype.mod = function (other) { return toBigNumber(this._bn.mod(toBN(other))); }; BigNumber.prototype.pow = function (other) { return toBigNumber(this._bn.pow(toBN(other))); }; BigNumber.prototype.maskn = function (value) { return toBigNumber(this._bn.maskn(value)); }; BigNumber.prototype.eq = function (other) { return this._bn.eq(toBN(other)); }; BigNumber.prototype.lt = function (other) { return this._bn.lt(toBN(other)); }; BigNumber.prototype.lte = function (other) { return this._bn.lte(toBN(other)); }; BigNumber.prototype.gt = function (other) { return this._bn.gt(toBN(other)); }; BigNumber.prototype.gte = function (other) { return this._bn.gte(toBN(other)); }; BigNumber.prototype.isZero = function () { return this._bn.isZero(); }; BigNumber.prototype.toNumber = function () { try { return this._bn.toNumber(); } catch (error) { errors.throwError('overflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'overflow', details: error.message }); } return null; }; BigNumber.prototype.toString = function () { return this._bn.toString(10); }; BigNumber.prototype.toHexString = function () { return this._hex; }; return BigNumber; }(types_1.BigNumber)); function bigNumberify(value) { if (value instanceof BigNumber) { return value; } return new BigNumber(value); } exports.bigNumberify = bigNumberify; exports.ConstantNegativeOne = bigNumberify(-1); exports.ConstantZero = bigNumberify(0); exports.ConstantOne = bigNumberify(1); exports.ConstantTwo = bigNumberify(2); exports.ConstantWeiPerEther = bigNumberify('1000000000000000000'); },{"./bytes":60,"./errors":61,"./properties":69,"./types":77,"bn.js":8}],60:[function(require,module,exports){ "use strict"; /** * Conversion Utilities * */ Object.defineProperty(exports, "__esModule", { value: true }); var types_1 = require("./types"); var errors = require("./errors"); exports.AddressZero = '0x0000000000000000000000000000000000000000'; exports.HashZero = '0x0000000000000000000000000000000000000000000000000000000000000000'; function isBigNumber(value) { return (value instanceof types_1.BigNumber); } function addSlice(array) { if (array.slice) { return array; } array.slice = function () { var args = Array.prototype.slice.call(arguments); return new Uint8Array(Array.prototype.slice.apply(array, args)); }; return array; } function isArrayish(value) { if (!value || parseInt(String(value.length)) != value.length || typeof (value) === 'string') { return false; } for (var i = 0; i < value.length; i++) { var v = value[i]; if (v < 0 || v >= 256 || parseInt(String(v)) != v) { return false; } } return true; } exports.isArrayish = isArrayish; function arrayify(value) { if (value == null) { errors.throwError('cannot convert null value to array', errors.INVALID_ARGUMENT, { arg: 'value', value: value }); } if (isBigNumber(value)) { value = value.toHexString(); } if (typeof (value) === 'string') { var match = value.match(/^(0x)?[0-9a-fA-F]*$/); if (!match) { errors.throwError('invalid hexidecimal string', errors.INVALID_ARGUMENT, { arg: 'value', value: value }); } if (match[1] !== '0x') { errors.throwError('hex string must have 0x prefix', errors.INVALID_ARGUMENT, { arg: 'value', value: value }); } value = value.substring(2); if (value.length % 2) { value = '0' + value; } var result = []; for (var i = 0; i < value.length; i += 2) { result.push(parseInt(value.substr(i, 2), 16)); } return addSlice(new Uint8Array(result)); } else if (typeof (value) === 'string') { } if (isArrayish(value)) { return addSlice(new Uint8Array(value)); } errors.throwError('invalid arrayify value', null, { arg: 'value', value: value, type: typeof (value) }); return null; } exports.arrayify = arrayify; function concat(objects) { var arrays = []; var length = 0; for (var i = 0; i < objects.length; i++) { var object = arrayify(objects[i]); arrays.push(object); length += object.length; } var result = new Uint8Array(length); var offset = 0; for (var i = 0; i < arrays.length; i++) { result.set(arrays[i], offset); offset += arrays[i].length; } return addSlice(result); } exports.concat = concat; function stripZeros(value) { var result = arrayify(value); if (result.length === 0) { return result; } // Find the first non-zero entry var start = 0; while (result[start] === 0) { start++; } // If we started with zeros, strip them if (start) { result = result.slice(start); } return result; } exports.stripZeros = stripZeros; function padZeros(value, length) { value = arrayify(value); if (length < value.length) { throw new Error('cannot pad'); } var result = new Uint8Array(length); result.set(value, length - value.length); return addSlice(result); } exports.padZeros = padZeros; function isHexString(value, length) { if (typeof (value) !== 'string' || !value.match(/^0x[0-9A-Fa-f]*$/)) { return false; } if (length && value.length !== 2 + 2 * length) { return false; } return true; } exports.isHexString = isHexString; var HexCharacters = '0123456789abcdef'; function hexlify(value) { if (isBigNumber(value)) { return value.toHexString(); } if (typeof (value) === 'number') { if (value < 0) { errors.throwError('cannot hexlify negative value', errors.INVALID_ARGUMENT, { arg: 'value', value: value }); } var hex = ''; while (value) { hex = HexCharacters[value & 0x0f] + hex; value = Math.floor(value / 16); } if (hex.length) { if (hex.length % 2) { hex = '0' + hex; } return '0x' + hex; } return '0x00'; } if (typeof (value) === 'string') { var match = value.match(/^(0x)?[0-9a-fA-F]*$/); if (!match) { errors.throwError('invalid hexidecimal string', errors.INVALID_ARGUMENT, { arg: 'value', value: value }); } if (match[1] !== '0x') { errors.throwError('hex string must have 0x prefix', errors.INVALID_ARGUMENT, { arg: 'value', value: value }); } if (value.length % 2) { value = '0x0' + value.substring(2); } return value; } if (isArrayish(value)) { var result = []; for (var i = 0; i < value.length; i++) { var v = value[i]; result.push(HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]); } return '0x' + result.join(''); } errors.throwError('invalid hexlify value', null, { arg: 'value', value: value }); return 'never'; } exports.hexlify = hexlify; function hexDataLength(data) { if (!isHexString(data) || (data.length % 2) !== 0) { return null; } return (data.length - 2) / 2; } exports.hexDataLength = hexDataLength; function hexDataSlice(data, offset, length) { if (!isHexString(data)) { errors.throwError('invalid hex data', errors.INVALID_ARGUMENT, { arg: 'value', value: data }); } if ((data.length % 2) !== 0) { errors.throwError('hex data length must be even', errors.INVALID_ARGUMENT, { arg: 'value', value: data }); } offset = 2 + 2 * offset; if (length != null) { return '0x' + data.substring(offset, offset + 2 * length); } return '0x' + data.substring(offset); } exports.hexDataSlice = hexDataSlice; function hexStripZeros(value) { if (!isHexString(value)) { errors.throwError('invalid hex string', errors.INVALID_ARGUMENT, { arg: 'value', value: value }); } while (value.length > 3 && value.substring(0, 3) === '0x0') { value = '0x' + value.substring(3); } return value; } exports.hexStripZeros = hexStripZeros; function hexZeroPad(value, length) { if (!isHexString(value)) { errors.throwError('invalid hex string', errors.INVALID_ARGUMENT, { arg: 'value', value: value }); } while (value.length < 2 * length + 2) { value = '0x0' + value.substring(2); } return value; } exports.hexZeroPad = hexZeroPad; function isSignature(value) { return (value && value.r != null && value.s != null); } function splitSignature(signature) { var v = 0; var r = '0x', s = '0x'; if (isSignature(signature)) { if (signature.v == null && signature.recoveryParam == null) { errors.throwError('at least on of recoveryParam or v must be specified', errors.INVALID_ARGUMENT, { argument: 'signature', value: signature }); } r = hexZeroPad(signature.r, 32); s = hexZeroPad(signature.s, 32); v = signature.v; if (typeof (v) === 'string') { v = parseInt(v, 16); } var recoveryParam = signature.recoveryParam; if (recoveryParam == null && signature.v != null) { recoveryParam = 1 - (v % 2); } v = 27 + recoveryParam; } else { var bytes = arrayify(signature); if (bytes.length !== 65) { throw new Error('invalid signature'); } r = hexlify(bytes.slice(0, 32)); s = hexlify(bytes.slice(32, 64)); v = bytes[64]; if (v !== 27 && v !== 28) { v = 27 + (v % 2); } } return { r: r, s: s, recoveryParam: (v - 27), v: v }; } exports.splitSignature = splitSignature; function joinSignature(signature) { signature = splitSignature(signature); return hexlify(concat([ signature.r, signature.s, (signature.recoveryParam ? '0x1c' : '0x1b') ])); } exports.joinSignature = joinSignature; },{"./errors":61,"./types":77}],61:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); // Unknown Error exports.UNKNOWN_ERROR = 'UNKNOWN_ERROR'; // Not implemented exports.NOT_IMPLEMENTED = 'NOT_IMPLEMENTED'; // Missing new operator to an object // - name: The name of the class exports.MISSING_NEW = 'MISSING_NEW'; // Call exception // - transaction: the transaction // - address?: the contract address // - args?: The arguments passed into the function // - method?: The Solidity method signature // - errorSignature?: The EIP848 error signature // - errorArgs?: The EIP848 error parameters // - reason: The reason (only for EIP848 "Error(string)") exports.CALL_EXCEPTION = 'CALL_EXCEPTION'; // Response from a server was invalid // - response: The body of the response //'BAD_RESPONSE', // Invalid argument (e.g. value is incompatible with type) to a function: // - arg: The argument name that was invalid // - value: The value of the argument exports.INVALID_ARGUMENT = 'INVALID_ARGUMENT'; // Missing argument to a function: // - count: The number of arguments received // - expectedCount: The number of arguments expected exports.MISSING_ARGUMENT = 'MISSING_ARGUMENT'; // Too many arguments // - count: The number of arguments received // - expectedCount: The number of arguments expected exports.UNEXPECTED_ARGUMENT = 'UNEXPECTED_ARGUMENT'; // Numeric Fault // - operation: the operation being executed // - fault: the reason this faulted exports.NUMERIC_FAULT = 'NUMERIC_FAULT'; // Unsupported operation // - operation exports.UNSUPPORTED_OPERATION = 'UNSUPPORTED_OPERATION'; var _permanentCensorErrors = false; var _censorErrors = false; // @TODO: Enum function throwError(message, code, params) { if (_censorErrors) { throw new Error('unknown error'); } if (!code) { code = exports.UNKNOWN_ERROR; } if (!params) { params = {}; } var messageDetails = []; Object.keys(params).forEach(function (key) { try { messageDetails.push(key + '=' + JSON.stringify(params[key])); } catch (error) { messageDetails.push(key + '=' + JSON.stringify(params[key].toString())); } }); var reason = message; if (messageDetails.length) { message += ' (' + messageDetails.join(', ') + ')'; } // @TODO: Any?? var error = new Error(message); error.reason = reason; error.code = code; Object.keys(params).forEach(function (key) { error[key] = params[key]; }); throw error; } exports.throwError = throwError; function checkNew(self, kind) { if (!(self instanceof kind)) { throwError('missing new', exports.MISSING_NEW, { name: kind.name }); } } exports.checkNew = checkNew; function checkArgumentCount(count, expectedCount, suffix) { if (!suffix) { suffix = ''; } if (count < expectedCount) { throwError('missing argument' + suffix, exports.MISSING_ARGUMENT, { count: count, expectedCount: expectedCount }); } if (count > expectedCount) { throwError('too many arguments' + suffix, exports.UNEXPECTED_ARGUMENT, { count: count, expectedCount: expectedCount }); } } exports.checkArgumentCount = checkArgumentCount; function setCensorship(censorship, permanent) { if (_permanentCensorErrors) { throwError('error censorship permanent', exports.UNSUPPORTED_OPERATION, { operation: 'setCersorship' }); } _censorErrors = !!censorship; _permanentCensorErrors = !!permanent; } exports.setCensorship = setCensorship; },{}],62:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var bytes_1 = require("./bytes"); var utf8_1 = require("./utf8"); var keccak256_1 = require("./keccak256"); var Zeros = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); var Partition = new RegExp("^((.*)\\.)?([^.]+)$"); var UseSTD3ASCIIRules = new RegExp("^[a-z0-9.-]*$"); function namehash(name) { name = name.toLowerCase(); // Supporting the full UTF-8 space requires additional (and large) // libraries, so for now we simply do not support them. // It should be fairly easy in the future to support systems with // String.normalize, but that is future work. if (!name.match(UseSTD3ASCIIRules)) { throw new Error('contains invalid UseSTD3ASCIIRules characters'); } var result = Zeros; while (name.length) { var partition = name.match(Partition); var label = utf8_1.toUtf8Bytes(partition[3]); result = keccak256_1.keccak256(bytes_1.concat([result, keccak256_1.keccak256(label)])); name = partition[2] || ''; } return bytes_1.hexlify(result); } exports.namehash = namehash; function id(text) { return keccak256_1.keccak256(utf8_1.toUtf8Bytes(text)); } exports.id = id; function hashMessage(message) { var payload = bytes_1.concat([ utf8_1.toUtf8Bytes('\x19Ethereum Signed Message:\n'), utf8_1.toUtf8Bytes(String(message.length)), ((typeof (message) === 'string') ? utf8_1.toUtf8Bytes(message) : message) ]); return keccak256_1.keccak256(payload); } exports.hashMessage = hashMessage; },{"./bytes":60,"./keccak256":66,"./utf8":79}],63:[function(require,module,exports){ "use strict"; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var hash = __importStar(require("hash.js")); var bytes_1 = require("../utils/bytes"); var errors = __importStar(require("../utils/errors")); var supportedAlgorithms = { sha256: true, sha512: true }; function computeHmac(algorithm, key, data) { if (!supportedAlgorithms[algorithm]) { errors.throwError('unsupported algorithm ' + algorithm, errors.UNSUPPORTED_OPERATION, { operation: 'hmac', algorithm: algorithm }); } return bytes_1.arrayify(hash.hmac(hash[algorithm], bytes_1.arrayify(key)).update(bytes_1.arrayify(data)).digest()); } exports.computeHmac = computeHmac; },{"../utils/bytes":60,"../utils/errors":61,"hash.js":26}],64:[function(require,module,exports){ 'use strict'; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); // This is SUPER useful, but adds 140kb (even zipped, adds 40kb) //var unorm = require('unorm'); var address_1 = require("./address"); exports.getAddress = address_1.getAddress; exports.getContractAddress = address_1.getContractAddress; exports.getIcapAddress = address_1.getIcapAddress; var abi_coder_1 = require("./abi-coder"); exports.AbiCoder = abi_coder_1.AbiCoder; exports.defaultAbiCoder = abi_coder_1.defaultAbiCoder; exports.formatSignature = abi_coder_1.formatSignature; exports.formatParamType = abi_coder_1.formatParamType; exports.parseSignature = abi_coder_1.parseSignature; exports.parseParamType = abi_coder_1.parseParamType; var base64 = __importStar(require("./base64")); exports.base64 = base64; var bignumber_1 = require("./bignumber"); exports.bigNumberify = bignumber_1.bigNumberify; var bytes_1 = require("./bytes"); exports.arrayify = bytes_1.arrayify; exports.concat = bytes_1.concat; exports.hexDataSlice = bytes_1.hexDataSlice; exports.hexDataLength = bytes_1.hexDataLength; exports.hexlify = bytes_1.hexlify; exports.hexStripZeros = bytes_1.hexStripZeros; exports.hexZeroPad = bytes_1.hexZeroPad; exports.joinSignature = bytes_1.joinSignature; exports.padZeros = bytes_1.padZeros; exports.splitSignature = bytes_1.splitSignature; exports.stripZeros = bytes_1.stripZeros; var hash_1 = require("./hash"); exports.hashMessage = hash_1.hashMessage; exports.id = hash_1.id; exports.namehash = hash_1.namehash; var json_wallet_1 = require("./json-wallet"); exports.getJsonWalletAddress = json_wallet_1.getJsonWalletAddress; var keccak256_1 = require("./keccak256"); exports.keccak256 = keccak256_1.keccak256; var sha2_1 = require("./sha2"); exports.sha256 = sha2_1.sha256; var solidity_1 = require("./solidity"); exports.solidityKeccak256 = solidity_1.keccak256; exports.solidityPack = solidity_1.pack; exports.soliditySha256 = solidity_1.sha256; var random_bytes_1 = require("./random-bytes"); exports.randomBytes = random_bytes_1.randomBytes; var networks_1 = require("./networks"); exports.getNetwork = networks_1.getNetwork; var properties_1 = require("./properties"); exports.defineFrozen = properties_1.defineFrozen; exports.defineReadOnly = properties_1.defineReadOnly; exports.resolveProperties = properties_1.resolveProperties; exports.shallowCopy = properties_1.shallowCopy; var RLP = __importStar(require("./rlp")); exports.RLP = RLP; var secp256k1_1 = require("./secp256k1"); exports.computePublicKey = secp256k1_1.computePublicKey; exports.verifyMessage = secp256k1_1.verifyMessage; var transaction_1 = require("./transaction"); exports.parseTransaction = transaction_1.parse; exports.serializeTransaction = transaction_1.serialize; var utf8_1 = require("./utf8"); exports.toUtf8Bytes = utf8_1.toUtf8Bytes; exports.toUtf8String = utf8_1.toUtf8String; var units_1 = require("./units"); exports.formatEther = units_1.formatEther; exports.parseEther = units_1.parseEther; exports.formatUnits = units_1.formatUnits; exports.parseUnits = units_1.parseUnits; var web_1 = require("./web"); exports.fetchJson = web_1.fetchJson; var types = __importStar(require("./types")); exports.types = types; var errors = __importStar(require("./errors")); exports.errors = errors; // NFKD (decomposed) //const etherSymbol = '\uD835\uDF63'; // NFKC (composed) var etherSymbol = '\u039e'; exports.etherSymbol = etherSymbol; var constants = { AddressZero: bytes_1.AddressZero, HashZero: bytes_1.HashZero, NegativeOne: bignumber_1.ConstantNegativeOne, Zero: bignumber_1.ConstantZero, One: bignumber_1.ConstantOne, Two: bignumber_1.ConstantTwo, WeiPerEther: bignumber_1.ConstantWeiPerEther }; exports.constants = constants; },{"./abi-coder":56,"./address":57,"./base64":58,"./bignumber":59,"./bytes":60,"./errors":61,"./hash":62,"./json-wallet":65,"./keccak256":66,"./networks":67,"./properties":69,"./random-bytes":70,"./rlp":71,"./secp256k1":72,"./sha2":73,"./solidity":75,"./transaction":76,"./types":77,"./units":78,"./utf8":79,"./web":80}],65:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var address_1 = require("./address"); function isCrowdsaleWallet(json) { try { var data = JSON.parse(json); } catch (error) { return false; } return (data.encseed && data.ethaddr); } exports.isCrowdsaleWallet = isCrowdsaleWallet; function isSecretStorageWallet(json) { try { var data = JSON.parse(json); } catch (error) { return false; } if (!data.version || parseInt(data.version) !== data.version || parseInt(data.version) !== 3) { return false; } // @TODO: Put more checks to make sure it has kdf, iv and all that good stuff return true; } exports.isSecretStorageWallet = isSecretStorageWallet; //export function isJsonWallet(json: string): boolean { // return (isSecretStorageWallet(json) || isCrowdsaleWallet(json)); //} function getJsonWalletAddress(json) { if (isCrowdsaleWallet(json)) { try { return address_1.getAddress(JSON.parse(json).ethaddr); } catch (error) { return null; } } if (isSecretStorageWallet(json)) { try { return address_1.getAddress(JSON.parse(json).address); } catch (error) { return null; } } return null; } exports.getJsonWalletAddress = getJsonWalletAddress; },{"./address":57}],66:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var sha3 = require("js-sha3"); var bytes_1 = require("./bytes"); function keccak256(data) { return '0x' + sha3.keccak_256(bytes_1.arrayify(data)); } exports.keccak256 = keccak256; },{"./bytes":60,"js-sha3":39}],67:[function(require,module,exports){ 'use strict'; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var errors = __importStar(require("../utils/errors")); var homestead = { chainId: 1, ensAddress: "0x314159265dd8dbb310642f98f50c066173c1259b", name: "homestead" }; var ropsten = { chainId: 3, ensAddress: "0x112234455c3a32fd11230c42e7bccd4a84e02010", name: "ropsten" }; var networks = { unspecified: { chainId: 0 }, homestead: homestead, mainnet: homestead, morden: { chainId: 2 }, ropsten: ropsten, testnet: ropsten, rinkeby: { chainId: 4, ensAddress: "0xe7410170f87102DF0055eB195163A03B7F2Bff4A" }, kovan: { chainId: 42 }, classic: { chainId: 61 } }; /** * getNetwork * * Converts a named common networks or chain ID (network ID) to a Network * and verifies a network is a valid Network.. */ function getNetwork(network) { // No network (null) or unspecified (chainId = 0) if (!network) { return null; } if (typeof (network) === 'number') { for (var name in networks) { var n_1 = networks[name]; if (n_1.chainId === network) { return { name: name, chainId: n_1.chainId, ensAddress: n_1.ensAddress }; } } return { chainId: network, name: 'unknown' }; } if (typeof (network) === 'string') { var n_2 = networks[network]; if (n_2 == null) { return null; } return { name: network, chainId: n_2.chainId, ensAddress: n_2.ensAddress }; } var n = networks[network.name]; // Not a standard network; check that it is a valid network in general if (!n) { if (typeof (n.chainId) !== 'number') { errors.throwError('invalid network chainId', errors.INVALID_ARGUMENT, { arg: 'network', value: network }); } return network; } // Make sure the chainId matches the expected network chainId (or is 0; disable EIP-155) if (network.chainId !== 0 && network.chainId !== n.chainId) { errors.throwError('network chainId mismatch', errors.INVALID_ARGUMENT, { arg: 'network', value: network }); } // Standard Network return { name: network.name, chainId: n.chainId, ensAddress: n.ensAddress }; } exports.getNetwork = getNetwork; },{"../utils/errors":61}],68:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var bytes_1 = require("../utils/bytes"); var hmac_1 = require("./hmac"); function pbkdf2(password, salt, iterations, keylen, hashAlgorithm) { password = bytes_1.arrayify(password); salt = bytes_1.arrayify(salt); var hLen; var l = 1; var DK = new Uint8Array(keylen); var block1 = new Uint8Array(salt.length + 4); block1.set(salt); //salt.copy(block1, 0, 0, salt.length) var r; var T; for (var i = 1; i <= l; i++) { //block1.writeUInt32BE(i, salt.length) block1[salt.length] = (i >> 24) & 0xff; block1[salt.length + 1] = (i >> 16) & 0xff; block1[salt.length + 2] = (i >> 8) & 0xff; block1[salt.length + 3] = i & 0xff; //var U = createHmac(password).update(block1).digest(); var U = hmac_1.computeHmac(hashAlgorithm, password, block1); if (!hLen) { hLen = U.length; T = new Uint8Array(hLen); l = Math.ceil(keylen / hLen); r = keylen - (l - 1) * hLen; } //U.copy(T, 0, 0, hLen) T.set(U); for (var j = 1; j < iterations; j++) { //U = createHmac(password).update(U).digest(); U = hmac_1.computeHmac(hashAlgorithm, password, U); for (var k = 0; k < hLen; k++) T[k] ^= U[k]; } var destPos = (i - 1) * hLen; var len = (i === l ? r : hLen); //T.copy(DK, destPos, 0, len) DK.set(bytes_1.arrayify(T).slice(0, len), destPos); } return bytes_1.arrayify(DK); } exports.pbkdf2 = pbkdf2; },{"../utils/bytes":60,"./hmac":63}],69:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); function defineReadOnly(object, name, value) { Object.defineProperty(object, name, { enumerable: true, value: value, writable: false, }); } exports.defineReadOnly = defineReadOnly; function defineFrozen(object, name, value) { var frozen = JSON.stringify(value); Object.defineProperty(object, name, { enumerable: true, get: function () { return JSON.parse(frozen); } }); } exports.defineFrozen = defineFrozen; function resolveProperties(object) { var result = {}; var promises = []; Object.keys(object).forEach(function (key) { var value = object[key]; if (value instanceof Promise) { promises.push(value.then(function (value) { result[key] = value; return null; })); } else { result[key] = value; } }); return Promise.all(promises).then(function () { return result; }); } exports.resolveProperties = resolveProperties; function shallowCopy(object) { var result = {}; for (var key in object) { result[key] = object[key]; } return result; } exports.shallowCopy = shallowCopy; function jsonCopy(object) { return JSON.parse(JSON.stringify(object)); } exports.jsonCopy = jsonCopy; },{}],70:[function(require,module,exports){ (function (global){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var bytes_1 = require("../utils/bytes"); var properties_1 = require("../utils/properties"); var crypto = global.crypto || global.msCrypto; if (!crypto || !crypto.getRandomValues) { console.log('WARNING: Missing strong random number source; using weak randomBytes'); crypto = { getRandomValues: function (buffer) { for (var round = 0; round < 20; round++) { for (var i = 0; i < buffer.length; i++) { if (round) { buffer[i] ^= Math.trunc(256 * Math.random()); } else { buffer[i] = Math.trunc(256 * Math.random()); } } } return buffer; }, _weakCrypto: true }; } function randomBytes(length) { if (length <= 0 || length > 1024 || parseInt(String(length)) != length) { throw new Error('invalid length'); } var result = new Uint8Array(length); crypto.getRandomValues(result); return bytes_1.arrayify(result); } exports.randomBytes = randomBytes; ; if (crypto._weakCrypto === true) { properties_1.defineReadOnly(randomBytes, '_weakCrypto', true); } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../utils/bytes":60,"../utils/properties":69}],71:[function(require,module,exports){ "use strict"; //See: https://github.com/ethereum/wiki/wiki/RLP Object.defineProperty(exports, "__esModule", { value: true }); var bytes_1 = require("./bytes"); function arrayifyInteger(value) { var result = []; while (value) { result.unshift(value & 0xff); value >>= 8; } return result; } function unarrayifyInteger(data, offset, length) { var result = 0; for (var i = 0; i < length; i++) { result = (result * 256) + data[offset + i]; } return result; } function _encode(object) { if (Array.isArray(object)) { var payload = []; object.forEach(function (child) { payload = payload.concat(_encode(child)); }); if (payload.length <= 55) { payload.unshift(0xc0 + payload.length); return payload; } var length = arrayifyInteger(payload.length); length.unshift(0xf7 + length.length); return length.concat(payload); } var data = Array.prototype.slice.call(bytes_1.arrayify(object)); if (data.length === 1 && data[0] <= 0x7f) { return data; } else if (data.length <= 55) { data.unshift(0x80 + data.length); return data; } var length = arrayifyInteger(data.length); length.unshift(0xb7 + length.length); return length.concat(data); } function encode(object) { return bytes_1.hexlify(_encode(object)); } exports.encode = encode; function _decodeChildren(data, offset, childOffset, length) { var result = []; while (childOffset < offset + 1 + length) { var decoded = _decode(data, childOffset); result.push(decoded.result); childOffset += decoded.consumed; if (childOffset > offset + 1 + length) { throw new Error('invalid rlp'); } } return { consumed: (1 + length), result: result }; } // returns { consumed: number, result: Object } function _decode(data, offset) { if (data.length === 0) { throw new Error('invalid rlp data'); } // Array with extra length prefix if (data[offset] >= 0xf8) { var lengthLength = data[offset] - 0xf7; if (offset + 1 + lengthLength > data.length) { throw new Error('too short'); } var length = unarrayifyInteger(data, offset + 1, lengthLength); if (offset + 1 + lengthLength + length > data.length) { throw new Error('to short'); } return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); } else if (data[offset] >= 0xc0) { var length = data[offset] - 0xc0; if (offset + 1 + length > data.length) { throw new Error('invalid rlp data'); } return _decodeChildren(data, offset, offset + 1, length); } else if (data[offset] >= 0xb8) { var lengthLength = data[offset] - 0xb7; if (offset + 1 + lengthLength > data.length) { throw new Error('invalid rlp data'); } var length = unarrayifyInteger(data, offset + 1, lengthLength); if (offset + 1 + lengthLength + length > data.length) { throw new Error('invalid rlp data'); } var result = bytes_1.hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); return { consumed: (1 + lengthLength + length), result: result }; } else if (data[offset] >= 0x80) { var length = data[offset] - 0x80; if (offset + 1 + length > data.length) { throw new Error('invlaid rlp data'); } var result = bytes_1.hexlify(data.slice(offset + 1, offset + 1 + length)); return { consumed: (1 + length), result: result }; } return { consumed: 1, result: bytes_1.hexlify(data[offset]) }; } function decode(data) { var bytes = bytes_1.arrayify(data); var decoded = _decode(bytes, 0); if (decoded.consumed !== bytes.length) { throw new Error('invalid rlp data'); } return decoded.result; } exports.decode = decode; },{"./bytes":60}],72:[function(require,module,exports){ 'use strict'; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var address_1 = require("./address"); var bytes_1 = require("./bytes"); var hash_1 = require("./hash"); var keccak256_1 = require("./keccak256"); var properties_1 = require("./properties"); var errors = __importStar(require("./errors")); var _curve = null; function getCurve() { if (!_curve) { _curve = new elliptic_1.ec('secp256k1'); } return _curve; } var KeyPair = /** @class */ (function () { function KeyPair(privateKey) { var keyPair = getCurve().keyFromPrivate(bytes_1.arrayify(privateKey)); properties_1.defineReadOnly(this, 'privateKey', bytes_1.hexlify(keyPair.priv.toArray('be', 32))); properties_1.defineReadOnly(this, 'publicKey', '0x' + keyPair.getPublic(false, 'hex')); properties_1.defineReadOnly(this, 'compressedPublicKey', '0x' + keyPair.getPublic(true, 'hex')); properties_1.defineReadOnly(this, 'publicKeyBytes', keyPair.getPublic().encode(null, true)); } KeyPair.prototype.sign = function (digest) { var keyPair = getCurve().keyFromPrivate(bytes_1.arrayify(this.privateKey)); var signature = keyPair.sign(bytes_1.arrayify(digest), { canonical: true }); return { recoveryParam: signature.recoveryParam, r: bytes_1.hexZeroPad('0x' + signature.r.toString(16), 32), s: bytes_1.hexZeroPad('0x' + signature.s.toString(16), 32), v: 27 + signature.recoveryParam }; }; return KeyPair; }()); exports.KeyPair = KeyPair; function recoverPublicKey(digest, signature) { var sig = { r: bytes_1.arrayify(signature.r), s: bytes_1.arrayify(signature.s) }; return '0x' + getCurve().recoverPubKey(bytes_1.arrayify(digest), sig, signature.recoveryParam).encode('hex', false); } exports.recoverPublicKey = recoverPublicKey; function computePublicKey(key, compressed) { var bytes = bytes_1.arrayify(key); if (bytes.length === 32) { var keyPair = new KeyPair(bytes); if (compressed) { return keyPair.compressedPublicKey; } return keyPair.publicKey; } else if (bytes.length === 33) { if (compressed) { return bytes_1.hexlify(bytes); } return '0x' + getCurve().keyFromPublic(bytes).getPublic(false, 'hex'); } else if (bytes.length === 65) { if (!compressed) { return bytes_1.hexlify(bytes); } return '0x' + getCurve().keyFromPublic(bytes).getPublic(true, 'hex'); } errors.throwError('invalid public or private key', errors.INVALID_ARGUMENT, { arg: 'key', value: '[REDACTED]' }); return null; } exports.computePublicKey = computePublicKey; function recoverAddress(digest, signature) { return computeAddress(recoverPublicKey(digest, signature)); } exports.recoverAddress = recoverAddress; function computeAddress(key) { // Strip off the leading "0x04" var publicKey = '0x' + computePublicKey(key).slice(4); return address_1.getAddress('0x' + keccak256_1.keccak256(publicKey).substring(26)); } exports.computeAddress = computeAddress; function verifyMessage(message, signature) { var sig = bytes_1.splitSignature(signature); var digest = hash_1.hashMessage(message); return recoverAddress(digest, { r: sig.r, s: sig.s, recoveryParam: sig.recoveryParam }); } exports.verifyMessage = verifyMessage; // !!! IMPORTANT !!! // // This must be be at the end, otherwise Browserify attempts to include upstream // dependencies before this module is loaded. var elliptic_1 = require("elliptic"); },{"./address":57,"./bytes":60,"./errors":61,"./hash":62,"./keccak256":66,"./properties":69,"elliptic":11}],73:[function(require,module,exports){ 'use strict'; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var hash_js_1 = __importDefault(require("hash.js")); var bytes_1 = require("./bytes"); function sha256(data) { return '0x' + (hash_js_1.default.sha256().update(bytes_1.arrayify(data)).digest('hex')); } exports.sha256 = sha256; function sha512(data) { return '0x' + (hash_js_1.default.sha512().update(bytes_1.arrayify(data)).digest('hex')); } exports.sha512 = sha512; },{"./bytes":60,"hash.js":26}],74:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); require('setimmediate'); exports.platform = "browser"; },{"setimmediate":43}],75:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var bignumber_1 = require("./bignumber"); var bytes_1 = require("./bytes"); var utf8_1 = require("./utf8"); var keccak256_1 = require("./keccak256"); var sha2_1 = require("./sha2"); var regexBytes = new RegExp("^bytes([0-9]+)$"); var regexNumber = new RegExp("^(u?int)([0-9]*)$"); var regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); var Zeros = '0000000000000000000000000000000000000000000000000000000000000000'; function _pack(type, value, isArray) { switch (type) { case 'address': if (isArray) { return bytes_1.padZeros(value, 32); } return bytes_1.arrayify(value); case 'string': return utf8_1.toUtf8Bytes(value); case 'bytes': return bytes_1.arrayify(value); case 'bool': value = (value ? '0x01' : '0x00'); if (isArray) { return bytes_1.padZeros(value, 32); } return bytes_1.arrayify(value); } var match = type.match(regexNumber); if (match) { //var signed = (match[1] === 'int') var size = parseInt(match[2] || "256"); if ((size % 8 != 0) || size === 0 || size > 256) { throw new Error('invalid number type - ' + type); } if (isArray) { size = 256; } value = bignumber_1.bigNumberify(value).toTwos(size); return bytes_1.padZeros(value, size / 8); } match = type.match(regexBytes); if (match) { var size = parseInt(match[1]); if (String(size) != match[1] || size === 0 || size > 32) { throw new Error('invalid number type - ' + type); } if (bytes_1.arrayify(value).byteLength !== size) { throw new Error('invalid value for ' + type); } if (isArray) { return bytes_1.arrayify((value + Zeros).substring(0, 66)); } return value; } match = type.match(regexArray); if (match && Array.isArray(value)) { var baseType = match[1]; var count = parseInt(match[2] || String(value.length)); if (count != value.length) { throw new Error('invalid value for ' + type); } var result = []; value.forEach(function (value) { result.push(_pack(baseType, value, true)); }); return bytes_1.concat(result); } throw new Error('unknown type - ' + type); } // @TODO: Array Enum function pack(types, values) { if (types.length != values.length) { throw new Error('type/value count mismatch'); } var tight = []; types.forEach(function (type, index) { tight.push(_pack(type, values[index])); }); return bytes_1.hexlify(bytes_1.concat(tight)); } exports.pack = pack; function keccak256(types, values) { return keccak256_1.keccak256(pack(types, values)); } exports.keccak256 = keccak256; function sha256(types, values) { return sha2_1.sha256(pack(types, values)); } exports.sha256 = sha256; },{"./bignumber":59,"./bytes":60,"./keccak256":66,"./sha2":73,"./utf8":79}],76:[function(require,module,exports){ "use strict"; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var address_1 = require("./address"); var bignumber_1 = require("./bignumber"); var bytes_1 = require("./bytes"); var keccak256_1 = require("./keccak256"); var RLP = __importStar(require("./rlp")); var errors = __importStar(require("./errors")); /* !!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!! * * Due to a weird ordering-issue with browserify, there is an * import for secp256k1 at the bottom of the file; it must be * required AFTER the parse and serialize exports have been * defined. * */ function handleAddress(value) { if (value === '0x') { return null; } return address_1.getAddress(value); } function handleNumber(value) { if (value === '0x') { return bignumber_1.ConstantZero; } return bignumber_1.bigNumberify(value); } var transactionFields = [ { name: 'nonce', maxLength: 32 }, { name: 'gasPrice', maxLength: 32 }, { name: 'gasLimit', maxLength: 32 }, { name: 'to', length: 20 }, { name: 'value', maxLength: 32 }, { name: 'data' }, ]; function serialize(transaction, signature) { var raw = []; transactionFields.forEach(function (fieldInfo) { var value = transaction[fieldInfo.name] || ([]); value = bytes_1.arrayify(bytes_1.hexlify(value)); // Fixed-width field if (fieldInfo.length && value.length !== fieldInfo.length && value.length > 0) { errors.throwError('invalid length for ' + fieldInfo.name, errors.INVALID_ARGUMENT, { arg: ('transaction' + fieldInfo.name), value: value }); } // Variable-width (with a maximum) if (fieldInfo.maxLength) { value = bytes_1.stripZeros(value); if (value.length > fieldInfo.maxLength) { errors.throwError('invalid length for ' + fieldInfo.name, errors.INVALID_ARGUMENT, { arg: ('transaction' + fieldInfo.name), value: value }); } } raw.push(bytes_1.hexlify(value)); }); if (transaction.chainId != null && transaction.chainId !== 0) { raw.push(bytes_1.hexlify(transaction.chainId)); raw.push('0x'); raw.push('0x'); } var unsignedTransaction = RLP.encode(raw); // Requesting an unsigned transation if (!signature) { return unsignedTransaction; } // The splitSignature will ensure the transaction has a recoveryParam in the // case that the signTransaction function only adds a v. signature = bytes_1.splitSignature(signature); // We pushed a chainId and null r, s on for hashing only; remove those var v = 27 + signature.recoveryParam; if (raw.length === 9) { raw.pop(); raw.pop(); raw.pop(); v += transaction.chainId * 2 + 8; } raw.push(bytes_1.hexlify(v)); raw.push(bytes_1.stripZeros(bytes_1.arrayify(signature.r))); raw.push(bytes_1.stripZeros(bytes_1.arrayify(signature.s))); return RLP.encode(raw); } exports.serialize = serialize; function parse(rawTransaction) { var transaction = RLP.decode(rawTransaction); if (transaction.length !== 9 && transaction.length !== 6) { errors.throwError('invalid raw transaction', errors.INVALID_ARGUMENT, { arg: 'rawTransactin', value: rawTransaction }); } var tx = { nonce: handleNumber(transaction[0]).toNumber(), gasPrice: handleNumber(transaction[1]), gasLimit: handleNumber(transaction[2]), to: handleAddress(transaction[3]), value: handleNumber(transaction[4]), data: transaction[5], chainId: 0 }; // Legacy unsigned transaction if (transaction.length === 6) { return tx; } try { tx.v = bignumber_1.bigNumberify(transaction[6]).toNumber(); } catch (error) { console.log(error); return tx; } tx.r = bytes_1.hexZeroPad(transaction[7], 32); tx.s = bytes_1.hexZeroPad(transaction[8], 32); if (bignumber_1.bigNumberify(tx.r).isZero() && bignumber_1.bigNumberify(tx.s).isZero()) { // EIP-155 unsigned transaction tx.chainId = tx.v; tx.v = 0; } else { // Signed Tranasaction tx.chainId = Math.floor((tx.v - 35) / 2); if (tx.chainId < 0) { tx.chainId = 0; } var recoveryParam = tx.v - 27; var raw = transaction.slice(0, 6); if (tx.chainId !== 0) { raw.push(bytes_1.hexlify(tx.chainId)); raw.push('0x'); raw.push('0x'); recoveryParam -= tx.chainId * 2 + 8; } var digest = keccak256_1.keccak256(RLP.encode(raw)); try { tx.from = secp256k1_1.recoverAddress(digest, { r: bytes_1.hexlify(tx.r), s: bytes_1.hexlify(tx.s), recoveryParam: recoveryParam }); } catch (error) { console.log(error); } tx.hash = keccak256_1.keccak256(rawTransaction); } return tx; } exports.parse = parse; // !!! IMPORTANT !!! // // This must be be at the end, otherwise Browserify attempts to include upstream // dependencies before this module is loaded. var secp256k1_1 = require("./secp256k1"); },{"./address":57,"./bignumber":59,"./bytes":60,"./errors":61,"./keccak256":66,"./rlp":71,"./secp256k1":72}],77:[function(require,module,exports){ "use strict"; /////////////////////////////// // Bytes Object.defineProperty(exports, "__esModule", { value: true }); /////////////////////////////// // BigNumber var BigNumber = /** @class */ (function () { function BigNumber() { } return BigNumber; }()); exports.BigNumber = BigNumber; ; ; ; /////////////////////////////// // Interface var Indexed = /** @class */ (function () { function Indexed() { } return Indexed; }()); exports.Indexed = Indexed; /** * Provider * * Note: We use an abstract class so we can use instanceof to determine if an * object is a Provider. */ var MinimalProvider = /** @class */ (function () { function MinimalProvider() { } return MinimalProvider; }()); exports.MinimalProvider = MinimalProvider; /** * Signer * * Note: We use an abstract class so we can use instanceof to determine if an * object is a Signer. */ var Signer = /** @class */ (function () { function Signer() { } return Signer; }()); exports.Signer = Signer; /////////////////////////////// // HDNode var HDNode = /** @class */ (function () { function HDNode() { } return HDNode; }()); exports.HDNode = HDNode; },{}],78:[function(require,module,exports){ 'use strict'; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var bignumber_1 = require("./bignumber"); var errors = __importStar(require("./errors")); var names = [ 'wei', 'kwei', 'Mwei', 'Gwei', 'szabo', 'finny', 'ether', ]; var unitInfos = {}; function _getUnitInfo(value) { return { decimals: value.length - 1, tenPower: bignumber_1.bigNumberify(value) }; } // Build cache of common units (function () { // Cache the common units var value = '1'; names.forEach(function (name) { var info = _getUnitInfo(value); unitInfos[name.toLowerCase()] = info; unitInfos[String(info.decimals)] = info; value += '000'; }); })(); function getUnitInfo(name) { // Try the cache var info = unitInfos[String(name).toLowerCase()]; if (!info && typeof (name) === 'number' && parseInt(String(name)) == name && name >= 0 && name <= 256) { var value = '1'; for (var i = 0; i < name; i++) { value += '0'; } info = _getUnitInfo(value); } // Make sure we got something if (!info) { errors.throwError('invalid unitType', errors.INVALID_ARGUMENT, { arg: 'name', value: name }); } return info; } function formatUnits(value, unitType, options) { /* if (typeof(unitType) === 'object' && !options) { options = unitType; unitType = undefined; } if (unitType == null) { unitType = 18; } */ if (!options) { options = {}; } var unitInfo = getUnitInfo(unitType); // Make sure wei is a big number (convert as necessary) value = bignumber_1.bigNumberify(value); var negative = value.lt(bignumber_1.ConstantZero); if (negative) { value = value.mul(bignumber_1.ConstantNegativeOne); } var fraction = value.mod(unitInfo.tenPower).toString(); while (fraction.length < unitInfo.decimals) { fraction = '0' + fraction; } // Strip off trailing zeros (but keep one if would otherwise be bare decimal point) if (!options.pad) { fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1]; } var whole = value.div(unitInfo.tenPower).toString(); if (options.commify) { whole = whole.replace(/\B(?=(\d{3})+(?!\d))/g, ","); } value = whole + '.' + fraction; if (negative) { value = '-' + value; } return value; } exports.formatUnits = formatUnits; function parseUnits(value, unitType) { if (unitType == null) { unitType = 18; } var unitInfo = getUnitInfo(unitType); if (typeof (value) !== 'string' || !value.match(/^-?[0-9.,]+$/)) { errors.throwError('invalid decimal value', errors.INVALID_ARGUMENT, { arg: 'value', value: value }); } // Remove commas var value = value.replace(/,/g, ''); if (unitInfo.decimals === 0) { return bignumber_1.bigNumberify(value); } // Is it negative? var negative = (value.substring(0, 1) === '-'); if (negative) { value = value.substring(1); } if (value === '.') { errors.throwError('missing value', errors.INVALID_ARGUMENT, { arg: 'value', value: value }); } // Split it into a whole and fractional part var comps = value.split('.'); if (comps.length > 2) { errors.throwError('too many decimal points', errors.INVALID_ARGUMENT, { arg: 'value', value: value }); } var whole = comps[0], fraction = comps[1]; if (!whole) { whole = '0'; } if (!fraction) { fraction = '0'; } // Prevent underflow if (fraction.length > unitInfo.decimals) { errors.throwError('underflow occurred', errors.NUMERIC_FAULT, { operation: 'division', fault: "underflow" }); } // Fully pad the string with zeros to get to wei while (fraction.length < unitInfo.decimals) { fraction += '0'; } var wholeValue = bignumber_1.bigNumberify(whole); var fractionValue = bignumber_1.bigNumberify(fraction); var wei = (wholeValue.mul(unitInfo.tenPower)).add(fractionValue); if (negative) { wei = wei.mul(bignumber_1.ConstantNegativeOne); } return wei; } exports.parseUnits = parseUnits; function formatEther(wei, options) { return formatUnits(wei, 18, options); } exports.formatEther = formatEther; function parseEther(ether) { return parseUnits(ether, 18); } exports.parseEther = parseEther; },{"./bignumber":59,"./errors":61}],79:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var bytes_1 = require("./bytes"); var UnicodeNormalizationForm; (function (UnicodeNormalizationForm) { UnicodeNormalizationForm["current"] = ""; UnicodeNormalizationForm["NFC"] = "NFC"; UnicodeNormalizationForm["NFD"] = "NFD"; UnicodeNormalizationForm["NFKC"] = "NFKC"; UnicodeNormalizationForm["NFKD"] = "NFKD"; })(UnicodeNormalizationForm = exports.UnicodeNormalizationForm || (exports.UnicodeNormalizationForm = {})); ; // http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array function toUtf8Bytes(str, form) { if (form === void 0) { form = UnicodeNormalizationForm.current; } if (form != UnicodeNormalizationForm.current) { str = str.normalize(form); } var result = []; var offset = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { result[offset++] = c; } else if (c < 2048) { result[offset++] = (c >> 6) | 192; result[offset++] = (c & 63) | 128; } else if (((c & 0xFC00) == 0xD800) && (i + 1) < str.length && ((str.charCodeAt(i + 1) & 0xFC00) == 0xDC00)) { // Surrogate Pair c = 0x10000 + ((c & 0x03FF) << 10) + (str.charCodeAt(++i) & 0x03FF); result[offset++] = (c >> 18) | 240; result[offset++] = ((c >> 12) & 63) | 128; result[offset++] = ((c >> 6) & 63) | 128; result[offset++] = (c & 63) | 128; } else { result[offset++] = (c >> 12) | 224; result[offset++] = ((c >> 6) & 63) | 128; result[offset++] = (c & 63) | 128; } } return bytes_1.arrayify(result); } exports.toUtf8Bytes = toUtf8Bytes; ; // http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 function toUtf8String(bytes) { bytes = bytes_1.arrayify(bytes); var result = ''; var i = 0; // Invalid bytes are ignored while (i < bytes.length) { var c = bytes[i++]; if (c >> 7 == 0) { // 0xxx xxxx result += String.fromCharCode(c); continue; } // Invalid starting byte if (c >> 6 == 0x02) { continue; } // Multibyte; how many bytes left for thus character? var extraLength = null; if (c >> 5 == 0x06) { extraLength = 1; } else if (c >> 4 == 0x0e) { extraLength = 2; } else if (c >> 3 == 0x1e) { extraLength = 3; } else if (c >> 2 == 0x3e) { extraLength = 4; } else if (c >> 1 == 0x7e) { extraLength = 5; } else { continue; } // Do we have enough bytes in our data? if (i + extraLength > bytes.length) { // If there is an invalid unprocessed byte, try to continue for (; i < bytes.length; i++) { if (bytes[i] >> 6 != 0x02) { break; } } if (i != bytes.length) continue; // All leftover bytes are valid. return result; } // Remove the UTF-8 prefix from the char (res) var res = c & ((1 << (8 - extraLength - 1)) - 1); var count; for (count = 0; count < extraLength; count++) { var nextChar = bytes[i++]; // Is the char valid multibyte part? if (nextChar >> 6 != 0x02) { break; } ; res = (res << 6) | (nextChar & 0x3f); } if (count != extraLength) { i--; continue; } if (res <= 0xffff) { result += String.fromCharCode(res); continue; } res -= 0x10000; result += String.fromCharCode(((res >> 10) & 0x3ff) + 0xd800, (res & 0x3ff) + 0xdc00); } return result; } exports.toUtf8String = toUtf8String; },{"./bytes":60}],80:[function(require,module,exports){ 'use strict'; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var xmlhttprequest_1 = require("xmlhttprequest"); var base64_1 = require("./base64"); var utf8_1 = require("./utf8"); var errors = __importStar(require("./errors")); function fetchJson(connection, json, processFunc) { var headers = []; var url = null; if (typeof (connection) === 'string') { url = connection; } else if (typeof (connection) === 'object') { if (connection.url == null) { errors.throwError('missing URL', errors.MISSING_ARGUMENT, { arg: 'url' }); } url = connection.url; if (connection.user != null && connection.password != null) { if (url.substring(0, 6) !== 'https:' && connection.allowInsecure !== true) { errors.throwError('basic authentication requires a secure https url', errors.INVALID_ARGUMENT, { arg: 'url', url: url, user: connection.user, password: '[REDACTED]' }); } var authorization = connection.user + ':' + connection.password; headers.push({ key: 'Authorization', value: 'Basic ' + base64_1.encode(utf8_1.toUtf8Bytes(authorization)) }); } } return new Promise(function (resolve, reject) { var request = new xmlhttprequest_1.XMLHttpRequest(); if (json) { request.open('POST', url, true); headers.push({ key: 'Content-Type', value: 'application/json' }); } else { request.open('GET', url, true); } headers.forEach(function (header) { request.setRequestHeader(header.key, header.value); }); request.onreadystatechange = function () { if (request.readyState !== 4) { return; } try { var result = JSON.parse(request.responseText); } catch (error) { // @TODO: not any! var jsonError = new Error('invalid json response'); jsonError.orginialError = error; jsonError.responseText = request.responseText; jsonError.url = url; reject(jsonError); return; } if (processFunc) { try { result = processFunc(result); } catch (error) { error.url = url; error.body = json; error.responseText = request.responseText; reject(error); return; } } if (request.status != 200) { // @TODO: not any! var error = new Error('invalid response - ' + request.status); error.statusCode = request.status; reject(error); return; } resolve(result); }; request.onerror = function (error) { reject(error); }; try { if (json) { request.send(json); } else { request.send(); } } catch (error) { // @TODO: not any! var connectionError = new Error('connection error'); connectionError.error = error; reject(connectionError); } }); } exports.fetchJson = fetchJson; function poll(func, options) { if (!options) { options = {}; } if (options.floor == null) { options.floor = 0; } if (options.ceiling == null) { options.ceiling = 10000; } if (options.interval == null) { options.interval = 250; } return new Promise(function (resolve, reject) { var timer = null; var done = false; // Returns true if cancel was successful. Unsuccessful cancel means we're already done. var cancel = function () { if (done) { return false; } done = true; if (timer) { clearTimeout(timer); } return true; }; if (options.timeout) { timer = setTimeout(function () { if (cancel()) { reject(new Error('timeout')); } }, options.timeout); } var attempt = 0; function check() { return func().then(function (result) { // If we have a result, or are allowed null then we're done if (result !== undefined) { if (cancel()) { resolve(result); } } else if (options.onceBlock) { options.onceBlock.once('block', check); // Otherwise, exponential back-off (up to 10s) our next request } else if (!done) { attempt++; var timeout = options.interval * parseInt(String(Math.random() * Math.pow(2, attempt))); if (timeout < options.floor) { timeout = options.floor; } if (timeout > options.ceiling) { timeout = options.ceiling; } setTimeout(check, timeout); } return null; }, function (error) { if (cancel()) { reject(error); } }); } check(); }); } exports.poll = poll; },{"./base64":58,"./errors":61,"./utf8":79,"xmlhttprequest":47}],81:[function(require,module,exports){ 'use strict'; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); // See: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki // See: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki // The English language word list. // For additional word lists, please see /src.tc/wordlists/ var lang_en_1 = require("../wordlists/lang-en"); // Automatically register English? //import { register } from '../wordlists/wordlist'; //register(langEn); var bytes_1 = require("../utils/bytes"); var bignumber_1 = require("../utils/bignumber"); var utf8_1 = require("../utils/utf8"); var pbkdf2_1 = require("../utils/pbkdf2"); var hmac_1 = require("../utils/hmac"); var properties_1 = require("../utils/properties"); var secp256k1_1 = require("../utils/secp256k1"); var sha2_1 = require("../utils/sha2"); var N = bignumber_1.bigNumberify("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); var types_1 = require("../utils/types"); var errors = __importStar(require("../utils/errors")); // "Bitcoin seed" var MasterSecret = utf8_1.toUtf8Bytes('Bitcoin seed'); var HardenedBit = 0x80000000; // Returns a byte with the MSB bits set function getUpperMask(bits) { return ((1 << bits) - 1) << (8 - bits); } // Returns a byte with the LSB bits set function getLowerMask(bits) { return (1 << bits) - 1; } exports.defaultPath = "m/44'/60'/0'/0/0"; var HDNode = /** @class */ (function (_super) { __extends(HDNode, _super); /** * This constructor should not be called directly. * * Please use: * - fromMnemonic * - fromSeed */ function HDNode(privateKey, chainCode, index, depth, mnemonic, path) { var _this = _super.call(this) || this; errors.checkNew(_this, HDNode); properties_1.defineReadOnly(_this, 'keyPair', new secp256k1_1.KeyPair(privateKey)); properties_1.defineReadOnly(_this, 'privateKey', _this.keyPair.privateKey); properties_1.defineReadOnly(_this, 'publicKey', _this.keyPair.compressedPublicKey); properties_1.defineReadOnly(_this, 'chainCode', bytes_1.hexlify(chainCode)); properties_1.defineReadOnly(_this, 'index', index); properties_1.defineReadOnly(_this, 'depth', depth); properties_1.defineReadOnly(_this, 'mnemonic', mnemonic); properties_1.defineReadOnly(_this, 'path', path); return _this; } HDNode.prototype._derive = function (index) { // Public parent key -> public child key if (!this.privateKey) { if (index >= HardenedBit) { throw new Error('cannot derive child of neutered node'); } throw new Error('not implemented'); } var data = new Uint8Array(37); // Base path var mnemonic = this.mnemonic; var path = this.path; if (path) { path += '/' + index; } if (index & HardenedBit) { // Data = 0x00 || ser_256(k_par) data.set(bytes_1.arrayify(this.privateKey), 1); // Hardened path if (path) { path += "'"; } } else { // Data = ser_p(point(k_par)) data.set(this.keyPair.publicKeyBytes); } // Data += ser_32(i) for (var i = 24; i >= 0; i -= 8) { data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff); } var I = hmac_1.computeHmac('sha512', this.chainCode, data); var IL = bignumber_1.bigNumberify(I.slice(0, 32)); var IR = I.slice(32); var ki = IL.add(this.keyPair.privateKey).mod(N); return new HDNode(bytes_1.arrayify(ki), IR, index, this.depth + 1, mnemonic, path); }; HDNode.prototype.derivePath = function (path) { var components = path.split('/'); if (components.length === 0 || (components[0] === 'm' && this.depth !== 0)) { throw new Error('invalid path'); } if (components[0] === 'm') { components.shift(); } var result = this; for (var i = 0; i < components.length; i++) { var component = components[i]; if (component.match(/^[0-9]+'$/)) { var index = parseInt(component.substring(0, component.length - 1)); if (index >= HardenedBit) { throw new Error('invalid path index - ' + component); } result = result._derive(HardenedBit + index); } else if (component.match(/^[0-9]+$/)) { var index = parseInt(component); if (index >= HardenedBit) { throw new Error('invalid path index - ' + component); } result = result._derive(index); } else { throw new Error('invlaid path component - ' + component); } } return result; }; return HDNode; }(types_1.HDNode)); function _fromSeed(seed, mnemonic) { var seedArray = bytes_1.arrayify(seed); if (seedArray.length < 16 || seedArray.length > 64) { throw new Error('invalid seed'); } var I = bytes_1.arrayify(hmac_1.computeHmac('sha512', MasterSecret, seedArray)); return new HDNode(I.slice(0, 32), I.slice(32), 0, 0, mnemonic, 'm'); } function fromMnemonic(mnemonic, wordlist) { // Check that the checksum s valid (will throw an error) mnemonicToEntropy(mnemonic, wordlist); return _fromSeed(mnemonicToSeed(mnemonic), mnemonic); } exports.fromMnemonic = fromMnemonic; function fromSeed(seed) { return _fromSeed(seed, null); } exports.fromSeed = fromSeed; function mnemonicToSeed(mnemonic, password) { if (!password) { password = ''; } var salt = utf8_1.toUtf8Bytes('mnemonic' + password, utf8_1.UnicodeNormalizationForm.NFKD); return bytes_1.hexlify(pbkdf2_1.pbkdf2(utf8_1.toUtf8Bytes(mnemonic, utf8_1.UnicodeNormalizationForm.NFKD), salt, 2048, 64, 'sha512')); } exports.mnemonicToSeed = mnemonicToSeed; function mnemonicToEntropy(mnemonic, wordlist) { if (!wordlist) { wordlist = lang_en_1.langEn; } var words = wordlist.split(mnemonic); if ((words.length % 3) !== 0) { throw new Error('invalid mnemonic'); } var entropy = bytes_1.arrayify(new Uint8Array(Math.ceil(11 * words.length / 8))); var offset = 0; for (var i = 0; i < words.length; i++) { var index = wordlist.getWordIndex(words[i].normalize('NFKD')); if (index === -1) { throw new Error('invalid mnemonic'); } for (var bit = 0; bit < 11; bit++) { if (index & (1 << (10 - bit))) { entropy[offset >> 3] |= (1 << (7 - (offset % 8))); } offset++; } } var entropyBits = 32 * words.length / 3; var checksumBits = words.length / 3; var checksumMask = getUpperMask(checksumBits); var checksum = bytes_1.arrayify(sha2_1.sha256(entropy.slice(0, entropyBits / 8)))[0]; checksum &= checksumMask; if (checksum !== (entropy[entropy.length - 1] & checksumMask)) { throw new Error('invalid checksum'); } return bytes_1.hexlify(entropy.slice(0, entropyBits / 8)); } exports.mnemonicToEntropy = mnemonicToEntropy; function entropyToMnemonic(entropy, wordlist) { entropy = bytes_1.arrayify(entropy); if ((entropy.length % 4) !== 0 || entropy.length < 16 || entropy.length > 32) { throw new Error('invalid entropy'); } var indices = [0]; var remainingBits = 11; for (var i = 0; i < entropy.length; i++) { // Consume the whole byte (with still more to go) if (remainingBits > 8) { indices[indices.length - 1] <<= 8; indices[indices.length - 1] |= entropy[i]; remainingBits -= 8; // This byte will complete an 11-bit index } else { indices[indices.length - 1] <<= remainingBits; indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits); // Start the next word indices.push(entropy[i] & getLowerMask(8 - remainingBits)); remainingBits += 3; } } // Compute the checksum bits var checksum = bytes_1.arrayify(sha2_1.sha256(entropy))[0]; var checksumBits = entropy.length / 4; checksum &= getUpperMask(checksumBits); // Shift the checksum into the word indices indices[indices.length - 1] <<= checksumBits; indices[indices.length - 1] |= (checksum >> (8 - checksumBits)); if (!wordlist) { wordlist = lang_en_1.langEn; } return wordlist.join(indices.map(function (index) { return wordlist.getWord(index); })); } exports.entropyToMnemonic = entropyToMnemonic; function isValidMnemonic(mnemonic, wordlist) { try { mnemonicToEntropy(mnemonic, wordlist); return true; } catch (error) { } return false; } exports.isValidMnemonic = isValidMnemonic; },{"../utils/bignumber":59,"../utils/bytes":60,"../utils/errors":61,"../utils/hmac":63,"../utils/pbkdf2":68,"../utils/properties":69,"../utils/secp256k1":72,"../utils/sha2":73,"../utils/types":77,"../utils/utf8":79,"../wordlists/lang-en":87}],82:[function(require,module,exports){ 'use strict'; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var wallet_1 = require("./wallet"); exports.Wallet = wallet_1.Wallet; var HDNode = __importStar(require("./hdnode")); exports.HDNode = HDNode; var signing_key_1 = require("./signing-key"); exports.SigningKey = signing_key_1.SigningKey; },{"./hdnode":81,"./signing-key":84,"./wallet":85}],83:[function(require,module,exports){ 'use strict'; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var aes_js_1 = __importDefault(require("aes-js")); var scrypt_js_1 = __importDefault(require("scrypt-js")); var uuid_1 = __importDefault(require("uuid")); var signing_key_1 = require("./signing-key"); var HDNode = __importStar(require("./hdnode")); var address_1 = require("../utils/address"); var bytes_1 = require("../utils/bytes"); var pbkdf2_1 = require("../utils/pbkdf2"); var keccak256_1 = require("../utils/keccak256"); var utf8_1 = require("../utils/utf8"); var random_bytes_1 = require("../utils/random-bytes"); function looseArrayify(hexString) { if (typeof (hexString) === 'string' && hexString.substring(0, 2) !== '0x') { hexString = '0x' + hexString; } return bytes_1.arrayify(hexString); } function zpad(value, length) { value = String(value); while (value.length < length) { value = '0' + value; } return value; } function getPassword(password) { if (typeof (password) === 'string') { return utf8_1.toUtf8Bytes(password, utf8_1.UnicodeNormalizationForm.NFKC); } return bytes_1.arrayify(password); } // Search an Object and its children recursively, caselessly. function searchPath(object, path) { var currentChild = object; var comps = path.toLowerCase().split('/'); for (var i = 0; i < comps.length; i++) { // Search for a child object with a case-insensitive matching key var matchingChild = null; for (var key in currentChild) { if (key.toLowerCase() === comps[i]) { matchingChild = currentChild[key]; break; } } // Didn't find one. :'( if (matchingChild === null) { return null; } // Now check this child... currentChild = matchingChild; } return currentChild; } // @TODO: Make a type for string or arrayish // See: https://github.com/ethereum/pyethsaletool function decryptCrowdsale(json, password) { var data = JSON.parse(json); password = getPassword(password); // Ethereum Address var ethaddr = address_1.getAddress(searchPath(data, 'ethaddr')); // Encrypted Seed var encseed = looseArrayify(searchPath(data, 'encseed')); if (!encseed || (encseed.length % 16) !== 0) { throw new Error('invalid encseed'); } var key = pbkdf2_1.pbkdf2(password, password, 2000, 32, 'sha256').slice(0, 16); var iv = encseed.slice(0, 16); var encryptedSeed = encseed.slice(16); // Decrypt the seed var aesCbc = new aes_js_1.default.ModeOfOperation.cbc(key, iv); var seed = bytes_1.arrayify(aesCbc.decrypt(encryptedSeed)); seed = aes_js_1.default.padding.pkcs7.strip(seed); // This wallet format is weird... Convert the binary encoded hex to a string. var seedHex = ''; for (var i = 0; i < seed.length; i++) { seedHex += String.fromCharCode(seed[i]); } var seedHexBytes = utf8_1.toUtf8Bytes(seedHex); var signingKey = new signing_key_1.SigningKey(keccak256_1.keccak256(seedHexBytes)); if (signingKey.address !== ethaddr) { throw new Error('corrupt crowdsale wallet'); } return signingKey; } exports.decryptCrowdsale = decryptCrowdsale; //@TODO: string or arrayish function decrypt(json, password, progressCallback) { var data = JSON.parse(json); var passwordBytes = getPassword(password); var decrypt = function (key, ciphertext) { var cipher = searchPath(data, 'crypto/cipher'); if (cipher === 'aes-128-ctr') { var iv = looseArrayify(searchPath(data, 'crypto/cipherparams/iv')); var counter = new aes_js_1.default.Counter(iv); var aesCtr = new aes_js_1.default.ModeOfOperation.ctr(key, counter); return bytes_1.arrayify(aesCtr.decrypt(ciphertext)); } return null; }; var computeMAC = function (derivedHalf, ciphertext) { return keccak256_1.keccak256(bytes_1.concat([derivedHalf, ciphertext])); }; var getSigningKey = function (key, reject) { var ciphertext = looseArrayify(searchPath(data, 'crypto/ciphertext')); var computedMAC = bytes_1.hexlify(computeMAC(key.slice(16, 32), ciphertext)).substring(2); if (computedMAC !== searchPath(data, 'crypto/mac').toLowerCase()) { reject(new Error('invalid password')); return null; } var privateKey = decrypt(key.slice(0, 16), ciphertext); var mnemonicKey = key.slice(32, 64); if (!privateKey) { reject(new Error('unsupported cipher')); return null; } var signingKey = new signing_key_1.SigningKey(privateKey); if (signingKey.address !== address_1.getAddress(data.address)) { reject(new Error('address mismatch')); return null; } // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase if (searchPath(data, 'x-ethers/version') === '0.1') { var mnemonicCiphertext = looseArrayify(searchPath(data, 'x-ethers/mnemonicCiphertext')); var mnemonicIv = looseArrayify(searchPath(data, 'x-ethers/mnemonicCounter')); var mnemonicCounter = new aes_js_1.default.Counter(mnemonicIv); var mnemonicAesCtr = new aes_js_1.default.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter); var path = searchPath(data, 'x-ethers/path') || HDNode.defaultPath; var entropy = bytes_1.arrayify(mnemonicAesCtr.decrypt(mnemonicCiphertext)); var mnemonic = HDNode.entropyToMnemonic(entropy); var node = HDNode.fromMnemonic(mnemonic).derivePath(path); if (node.privateKey != bytes_1.hexlify(privateKey)) { reject(new Error('mnemonic mismatch')); return null; } signingKey = new signing_key_1.SigningKey(node); } return signingKey; }; return new Promise(function (resolve, reject) { var kdf = searchPath(data, 'crypto/kdf'); if (kdf && typeof (kdf) === 'string') { if (kdf.toLowerCase() === 'scrypt') { var salt = looseArrayify(searchPath(data, 'crypto/kdfparams/salt')); var N = parseInt(searchPath(data, 'crypto/kdfparams/n')); var r = parseInt(searchPath(data, 'crypto/kdfparams/r')); var p = parseInt(searchPath(data, 'crypto/kdfparams/p')); if (!N || !r || !p) { reject(new Error('unsupported key-derivation function parameters')); return; } // Make sure N is a power of 2 if ((N & (N - 1)) !== 0) { reject(new Error('unsupported key-derivation function parameter value for N')); return; } var dkLen = parseInt(searchPath(data, 'crypto/kdfparams/dklen')); if (dkLen !== 32) { reject(new Error('unsupported key-derivation derived-key length')); return; } if (progressCallback) { progressCallback(0); } scrypt_js_1.default(passwordBytes, salt, N, r, p, 64, function (error, progress, key) { if (error) { error.progress = progress; reject(error); } else if (key) { key = bytes_1.arrayify(key); var signingKey = getSigningKey(key, reject); if (!signingKey) { return; } if (progressCallback) { progressCallback(1); } resolve(signingKey); } else if (progressCallback) { return progressCallback(progress); } }); } else if (kdf.toLowerCase() === 'pbkdf2') { var salt = looseArrayify(searchPath(data, 'crypto/kdfparams/salt')); var prfFunc = null; var prf = searchPath(data, 'crypto/kdfparams/prf'); if (prf === 'hmac-sha256') { prfFunc = 'sha256'; } else if (prf === 'hmac-sha512') { prfFunc = 'sha512'; } else { reject(new Error('unsupported prf')); return; } var c = parseInt(searchPath(data, 'crypto/kdfparams/c')); var dkLen = parseInt(searchPath(data, 'crypto/kdfparams/dklen')); if (dkLen !== 32) { reject(new Error('unsupported key-derivation derived-key length')); return; } var key = pbkdf2_1.pbkdf2(passwordBytes, salt, c, dkLen, prfFunc); var signingKey = getSigningKey(key, reject); if (!signingKey) { return; } resolve(signingKey); } else { reject(new Error('unsupported key-derivation function')); } } else { reject(new Error('unsupported key-derivation function')); } }); } exports.decrypt = decrypt; function encrypt(privateKey, password, options, progressCallback) { // the options are optional, so adjust the call as needed if (typeof (options) === 'function' && !progressCallback) { progressCallback = options; options = {}; } if (!options) { options = {}; } // Check the private key var privateKeyBytes = null; if (privateKey instanceof signing_key_1.SigningKey) { privateKeyBytes = bytes_1.arrayify(privateKey.privateKey); } else { privateKeyBytes = bytes_1.arrayify(privateKey); } if (privateKeyBytes.length !== 32) { throw new Error('invalid private key'); } var passwordBytes = getPassword(password); var entropy = null; if (options.entropy) { entropy = bytes_1.arrayify(options.entropy); } if (options.mnemonic) { if (entropy) { if (HDNode.entropyToMnemonic(entropy) !== options.mnemonic) { throw new Error('entropy and mnemonic mismatch'); } } else { entropy = bytes_1.arrayify(HDNode.mnemonicToEntropy(options.mnemonic)); } } var path = options.path; if (entropy && !path) { path = HDNode.defaultPath; } var client = options.client; if (!client) { client = "ethers.js"; } // Check/generate the salt var salt = null; if (options.salt) { salt = bytes_1.arrayify(options.salt); } else { salt = random_bytes_1.randomBytes(32); ; } // Override initialization vector var iv = null; if (options.iv) { iv = bytes_1.arrayify(options.iv); if (iv.length !== 16) { throw new Error('invalid iv'); } } else { iv = random_bytes_1.randomBytes(16); } // Override the uuid var uuidRandom = null; if (options.uuid) { uuidRandom = bytes_1.arrayify(options.uuid); if (uuidRandom.length !== 16) { throw new Error('invalid uuid'); } } else { uuidRandom = random_bytes_1.randomBytes(16); } // Override the scrypt password-based key derivation function parameters var N = (1 << 17), r = 8, p = 1; if (options.scrypt) { if (options.scrypt.N) { N = options.scrypt.N; } if (options.scrypt.r) { r = options.scrypt.r; } if (options.scrypt.p) { p = options.scrypt.p; } } return new Promise(function (resolve, reject) { if (progressCallback) { progressCallback(0); } // We take 64 bytes: // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix) // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet) scrypt_js_1.default(passwordBytes, salt, N, r, p, 64, function (error, progress, key) { if (error) { error.progress = progress; reject(error); } else if (key) { key = bytes_1.arrayify(key); // This will be used to encrypt the wallet (as per Web3 secret storage) var derivedKey = key.slice(0, 16); var macPrefix = key.slice(16, 32); // This will be used to encrypt the mnemonic phrase (if any) var mnemonicKey = key.slice(32, 64); // Get the address for this private key var address = (new signing_key_1.SigningKey(privateKeyBytes)).address; // Encrypt the private key var counter = new aes_js_1.default.Counter(iv); var aesCtr = new aes_js_1.default.ModeOfOperation.ctr(derivedKey, counter); var ciphertext = bytes_1.arrayify(aesCtr.encrypt(privateKeyBytes)); // Compute the message authentication code, used to check the password var mac = keccak256_1.keccak256(bytes_1.concat([macPrefix, ciphertext])); // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition var data = { address: address.substring(2).toLowerCase(), id: uuid_1.default.v4({ random: uuidRandom }), version: 3, Crypto: { cipher: 'aes-128-ctr', cipherparams: { iv: bytes_1.hexlify(iv).substring(2), }, ciphertext: bytes_1.hexlify(ciphertext).substring(2), kdf: 'scrypt', kdfparams: { salt: bytes_1.hexlify(salt).substring(2), n: N, dklen: 32, p: p, r: r }, mac: mac.substring(2) } }; // If we have a mnemonic, encrypt it into the JSON wallet if (entropy) { var mnemonicIv = random_bytes_1.randomBytes(16); var mnemonicCounter = new aes_js_1.default.Counter(mnemonicIv); var mnemonicAesCtr = new aes_js_1.default.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter); var mnemonicCiphertext = bytes_1.arrayify(mnemonicAesCtr.encrypt(entropy)); var now = new Date(); var timestamp = (now.getUTCFullYear() + '-' + zpad(now.getUTCMonth() + 1, 2) + '-' + zpad(now.getUTCDate(), 2) + 'T' + zpad(now.getUTCHours(), 2) + '-' + zpad(now.getUTCMinutes(), 2) + '-' + zpad(now.getUTCSeconds(), 2) + '.0Z'); data['x-ethers'] = { client: client, gethFilename: ('UTC--' + timestamp + '--' + data.address), mnemonicCounter: bytes_1.hexlify(mnemonicIv).substring(2), mnemonicCiphertext: bytes_1.hexlify(mnemonicCiphertext).substring(2), version: "0.1" }; } if (progressCallback) { progressCallback(1); } resolve(JSON.stringify(data)); } else if (progressCallback) { return progressCallback(progress); } }); }); } exports.encrypt = encrypt; },{"../utils/address":57,"../utils/bytes":60,"../utils/keccak256":66,"../utils/pbkdf2":68,"../utils/random-bytes":70,"../utils/utf8":79,"./hdnode":81,"./signing-key":84,"aes-js":7,"scrypt-js":42,"uuid":46}],84:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); /** * SigningKey * * */ var bytes_1 = require("../utils/bytes"); var properties_1 = require("../utils/properties"); var secp256k1_1 = require("../utils/secp256k1"); var types_1 = require("../utils/types"); var errors = require("../utils/errors"); var SigningKey = /** @class */ (function () { function SigningKey(privateKey) { errors.checkNew(this, SigningKey); var privateKeyBytes = null; if (privateKey instanceof types_1.HDNode) { properties_1.defineReadOnly(this, 'mnemonic', privateKey.mnemonic); properties_1.defineReadOnly(this, 'path', privateKey.path); privateKeyBytes = bytes_1.arrayify(privateKey.privateKey); } else { // A lot of common tools do not prefix private keys with a 0x if (typeof (privateKey) === 'string' && privateKey.match(/^[0-9a-f]*$/i) && privateKey.length === 64) { privateKey = '0x' + privateKey; } privateKeyBytes = bytes_1.arrayify(privateKey); } try { if (privateKeyBytes.length !== 32) { errors.throwError('exactly 32 bytes required', errors.INVALID_ARGUMENT, { arg: 'privateKey', value: '[REDACTED]' }); } } catch (error) { var params = { arg: 'privateKey', reason: error.reason, value: '[REDACTED]' }; if (error.value) { if (typeof (error.value.length) === 'number') { params.length = error.value.length; } params.type = typeof (error.value); } errors.throwError('invalid private key', error.code, params); } properties_1.defineReadOnly(this, 'privateKey', bytes_1.hexlify(privateKeyBytes)); properties_1.defineReadOnly(this, 'keyPair', new secp256k1_1.KeyPair(privateKeyBytes)); properties_1.defineReadOnly(this, 'publicKey', this.keyPair.publicKey); properties_1.defineReadOnly(this, 'address', secp256k1_1.computeAddress(this.keyPair.publicKey)); } SigningKey.prototype.signDigest = function (digest) { return this.keyPair.sign(digest); }; return SigningKey; }()); exports.SigningKey = SigningKey; },{"../utils/bytes":60,"../utils/errors":61,"../utils/properties":69,"../utils/secp256k1":72,"../utils/types":77}],85:[function(require,module,exports){ 'use strict'; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var hdnode_1 = require("./hdnode"); var secretStorage = __importStar(require("./secret-storage")); var signing_key_1 = require("./signing-key"); var bytes_1 = require("../utils/bytes"); var hash_1 = require("../utils/hash"); var json_wallet_1 = require("../utils/json-wallet"); var keccak256_1 = require("../utils/keccak256"); var properties_1 = require("../utils/properties"); var random_bytes_1 = require("../utils/random-bytes"); var transaction_1 = require("../utils/transaction"); var types_1 = require("../utils/types"); var errors = __importStar(require("../utils/errors")); var Wallet = /** @class */ (function (_super) { __extends(Wallet, _super); function Wallet(privateKey, provider) { var _this = _super.call(this) || this; errors.checkNew(_this, Wallet); // Make sure we have a valid signing key if (privateKey instanceof signing_key_1.SigningKey) { properties_1.defineReadOnly(_this, 'signingKey', privateKey); } else { properties_1.defineReadOnly(_this, 'signingKey', new signing_key_1.SigningKey(privateKey)); } properties_1.defineReadOnly(_this, 'provider', provider); return _this; } Object.defineProperty(Wallet.prototype, "address", { get: function () { return this.signingKey.address; }, enumerable: true, configurable: true }); Object.defineProperty(Wallet.prototype, "mnemonic", { get: function () { return this.signingKey.mnemonic; }, enumerable: true, configurable: true }); Object.defineProperty(Wallet.prototype, "path", { get: function () { return this.signingKey.mnemonic; }, enumerable: true, configurable: true }); Object.defineProperty(Wallet.prototype, "privateKey", { get: function () { return this.signingKey.privateKey; }, enumerable: true, configurable: true }); /** * Create a new instance of this Wallet connected to provider. */ Wallet.prototype.connect = function (provider) { if (!(provider instanceof types_1.MinimalProvider)) { errors.throwError('invalid provider', errors.INVALID_ARGUMENT, { argument: 'provider', value: provider }); } return new Wallet(this.signingKey, provider); }; Wallet.prototype.getAddress = function () { return Promise.resolve(this.address); }; Wallet.prototype.sign = function (transaction) { var _this = this; return properties_1.resolveProperties(transaction).then(function (tx) { var rawTx = transaction_1.serialize(tx); var signature = _this.signingKey.signDigest(keccak256_1.keccak256(rawTx)); return Promise.resolve(transaction_1.serialize(tx, signature)); }); }; Wallet.prototype.signMessage = function (message) { return Promise.resolve(bytes_1.joinSignature(this.signingKey.signDigest(hash_1.hashMessage(message)))); }; Wallet.prototype.getBalance = function (blockTag) { if (!this.provider) { throw new Error('missing provider'); } return this.provider.getBalance(this.address, blockTag); }; Wallet.prototype.getTransactionCount = function (blockTag) { if (!this.provider) { throw new Error('missing provider'); } return this.provider.getTransactionCount(this.address, blockTag); }; Wallet.prototype.sendTransaction = function (transaction) { if (!this.provider) { throw new Error('missing provider'); } if (!transaction || typeof (transaction) !== 'object') { throw new Error('invalid transaction object'); } var tx = properties_1.shallowCopy(transaction); if (tx.to != null) { tx.to = this.provider.resolveName(tx.to); } if (tx.gasLimit == null) { tx.from = this.getAddress(); tx.gasLimit = this.provider.estimateGas(tx); } if (tx.gasPrice == null) { tx.gasPrice = this.provider.getGasPrice(); } if (tx.nonce == null) { tx.nonce = this.getTransactionCount(); } if (tx.chainId == null) { tx.chainId = this.provider.getNetwork().then(function (network) { return network.chainId; }); } return this.provider.sendTransaction(this.sign(tx)); }; Wallet.prototype.encrypt = function (password, options, progressCallback) { if (typeof (options) === 'function' && !progressCallback) { progressCallback = options; options = {}; } if (progressCallback && typeof (progressCallback) !== 'function') { throw new Error('invalid callback'); } if (!options) { options = {}; } if (this.mnemonic) { // Make sure we don't accidentally bubble the mnemonic up the call-stack var safeOptions = {}; for (var key in options) { safeOptions[key] = options[key]; } options = safeOptions; // Set the mnemonic and path options.mnemonic = this.mnemonic; options.path = this.path; } return secretStorage.encrypt(this.privateKey, password, options, progressCallback); }; /** * Static methods to create Wallet instances. */ Wallet.createRandom = function (options) { var entropy = random_bytes_1.randomBytes(16); if (!options) { options = {}; } if (options.extraEntropy) { entropy = bytes_1.arrayify(keccak256_1.keccak256(bytes_1.concat([entropy, options.extraEntropy])).substring(0, 34)); } var mnemonic = hdnode_1.entropyToMnemonic(entropy, options.locale); return Wallet.fromMnemonic(mnemonic, options.path, options.locale); }; Wallet.fromEncryptedJson = function (json, password, progressCallback) { if (json_wallet_1.isCrowdsaleWallet(json)) { try { if (progressCallback) { progressCallback(0); } var privateKey = secretStorage.decryptCrowdsale(json, password); if (progressCallback) { progressCallback(1); } return Promise.resolve(new Wallet(privateKey)); } catch (error) { return Promise.reject(error); } } else if (json_wallet_1.isSecretStorageWallet(json)) { return secretStorage.decrypt(json, password, progressCallback).then(function (signingKey) { return new Wallet(signingKey); }); } return Promise.reject('invalid wallet JSON'); }; Wallet.fromMnemonic = function (mnemonic, path, wordlist) { if (!path) { path = hdnode_1.defaultPath; } return new Wallet(hdnode_1.fromMnemonic(mnemonic, wordlist).derivePath(path)); }; return Wallet; }(types_1.Signer)); exports.Wallet = Wallet; },{"../utils/bytes":60,"../utils/errors":61,"../utils/hash":62,"../utils/json-wallet":65,"../utils/keccak256":66,"../utils/properties":69,"../utils/random-bytes":70,"../utils/transaction":76,"../utils/types":77,"./hdnode":81,"./secret-storage":83,"./signing-key":84}],86:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var lang_en_1 = require("../wordlists/lang-en"); var en = lang_en_1.langEn; exports.en = en; },{"../wordlists/lang-en":87}],87:[function(require,module,exports){ 'use strict'; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var wordlist_1 = require("./wordlist"); var words = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; var wordlist = null; function loadWords(lang) { if (wordlist != null) { return; } wordlist = words.replace(/([A-Z])/g, ' $1').toLowerCase().substring(1).split(' '); if (wordlist_1.check(lang) !== '0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60') { wordlist = null; throw new Error('BIP39 Wordlist for en (English) FAILED'); } } var LangEn = /** @class */ (function (_super) { __extends(LangEn, _super); function LangEn() { return _super.call(this, 'en') || this; } LangEn.prototype.getWord = function (index) { loadWords(this); return wordlist[index]; }; LangEn.prototype.getWordIndex = function (word) { loadWords(this); return wordlist.indexOf(word); }; return LangEn; }(wordlist_1.Wordlist)); var langEn = new LangEn(); exports.langEn = langEn; wordlist_1.register(langEn); },{"./wordlist":88}],88:[function(require,module,exports){ (function (global){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // This gets overriddenby gulp during bip39-XX var exportWordlist = false; var hash_1 = require("../utils/hash"); var properties_1 = require("../utils/properties"); function check(wordlist) { var words = []; for (var i = 0; i < 2048; i++) { var word = wordlist.getWord(i); if (i !== wordlist.getWordIndex(word)) { return '0x'; } words.push(word); } return hash_1.id(words.join('\n') + '\n'); } exports.check = check; var Wordlist = /** @class */ (function () { function Wordlist(locale) { properties_1.defineReadOnly(this, 'locale', locale); } // Subclasses may override this Wordlist.prototype.split = function (mnemonic) { return mnemonic.toLowerCase().split(/ +/g); }; // Subclasses may override this Wordlist.prototype.join = function (words) { return words.join(' '); }; return Wordlist; }()); exports.Wordlist = Wordlist; function register(lang, name) { if (!name) { name = lang.locale; } if (exportWordlist) { var g = global; if (!(g.wordlists)) { properties_1.defineReadOnly(g, 'wordlists', {}); } if (!g.wordlists[name]) { properties_1.defineReadOnly(g.wordlists, name, lang); } if (g.ethers && g.ethers.wordlists) { if (!g.ethers.wordlists[name]) { properties_1.defineReadOnly(g.ethers.wordlists, name, lang); } } } } exports.register = register; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../utils/hash":62,"../utils/properties":69}]},{},[6])(6) });
ml.module('three.core.Vector4') .requires('three.Three') .defines(function(){ /** * @author supereggbert / http://www.paulbrunt.co.uk/ * @author philogb / http://blog.thejit.org/ * @author mikael emtinger / http://gomo.se/ * @author egraether / http://egraether.com/ * @author WestLangley / http://github.com/WestLangley */ THREE.Vector4 = function ( x, y, z, w ) { this.x = x || 0; this.y = y || 0; this.z = z || 0; this.w = ( w !== undefined ) ? w : 1; }; THREE.Vector4.prototype = { constructor: THREE.Vector4, set: function ( x, y, z, w ) { this.x = x; this.y = y; this.z = z; this.w = w; return this; }, copy: function ( v ) { this.x = v.x; this.y = v.y; this.z = v.z; this.w = ( v.w !== undefined ) ? v.w : 1; return this; }, add: function ( a, b ) { this.x = a.x + b.x; this.y = a.y + b.y; this.z = a.z + b.z; this.w = a.w + b.w; return this; }, addSelf: function ( v ) { this.x += v.x; this.y += v.y; this.z += v.z; this.w += v.w; return this; }, sub: function ( a, b ) { this.x = a.x - b.x; this.y = a.y - b.y; this.z = a.z - b.z; this.w = a.w - b.w; return this; }, subSelf: function ( v ) { this.x -= v.x; this.y -= v.y; this.z -= v.z; this.w -= v.w; return this; }, multiplyScalar: function ( s ) { this.x *= s; this.y *= s; this.z *= s; this.w *= s; return this; }, divideScalar: function ( s ) { if ( s ) { this.x /= s; this.y /= s; this.z /= s; this.w /= s; } else { this.x = 0; this.y = 0; this.z = 0; this.w = 1; } return this; }, negate: function() { return this.multiplyScalar( -1 ); }, dot: function ( v ) { return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; }, lengthSq: function () { return this.dot( this ); }, length: function () { return Math.sqrt( this.lengthSq() ); }, lengthManhattan: function () { return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w ); }, normalize: function () { return this.divideScalar( this.length() ); }, setLength: function ( l ) { return this.normalize().multiplyScalar( l ); }, lerpSelf: function ( v, alpha ) { this.x += ( v.x - this.x ) * alpha; this.y += ( v.y - this.y ) * alpha; this.z += ( v.z - this.z ) * alpha; this.w += ( v.w - this.w ) * alpha; return this; }, clone: function () { return new THREE.Vector4( this.x, this.y, this.z, this.w ); }, setAxisAngleFromQuaternion: function ( q ) { // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm // q is assumed to be normalized this.w = 2 * Math.acos( q.w ); var s = Math.sqrt( 1 - q.w * q.w ); if ( s < 0.0001 ) { this.x = 1; this.y = 0; this.z = 0; } else { this.x = q.x / s; this.y = q.y / s; this.z = q.z / s; } return this; }, setAxisAngleFromRotationMatrix: function ( m ) { // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) var angle, x, y, z, // variables for result epsilon = 0.01, // margin to allow for rounding errors epsilon2 = 0.1, // margin to distinguish between 0 and 180 degrees te = m.elements, m11 = te[0], m12 = te[4], m13 = te[8], m21 = te[1], m22 = te[5], m23 = te[9], m31 = te[2], m32 = te[6], m33 = te[10]; if ( ( Math.abs( m12 - m21 ) < epsilon ) && ( Math.abs( m13 - m31 ) < epsilon ) && ( Math.abs( m23 - m32 ) < epsilon ) ) { // singularity found // first check for identity matrix which must have +1 for all terms // in leading diagonal and zero in other terms if ( ( Math.abs( m12 + m21 ) < epsilon2 ) && ( Math.abs( m13 + m31 ) < epsilon2 ) && ( Math.abs( m23 + m32 ) < epsilon2 ) && ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) { // this singularity is identity matrix so angle = 0 this.set( 1, 0, 0, 0 ); return this; // zero angle, arbitrary axis } // otherwise this singularity is angle = 180 angle = Math.PI; var xx = ( m11 + 1 ) / 2; var yy = ( m22 + 1 ) / 2; var zz = ( m33 + 1 ) / 2; var xy = ( m12 + m21 ) / 4; var xz = ( m13 + m31 ) / 4; var yz = ( m23 + m32 ) / 4; if ( ( xx > yy ) && ( xx > zz ) ) { // m11 is the largest diagonal term if ( xx < epsilon ) { x = 0; y = 0.707106781; z = 0.707106781; } else { x = Math.sqrt( xx ); y = xy / x; z = xz / x; } } else if ( yy > zz ) { // m22 is the largest diagonal term if ( yy < epsilon ) { x = 0.707106781; y = 0; z = 0.707106781; } else { y = Math.sqrt( yy ); x = xy / y; z = yz / y; } } else { // m33 is the largest diagonal term so base result on this if ( zz < epsilon ) { x = 0.707106781; y = 0.707106781; z = 0; } else { z = Math.sqrt( zz ); x = xz / z; y = yz / z; } } this.set( x, y, z, angle ); return this; // return 180 deg rotation } // as we have reached here there are no singularities so we can handle normally var s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) + ( m13 - m31 ) * ( m13 - m31 ) + ( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize if ( Math.abs( s ) < 0.001 ) s = 1; // prevent divide by zero, should not happen if matrix is orthogonal and should be // caught by singularity test above, but I've left it in just in case this.x = ( m32 - m23 ) / s; this.y = ( m13 - m31 ) / s; this.z = ( m21 - m12 ) / s; this.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 ); return this; } }; });
const fs = require('fs'); const path = require('path'); const xcode = require('xcode'); const chalk = require('chalk'); const utilities = require('../lib/utilities'); /** * This is used as the display text for the build phase block in XCode as well as the * inline comments inside of the .pbxproj file for the build script phase block. */ const comment = '"Crashlytics"'; module.exports = { /** * @returns string path to the XCode project's .pbxproj file. */ getXcodeProjectPath: function () { const appName = utilities.getAppName(); const xcodeProjectPath = path.join("platforms", "ios", appName + ".xcodeproj", "project.pbxproj"); console.log(chalk.blue.bold('Xcode project path:', xcodeProjectPath)); return xcodeProjectPath; }, /** * This helper is used to add a build phase to the XCode project which runs a shell * script during the build process. The script executes Crashlytics run command line * tool with the API and Secret keys. This tool is used to upload the debug symbols * (dSYMs) so that Crashlytics can display stack trace information in it's web console. */ addShellScriptBuildPhase: function (context, xcodeProjectPath) { // Read and parse the XCode project (.pxbproj) from disk. // File format information: http://www.monobjc.net/xcode-project-file-format.html const xcodeProject = xcode.project(xcodeProjectPath); xcodeProject.parseSync(); // Build the body of the script to be executed during the build phase. const script = '"' + '\\"${PODS_ROOT}/Fabric/run\\"' + '"'; // Generate a unique ID for our new build phase. const id = xcodeProject.generateUuid(); // Create the build phase. xcodeProject.hash.project.objects.PBXShellScriptBuildPhase[id] = { isa: "PBXShellScriptBuildPhase", buildActionMask: 2147483647, files: [], inputPaths: ['"' + '$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)' + '"'], name: comment, outputPaths: [], runOnlyForDeploymentPostprocessing: 0, shellPath: "/bin/sh", shellScript: script, showEnvVarsInLog: 0 }; // Add a comment to the block (viewable in the source of the pbxproj file). xcodeProject.hash.project.objects.PBXShellScriptBuildPhase[id + "_comment"] = comment; // Add this new shell script build phase block to the targets. for (const nativeTargetId in xcodeProject.hash.project.objects.PBXNativeTarget) { // Skip over the comment blocks. if (nativeTargetId.indexOf("_comment") !== -1) { continue; } const nativeTarget = xcodeProject.hash.project.objects.PBXNativeTarget[nativeTargetId]; nativeTarget.buildPhases.push({ value: id, comment: comment }); } // Finally, write the .pbxproj back out to disk. fs.writeFileSync(xcodeProjectPath, xcodeProject.writeSync()); }, /** * This helper is used to remove the build phase from the XCode project that was added * by the addShellScriptBuildPhase() helper method. */ removeShellScriptBuildPhase: function (context, xcodeProjectPath) { // Read and parse the XCode project (.pxbproj) from disk. // File format information: http://www.monobjc.net/xcode-project-file-format.html const xcodeProject = xcode.project(xcodeProjectPath); xcodeProject.parseSync(); // First, we want to delete the build phase block itself. const buildPhases = xcodeProject.hash.project.objects.PBXShellScriptBuildPhase; const commentTest = comment.replace(/"/g, ''); for (const buildPhaseId in buildPhases) { const buildPhase = xcodeProject.hash.project.objects.PBXShellScriptBuildPhase[buildPhaseId]; let shouldDelete = false; if (buildPhaseId.indexOf("_comment") === -1) { // Dealing with a build phase block. // If the name of this block matches ours, then we want to delete it. shouldDelete = buildPhase.name && buildPhase.name.indexOf(commentTest) !== -1; } else { // Dealing with a comment block. // If this is a comment block that matches ours, then we want to delete it. shouldDelete = buildPhase === commentTest; } if (shouldDelete) { delete buildPhases[buildPhaseId]; } } // Second, we want to delete the native target reference to the block. const nativeTargets = xcodeProject.hash.project.objects.PBXNativeTarget; for (const nativeTargetId in nativeTargets) { // Skip over the comment blocks. if (nativeTargetId.indexOf("_comment") !== -1) { continue; } const nativeTarget = nativeTargets[nativeTargetId]; // We remove the reference to the block by filtering out the the ones that match. nativeTarget.buildPhases = nativeTarget.buildPhases.filter(function (buildPhase) { return buildPhase.comment !== commentTest; }); } // Finally, write the .pbxproj back out to disk. fs.writeFileSync(xcodeProjectPath, xcodeProject.writeSync()); } };
const User = require('../models/User'); const { hash, compare } = require('bcrypt'); //TODO add all fields required by the exam async function register(email, password, gender) { const existing = await getUserByEmail(email); if (existing) { throw new Error('Email is taken') } const hashedPassword = await hash(password, 10); const user = new User({ email, hashedPassword, gender }); await user.save(); return user; } //TODO change indentifier async function login(email, password){ const user = await getUserByEmail(email); if(!user){ throw new Error('Email or password dont match'); } const hasMatch = await compare(password, user.hashedPassword); if(!hasMatch){ throw new Error('Email or password dont match'); } return user; } //TODO indentify user by given indentifier async function getUserByEmail(email) { const user = await User.findOne({ email: new RegExp(`^${email}$`, 'i') }); return user; } module.exports = { login, register }
// Themes begin am4core.useTheme(am4themes_animated); // Themes end // Create chart instance var chart = am4core.create("chartdiv", am4charts.RadarChart); var data = [ { category: "No poverty", value: 260 }, { category: "Zero Hunger", value: 230 }, { category: "Good Health and Well", value: 200 }, { category: "Quality Education", value: 165 }, { category: "Gender Equality", value: 139 }, { category: "Clean Water and Sanitation", value: 260 }, { category: "Affordable and Clean Energy", value: 230 }, { category: "Decent Work and Economic Growth", value: 200 }, { category: "Industry Innovation and Infrastructure", value: 165 }, { category: "Reduced Inequalities", value: 139 }, { category: "Sustainable Cities and Communities", value: 260 }, { category: "Responsible Consumption and Production", value: 230 }, { category: "Climate Action", value: 200 }, { category: "Life Below Water", value: 165 }, { category: "Life on Land", value: 139 }, { category: "Peace, Justice and Strong Institutions", value: 139 }, { category: "Partnerships for the Goals", value: 128 } ]; // for(var i = 0; i < 20; i++){ // data.push({category: i, value:Math.round(Math.random() * 100)}); // } chart.data = data; chart.radius = am4core.percent(100); chart.innerRadius = am4core.percent(50); // Create axes var categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis()); categoryAxis.dataFields.category = "category"; categoryAxis.renderer.minGridDistance = 10; categoryAxis.tooltip.disabled = true; categoryAxis.renderer.minHeight = 1100; categoryAxis.renderer.grid.template.disabled = true; //categoryAxis.renderer.labels.template.disabled = true; let labelTemplate = categoryAxis.renderer.labels.template; labelTemplate.radius = am4core.percent(0); labelTemplate.location = 0.5; labelTemplate.relativeRotation = 90; var valueAxis = chart.yAxes.push(new am4charts.ValueAxis()); valueAxis.renderer.grid.template.disabled = true; valueAxis.renderer.labels.template.disabled = true; valueAxis.tooltip.disabled = true; // Create series var series = chart.series.push(new am4charts.RadarColumnSeries()); series.sequencedInterpolation = true; series.dataFields.valueY = "value"; series.dataFields.categoryX = "category"; series.columns.template.strokeWidth = 0; series.tooltipText = "{valueY}"; series.columns.template.radarColumn.cornerRadius = 10; series.columns.template.radarColumn.innerCornerRadius = 0; series.tooltip.pointerOrientation = "vertical"; // on hover, make corner radiuses bigger let hoverState = series.columns.template.radarColumn.states.create("hover"); hoverState.properties.cornerRadius = 0; hoverState.properties.fillOpacity = 1; series.columns.template.adapter.add("fill", function(fill, target) { return chart.colors.getIndex(target.dataItem.index); }) // Cursor chart.cursor = new am4charts.RadarCursor(); chart.cursor.innerRadius = am4core.percent(50); chart.cursor.lineY.disabled = true;
/*********************************************************************** Write a function named `spreadItOut(array1, array2)` that accepts two arrays and uses *spread operator* syntax to return a single array. Examples: spreadItOut([3,5,6], [1,2,3]); // => [3,5,6,1,2,3]; spreadItOut([], [1,2,3]); // => 14; spreadItOut(["apple", "banana"], [1,2,3]); // => ["apple", "banana", 1, 2, 3]; ***********************************************************************/ function spreadItOut(array1, array2) { let joinedArray = [...array1, ...array2]; return joinedArray; } /**************DO NOT MODIFY ANYTHING UNDER THIS LINE*****************/ module.exports = spreadItOut;
var boolbase = { trueFunc: function trueFunc(){ return true; }, falseFunc: function falseFunc(){ return false; } }; export default boolbase;
import { resolve } from 'rsvp'; import { module } from 'qunit'; import startApp from '../helpers/start-app'; import destroyApp from '../helpers/destroy-app'; import { setResolverRegistry } from './resolver'; import QUnitTestAdapter from './qunit-test-adapter'; import Ember from 'ember'; export default function(name, options = {}) { module(name, { beforeEach() { Ember.Test.adapter = QUnitTestAdapter.create(); if (options.registry) { setResolverRegistry(options.registry); } let testElementContainer = document.querySelector('#ember-testing-container'); this.fixtureResetValue = testElementContainer.innerHTML; Ember.testing = true; this.application = startApp(); if (options.beforeEach) { return options.beforeEach.apply(this, arguments); } }, afterEach() { let afterEach = options.afterEach && options.afterEach.apply(this, arguments); return resolve(afterEach) .then(() => destroyApp(this.application)) .finally(() => { Ember.testing = false; document.getElementById('ember-testing-container').innerHTML = this.fixtureResetValue; }); }, }); }
import React from 'react' import styled from 'styled-components' import { Formik, Form } from 'formik' import Layout from 'components/layout/layout' import { localize, WithIntl } from 'components/localization' import { Container, SEO } from 'components/containers' import { Header, Text } from 'components/elements' import { Input, Button } from 'components/form' import validation from 'common/validation' import { trimSpaces } from 'common/utility' import { BinarySocketBase } from 'common/websocket/socket_base' import Login from 'common/login' const StyledContainer = styled(Container)` text-align: center; height: 100vh; padding: auto 0; justify-content: start; ` const ButtonContainer = styled.div` margin-top: 2rem; ` const InputGroup = styled.div` width: 40rem; margin: 0 auto 3.4rem; ` const StyledButton = styled(Button)` margin: 0.8rem 0.4rem; ` const resetValidation = (values) => { let errors = {} const email_error = validation.email(trimSpaces(values.email)) if (email_error) { errors.email = email_error } return errors } const resetSubmission = (values, actions) => { const binary_socket = BinarySocketBase.init() binary_socket.onopen = () => { binary_socket.send( JSON.stringify({ verify_email: trimSpaces(values.email), type: 'reset_password' }), ) } binary_socket.onmessage = (msg) => { const response = JSON.parse(msg.data) actions.setSubmitting(false) if (response.error) { actions.setStatus({ error: response.error.message, }) return } actions.resetForm({ email: '' }) actions.setStatus({ success: localize( 'Please check your email and click on the link provided to reset your password.', ), }) binary_socket.close() } } const ResetPassword = () => ( <Layout type="static" margin_top={'0'}> <SEO title={localize('Reset password | Deriv')} description={localize( 'Forgot your Deriv password? Want to reset your password? Send us your email address and we’ll email you the instructions.', )} no_index /> <StyledContainer justify="center" align="center" direction="column"> <Header as="h2" type="page-title" align="center" mt="80px"> {localize('Reset password')} </Header> <Header as="h4" type="sub-section-title" align="center" weight="500" mt="0.5rem" mb="3.8rem" > {localize("We'll email you instructions to reset your password.")} </Header> <Formik initialValues={{ email: '' }} initialStatus={{}} validate={resetValidation} onSubmit={resetSubmission} > {({ values, errors, handleChange, handleBlur, isSubmitting, resetForm, status, }) => ( <Form noValidate> <InputGroup> <Input id="email" name="email" error={errors.email} value={trimSpaces(values.email)} handleError={resetForm} onChange={handleChange} onBlur={handleBlur} autoComplete="off" type="text" label={localize('Email')} background="white" placeholder={'[email protected]'} data-lpignore="true" required /> </InputGroup> <Text align="center" color="red"> {status.error && status.error} </Text> <Text align="center" color="green"> {status.success && status.success} </Text> <ButtonContainer> <StyledButton tertiary onClick={Login.redirectToLogin} type="button"> {localize('Return to log in')} </StyledButton> <StyledButton secondary="true" disabled={isSubmitting} type="submit"> {localize('Reset my password')} </StyledButton> </ButtonContainer> </Form> )} </Formik> </StyledContainer> </Layout> ) export default WithIntl()(ResetPassword)
'use strict'; export const TAB_ID_KEY = 'tabId'; export const TIMESTAMP_KEY = 'timestamp'; export const MESSAGE_TYPE_KEY = 'messageType'; export const MESSAGE_TYPE_POPUP_TO_BACKGROUND = 'popup2background'; export const MESSAGE_TYPE_BING_TO_BACKGROUND = 'bing2background'; export const MESSAGE_TYPE_CONTENT_SCRIPT_TO_BACKGROUND = 'contentScript2background'; export const MESSAGE_TYPE_BACKGROUND_TO_CONTENT_SCRIPT = 'background2contentScript'; export function getTimeStamp() { return Math.floor(Date.now() / 1000); }
var list; var input; var mean; var median; var mode; var k; // Mean function arithmeticMean(array){ const sumList = array.reduce( function (valorAcumulado = 0, nuevoElemento) { return valorAcumulado + nuevoElemento; } ); const average = sumList / array.length; return average; } // Median function medianaCalcule(array){ array.sort(function(a, b){return a-b}); const mitadLista = parseInt(array.length/2); var mediana; if (array.lenght % 2 === 0) { const element1 = array[mitadLista - 1]; const element2 = array[mitadLista]; mediana = arithmeticMean([element1, element2]); } else { mediana = array[mitadLista]; } return mediana; } // Mode var listCount; var listArray; function modeCalcule(array){ listCount = {}; array.map( function (element) { if (listCount[element]) { listCount[element] += 1; } else { listCount[element] = 1; } } ); listArray = Object.entries(listCount).sort( function (arr1, arr2) { return arr1[1] - arr2[1]; } ); const mode = listArray[listArray.length - 1][0]; return mode; } //Printing function printingFunction(){ list = []; input = document.getElementsByName('array'); for (var i = 0; i < input.length; i++) { var a = input[i]; list.push(parseInt(a.value)); } average = arithmeticMean(list); median = medianaCalcule(list); mode = modeCalcule(list); k = "The average is: " + average + "\n"; k = k + "The median is: " + median + "\n"; k = k + "The mode is: " + mode + "\n"; document.getElementById("tendency").innerHTML = k; }
'use strict'; var DataNodeBase = require('./DataNodeBase'); /** * @constructor * @extends DataNodeBase */ var DataNodeLeaf = DataNodeBase.extend('DataNodeLeaf', { /** * @memberOf DataNodeLeaf# * @param {string} key */ initialize: function(key) { this.hasChildren = false; }, /** * @memberOf DataNodeLeaf# * @param depth */ toArray: function(depth) { this.depth = depth; this.data[0] = this.computeDepthString(); }, /** * @memberOf DataNodeLeaf# * @returns {numer[]} */ getIndex: function() { return this.index; }, /** * @memberOf DataNodeLeaf# * @param drillDown */ buildView: function(drillDown) { drillDown.addView(this); }, /** * @memberOf DataNodeLeaf# * @param aggregator */ getRowData: function(drillDown) { var index = this.getIndex(); if (index.length) { var sorter = drillDown.sorterInstance, data = this.data, dataLen = sorter.getColumnCount(), i = 0; sorter.index = index; for (i; i < dataLen; i++) { data[i] = sorter.getValue(i, 0); } } }, /** * @memberOf DataNodeLeaf# * @returns {number} */ computeHeight: function() { return 1; }, sortWith: function(sorter) { // do nothing we have no children to sort }, clearGroupSorts: function() { // do nothing we have no children to sort } }); module.exports = DataNodeLeaf;
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for L{twisted.python.monkey}. """ from __future__ import division, absolute_import from twisted.trial import unittest from twisted.python.monkey import MonkeyPatcher class TestObj: def __init__(self): self.foo = 'foo value' self.bar = 'bar value' self.baz = 'baz value' class MonkeyPatcherTest(unittest.SynchronousTestCase): """ Tests for L{MonkeyPatcher} monkey-patching class. """ def setUp(self): self.testObject = TestObj() self.originalObject = TestObj() self.monkeyPatcher = MonkeyPatcher() def test_empty(self): """ A monkey patcher without patches shouldn't change a thing. """ self.monkeyPatcher.patch() # We can't assert that all state is unchanged, but at least we can # check our test object. self.assertEqual(self.originalObject.foo, self.testObject.foo) self.assertEqual(self.originalObject.bar, self.testObject.bar) self.assertEqual(self.originalObject.baz, self.testObject.baz) def test_constructWithPatches(self): """ Constructing a L{MonkeyPatcher} with patches should add all of the given patches to the patch list. """ patcher = MonkeyPatcher((self.testObject, 'foo', 'haha'), (self.testObject, 'bar', 'hehe')) patcher.patch() self.assertEqual('haha', self.testObject.foo) self.assertEqual('hehe', self.testObject.bar) self.assertEqual(self.originalObject.baz, self.testObject.baz) def test_patchExisting(self): """ Patching an attribute that exists sets it to the value defined in the patch. """ self.monkeyPatcher.addPatch(self.testObject, 'foo', 'haha') self.monkeyPatcher.patch() self.assertEqual(self.testObject.foo, 'haha') def test_patchNonExisting(self): """ Patching a non-existing attribute fails with an C{AttributeError}. """ self.monkeyPatcher.addPatch(self.testObject, 'nowhere', 'blow up please') self.assertRaises(AttributeError, self.monkeyPatcher.patch) def test_patchAlreadyPatched(self): """ Adding a patch for an object and attribute that already have a patch overrides the existing patch. """ self.monkeyPatcher.addPatch(self.testObject, 'foo', 'blah') self.monkeyPatcher.addPatch(self.testObject, 'foo', 'BLAH') self.monkeyPatcher.patch() self.assertEqual(self.testObject.foo, 'BLAH') self.monkeyPatcher.restore() self.assertEqual(self.testObject.foo, self.originalObject.foo) def test_restoreTwiceIsANoOp(self): """ Restoring an already-restored monkey patch is a no-op. """ self.monkeyPatcher.addPatch(self.testObject, 'foo', 'blah') self.monkeyPatcher.patch() self.monkeyPatcher.restore() self.assertEqual(self.testObject.foo, self.originalObject.foo) self.monkeyPatcher.restore() self.assertEqual(self.testObject.foo, self.originalObject.foo) def test_runWithPatchesDecoration(self): """ runWithPatches should run the given callable, passing in all arguments and keyword arguments, and return the return value of the callable. """ log = [] def f(a, b, c=None): log.append((a, b, c)) return 'foo' result = self.monkeyPatcher.runWithPatches(f, 1, 2, c=10) self.assertEqual('foo', result) self.assertEqual([(1, 2, 10)], log) def test_repeatedRunWithPatches(self): """ We should be able to call the same function with runWithPatches more than once. All patches should apply for each call. """ def f(): return (self.testObject.foo, self.testObject.bar, self.testObject.baz) self.monkeyPatcher.addPatch(self.testObject, 'foo', 'haha') result = self.monkeyPatcher.runWithPatches(f) self.assertEqual( ('haha', self.originalObject.bar, self.originalObject.baz), result) result = self.monkeyPatcher.runWithPatches(f) self.assertEqual( ('haha', self.originalObject.bar, self.originalObject.baz), result) def test_runWithPatchesRestores(self): """ C{runWithPatches} should restore the original values after the function has executed. """ self.monkeyPatcher.addPatch(self.testObject, 'foo', 'haha') self.assertEqual(self.originalObject.foo, self.testObject.foo) self.monkeyPatcher.runWithPatches(lambda: None) self.assertEqual(self.originalObject.foo, self.testObject.foo) def test_runWithPatchesRestoresOnException(self): """ Test runWithPatches restores the original values even when the function raises an exception. """ def _(): self.assertEqual(self.testObject.foo, 'haha') self.assertEqual(self.testObject.bar, 'blahblah') raise RuntimeError("Something went wrong!") self.monkeyPatcher.addPatch(self.testObject, 'foo', 'haha') self.monkeyPatcher.addPatch(self.testObject, 'bar', 'blahblah') self.assertRaises(RuntimeError, self.monkeyPatcher.runWithPatches, _) self.assertEqual(self.testObject.foo, self.originalObject.foo) self.assertEqual(self.testObject.bar, self.originalObject.bar)
#!/usr/bin/env python # -*- coding: utf-8 -*- import simplejson as json from alipay.aop.api.FileItem import FileItem from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.AlipaySecurityProdFacepayVerifyModel import AlipaySecurityProdFacepayVerifyModel class AlipaySecurityProdFacepayVerifyRequest(object): def __init__(self, biz_model=None): self._biz_model = biz_model self._biz_content = None self._version = "1.0" self._terminal_type = None self._terminal_info = None self._prod_code = None self._notify_url = None self._return_url = None self._udf_params = None self._need_encrypt = False @property def biz_model(self): return self._biz_model @biz_model.setter def biz_model(self, value): self._biz_model = value @property def biz_content(self): return self._biz_content @biz_content.setter def biz_content(self, value): if isinstance(value, AlipaySecurityProdFacepayVerifyModel): self._biz_content = value else: self._biz_content = AlipaySecurityProdFacepayVerifyModel.from_alipay_dict(value) @property def version(self): return self._version @version.setter def version(self, value): self._version = value @property def terminal_type(self): return self._terminal_type @terminal_type.setter def terminal_type(self, value): self._terminal_type = value @property def terminal_info(self): return self._terminal_info @terminal_info.setter def terminal_info(self, value): self._terminal_info = value @property def prod_code(self): return self._prod_code @prod_code.setter def prod_code(self, value): self._prod_code = value @property def notify_url(self): return self._notify_url @notify_url.setter def notify_url(self, value): self._notify_url = value @property def return_url(self): return self._return_url @return_url.setter def return_url(self, value): self._return_url = value @property def udf_params(self): return self._udf_params @udf_params.setter def udf_params(self, value): if not isinstance(value, dict): return self._udf_params = value @property def need_encrypt(self): return self._need_encrypt @need_encrypt.setter def need_encrypt(self, value): self._need_encrypt = value def add_other_text_param(self, key, value): if not self.udf_params: self.udf_params = dict() self.udf_params[key] = value def get_params(self): params = dict() params[P_METHOD] = 'alipay.security.prod.facepay.verify' params[P_VERSION] = self.version if self.biz_model: params[P_BIZ_CONTENT] = json.dumps(obj=self.biz_model.to_alipay_dict(), use_decimal=True, ensure_ascii=False, sort_keys=True, separators=(',', ':')) if self.biz_content: if hasattr(self.biz_content, 'to_alipay_dict'): params['biz_content'] = json.dumps(obj=self.biz_content.to_alipay_dict(), use_decimal=True, ensure_ascii=False, sort_keys=True, separators=(',', ':')) else: params['biz_content'] = self.biz_content if self.terminal_type: params['terminal_type'] = self.terminal_type if self.terminal_info: params['terminal_info'] = self.terminal_info if self.prod_code: params['prod_code'] = self.prod_code if self.notify_url: params['notify_url'] = self.notify_url if self.return_url: params['return_url'] = self.return_url if self.udf_params: params.update(self.udf_params) return params def get_multipart_params(self): multipart_params = dict() return multipart_params
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gnu.org/licenses/gpl.html - GNU Lesser General Public License Version 2.1 or later (the "LGPL") http://www.gnu.org/licenses/lgpl.html - Mozilla Public License Version 1.1 or later (the "MPL") http://www.mozilla.org/MPL/MPL-1.1.html == END LICENSE == Connector for Python (CGI and WSGI). """ from time import gmtime, strftime import string def escape(text, replace=string.replace): """ Converts the special characters '<', '>', and '&'. RFC 1866 specifies that these characters be represented in HTML as &lt; &gt; and &amp; respectively. In Python 1.5 we use the new string.replace() function for speed. """ text = replace(text, '&', '&amp;') # must be done 1st text = replace(text, '<', '&lt;') text = replace(text, '>', '&gt;') text = replace(text, '"', '&quot;') return text def convertToXmlAttribute(value): if (value is None): value = "" return escape(value) class BaseHttpMixin(object): def setHttpHeaders(self, content_type='text/xml'): "Purpose: to prepare the headers for the xml to return" # Prevent the browser from caching the result. # Date in the past self.setHeader('Expires','Mon, 26 Jul 1997 05:00:00 GMT') # always modified self.setHeader('Last-Modified',strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime())) # HTTP/1.1 self.setHeader('Cache-Control','no-store, no-cache, must-revalidate') self.setHeader('Cache-Control','post-check=0, pre-check=0') # HTTP/1.0 self.setHeader('Pragma','no-cache') # Set the response format. self.setHeader( 'Content-Type', content_type + '; charset=utf-8' ) return class BaseXmlMixin(object): def createXmlHeader(self, command, resourceType, currentFolder, url): "Purpose: returns the xml header" self.setHttpHeaders() # Create the XML document header s = """<?xml version="1.0" encoding="utf-8" ?>""" # Create the main connector node s += """<Connector command="%s" resourceType="%s">""" % ( command, resourceType ) # Add the current folder node s += """<CurrentFolder path="%s" url="%s" />""" % ( convertToXmlAttribute(currentFolder), convertToXmlAttribute(url), ) return s def createXmlFooter(self): "Purpose: returns the xml footer" return """</Connector>""" def sendError(self, number, text): "Purpose: in the event of an error, return an xml based error" self.setHttpHeaders() return ("""<?xml version="1.0" encoding="utf-8" ?>""" + """<Connector>""" + self.sendErrorNode (number, text) + """</Connector>""" ) def sendErrorNode(self, number, text): if number != 1: return """<Error number="%s" />""" % (number) else: return """<Error number="%s" text="%s" />""" % (number, convertToXmlAttribute(text)) class BaseHtmlMixin(object): def sendUploadResults( self, errorNo = 0, fileUrl = '', fileName = '', customMsg = '' ): self.setHttpHeaders("text/html") "This is the function that sends the results of the uploading process" "Minified version of the document.domain automatic fix script (#1919)." "The original script can be found at _dev/domain_fix_template.js" return """<script type="text/javascript"> (function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})(); window.parent.OnUploadCompleted(%(errorNumber)s,"%(fileUrl)s","%(fileName)s","%(customMsg)s"); </script>""" % { 'errorNumber': errorNo, 'fileUrl': fileUrl.replace ('"', '\\"'), 'fileName': fileName.replace ( '"', '\\"' ) , 'customMsg': customMsg.replace ( '"', '\\"' ), }
$(document).on('change','select[name="campusAppSelect"], select[name="idiomaAppSelect"]',function(){ var results = $(this).attr('results'); var route = $(this).attr('url'); var thisName = $(this).attr('name'); var inputData = {}; var token = $('#'+thisName).find('input[name="_token"]').val(); var smallBoxTitleSuccess = "El dato se cambio correctamente!"; var smallBoxTitleError = "Error! El dato no pudo ser cambiado"; if (thisName == 'campusAppSelect') { inputData = {campusAppSelect: $(this).val()}; smallBoxTitleSuccess = "El campus se cambio correctamente!"; smallBoxTitleError = "Error! El campus no pudo ser cambiado"; }else if (thisName == 'idiomaAppSelect') { inputData = {idiomaAppSelect: $(this).val()}; smallBoxTitleSuccess = "El idioma se cambio correctamente!"; smallBoxTitleError = "Error! El idioma no pudo ser cambiado"; } if ($(this).val() != '') { //se envia la peticion mediante el metodo DELETE con el id del genero $.ajax({ url: route, type: 'POST', headers: {'X-CSRF-TOKEN': token}, data: inputData, success: function(msj){ $.smallBox({ title: smallBoxTitleSuccess, content: "Hace un momento...", color: '#5f895f', iconSmall: "fa fa-check bounce animated" }); $( document ).one('ajaxStop', function() { $('#container-loading').addClass("show"); location.reload(); }); }, error: function(msj){ var row = ''; row = msj.responseText; //console.log(msj.responseJSON); if( msj.responseJSON != undefined ){ row = ''; $.each(msj.responseJSON, function( index, value ) { row = row + value + "<br>"; }); } $.smallBox({ title: smallBoxTitleError, content: row, color: '#8b0000', iconSmall: "fa fa-times bounce animated" }); } }).fail(function(jqXHR, textStatus, errorThrown) { //de este modo se redirecciona a la pagina correspondiente if (jqXHR.getResponseHeader('Location') != null){ window.Location= jqXHR.getResponseHeader('Location'); }; }); } });
'use strict'; // 获取全局应用程序实例对象 // const app = getApp() var tcity = require('../../utils/city'); // 创建页面实例对象 Page({ /** * 页面的初始数据 */ data: { title: 'businessCooperation', // 地区选择相关 provinces: [], province: '', citys: [], city: '', countys: [], county: '', value: [0, 0, 0], values: [0, 0, 0], condition: false, // 地区选择相关 shopAddress: '添加地图标记', showMain: true, allHidden: false, hiddenMain: false, // 图片上传 addPicText: '立即上传', faceImg: '../../images/4.png', insideImg: '../../images/5.png', IdFaceImg: '../../images/6.png', licenseImg: '../../images/2.png', restaurantLicenseImg: '../../images/3.png', upStatus: 0, license: [{name: 'noraml', value: '营业执照', checked: 'true'}, {name: 'special', value: '特许证件'}], licenseTime: [{name: 'noTime', value: '长期有效', checked: 'true'}, {name: 'haveTime', value: '固定有效期'}], restaurantLicenseTime: [{name: 'noTime', value: '长期有效', checked: 'true'}, {name: 'haveTime', value: '固定有效期'}] }, /** * 信息录入 * @param e */ inputMessage: function inputMessage(e) { var obj = {}; obj[e.currentTarget.dataset.type] = e.detail.value; this.setData(obj); }, /** * 执行下一步操作 */ // // nextStep2: function nextStep2() { if (!this.data.xkzAddress || !this.data.xkzNumber || !this.data.xkzName || !this.data.zzAddress || !this.data.zzNumber || !this.data.zzName || !this.data.frIdNumber || !this.data.frName || this.data.IdFaceImg.indexOf('wxfile') === -1 || this.data.licenseImg.indexOf('wxfile') === -1 || this.data.restaurantLicenseImg.indexOf('wxfile') === -1) { return wx.showModal({ title: '抱歉', content: '请补全您的资质信息,再进行下一步操作', showCancel: false }); } this.setData({ allHidden: true }); }, /** * 单项选择设置 * @param e */ radioChange: function radioChange(e) { console.log('radio发生change事件,携带value值为:', e.detail.value); }, /** * 选择地区 * @param e */ bindChange: function bindChange(e) { // console.log(e); var val = e.detail.value; var t = this.data.values; var cityData = this.data.cityData; if (val[0] !== t[0]) { console.log('province no '); var citys = []; var countys = []; for (var i = 0; i < cityData[val[0]].sub.length; i++) { citys.push(cityData[val[0]].sub[i].name); } for (var _i = 0; _i < cityData[val[0]].sub[0].sub.length; _i++) { countys.push(cityData[val[0]].sub[0].sub[_i].name); } this.setData({ province: this.data.provinces[val[0]], city: cityData[val[0]].sub[0].name, citys: citys, county: cityData[val[0]].sub[0].sub[0].name, countys: countys, values: val, value: [val[0], 0, 0] }); return; } if (val[1] !== t[1]) { console.log('city no'); var _countys = []; for (var _i2 = 0; _i2 < cityData[val[0]].sub[val[1]].sub.length; _i2++) { _countys.push(cityData[val[0]].sub[val[1]].sub[_i2].name); } this.setData({ city: this.data.citys[val[1]], county: cityData[val[0]].sub[val[1]].sub[0].name, countys: _countys, values: val, value: [val[0], val[1], 0] }); return; } if (val[2] !== t[2]) { // console.log('county no') this.setData({ county: this.data.countys[val[2]], values: val, value: [val[0], val[1], val[2]] }); return; } }, /** * 地区显示开关 */ open: function open() { this.setData({ condition: !this.data.condition }); }, /** * 添加店铺图片 */ addPic: function addPic() { this.setData({ showMain: false }); }, /** * 选择地址 */ addMapSite: function addMapSite() { var that = this; wx.chooseLocation({ success: function success(res) { // console.log(res) that.setData({ shopAddress: res.name || res.address || '添加地图标记' }); } }); // todo 添加地址后展示地址 }, /** * 保存上传后的店铺图片 */ saveShopImg: function saveShopImg() { this.setData({ showMain: true }); if (this.data.upStatus === 1) { this.setData({ addPicText: '重新上传图片' }); } }, /** * 上传门脸图 */ upFacePic: function upFacePic(e) { var that = this; wx.chooseImage({ count: 1, // 默认9 sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 success: function success(res) { // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片 var tempFilePaths = res.tempFilePaths[0]; // console.log(tempFilePaths) if (e.currentTarget.dataset.shop === 'faceImg') { that.setData({ faceImg: tempFilePaths }); } else if (e.currentTarget.dataset.shop === 'insideImg') { that.setData({ insideImg: tempFilePaths }); } else if (e.currentTarget.dataset.shop === 'IdFaceImg') { that.setData({ IdFaceImg: tempFilePaths }); } else if (e.currentTarget.dataset.shop === 'licenseImg') { that.setData({ licenseImg: tempFilePaths }); } else if (e.currentTarget.dataset.shop === 'restaurantLicenseImg') { that.setData({ restaurantLicenseImg: tempFilePaths }); } that.setData({ upStatus: 1 }); } }); }, /** * 显示资质信息 */ nextStep: function nextStep() { if (this.data.shopAddress === '添加地图标记' || this.data.insideImg.indexOf('wxfile') === -1 || this.data.faceImg.indexOf('wxfile') === -1 || !this.data.addressDetail || !this.data.lxrName || !this.data.lxrPhone) { return wx.showModal({ title: '抱歉', content: '请补全相关信息,再进行下一步操作', showCancel: false }); } this.setData({ hiddenMain: true }); }, /** * 生命周期函数--监听页面加载 */ onLoad: function onLoad(e) { // TODO: onLoad var that = this; tcity.init(that); var cityData = that.data.cityData; var provinces = []; var citys = []; var countys = []; for (var i = 0; i < cityData.length; i++) { provinces.push(cityData[i].name); } // console.log('省份完成') for (var _i3 = 0; _i3 < cityData[0].sub.length; _i3++) { citys.push(cityData[0].sub[_i3].name); } // console.log('city完成') for (var _i4 = 0; _i4 < cityData[0].sub[0].sub.length; _i4++) { countys.push(cityData[0].sub[0].sub[_i4].name); } that.setData({ 'provinces': provinces, 'citys': citys, 'countys': countys, 'province': cityData[0].name, 'city': cityData[0].sub[0].name, 'county': cityData[0].sub[0].sub[0].name }); // console.log('初始化完成') console.log(e); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function onReady() { // TODO: onReady }, /** * 生命周期函数--监听页面显示 */ onShow: function onShow() { // TODO: onShow }, /** * 生命周期函数--监听页面隐藏 */ onHide: function onHide() { // TODO: onHide }, /** * 生命周期函数--监听页面卸载 */ onUnload: function onUnload() { // TODO: onUnload }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function onPullDownRefresh() { // TODO: onPullDownRefresh } }); //# sourceMappingURL=businessCooperation.js.map
macDetailCallback("c4ffbc200000/28",[{"a":"85, Sec.4, Chung-Ching Rd., Ta-Ya District Taichung TW 428","o":"Mobiletron Electronics Co., Ltd","d":"2017-10-22","t":"add","s":"ieee","c":"TW"}]);
import entries from 'object.entries'; import slug from 'slugg'; import ref from '@mapbox/mapbox-gl-style-spec/reference/latest'; import { layerTypes, groupedExpressions } from './types'; /* This object powers the sidebar navigation for the Style Specification page. IMPORTANT: Match the heading (h2, h3) and <Property> hierarchy found in each respective page. */ const icons = { paint: 'paint', layout: 'line' }; // generates subnav using the style-spec reference data function makeSubNav(entry, section, level) { return entries(entry) .sort() .reduce((arr, [name]) => { if ( [ 'vector', 'raster', 'raster-dem', 'geojson', 'image', 'video' ].indexOf(section) > -1 && (name === '*' || name === 'type') ) { return arr; } else { const sectionName = section ? section.split('-')[0] : undefined; const icon = section && sectionName ? icons[sectionName] : undefined; arr.push({ text: name, slug: `${section ? `${section}-` : ''}${name}`, level, ...(icon && { icon: icon }) }); } return arr; }, []); } export const styleSpecNavigation = [ { title: 'Introduction', path: '/mapbox-gl-js/style-spec/' }, { title: 'Root', path: '/mapbox-gl-js/style-spec/root/', subnav: makeSubNav(ref.$root, null, 2) }, { title: 'Sources', path: '/mapbox-gl-js/style-spec/sources/', subnav: [ { text: 'vector', slug: 'vector', level: 2 }, ...makeSubNav(ref.source_vector, 'vector', 3), { text: 'raster', slug: 'raster', level: 2 }, ...makeSubNav(ref.source_raster, 'raster', 3), { text: 'raster-dem', slug: 'raster-dem', level: 2 }, ...makeSubNav(ref.source_raster_dem, 'raster-dem', 3), { text: 'geojson', slug: 'geojson', level: 2 }, ...makeSubNav(ref.source_geojson, 'geojson', 3), { text: 'image', slug: 'image', level: 2 }, ...makeSubNav(ref.source_image, 'image', 3), { text: 'video', slug: 'video', level: 2 }, ...makeSubNav(ref.source_video, 'video', 3) ] }, { title: 'Layers', path: '/mapbox-gl-js/style-spec/layers/', subnav: layerTypes.reduce((arr, type) => { arr.push({ text: type, slug: type, level: 2 }); const thirdLevelItems = [ ...makeSubNav(ref[`layout_${type}`], `layout-${type}`, 3), ...makeSubNav(ref[`paint_${type}`], `paint-${type}`, 3) ].sort((a, b) => a.text.localeCompare(b.text)); arr = arr.concat(thirdLevelItems); return arr; }, []) }, { title: 'Expressions', path: '/mapbox-gl-js/style-spec/expressions/', subnav: groupedExpressions.reduce((arr, group) => { arr.push({ text: group.name, slug: `${slug(group.name)}`, level: 2 }); const thirdLevelItems = group.expressions.map((g) => { return { text: g.name, slug: `${group.name === 'Types' ? 'types-' : ''}${ slug(g.name) || g.name }`, level: 3 }; }); arr = arr.concat(thirdLevelItems); return arr; }, []) }, { title: 'Types', path: '/mapbox-gl-js/style-spec/types/', subnav: [ { text: 'Color', slug: 'color', level: 2 }, { text: 'Formatted', slug: 'formatted', level: 2 }, { text: 'ResolvedImage', slug: 'resolvedimage', level: 2 }, { text: 'String', slug: 'string', level: 2 }, { text: 'Boolean', slug: 'boolean', level: 2 }, { text: 'Number', slug: 'number', level: 2 }, { text: 'Array', slug: 'array', level: 2 } ] }, { title: 'Sprite', path: '/mapbox-gl-js/style-spec/sprite/' }, { title: 'Glyphs', path: '/mapbox-gl-js/style-spec/glyphs/' }, { title: 'Transition', path: '/mapbox-gl-js/style-spec/transition/', subnav: makeSubNav(ref.transition, null, 2) }, { title: 'Light', path: '/mapbox-gl-js/style-spec/light/', subnav: makeSubNav(ref.light, null, 2) }, { title: 'Terrain', path: '/mapbox-gl-js/style-spec/terrain/', subnav: makeSubNav(ref.terrain, null, 2) }, { title: 'Other', path: '/mapbox-gl-js/style-spec/other/', tag: 'legacy', subnav: [ { text: 'Function', slug: 'function', level: 2 }, ...[ 'stops', 'property', 'base', 'type', 'default', 'colorSpace' ].map((text) => { return { text, slug: `function-${text}`, level: 3 }; }), { text: 'Other filter', slug: 'other-filter', level: 2 }, ...[ 'Existential filters', 'Comparison filters', 'Set membership filters', 'Combining filters' ].map((text) => { return { text, slug: slug(text), level: 3 }; }) ] } ];
from tests.package.test_python import TestPythonPackageBase class TestPythonPy2Subprocess32(TestPythonPackageBase): __test__ = True config = TestPythonPackageBase.config + \ """ BR2_PACKAGE_PYTHON=y BR2_PACKAGE_PYTHON_SUBPROCESS32=y """ sample_scripts = ["tests/package/sample_python_subprocess32.py"]
/** * ************************************ * * @module store.js * @author * @date * @description Redux 'single source of truth' * * ************************************ */ import { createStore, applyMiddleware } from 'redux'; import { composeWithDevTools } from 'redux-devtools-extension'; import thunk from 'redux-thunk'; import reducers from './reducers/index'; const store = createStore( reducers, composeWithDevTools(applyMiddleware(thunk)), ); export default store;
""" Ensure that we can use pathlib.Path objects in all relevant IO functions. """ import sys from pathlib import Path import numpy as np import scipy.io import scipy.io.wavfile from scipy._lib._tmpdirs import tempdir import scipy.sparse class TestPaths: data = np.arange(5).astype(np.int64) def test_savemat(self): with tempdir() as temp_dir: path = Path(temp_dir) / 'data.mat' scipy.io.savemat(path, {'data': self.data}) assert path.is_file() def test_loadmat(self): # Save data with string path, load with pathlib.Path with tempdir() as temp_dir: path = Path(temp_dir) / 'data.mat' scipy.io.savemat(str(path), {'data': self.data}) mat_contents = scipy.io.loadmat(path) assert (mat_contents['data'] == self.data).all() def test_whosmat(self): # Save data with string path, load with pathlib.Path with tempdir() as temp_dir: path = Path(temp_dir) / 'data.mat' scipy.io.savemat(str(path), {'data': self.data}) contents = scipy.io.whosmat(path) assert contents[0] == ('data', (1, 5), 'int64') def test_readsav(self): path = Path(__file__).parent / 'data/scalar_string.sav' scipy.io.readsav(path) def test_hb_read(self): # Save data with string path, load with pathlib.Path with tempdir() as temp_dir: data = scipy.sparse.csr_matrix(scipy.sparse.eye(3)) path = Path(temp_dir) / 'data.hb' scipy.io.hb_write(str(path), data) data_new = scipy.io.hb_read(path) assert (data_new != data).nnz == 0 def test_hb_write(self): with tempdir() as temp_dir: data = scipy.sparse.csr_matrix(scipy.sparse.eye(3)) path = Path(temp_dir) / 'data.hb' scipy.io.hb_write(path, data) assert path.is_file() def test_mmio_read(self): # Save data with string path, load with pathlib.Path with tempdir() as temp_dir: data = scipy.sparse.csr_matrix(scipy.sparse.eye(3)) path = Path(temp_dir) / 'data.mtx' scipy.io.mmwrite(str(path), data) data_new = scipy.io.mmread(path) assert (data_new != data).nnz == 0 def test_mmio_write(self): with tempdir() as temp_dir: data = scipy.sparse.csr_matrix(scipy.sparse.eye(3)) path = Path(temp_dir) / 'data.mtx' scipy.io.mmwrite(path, data) def test_netcdf_file(self): path = Path(__file__).parent / 'data/example_1.nc' scipy.io.netcdf_file(path) def test_wavfile_read(self): path = Path(__file__).parent / 'data/test-8000Hz-le-2ch-1byteu.wav' scipy.io.wavfile.read(path) def test_wavfile_write(self): # Read from str path, write to Path input_path = Path(__file__).parent / 'data/test-8000Hz-le-2ch-1byteu.wav' rate, data = scipy.io.wavfile.read(str(input_path)) with tempdir() as temp_dir: output_path = Path(temp_dir) / input_path.name scipy.io.wavfile.write(output_path, rate, data)
from jinfo.tables import DNA_VOCAB, AA_VOCAB class BaseAlignment: """ Iterator which holds sequence alignments and the respective sequence labels """ def __init__( self, aligned_sequences: list, labels: list = None, vocab: set = None ) -> None: self.seqs = aligned_sequences self.seqs_str = [seq_obj.seq for seq_obj in self.seqs] self.vocab = vocab if labels: self.labels = labels else: self.labels = [seq.label for seq in aligned_sequences] return def __iter__(self): self.index = 0 return self def __next__(self): if self.index < len(self.seqs): next_seq = self.seqs[self.index] self.index += 1 return next_seq else: raise StopIteration def __str__(self): str_out = "" for seq_obj in self.seqs: str_out += f"{seq_obj}\n" return str_out def calc_tree(self): """ Calculate a phylogenetic tree from the alignment ***Requires FastTree2 package*** Returns: Tree object """ from jinfo.utils.calc_phylo_tree import calc_phylo_tree return calc_phylo_tree(self) def identity_filter(self, identity_limit: int = 90, show_id_array: bool = False): """ Filter similar sequences from the alignment Remove sequences form the alignment with percantage identity above a certain limit Returns: filtered Alignment object """ from jinfo.utils.remove_degenerate_seqs import remove_degenerate_seqs return remove_degenerate_seqs( alignment_obj=self, identity_limit=identity_limit, show_id_array=show_id_array, ) pass
/* * @name Video Pixels * @frame 320,240 * @description <p>Load a video, manipulate its pixels and draw to canvas. * <p><em><span class="small"> To run this example locally, you will need the * <a href="http://p5js.org/reference/#/libraries/p5.dom">p5.dom library</a> * at least one video file, and a running <a href="https://github.com/processing/p5.js/wiki/Local-server">local server</a>.</span></em></p> */ var fingers; function setup() { // specify multiple formats for different browsers space = createVideo(['media/anni003.mp4']); space.loop(); // set the video to loop and start playing space.volume(0);//we set the volume to 0 because we don't want //sound space.hide(); // noStroke(); //fill(0); createCanvas(windowWidth,windowHeight); // noLoop(); } function draw() { background(255); space.loadPixels(); // var stepSize = round(constrain(mouseX / 8, 6, 64)); for (var y=0; y<height; y+=70) { for (var x=0; x<width; x+=70) { var i = y * width + x; var darkness = (255 - space.pixels[i*4 % (space.pixels.length / 4)])/255; var radius = 25;//darkness*25;//stepSize * darkness; println(space.pixels); fill( space.pixels[i % space.pixels.length], space.pixels[i*2 % space.pixels.length], space.pixels[i*3 % space.pixels.length] ); ellipse(x, y, radius, radius); } } }
// Add _ownerId to every study var users = db.user.find({projects: {$exists: true, $ne: []}}, {"projects.id": 1}); for (var i = 0; i < users.length(); i++) { var user = users[i]; var projectIds = []; for (var j = 0; j < user.projects.length; j++) { projectIds.push(user.projects[j].id); } // Add _ownerId to all the studies belonging to these projects db.study.update({"_projectId": {$in: projectIds}}, {$set: {_ownerId: user["_id"]}}, {multi: 1}); }
const path = require('path') var prod = process.env.NODE_ENV === 'production' module.exports = { target: 'dist', source: 'src', wpyExt: '.wpy', eslint: true, cliLogs: !prod, web: { htmlTemplate: path.join('src', 'index.template.html'), htmlOutput: path.join('web', 'index.html'), jsOutput: path.join('web', 'index.js') }, resolve: { alias: { '@': path.join(__dirname, 'src'), 'utils': path.join(__dirname, 'src/utils'), 'mixins': path.join(__dirname, 'src/mixins'), 'config': path.join(__dirname, 'src/config'), 'packages': path.join(__dirname, 'src/packages') }, aliasFields: ['wepy'], modules: ['node_modules'] }, compilers: { less: { compress: prod }, babel: { sourceMap: true, presets: [ 'env', 'es2015', 'stage-1' ], plugins: [ 'transform-class-properties', 'transform-decorators-legacy', 'transform-object-rest-spread', 'transform-export-extensions', 'transform-node-env-inline' ] } }, plugins: { px2units: { filter: /\.wxss$/ } }, appConfig: { noPromiseAPI: ['createSelectorQuery'] } } if (prod) { // 压缩less module.exports['less'] = { 'compress': true } // 压缩js module.exports.plugins = { px2units: { filter: /\.wxss$/ }, uglifyjs: { filter: /\.js$/, config: {} }, imagemin: { filter: /\.(jpg|png|jpeg)$/, config: { jpg: { quality: 80 }, png: { quality: 80 } } } } }
import requests import json from requests.auth import HTTPBasicAuth import pandas as pd from io import StringIO from urllib.parse import urljoin class ScienceServerApi: _token = None _enviroments = { "localhost": "http://localhost/dri/api/", "linea-dev": "https://scienceserver-dev.linea.gov.br/dri/api/", "linea": "https://scienceserver.linea.gov.br/dri/api/", } _base_api_url = None def __init__(self, token, host="linea"): self._base_api_url = self._enviroments[host] self._token = token def _generate_internal_name(self, name): return "".join(x if x.isalnum() else "_" for x in name) def _get_request(self, url, params): try: r = requests.get( url, params=params, headers=dict( { "Accept": "application/json", "Content-Type": "application/json", "Authorization": "Token {}".format(self._token), } ), ) if r.status_code == 200: return r.json() elif r.status_code == 403: # Não enviou as credenciais de usuario message = json.loads(str(r.text))["detail"] return dict( { "success": False, "message": message, "status_code": r.status_code, } ) elif r.status_code == 404: # Mensagem de erro pra Not Found. message = r.text return dict( { "success": False, "message": message, "status_code": r.status_code, } ) else: return dict( { "success": False, "status_code": r.status_code, } ) except requests.exceptions.HTTPError as errh: message = "Http Error: {}".format(errh) return dict( { "success": False, "message": message, } ) except requests.exceptions.ConnectionError as errc: message = "Connection Error: {}".format(errc) return dict( { "success": False, "message": message, } ) except requests.exceptions.Timeout as errt: message = "Timeout Error: {}".format(errt) return dict( { "success": False, "message": message, } ) except requests.exceptions.RequestException as err: message = "Request Error: {}".format(err) return dict( { "success": False, "message": message, } ) def _post_request(self, url, payload): try: r = requests.post( url, data=json.dumps(payload), headers=dict( { "Accept": "application/json", "Content-Type": "application/json", "Authorization": "Token {}".format(self._token), } ), ) if r.status_code == 200: return r.json() elif r.status_code == 403: # Não enviou as credenciais de usuario message = json.loads(str(r.text))["detail"] return dict( { "success": False, "message": message, "status_code": r.status_code, } ) elif r.status_code == 404: # Mensagem de erro pra Not Found. message = r.text return dict( { "success": False, "message": message, "status_code": r.status_code, } ) else: return dict( { "success": False, "status_code": r.status_code, } ) except requests.exceptions.HTTPError as errh: message = "Http Error: {}".format(errh) return dict( { "success": False, "message": message, } ) except requests.exceptions.ConnectionError as errc: message = "Connection Error: {}".format(errc) return dict( { "success": False, "message": message, } ) except requests.exceptions.Timeout as errt: message = "Timeout Error: {}".format(errt) return dict( { "success": False, "message": message, } ) except requests.exceptions.RequestException as err: message = "Request Error: {}".format(err) return dict( { "success": False, "message": message, } ) def _delete_request(self, url): try: r = requests.delete( url, headers=dict( { "Accept": "application/json", "Authorization": "Token {}".format(self._token), } ), ) if r.status_code == 204: return True elif r.status_code == 400: return dict( { "success": False, "message": "The server failed to perform the operation.", "status_code": r.status_code, } ) elif r.status_code == 403: # Não enviou as credenciais de usuario message = json.loads(str(r.text))["detail"] return dict( { "success": False, "message": message, "status_code": r.status_code, } ) elif r.status_code == 404: # Mensagem de erro pra Not Found. message = json.loads(str(r.text))["detail"] return dict( { "success": False, "message": message, "status_code": r.status_code, } ) else: return dict( { "success": False, "status_code": r.status_code, } ) except requests.exceptions.HTTPError as errh: message = "Http Error: {}".format(errh) return dict( { "success": False, "message": message, } ) except requests.exceptions.ConnectionError as errc: message = "Connection Error: {}".format(errc) return dict( { "success": False, "message": message, } ) except requests.exceptions.Timeout as errt: message = "Timeout Error: {}".format(errt) return dict( { "success": False, "message": message, } ) except requests.exceptions.RequestException as err: message = "Request Error: {}".format(err) return dict( { "success": False, "message": message, } ) def get_catalog(self, id): url = urljoin(self._base_api_url, "catalog/") params = dict({"id": int(id)}) result = self._get_request(url, params) if "success" in result and result["success"] is False: return result if len(result) > 0: data = result[0] url = urljoin(self._base_api_url, "/target/#cv/%s" % str(data["id"])) catalog = dict( { "id": data["id"], "owner": data["owner"], "date": data["prd_date"], "internal_name": data["prd_name"], "display_name": data["prd_display_name"], "display_name": data["prd_display_name"], "tbl_schema": data["tbl_schema"], "tbl_name": data["tbl_name"], "rows": data["tbl_rows"], "url": url, } ) return catalog else: # Retorna None se nenhum catalogo for encontrado # Pode aconter quando o id não existe ou se o usuario não tiver permissão ao id que está tentando acessar. return None def __register_target_list( self, name, data, cls="objects", releases=[], description=None, base64=False, mime="csv", ): url = urljoin(self._base_api_url, "import_target_list/") payload = dict( { "type": "catalog", "class": cls, "name": self._generate_internal_name(name), "displayName": name, "releases": releases, "isPublic": False, "description": description, "base64": base64, "mime": mime, "csvData": data, } ) result = self._post_request(url, payload) if "success" in result and result["success"] is False: return result if result["success"] is True: # Importou com sucesso catalog = self.get_catalog(result["product"]) return catalog def target_list_from_list( self, name, data, cls="objects", releases=[], description=None, ): # Criar um dataframe e converter para string csv. df = pd.DataFrame(data) f = StringIO() df.to_csv( f, sep=";", header=True, index=False, ) str_csv = f.getvalue() return self.__register_target_list( name, str_csv, cls, releases, description, base64=False, mime="csv" ) def target_list_from_df( self, name, df, cls="objects", releases=[], description=None, ): # Converter para string csv. f = StringIO() df.to_csv( f, sep=";", header=True, index=False, ) str_csv = f.getvalue() return self.__register_target_list( name, str_csv, cls, releases, description, base64=False, mime="csv" ) def remove_target_list(self, id): url = urljoin(self._base_api_url, "catalog/%s/" % int(id)) result = self._delete_request(url) if result is True: return dict( {"success": True, "message": "Target List successfully removed"} ) else: return result # from random import randint # token = "c7aef9b2fbe8e9b5dea02e456c8075877b1dc841" # name = "Teste %s" % randint(10, 50) # data = "RA;DEC;Mag_g\n10;20;24.5\n25;15;22.7" # data = [{"RA": 10, "DEC": 20, "Mag_g": 24.5}, {"RA": 25, "DEC": 15, "Mag_g": 22.7}] # ss = ScienceServerApi(token, host="localhost") # catalog = ss.target_list_from_list(name=name, data=data) # print(catalog) # df = pd.DataFrame(data) # catalog = ss.target_list_from_df(name=name, df=df) # print(catalog) # catalog = ss.get_catalog(26) # print(catalog) # catalog = ss.remove_target_list(100) # print(catalog)
from io import open import urllib2 from bs4 import BeautifulSoup import re import urlparse import time import numpy as np class Get(object): def __init__(self): self.tag = set() self.links = set() def iniPar(self, url) : # proxies = {'http':'http://10.10.10.10:8765','https':'https://10.10.10.10:8765'} header = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.63 Safari/537.36'} req = urllib2.Request(url, headers=header) response = urllib2.urlopen(req) cont = response.read() soup = BeautifulSoup(cont, 'html.parser', from_encoding='utf-8') tags = soup.find_all('a', href=re.compile(r'^/tag/')) if len(tags) ==0 : print 'no tag' return for a in tags: text = a.get_text() #tail = urllib2.quote(text.encode('utf8')) #newlink = 'https://book.douban.com/tag/' + tail self.tag.add(text) def getLinks(self): for tag in self.tag: print ( "cate: " + tag+"\n") tail = urllib2.quote(tag.encode('utf8')) link = 'https://book.douban.com/tag/' + tail hds=[{'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6'},\ {'User-Agent':'Mozilla/5.0 (Windows NT 6.2) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.12 Safari/535.11'},\ {'User-Agent': 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)'}] #header = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.63 Safari/537.36'} count = 0 url = link + '?start='+str(count)+'&type=T' #type can change from T, R and S, with respect to different ranking method for books while (count < 1000 ): #print "page: " + str(count/20 + 1) print("page: " +unicode(str(count/20 + 1))+"\n") #print url time.sleep(np.random.rand()) #time.sleep(random.random()) try: req = urllib2.Request(url, headers=hds[(count/20)%len(hds)]) response = urllib2.urlopen(req) cont = response.read() soup = BeautifulSoup(cont, 'html.parser', from_encoding='utf-8') links = soup.find_all('a', class_='nbg',href=re.compile(r'^https://book.douban.com/subject/+\d+/$')) #for a in links: # self.links.add(a['href']) if len(links) ==0: print 'no book' break print "add: "+str(len(links)) for b in links: self.links.add(b['href']) except: print ('failed') count = count + 20 url = link + '?start='+str(count)+'&type=T' #print len(self.links) fout = open('link_set.txt', 'w') for link in self.links: fout.write(link + "\n") if __name__ == '__main__': root_url = "https://book.douban.com/tag/?view=type&icn=index-sorttags-all" obj_spider = Get() obj_spider.iniPar(root_url) obj_spider.getLinks()
import React from 'react' import PropTypes from 'prop-types' class Background extends React.Component { static propTypes = { backgroundState: PropTypes.string } constructor(props) { super(props) this.state = { backgroundState: this.props.backgroundState } } render() { return ( <div className='lines'> <div className='lines__vertical lines__vertical--1'></div> <div className='lines__vertical lines__vertical--2'></div> <div className='lines__vertical lines__vertical--3'></div> <div className='lines__horizontal lines__horizontal--1'></div> <div className='lines__horizontal lines__horizontal--2'></div> <div className='lines__horizontal lines__horizontal--3'></div> </div> ) } } export default Background
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 14 08:30:06 2021 @author: argenta """ import sympy as sp x, y, z, l, E, A, Ao, t, nu = sp.symbols('x, y, z, l, E, A, Ao, t, nu') t_w, b, t_f, b_f, h = sp.symbols('t_w, b, t_f, b_f, h') #h é a distância entre faces internas de mesas #derivadas das funções de forma (de /home/markinho/Dropbox/DocumentaçõesMK/MEFaplicado-mkdocs/docs/porticos_espacial/Codigos/Derivando-FuncoesFormaPorticoEspacial2nos.py): #trelica e torcao Bt = sp.Matrix([[-1/l],[ 1/l]]) #viga direção de y Bvy = -y*sp.Matrix([[ 12*x/l**3], [-1/l + 6*x/l**2], [ -12*x/l**3], [ 1/l + 6*x/l**2]]) #viga direção de z Bvz = -z*sp.Matrix([[ 12*x/l**3], [-1/l + 6*x/l**2], [ -12*x/l**3], [ 1/l + 6*x/l**2]]) # matriz das derivadas das funções de interpolação do pórtico # Bv = -s * sp.diff( sp.diff(Nn, r), r) # Bp = sp.Matrix([[ -1/l, 0, 0, 1/l, 0, 0 ], [ 0, Bv[0], Bv[1], 0, Bv[2], Bv[3] ] ]) ##vetor de deformações genérico ug0, ug1, ug2, ug3, ug4, ug5, ug6, ug7, ug8, ug9, ug10, ug11 = sp.symbols('ug0, ug1, ug2, ug3, ug4, ug5, ug6, ug7, ug8, ug9, ug10, ug11') UgN = sp.Matrix([ug0, ug6]) UgT = sp.Matrix([ug3, ug9]) UgMy = sp.Matrix([ug2, ug5, ug8, ug11]) UgMz = sp.Matrix([ug1, ug4, ug7, ug10]) #deformacoes epsilonN = (Bt.T*UgN)[0] epsilonT = (Bt.T*UgT)[0] epsilonMy = (Bvy.T*UgMy)[0] epsilonMz = (Bvz.T*UgMz)[0] #tensoes sigmaN = epsilonN*E sigmaT = epsilonT*E/(2*(1 + nu)) sigmaMy = epsilonMy*E sigmaMz = epsilonMz*E #integrações normais = sigmaN*A torsao = 2*sigmaT*t*Ao momentoy = 2 * t_w * sp.integrate( y * sigmaMy, (y, -h/2, h/2 ) ) + 2 * b_f * sp.integrate( y * sigmaMy, (y, h/2, h/2 + t_f ) ) momentoz = 2 * t_f * sp.integrate( z * sigmaMz, (z, -b_f/2, b_f/2 ) ) + 2 * h * sp.integrate( z * sigmaMz, (z, b_f/2 - t_w, b_f/2 ) ) cortey = sp.diff(momentoy, x) cortez = sp.diff(momentoz, x)
module.exports={A:{A:{"2":"O D G E A B lB"},B:{"1":"M KB N R YB T PB","2":"C I F P J K L"},C:{"2":"0 1 2 3 4 5 6 7 8 9 vB OB H Y O D G E A B C I F P J K L Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB NB GB HB IB JB Q LB FB W V U QB RB kB jB","260":"SB TB UB VB WB M KB N sB R"},D:{"1":"SB TB UB VB WB M KB N R YB T","2":"0 1 2 3 4 5 6 7 8 9 H Y O D G E A B C I F P J K L Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB","132":"EB NB GB HB IB JB Q LB FB W V U QB RB","1025":"PB eB cB 2B"},E:{"2":"H Y O D G E A B dB aB fB gB hB iB ZB","772":"C I F S X mB nB"},F:{"1":"GB HB IB JB Q LB FB W V U","2":"0 E B C P J K L Z a b c d e f g h i j k l m n o p q r s t u v w x y z oB pB qB rB S XB tB X","132":"1 2 3 4 5 6 7 8 9 AB BB CB EB"},G:{"2":"G aB uB MB wB xB yB zB 0B 1B bB 3B 4B","772":"F 5B 6B 7B 8B 9B AC BC"},H:{"2":"CC"},I:{"1":"N","2":"OB H DC EC FC GC MB HC IC"},J:{"2":"D A"},K:{"2":"A B C DB S XB X"},L:{"1":"T"},M:{"260":"M"},N:{"2":"A B"},O:{"2":"JC"},P:{"1":"PC QC","2":"H KC LC MC","132":"NC OC ZB"},Q:{"132":"RC"},R:{"2":"SC"},S:{"2":"TC"}},B:5,C:"Feature Policy"};
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `panw_utils` package.""" import unittest from panw_utils import panw_utils class TestPanw_utils(unittest.TestCase): """Tests for `panw_utils` package.""" def setUp(self): """Set up test fixtures, if any.""" def tearDown(self): """Tear down test fixtures, if any.""" def test_000_something(self): """Test something."""
// @noflow import * as React from 'react' import {is, launch} from 'effector' import { useStore as commonUseStore, useStoreMap as commonUseStoreMap, } from './useStore' import {useList as commonUseList} from './useList' class Defer { constructor() { this.req = new Promise((rs, rj) => { this.rs = rs this.rj = rj }) } } const Scope = React.createContext(null) export const {Provider} = Scope function useScopeStore(store) { const scope = React.useContext(Scope) return scope.find(store).meta.wrapped } export function createStoreConsumer(store) { return props => { const state = useStore(store) return props.children(state) } } export function createContextComponent(store, context, renderProp) { const Consumer = createStoreConsumer(store) return class RenderComponent extends React.Component { static contextType = context renderProp = state => renderProp(this.props, state, this.context) render() { return <Consumer>{this.renderProp}</Consumer> } } } export function createComponent(shape) { throw new Error('not implemented') } export function createReactState(store, Component) { const Store = createStoreConsumer(store) const ConnectedComponent = props => ( <Store>{state => <Component {...props} {...state} />}</Store> ) const wrappedComponentName = Component.displayName || Component.name || 'Unknown' ConnectedComponent.displayName = `Connect(${wrappedComponentName})` return ConnectedComponent } export function connect(Component) { return store => createReactState(store, Component) } /** useStore wrapper for scopes */ export function useStore(store) { return commonUseStore(useScopeStore(store)) } /** useList wrapper for scopes */ export function useList(store, opts) { return commonUseList(useScopeStore(store), opts) } /** useStoreMap wrapper for scopes */ export function useStoreMap({store, keys, fn}) { return commonUseStoreMap({ store: useScopeStore(store), keys, fn, }) } /** bind event to scope works like React.useCallback, but for scopes */ export function useEvent(event) { const scope = React.useContext(Scope) const unit = scope.find(event) const result = is.effect(event) ? params => { const req = new Defer() launch(unit, {params, req}) return req.req } : payload => { launch(unit, payload) return payload } return React.useCallback(result, [scope, event]) }
import copy import torch.nn as nn from .base import Stem, Head, MBConv from .util import make_divisible class efficientnetv2(nn.Module): def __init__(self, cfg, num_classes=1000): super().__init__() self.cfg = copy.deepcopy(cfg) out_ch = make_divisible(self.cfg['out_ch'] * self.cfg['width_mult'], self.cfg['divisor']) features = [] features.append(Stem(self.cfg['in_ch'], out_ch, kernel_size=self.cfg['kernel_size'], stride=self.cfg['stride'], actn_layer=self.cfg['actn_layer'], skip_init=True)) layers = self.cfg['layers'] input_ch = out_ch for layer in layers: out_ch = make_divisible(layer['channels'] * self.cfg['width_mult'], self.cfg['divisor']) ft = [] for i in range(layer['nums']): stride = 1 if i == 0 else layer['stride'] norm_layer = layer['norm_layer'] if layer['norm_layer'] \ else nn.BatchNorm2d ft.append(MBConv(input_ch, out_ch, fused=layer['fused'], expansion=layer['expansion'], kernel_size=layer['kernel_size'], stride=stride, norm_layer=norm_layer, dropout_ratio=layer['dropout_ratio'], reduction_ratio=layer['reduction_ratio'], drop_connect_ratio=layer['dc_ratio'], actn_layer=layer['actn_layer'], use_se=layer['use_se'], skip_init=True)) input_ch = out_ch features.append(nn.Sequential(*ft)) self.features = nn.Sequential(*features) out_ch = make_divisible(1280 * self.cfg['width_mult'], self.cfg['divisor']) self.conv = Head(input_ch, out_ch, actn_layer=self.cfg['actn_layer'], skip_init=True) self.avgpool = nn.AdaptiveAvgPool2d(1) self.fc = nn.Linear(out_ch, num_classes) self.init_weights() def init_weights(self): for _, module in self.named_modules(): if isinstance(module, nn.Conv2d): nn.init.kaiming_normal_(module.weight, mode='fan_out', nonlinearity='relu') elif isinstance(module, nn.BatchNorm2d): nn.init.ones_(module.weight) nn.init.zeros_(module.bias) elif isinstance(module, nn.Linear): module.weight.data.normal_(0, 0.001) module.bias.data.zero_() def forward(self, x): x = self.features(x) x = self.conv(x) x = self.avgpool(x) x = x.view(x.size(0), -1) x = self.fc(x) return x
'use strict' var assert = require('assert') //------ AWS ----------- process.env.AWS_EXECUTION_ENV = 'AWS_Lambda_nodejs6.10' process.env.LAMBDA_TASK_ROOT = '/var/task' var isServerless = require('../') assert(isServerless.result) assert.equal(isServerless.whichOne,'AWS')
import datetime import json import logging import os import secrets import time import warnings from logging import Logger from pathlib import Path from typing import Any, Dict, List, Optional from unittest import TestCase import boto3 import pytz from mypy_boto3_sqs.type_defs import MessageTypeDef from .index import TIMESTAMP_METADATA, FieldUpdate, ImgServer, MyJsonFormatter PERM_RESP_MAX_AGE = 365 * 24 * 60 * 60 TEMP_RESP_MAX_AGE = 20 * 60 GENERATED_KEY_PREFIX = 'prefix/' REGION = 'us-east-1' CSS_MIME = 'text/css' GIF_MIME = "image/gif" JPEG_MIME = 'image/jpeg' JS_MIME = 'text/javascript' PNG_MIME = 'image/png' SOURCEMAP_MIME = 'application/octet-stream' WEBP_MIME = "image/webp" CSS_NAME = 'スタイル.css' CSS_NAME_Q = '%E3%82%B9%E3%82%BF%E3%82%A4%E3%83%AB.css' JPG_NAME = 'image.jpg' JPG_NAME_U = 'image.JPG' JPG_NAME_MB = 'テスト.jpg' JPG_NAME_MB_Q = '%E3%83%86%E3%82%B9%E3%83%88.jpg' JPG_WEBP_NAME = 'image.jpg.webp' JPG_WEBP_NAME_U = 'image.JPG.webp' JPG_WEBP_NAME_MB = 'テスト.jpg.webp' JPG_WEBP_NAME_MB_Q = '%E3%83%86%E3%82%B9%E3%83%88.jpg.webp' JS_NAME = 'フィズバズ.js' JS_NAME_Q = '%E3%83%95%E3%82%A3%E3%82%BA%E3%83%90%E3%82%BA.js' MIN_CSS_NAME = 'スタイル.min.css' MIN_CSS_NAME_Q = '%E3%82%B9%E3%82%BF%E3%82%A4%E3%83%AB.min.css' MIN_JS_NAME = 'スクリプト.min.js' MIN_JS_NAME_Q = '%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88.min.js' SOURCEMAP_NAME = 'スクリプト.js.map' SOURCEMAP_NAME_Q = '%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88.js.map' DUMMY_DATETIME = datetime.datetime(2000, 1, 1) CHROME_ACCEPT_HEADER = 'image/avif,image/webp,image/apng,image/*,*/*;q=0.8' OLD_SAFARI_ACCEPT_HEADER = ( 'image/png,image/svg+xml,image/*;q=0.8,video/*;q=0.8,*/*;q=0.5') CACHE_CONTROL_PERM = f'public, max-age={PERM_RESP_MAX_AGE}' CACHE_CONTROL_TEMP = f'public, max-age={TEMP_RESP_MAX_AGE}' def read_test_config(name: str) -> str: path = f'{os.getcwd()}/config/test/{name}' with open(path, 'r') as f: return f.read().strip() def generate_safe_random_string() -> str: return secrets.token_urlsafe(256 // 8) def create_img_server( log: Logger, name: str, expiration_margin: int) -> ImgServer: account_id = read_test_config('aws-account-id') sqs_name = f'test-{name}-{generate_safe_random_string()}' sess = boto3.Session( aws_access_key_id=read_test_config('access-key-id'), aws_secret_access_key=read_test_config('secret-access-key')) # https://github.com/boto/boto3/issues/454#issuecomment-380900404 warnings.filterwarnings( 'ignore', category=ResourceWarning, message='unclosed.*<ssl.SSLSocket.*>') sqs = sess.client('sqs', region_name=REGION) s3 = sess.client('s3', region_name=REGION) return ImgServer( log=log, region=REGION, sqs=sqs, s3=s3, generated_domain=f"{read_test_config('generated-bucket')}.s3.example.com", original_bucket=read_test_config('original-bucket'), generated_key_prefix=GENERATED_KEY_PREFIX, sqs_queue_url=( f'https://sqs.{REGION}.amazonaws.com/{account_id}/{sqs_name}'), perm_resp_max_age=PERM_RESP_MAX_AGE, temp_resp_max_age=TEMP_RESP_MAX_AGE, expiration_margin=expiration_margin) def get_test_sqs_queue_name_from_url(sqs_queue_url: str) -> str: return sqs_queue_url.split('/')[-1] def create_test_environment( log: Logger, name: str, expiration_margin: int, ) -> ImgServer: img_server = create_img_server(log, name, expiration_margin) img_server.sqs.create_queue( QueueName=get_test_sqs_queue_name_from_url(img_server.sqs_queue_url)) return img_server def clean_test_environment(img_server: ImgServer) -> None: img_server.sqs.delete_queue(QueueUrl=img_server.sqs_queue_url) def put_original( img_server: ImgServer, key: str, name: str, mime: str, ) -> datetime.datetime: path = f'{os.getcwd()}/samplefile/original/{name}' with open(path, 'rb') as f: img_server.s3.put_object( Body=f, Bucket=img_server.original_bucket, ContentType=mime, Key=key, ) return get_original_object_time(img_server, key) def put_generated( img_server: ImgServer, key: str, name: str, mime: str, timestamp: Optional[datetime.datetime] = None, ) -> None: path = f'{os.getcwd()}/samplefile/generated/{name}' metadata = {} if timestamp is not None: metadata[TIMESTAMP_METADATA] = timestamp.astimezone( pytz.utc).strftime('%Y-%m-%dT%H:%M:%S.%fZ') with open(path, 'rb') as f: img_server.s3.put_object( Body=f, Bucket=img_server.generated_bucket, ContentType=mime, Key=key, Metadata=metadata) def get_original_object_time( img_server: ImgServer, key: str, ) -> datetime.datetime: res = img_server.s3.head_object(Bucket=img_server.original_bucket, Key=key) return res['LastModified'] def receive_sqs_message(img_server: ImgServer) -> Optional[Dict[str, Any]]: time.sleep(1.0) res = img_server.sqs.receive_message( QueueUrl=img_server.sqs_queue_url, MaxNumberOfMessages=1, VisibilityTimeout=1, WaitTimeSeconds=1) msgs: Optional[List[MessageTypeDef]] = res.get('Messages', None) if msgs is None or len(msgs) == 0: return None body: str = msgs[0]['Body'] obj: Dict[str, Any] = json.loads(body) return obj class BaseTestCase(TestCase): maxDiff = None def setUp(self) -> None: self._key_prefix = generate_safe_random_string() + '/' self._log = logging.getLogger(__name__) log_dir = f'{os.getcwd()}/work/test/imglambda/{self._key_prefix}' Path(log_dir).mkdir(parents=True, exist_ok=True) self._log_file = open(f'{log_dir}/test.log', 'w') log_handler = logging.StreamHandler() log_handler.setFormatter(MyJsonFormatter()) log_handler.setLevel(logging.DEBUG) log_handler.setStream(self._log_file) self._log.addHandler(log_handler) self._img_server = create_test_environment( self._log, 'imglambda', self.get_expiration_margin()) def get_expiration_margin(self) -> int: return 10 def put_original(self, name: str, mime: str) -> datetime.datetime: return put_original( self._img_server, f'{self._key_prefix}{name}', name, mime) def put_generated( self, name: str, mime: str, timestamp: Optional[datetime.datetime]) -> None: key = f'{self._img_server.generated_key_prefix}{self._key_prefix}{name}' put_generated(self._img_server, key, name, mime, timestamp) def receive_sqs_message(self) -> Optional[Dict[str, Any]]: return receive_sqs_message(self._img_server) def assert_no_sqs_message(self) -> None: self.assertIsNone(self.receive_sqs_message()) def assert_sqs_message(self, key: str) -> None: self.assertEqual( { 'version': 2, 'path': self._key_prefix + key, 'src': { 'bucket': self._img_server.original_bucket, 'prefix': '', }, 'dest': { 'bucket': self._img_server.generated_bucket, 'prefix': self._img_server.generated_key_prefix, }, }, self.receive_sqs_message()) def to_path(self, name: str) -> str: return f'/{self._key_prefix}{name}' def to_uri(self, name: str) -> str: return f'/{self._img_server.generated_key_prefix}{self._key_prefix}{name}' def tearDown(self) -> None: clean_test_environment(self._img_server) class ImgserverExpiredTestCase(BaseTestCase): def get_expiration_margin(self) -> int: return 60 * 60 * 24 * 2 def test_jpg_accepted_gen_orig(self) -> None: ts = self.put_original(JPG_NAME, JPEG_MIME) self.put_generated(JPG_WEBP_NAME, JPEG_MIME, ts) update = self._img_server.process( self.to_path(JPG_NAME), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_TEMP), update) self.assert_sqs_message(JPG_NAME) class ImgserverTestCase(BaseTestCase): # Test_JPGAcceptedS3EFS_L def test_jpg_accepted_gen_orig_l(self) -> None: self.jpg_accepted_gen_orig(JPG_WEBP_NAME, JPG_NAME, JPG_NAME) # Test_JPGAcceptedS3EFS_U def test_jpg_accepted_gen_orig_u(self) -> None: self.jpg_accepted_gen_orig(JPG_WEBP_NAME_U, JPG_NAME_U, JPG_NAME_U) # Test_JPGAcceptedS3EFS_MB def test_jpg_accepted_gen_orig_mb(self) -> None: self.jpg_accepted_gen_orig(JPG_WEBP_NAME_MB, JPG_NAME_MB, JPG_NAME_MB_Q) # JPGAcceptedS3EFS def jpg_accepted_gen_orig( self, gen_name: str, orig_name: str, path_name: str) -> None: ts = self.put_original(orig_name, JPEG_MIME) self.put_generated(gen_name, JPEG_MIME, ts) update = self._img_server.process( self.to_path(path_name), CHROME_ACCEPT_HEADER) self.assertEqual( FieldUpdate( res_cache_control=CACHE_CONTROL_PERM, origin_domain=self._img_server.generated_domain, uri=self.to_uri(f'{path_name}.webp'), ), update) self.assert_no_sqs_message() # Skipped: # # Test_PublicContentJPG # Test_JPGAcceptedS3NoEFS_L def test_jpg_accepted_gen_no_orig_l(self) -> None: self.jpg_accepted_gen_no_orig(JPG_WEBP_NAME, JPG_NAME, JPG_NAME) # Test_JPGAcceptedS3NoEFS_U def test_jpg_accepted_gen_no_orig_u(self) -> None: self.jpg_accepted_gen_no_orig(JPG_WEBP_NAME_U, JPG_NAME_U, JPG_NAME_U) # Test_JPGAcceptedS3NoEFS_MB def test_jpg_accepted_gen_no_orig_mb(self) -> None: self.jpg_accepted_gen_no_orig(JPG_WEBP_NAME_MB, JPG_NAME_MB, JPG_NAME_MB_Q) # JPGAcceptedS3NoEFS def jpg_accepted_gen_no_orig( self, gen_name: str, orig_name: str, path_name: str) -> None: self.put_generated(gen_name, JPEG_MIME, DUMMY_DATETIME) update = self._img_server.process( self.to_path(path_name), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_TEMP), update) self.assert_sqs_message(orig_name) # Test_JPGAcceptedNoS3EFS_L def test_jpg_accepted_no_gen_orig_l(self) -> None: self.jpg_accepted_no_gen_orig(JPG_NAME, JPG_NAME) # Test_JPGAcceptedNoS3EFS_U def test_jpg_accepted_no_gen_orig_u(self) -> None: self.jpg_accepted_no_gen_orig(JPG_NAME_U, JPG_NAME_U) # Test_JPGAcceptedNoS3EFS_MB def test_jpg_accepted_no_gen_orig_mb(self) -> None: self.jpg_accepted_no_gen_orig(JPG_NAME_MB, JPG_NAME_MB_Q) # JPGAcceptedNoS3EFS def jpg_accepted_no_gen_orig(self, orig_name: str, path_name: str) -> None: self.put_original(orig_name, JPEG_MIME) update = self._img_server.process( self.to_path(path_name), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_TEMP), update) self.assert_sqs_message(orig_name) # Test_JPGAcceptedNoS3NoEFS_L def test_jpg_accepted_no_gen_no_orig_l(self) -> None: self.jpg_accepted_no_gen_no_orig(JPG_NAME) # Test_JPGAcceptedNoS3NoEFS_U def test_jpg_accepted_no_gen_no_orig_u(self) -> None: self.jpg_accepted_no_gen_no_orig(JPG_NAME_U) # Test_JPGAcceptedNoS3NoEFS_MB def test_jpg_accepted_no_gen_no_orig_mb(self) -> None: self.jpg_accepted_no_gen_no_orig(JPG_NAME_MB_Q) # JPGAcceptedNoS3NoEFS def jpg_accepted_no_gen_no_orig(self, path_name: str) -> None: update = self._img_server.process( self.to_path(path_name), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_TEMP), update) self.assert_no_sqs_message() # Test_JPGUnacceptedS3EFS_L def test_jpg_unaccepted_gen_orig_l(self) -> None: self.jpg_unaccepted_gen_orig(JPG_WEBP_NAME, JPG_NAME, JPG_NAME) # Test_JPGUnacceptedS3EFS_U def test_jpg_unaccepted_gen_orig_u(self) -> None: self.jpg_unaccepted_gen_orig(JPG_WEBP_NAME_U, JPG_NAME_U, JPG_NAME_U) # Test_JPGUnacceptedS3EFS_MB def test_jpg_unaccepted_gen_orig_mb(self) -> None: self.jpg_unaccepted_gen_orig(JPG_WEBP_NAME_MB, JPG_NAME_MB, JPG_NAME_MB_Q) # JPGUnacceptedS3EFS def jpg_unaccepted_gen_orig( self, gen_name: str, orig_name: str, path_name: str) -> None: ts = self.put_original(orig_name, JPEG_MIME) self.put_generated(gen_name, JPEG_MIME, ts) update = self._img_server.process( self.to_path(path_name), OLD_SAFARI_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_PERM), update) self.assert_no_sqs_message() # Test_JPGUnacceptedS3NoEFS_L def test_jpg_unaccepted_gen_no_orig_l(self) -> None: self.jpg_unaccepted_gen_no_orig(JPG_WEBP_NAME, JPG_NAME, JPG_NAME) # Test_JPGUnacceptedS3NoEFS_U def test_jpg_unaccepted_gen_no_orig_u(self) -> None: self.jpg_unaccepted_gen_no_orig(JPG_WEBP_NAME_U, JPG_NAME_U, JPG_NAME_U) # Test_JPGUnacceptedS3NoEFS_MB def test_jpg_unaccepted_gen_no_orig_mb(self) -> None: self.jpg_unaccepted_gen_no_orig( JPG_WEBP_NAME_MB, JPG_NAME_MB, JPG_NAME_MB_Q) # JPGUnacceptedS3NoEFS def jpg_unaccepted_gen_no_orig( self, gen_name: str, orig_name: str, path_name: str) -> None: self.put_generated(gen_name, JPEG_MIME, DUMMY_DATETIME) update = self._img_server.process( self.to_path(path_name), OLD_SAFARI_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_TEMP), update) self.assert_sqs_message(orig_name) # Test_JPGUnacceptedNoS3EFS_L def test_jpg_unaccepted_no_gen_orig_l(self) -> None: self.jpg_unaccepted_no_gen_orig(JPG_NAME, JPG_NAME) # Test_JPGUnacceptedNoS3EFS_U def test_jpg_unaccepted_no_gen_orig_u(self) -> None: self.jpg_unaccepted_no_gen_orig(JPG_NAME_U, JPG_NAME_U) # Test_JPGUnacceptedNoS3EFS_MB def test_jpg_unaccepted_no_gen_orig_mb(self) -> None: self.jpg_unaccepted_no_gen_orig(JPG_NAME_MB, JPG_NAME_MB_Q) # JPGUnacceptedNoS3EFS def jpg_unaccepted_no_gen_orig(self, orig_name: str, path_name: str) -> None: self.put_original(orig_name, JPEG_MIME) update = self._img_server.process( self.to_path(path_name), OLD_SAFARI_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_PERM), update) self.assert_sqs_message(orig_name) # Test_JPGUnacceptedNoS3NoEFS_L def test_jpg_unaccepted_no_gen_no_orig_l(self) -> None: self.jpg_unaccepted_no_gen_no_orig(JPG_NAME) # Test_JPGUnacceptedNoS3NoEFS_U def test_jpg_unaccepted_no_gen_no_orig_u(self) -> None: self.jpg_unaccepted_no_gen_no_orig(JPG_NAME_U) # Test_JPGUnacceptedNoS3NoEFS_MB def test_jpg_unaccepted_no_gen_no_orig_mb(self) -> None: self.jpg_unaccepted_no_gen_no_orig(JPG_NAME_MB_Q) # JPGUnacceptedNoS3NoEFS def jpg_unaccepted_no_gen_no_orig(self, path_name: str) -> None: update = self._img_server.process( self.to_path(path_name), OLD_SAFARI_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_TEMP), update) self.assert_no_sqs_message() # Test_JPGAcceptedS3EFSOld_L def test_jpg_accepted_gen_orig_old_l(self) -> None: self.jpg_accepted_gen_orig_old(JPG_WEBP_NAME, JPG_NAME, JPG_NAME) # Test_JPGAcceptedS3EFSOld_U def test_jpg_accepted_gen_orig_old_u(self) -> None: self.jpg_accepted_gen_orig_old(JPG_WEBP_NAME_U, JPG_NAME_U, JPG_NAME_U) # Test_JPGAcceptedS3EFSOld_MB def test_jpg_accepted_gen_orig_old_mb(self) -> None: self.jpg_accepted_gen_orig_old(JPG_WEBP_NAME_MB, JPG_NAME_MB, JPG_NAME_MB_Q) # JPGAcceptedS3EFSOld def jpg_accepted_gen_orig_old( self, gen_name: str, orig_name: str, path_name: str) -> None: ts = self.put_original(orig_name, JPEG_MIME) self.put_generated(gen_name, JPEG_MIME, ts + datetime.timedelta(1)) update = self._img_server.process( self.to_path(path_name), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_TEMP), update) self.assert_sqs_message(orig_name) # Skipped: # # Test_JPGAcceptedNoS3EFSBatchSendRepeat # Test_JPGAcceptedNoS3EFSBatchSendWait # Test_ReopenLogFile # Test_JSS3EFS def test_js_gen_orig(self) -> None: ts = self.put_original(JS_NAME, JS_MIME) self.put_generated(JS_NAME, JS_MIME, ts) update = self._img_server.process( self.to_path(JS_NAME_Q), CHROME_ACCEPT_HEADER) self.assertEqual( FieldUpdate( res_cache_control=CACHE_CONTROL_PERM, origin_domain=self._img_server.generated_domain, uri=self.to_uri(JS_NAME_Q), ), update) self.assert_no_sqs_message() # Test_JSS3NoEFS def test_js_gen_no_orig(self) -> None: self.put_generated(JS_NAME, JS_MIME, DUMMY_DATETIME) update = self._img_server.process( self.to_path(JS_NAME_Q), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_TEMP), update) self.assert_sqs_message(JS_NAME) # Test_JSNoS3EFS def test_js_no_gen_orig(self) -> None: self.put_original(JS_NAME, JS_MIME) update = self._img_server.process( self.to_path(JS_NAME_Q), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_TEMP), update) self.assert_sqs_message(JS_NAME) # Test_JSNoS3NoEFS def test_js_no_gen_no_orig(self) -> None: update = self._img_server.process( self.to_path(JS_NAME_Q), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_TEMP), update) self.assert_no_sqs_message() # Test_JSS3EFSOld def test_js_gen_orig_old(self) -> None: ts = self.put_original(JS_NAME, JS_MIME) self.put_generated(JS_NAME, JS_MIME, ts + datetime.timedelta(1)) update = self._img_server.process( self.to_path(JS_NAME_Q), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_TEMP), update) self.assert_sqs_message(JS_NAME) # Test_CSSS3EFS def test_css_gen_orig(self) -> None: ts = self.put_original(CSS_NAME, CSS_MIME) self.put_generated(CSS_NAME, CSS_MIME, ts) update = self._img_server.process( self.to_path(CSS_NAME_Q), CHROME_ACCEPT_HEADER) self.assertEqual( FieldUpdate( res_cache_control=CACHE_CONTROL_PERM, origin_domain=self._img_server.generated_domain, uri=self.to_uri(CSS_NAME_Q), ), update) self.assert_no_sqs_message() # Test_CSSS3NoEFS def test_css_gen_no_orig(self) -> None: self.put_generated(CSS_NAME, CSS_MIME, DUMMY_DATETIME) update = self._img_server.process( self.to_path(CSS_NAME_Q), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_TEMP), update) self.assert_sqs_message(CSS_NAME) # Test_CSSNoS3EFS def test_css_no_gen_orig(self) -> None: self.put_original(CSS_NAME, CSS_MIME) update = self._img_server.process( self.to_path(CSS_NAME_Q), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_TEMP), update) self.assert_sqs_message(CSS_NAME) # Test_CSSNoS3NoEFS def test_css_no_gen_no_orig(self) -> None: update = self._img_server.process( self.to_path(CSS_NAME_Q), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_TEMP), update) self.assert_no_sqs_message() # Test_CSSS3EFSOld def test_css_gen_orig_old(self) -> None: ts = self.put_original(CSS_NAME, CSS_MIME) self.put_generated(CSS_NAME, CSS_MIME, ts + datetime.timedelta(1)) update = self._img_server.process( self.to_path(CSS_NAME_Q), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_TEMP), update) self.assert_sqs_message(CSS_NAME) # Test_SourceMapS3EFS def test_sourcemap_gen_orig(self) -> None: ts = self.put_original(SOURCEMAP_NAME, SOURCEMAP_MIME) self.put_generated(SOURCEMAP_NAME, SOURCEMAP_MIME, ts) update = self._img_server.process( self.to_path(SOURCEMAP_NAME_Q), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_PERM), update) self.assert_no_sqs_message() # Test_SourceMapS3NoEFS def test_sourcemap_gen_no_orig(self) -> None: self.put_generated(SOURCEMAP_NAME, SOURCEMAP_MIME, DUMMY_DATETIME) update = self._img_server.process( self.to_path(SOURCEMAP_NAME_Q), CHROME_ACCEPT_HEADER) self.assertEqual( FieldUpdate( res_cache_control=CACHE_CONTROL_PERM, origin_domain=self._img_server.generated_domain, uri=self.to_uri(SOURCEMAP_NAME_Q), ), update) self.assert_no_sqs_message() # Test_SourceMapNoS3EFS def test_sourcemap_no_gen_orig(self) -> None: self.put_original(SOURCEMAP_NAME, SOURCEMAP_MIME) update = self._img_server.process( self.to_path(SOURCEMAP_NAME_Q), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_PERM), update) self.assert_no_sqs_message() # Test_SourceMapNoS3NoEFS def test_sourcemap_no_gen_no_orig(self) -> None: update = self._img_server.process( self.to_path(SOURCEMAP_NAME_Q), CHROME_ACCEPT_HEADER) self.assertEqual( FieldUpdate( res_cache_control=CACHE_CONTROL_PERM, origin_domain=self._img_server.generated_domain, uri=self.to_uri(SOURCEMAP_NAME_Q), ), update) self.assert_no_sqs_message() def test_sourcemap_gen_orig_old(self) -> None: ts = self.put_original(SOURCEMAP_NAME, SOURCEMAP_MIME) self.put_generated( SOURCEMAP_NAME, SOURCEMAP_MIME, ts + datetime.timedelta(1)) update = self._img_server.process( self.to_path(SOURCEMAP_NAME_Q), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_PERM), update) self.assert_no_sqs_message() # Test_MinJSS3EFS def test_min_js_gen_orig(self) -> None: self.file_gen_orig(MIN_JS_NAME, MIN_JS_NAME_Q, JS_MIME) # Test_MinCSSS3EFS def test_min_css_gen_orig(self) -> None: self.file_gen_orig(MIN_CSS_NAME, MIN_CSS_NAME_Q, CSS_MIME) # FileS3EFS def file_gen_orig(self, key_name: str, path_name: str, mime: str) -> None: ts = self.put_original(key_name, mime) self.put_generated(key_name, mime, ts) update = self._img_server.process( self.to_path(path_name), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_PERM), update) self.assert_no_sqs_message() # Test_MinJSS3NoEFS def test_min_js_gen_no_orig(self) -> None: self.file_gen_no_orig(MIN_JS_NAME, MIN_JS_NAME_Q, JS_MIME) # Test_MinCSSS3NoEFS def test_min_css_gen_no_orig(self) -> None: self.file_gen_no_orig(MIN_CSS_NAME, MIN_CSS_NAME_Q, CSS_MIME) # FileS3NoEFS def file_gen_no_orig(self, key_name: str, path_name: str, mime: str) -> None: self.put_generated(key_name, mime, DUMMY_DATETIME) update = self._img_server.process( self.to_path(path_name), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_PERM), update) self.assert_no_sqs_message() # Test_MinJSNoS3EFS def test_min_js_no_gen_orig(self) -> None: self.file_no_gen_orig(MIN_JS_NAME, MIN_JS_NAME_Q, JS_MIME) # Test_MinCSSNoS3EFS def test_min_css_no_gen_orig(self) -> None: self.file_no_gen_orig(MIN_CSS_NAME, MIN_CSS_NAME_Q, CSS_MIME) # FileNoS3EFS def file_no_gen_orig(self, key_name: str, path_name: str, mime: str) -> None: self.put_original(key_name, mime) update = self._img_server.process( self.to_path(path_name), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_PERM), update) self.assert_no_sqs_message() # Test_MinJSNoS3NoEFS def test_min_js_no_gen_no_orig(self) -> None: self.file_no_gen_no_orig(MIN_JS_NAME_Q) # Test_MinCSSNoS3NoEFS def test_min_css_no_gen_no_orig(self) -> None: self.file_no_gen_no_orig(MIN_CSS_NAME_Q) # FileNoS3NoEFS def file_no_gen_no_orig(self, path_name: str) -> None: update = self._img_server.process( self.to_path(path_name), CHROME_ACCEPT_HEADER) self.assertEqual(FieldUpdate(res_cache_control=CACHE_CONTROL_PERM), update) self.assert_no_sqs_message() if 'unittest.util' in __import__('sys').modules: # Show full diff in self.assertEqual. __import__('sys').modules['unittest.util']._MAX_LENGTH = 999999999
import discord from discord.ext import commands class Errors(commands.Cog): """Error messages""" pass @commands.Cog.listener() async def on_command_error(self, ctx, error): if isinstance(error, commands.errors.MissingRequiredArgument): msg = discord.Embed() msg.title = "Missing argument" msg.description = error.args[0] print(error.args[0]) return await ctx.send(embed=msg) if isinstance(error, commands.errors.MissingPermissions): msg = discord.Embed() msg.title = "Missing permissions" msg.description = error.args[0] print(error.args[0]) return await ctx.send(embed=msg) if isinstance(error, commands.errors.NSFWChannelRequired): msg = discord.Embed() msg.title = "NSFW command" msg.description = error.args[0] print(error.args[0]) return await ctx.send(embed=msg) if isinstance(error, commands.errors.CommandInvokeError): msg = discord.Embed() msg.title = "Command Invoke Error" msg.description = error.args[0] print(error.args[0]) return await ctx.send(embed=msg) if isinstance(error, commands.errors.CommandNotFound): msg = discord.Embed() msg.title = "Command not found" msg.description = error.args[0] print(error.args[0]) return await ctx.send(embed=msg) if isinstance(error, commands.errors.BadArgument): msg = discord.Embed() msg.title = "Bad argument" msg.description = error.args[0] print(error.args[0]) return await ctx.send(embed=msg) if isinstance(error, commands.errors.NotOwner): msg = discord.Embed() msg.title = "You are not owner" msg.description = error.args[0] print(error.args[0]) return await ctx.send(embed=msg) def setup(client): client.add_cog(Errors(client))
import React, { Component } from 'react' import {Card,Button} from 'react-bootstrap' export class GameCard extends Component { render() { return ( <Card style={{ width: '18rem',margin:"1rem 0" }}> <Card.Img variant="top" src={this.props.item.img} /> <Card.Body> <Card.Title>{this.props.item.name}</Card.Title> <Card.Text> {this.props.item.level} </Card.Text> </Card.Body> <Card.Footer> <Button variant="outline-primary" style={{marginLeft:"3rem" ,pading:"1.5rem"}} onClick={()=>this.props.addToFav(this.props.item)}> ADD To FAV </Button> </Card.Footer> </Card> ) } } export default GameCard
"""SRGAN model. Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network https://arxiv.org/pdf/1609.04802.pdf """ from tensorflow.python.keras.layers import Add, BatchNormalization, Conv2D, Dense, Flatten, Input, LeakyReLU, PReLU, Lambda from tensorflow.python.keras.models import Model import tensorflow as tf def create_keras_model(inputShape, nClasses, scale=2, n_filters=64, depth=16): def residual(inputs, n_filters, momentum=0.8): x = Conv2D(n_filters, kernel_size=3, padding='same')(inputs) x = BatchNormalization(momentum=momentum)(x) x = PReLU(shared_axes=[1, 2])(x) x = Conv2D(n_filters, kernel_size=3, padding='same')(x) x = BatchNormalization(momentum=momentum)(x) x = Add()([inputs, x]) return x def upsample(inputs, n_filters, scale): x = Conv2D(n_filters * (scale ** 2), kernel_size=3, padding='same')(inputs) x = Lambda(lambda x: tf.nn.depth_to_space(x, scale))(x) x = PReLU(shared_axes=[1, 2])(x) return x inputs = Input(shape=inputShape) x = Conv2D(n_filters, kernel_size=9, padding='same')(inputs) x0 = PReLU(shared_axes=[1, 2])(x) x = residual(x0, n_filters) for i in range(depth-1): x = residual(x, n_filters) x = Conv2D(n_filters, kernel_size=3, padding='same')(x) x = BatchNormalization()(x) x = Add()([x0, x]) # Upsampling for super-resolution if scale == 2: x = upsample(x, n_filters, scale) elif scale == 3: x = upsample(x, n_filters, scale) elif scale == 4: x = upsample(x, n_filters, (scale-2)) x = upsample(x, n_filters, (scale-2)) outputs = Conv2D(nClasses, kernel_size=9, padding='same', activation='sigmoid')(x) model = Model(inputs, outputs, name="srgan") return model if __name__ == '__main__': model = create_keras_model((256,256,3), 6, 3) model.summary()
module.exports = (serverSocket) => function setAnswerReviewState({ answer = [], roomID, state, username, }) { const { WS__MSG_TYPE__ANSWER_REVIEW_STATE_UPDATED } = require('../../constants'); const room = serverSocket.getRoom(roomID); const { public: { users } } = room.data; room.data.public.blackCardAnswer = answer; for (let i = 0; i < users.length; i++) { const user = users[i]; if (user.name === username) { Object.assign(user, state); break; } } serverSocket.emitToAllInRoom(roomID, WS__MSG_TYPE__ANSWER_REVIEW_STATE_UPDATED, { room: room.data.public, }); }
//// [declareDottedExtend.ts] declare module A.B { export class C{ } } import ab = A.B; class D extends ab.C{ } class E extends A.B.C{ } //// [declareDottedExtend.js] var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var ab = A.B; var D = (function (_super) { __extends(D, _super); function D() { _super.apply(this, arguments); } return D; })(ab.C); var E = (function (_super) { __extends(E, _super); function E() { _super.apply(this, arguments); } return E; })(A.B.C);
import { nanoid } from 'nanoid'; // HEAD DATA export const headData = { title: 'John Wang | Full Stack Developer', // e.g: 'Name | Developer' lang: 'en', // e.g: en, es, fr, jp description: 'My Portfoliio', // e.g: Welcome to my website }; // HERO DATA export const heroData = { title: 'Hello my name is', name: 'John Wang', subtitle: `I'm a Full Stack Developer.`, cta: 'Learn More', }; // ABOUT DATA export const aboutData = { img: 'profile.jpg', paragraphOne: `Hi. I'm John, a full stack developer based in the Bay Area. I graduated from the University of California, Irvine in Summer of 2020 and have been working hard on sharpening my coding skills. When it comes to coding, I enjoy manipulating data from APIs and building clean, responsive web applications.`, paragraphTwo: `In my free time, I like working on myself and pushing myself to being the best that I can be. This includes working out, learning Japanese, and working on personal projects. I enjoy learning things from the ground up and watching myself improve along the way.`, resume: 'https://drive.google.com/file/d/13mHY26mUABi8iMMr4dOpqyuTqwQxLzzf/view?usp=sharing', // if no resume, the button will not show up }; // PROJECTS DATA export const projectsData = [ { id: nanoid(), img: 'fabflix.png', title: 'Fabflix', info: `Fabflix is a fullstack web application that displays a list of movies from The Movie Database API. It offers features like searching and browsing to help users find movies they would be interested in. Users have the option of creating an account and bookmarking movies for future references.`, info2: '', url: 'https://fabflix.herokuapp.com', repo: 'https://github.com/jwang4059/fabflix', // if no repo, the button will not show up }, { id: nanoid(), img: 'tangoland.png', title: 'Tango Land', info: `Tango Land is a simple flashcard web application that test users on common Japanese expressions. This app lets users select which words they would like to study and how they want to study them. Users have the option to answer with the expression, kana, or romaji. It also shows additional information like pronunciation and definition as well as the score so that users can keep track of their progress.`, info2: '', url: 'https://tangoland.herokuapp.com', repo: 'https://github.com/jwang4059/tangoland', // if no repo, the button will not show up }, { id: nanoid(), img: 'gatsbyblog.png', title: 'ZTM Gatsby + Netlify CMS Starter', info: `ZTM Gatsby + Netlify CMS Starter is a new up to date starter kit for a Gatsby.js blog. It connects to Netlify CMS to make it easier for users to create blog posts. On top of that, it has been built with Tailwind.css, a modern CSS framework that makes it easy for users to theme and customize their project. With the help of this starter kit, anyone can build their own personalized blog.`, info2: '', url: '', repo: 'https://github.com/jwang4059/ztm-gatsby-netlify-cms-blog-starter', // if no repo, the button will not show up }, ]; // CONTACT DATA export const contactData = { cta: '', btn: '', email: '[email protected]', }; // FOOTER DATA export const footerData = { networks: [ { id: nanoid(), name: 'linkedin', url: 'https://www.linkedin.com/in/jwang4059/', }, { id: nanoid(), name: 'github', url: 'https://github.com/jwang4059', }, ], }; // Github start/fork buttons export const githubButtons = { isEnabled: false, // set to false to disable the GitHub stars/fork buttons };
# ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ import abc import functools import time try: from typing import TYPE_CHECKING except ImportError: TYPE_CHECKING = False from msal import TokenCache from msal.oauth2cli.oauth2 import Client from azure.core.credentials import AccessToken from azure.core.exceptions import ClientAuthenticationError from .._constants import KnownAuthorities try: ABC = abc.ABC except AttributeError: # Python 2.7, abc exists, but not ABC ABC = abc.ABCMeta("ABC", (object,), {"__slots__": ()}) # type: ignore if TYPE_CHECKING: # pylint:disable=unused-import,ungrouped-imports from typing import Any, Callable, Iterable, Optional class AadClientBase(ABC): """Sans I/O methods for AAD clients wrapping MSAL's OAuth client""" def __init__(self, client_id, tenant, **kwargs): # type: (str, str, **Any) -> None authority = kwargs.pop("authority", KnownAuthorities.AZURE_PUBLIC_CLOUD) if authority[-1] == "/": authority = authority[:-1] token_endpoint = "https://" + "/".join((authority, tenant, "oauth2/v2.0/token")) config = {"token_endpoint": token_endpoint} self._client = Client(server_configuration=config, client_id=client_id) self._client.session.close() self._client.session = self._get_client_session(**kwargs) self._cache = TokenCache() def get_cached_access_token(self, scopes): # type: (Iterable[str]) -> Optional[AccessToken] tokens = self._cache.find(TokenCache.CredentialType.ACCESS_TOKEN, target=list(scopes)) for token in tokens: expires_on = int(token["expires_on"]) if expires_on - 300 > int(time.time()): return AccessToken(token["secret"], expires_on) return None def get_cached_refresh_tokens(self, scopes): """Assumes all cached refresh tokens belong to the same user""" return self._cache.find(TokenCache.CredentialType.REFRESH_TOKEN, target=list(scopes)) def obtain_token_by_authorization_code(self, code, redirect_uri, scopes, **kwargs): # type: (str, str, Iterable[str], **Any) -> AccessToken fn = functools.partial( self._client.obtain_token_by_authorization_code, code=code, redirect_uri=redirect_uri, **kwargs ) return self._obtain_token(scopes, fn, **kwargs) def obtain_token_by_refresh_token(self, refresh_token, scopes, **kwargs): # type: (str, Iterable[str], **Any) -> AccessToken fn = functools.partial( self._client.obtain_token_by_refresh_token, token_item=refresh_token, scope=scopes, rt_getter=lambda token: token["secret"], **kwargs ) return self._obtain_token(scopes, fn, **kwargs) def _process_response(self, response, scopes, now): # type: (dict, Iterable[str], int) -> AccessToken _raise_for_error(response) self._cache.add(event={"response": response, "scope": scopes}, now=now) if "expires_on" in response: expires_on = int(response["expires_on"]) elif "expires_in" in response: expires_on = now + int(response["expires_in"]) else: _scrub_secrets(response) raise ClientAuthenticationError( message="Unexpected response from Azure Active Directory: {}".format(response) ) return AccessToken(response["access_token"], expires_on) @abc.abstractmethod def _get_client_session(self, **kwargs): pass @abc.abstractmethod def _obtain_token(self, scopes, fn, **kwargs): # type: (Iterable[str], Callable, **Any) -> AccessToken pass def _scrub_secrets(response): for secret in ("access_token", "refresh_token"): if secret in response: response[secret] = "***" def _raise_for_error(response): # type: (dict) -> None if "error" not in response: return _scrub_secrets(response) if "error_description" in response: message = "Azure Active Directory error '({}) {}'".format(response["error"], response["error_description"]) else: message = "Azure Active Directory error '{}'".format(response) raise ClientAuthenticationError(message=message)
/* * Copyright (c) 2011 Yahoo! Inc. All rights reserved. */ YUI.add('RouteParamsBinderIndex', function(Y, NAME) { Y.namespace('mojito.binders')[NAME] = { /** * Binder initialization method, invoked after all binders on the page * have been constructed. */ init: function(mojitProxy) { this.mojitProxy = mojitProxy; }, /** * The binder method, invoked to allow the mojit to attach DOM event * handlers. * * @param node {Node} The DOM node to which this mojit is attached. */ bind: function(node) { var self = this; self.node = node; self.node.one('#routeParamsButton').on('click', function() { Y.log("******************firstcall"); self.mojitProxy.invoke('routeParams',{ params : { route: { foo: "fooval", bar: "barval" } } }, function(error, result){ if (error) Y.log("**********************I am getting an error: " + error); Y.log("******************This is the result: " + result); Y.Node.one('#RouteParamsResult').set('innerHTML', result); }); }, this); self.node.one('#routeParamsSimpleButton').on('click', function() { Y.log("******************firstcall"); self.mojitProxy.invoke('routeParamsSimple',{ params : { route: { foo: "fooval", bar: "barval" } } }, function(error, result){ if (error) Y.log("**********************I am getting an error: " + error); Y.log("******************This is the result: " + result); Y.Node.one('#RouteParamsResult').set('innerHTML', result); }); }, this); } }; }, '0.0.1', {requires: ['node']});
import { JSONPatchOTAgent } from '../../src/json-patch-ot-agent.js'; var obj; describe("JSONPatchOTAgent features:", function(){ describe("JSONPatchOTAgent instance", function () { var noop = function(){}; describe("when sends a JSON Patch", function () { var agent; beforeEach(function () { agent = new JSONPatchOTAgent({}, noop, ["/local","/remote"],function(){}); }); it("should push it to `.pending` sequences list (along with version operation objects)",function(){ var patch0 = [{op: 'replace', path: '/foo', value: 'smth'}]; var patch1 = [{op: 'replace', path: '/baz', value: 'smth'}]; var versionedJSONPatch1 = agent.send(patch0); var versionedJSONPatch2 = agent.send(patch1); // first two operation objects are versions expect(agent.pending[0]).toEqual(versionedJSONPatch1); expect(agent.pending[1]).toEqual(versionedJSONPatch2); }); it("should not increment `.ackLocalVersion`",function(){ var versionedJSONPatch1 = agent.send([{op: 'replace', path: '/baz', value: 'smth'}]); expect(agent.ackLocalVersion).toEqual(0); }); }); describe("when receives a Versioned JSON Patch", function () { var agent, applyPatch, transformPatch; var obj = {foo: 1, baz: [{qux: 'hello'}]}; beforeEach(function () { transformPatch = jasmine.createSpy("transformPatch"); var transform = function transform(){ transformPatch.apply(this, arguments); return [{op:"add", path: "/transformed", value: "JSON Patch sequence"}]; }; applyPatch = jasmine.createSpy("applyPatch"); var apply = function apply(){ applyPatch.apply(this, arguments); return arguments[0]; //obj } agent = new JSONPatchOTAgent(obj, transform, ["/local","/remote"], apply); agent.localVersion = 2; agent.pending = [ [{op: 'replace', path: '/foo', value: 1}], [{op: 'add', path: '/baz', value: [{qux: 'hello'}]}] ]; }); describe("with local version equal to current local version", function () { var versionedJSONPatch = [ {op: 'replace', path: '/remote', value: 1}, {op: 'test', path: '/local', value: 2}, // OT {op: 'add', path: '/bar', value: [1, 2, 3]}, {op: 'replace', path: '/baz', value: 'smth'} ]; beforeEach(function () { agent.receive(versionedJSONPatch); }); it('should apply given JSON Patch sequence', function() { expect(applyPatch).toHaveBeenCalled(); expect(applyPatch).toHaveBeenCalledWith( obj, [ {op: 'add', path: '/bar', value: [1, 2, 3]}, {op: 'replace', path: '/baz', value: 'smth'} ]); }); it('should clear pending sequences list', function() { expect(agent.pending).toEqual([]); }); it('should change `ackLocalVersion`', function() { expect(agent.ackLocalVersion).toEqual(2); }); }); describe("with local version lower than current local version", function () { var versionedJSONPatch1 = [ {op: 'replace', path: '/remote', value: 1}, {op: 'test', path: '/local', value: 1}, // OT {op: 'replace', path: '/baz', value: 'smth'} ]; beforeEach(function () { agent.receive(versionedJSONPatch1); }); it('should transform given JSON Patch sequence against pending sequences with higher versions', function() { expect(transformPatch).toHaveBeenCalled(); expect(transformPatch).toHaveBeenCalledWith( [{op: 'replace', path: '/baz', value: 'smth'}], // received sequence [ [{op: 'add', path: '/baz', value: [{qux: 'hello'}]}] ] //pending sequences with higher version ); }); it('should apply transformed JSON Patch sequence', function() { expect(applyPatch.calls.count()).toEqual(1); expect(applyPatch).toHaveBeenCalledWith( obj, [{op:"add", path: "/transformed", value: "JSON Patch sequence"}] // transformed JSON Patch ); }); it('should change `ackLocalVersion` according to received localVersion', function() { expect(agent.ackLocalVersion).toEqual(1); }); }); }); }); }); // Benchmark performance test if (typeof Benchmark !== 'undefined') { (function(){ var noop = function(){}; var banchAgent, remoteCounter, localCounter, obj; var suite = new Benchmark.Suite("JSONPatchOTAgent",{ onError: function(error){ console.error(error); } }); suite.add(suite.name + ' call transform against 1 of 2 pending sequences', function () { banchAgent.receive([ {op: 'replace', path: '/remote', value: remoteCounter}, {op: 'test', path: '/local', value: 1}, // OT {op: 'replace', path: '/foo', value: [1, 2, 3, 4]} ]); remoteCounter++; },{ onStart: function(){ obj = {foo: 1, baz: [ {qux: 'hello'} ]}; banchAgent = new JSONPatchOTAgent(obj, noop, ["/local","/remote"],function(){}); remoteCounter = 1; localCounter = 2; banchAgent.localVersion = 2; banchAgent.pending = [ [{op: 'replace', path: '/foo', value: 1}], [{op: 'add', path: '/baz', value: [{qux: 'hello'}]}] ]; } }); suite.add(suite.name + ' call transform against 7 of 10 pending sequences', function () { banchAgent.receive([ {op: 'replace', path: '/remote', value: remoteCounter}, {op: 'test', path: '/local', value: 1}, // OT {op: 'replace', path: '/foo', value: [1, 2, 3, 4]} ]); remoteCounter++; },{ onStart: function(){ obj = {foo: 1, baz: [ {qux: 'hello'} ]}; banchAgent = new JSONPatchOTAgent(obj, noop, ["/local","/remote"],function(){}); remoteCounter = 1; localCounter = 3; banchAgent.localVersion = 3; banchAgent.pending = [ [{op: 'replace', path: '/foo', value: 1}], [{op: 'add', path: '/baz', value: 10}], [{op: 'replace', path: '/foo', value: 10}], [{op: 'add', path: '/baz', value: 10}], [{op: 'replace', path: '/foo', value: 10}], [{op: 'add', path: '/baz', value: 10}], [{op: 'replace', path: '/foo', value: 10}], [{op: 'add', path: '/baz', value: 10}], [{op: 'replace', path: '/foo', value: 10}], [{op: 'add', path: '/baz', value: 10}] ]; } }); benchmarkReporter(suite); }()); }
# Author: Mathieu Blondel <[email protected]> # Arnaud Joly <[email protected]> # Maheshakya Wijewardena <[email protected]> # License: BSD 3 clause import warnings import numpy as np import scipy.sparse as sp from .base import BaseEstimator, ClassifierMixin, RegressorMixin from .base import MultiOutputMixin from .utils import check_random_state from .utils.validation import _num_samples from .utils.validation import check_array from .utils.validation import check_consistent_length from .utils.validation import check_is_fitted, _check_sample_weight from .utils.random import _random_choice_csc from .utils.stats import _weighted_percentile from .utils.multiclass import class_distribution class DummyClassifier(MultiOutputMixin, ClassifierMixin, BaseEstimator): """ DummyClassifier is a classifier that makes predictions using simple rules. This classifier is useful as a simple baseline to compare with other (real) classifiers. Do not use it for real problems. Read more in the :ref:`User Guide <dummy_estimators>`. .. versionadded:: 0.13 Parameters ---------- strategy : {"stratified", "most_frequent", "prior", "uniform", \ "constant"}, default="prior" Strategy to use to generate predictions. * "stratified": generates predictions by respecting the training set's class distribution. * "most_frequent": always predicts the most frequent label in the training set. * "prior": always predicts the class that maximizes the class prior (like "most_frequent") and ``predict_proba`` returns the class prior. * "uniform": generates predictions uniformly at random. * "constant": always predicts a constant label that is provided by the user. This is useful for metrics that evaluate a non-majority class .. versionchanged:: 0.24 The default value of `strategy` has changed to "prior" in version 0.24. random_state : int, RandomState instance or None, default=None Controls the randomness to generate the predictions when ``strategy='stratified'`` or ``strategy='uniform'``. Pass an int for reproducible output across multiple function calls. See :term:`Glossary <random_state>`. constant : int or str or array-like of shape (n_outputs,) The explicit constant as predicted by the "constant" strategy. This parameter is useful only for the "constant" strategy. Attributes ---------- classes_ : ndarray of shape (n_classes,) or list of such arrays Class labels for each output. n_classes_ : int or list of int Number of label for each output. class_prior_ : ndarray of shape (n_classes,) or list of such arrays Probability of each class for each output. n_outputs_ : int Number of outputs. sparse_output_ : bool True if the array returned from predict is to be in sparse CSC format. Is automatically set to True if the input y is passed in sparse format. Examples -------- >>> import numpy as np >>> from sklearn.dummy import DummyClassifier >>> X = np.array([-1, 1, 1, 1]) >>> y = np.array([0, 1, 1, 1]) >>> dummy_clf = DummyClassifier(strategy="most_frequent") >>> dummy_clf.fit(X, y) DummyClassifier(strategy='most_frequent') >>> dummy_clf.predict(X) array([1, 1, 1, 1]) >>> dummy_clf.score(X, y) 0.75 """ def __init__(self, *, strategy="prior", random_state=None, constant=None): self.strategy = strategy self.random_state = random_state self.constant = constant def fit(self, X, y, sample_weight=None): """Fit the random classifier. Parameters ---------- X : array-like of shape (n_samples, n_features) Training data. y : array-like of shape (n_samples,) or (n_samples, n_outputs) Target values. sample_weight : array-like of shape (n_samples,), default=None Sample weights. Returns ------- self : object """ allowed_strategies = ("most_frequent", "stratified", "uniform", "constant", "prior") if self.strategy not in allowed_strategies: raise ValueError("Unknown strategy type: %s, expected one of %s." % (self.strategy, allowed_strategies)) self._strategy = self.strategy if self._strategy == "uniform" and sp.issparse(y): y = y.toarray() warnings.warn('A local copy of the target data has been converted ' 'to a numpy array. Predicting on sparse target data ' 'with the uniform strategy would not save memory ' 'and would be slower.', UserWarning) self.sparse_output_ = sp.issparse(y) if not self.sparse_output_: y = np.asarray(y) y = np.atleast_1d(y) if y.ndim == 1: y = np.reshape(y, (-1, 1)) self.n_outputs_ = y.shape[1] self.n_features_in_ = None # No input validation is done for X check_consistent_length(X, y) if sample_weight is not None: sample_weight = _check_sample_weight(sample_weight, X) if self._strategy == "constant": if self.constant is None: raise ValueError("Constant target value has to be specified " "when the constant strategy is used.") else: constant = np.reshape(np.atleast_1d(self.constant), (-1, 1)) if constant.shape[0] != self.n_outputs_: raise ValueError("Constant target value should have " "shape (%d, 1)." % self.n_outputs_) (self.classes_, self.n_classes_, self.class_prior_) = class_distribution(y, sample_weight) if self._strategy == "constant": for k in range(self.n_outputs_): if not any(constant[k][0] == c for c in self.classes_[k]): # Checking in case of constant strategy if the constant # provided by the user is in y. err_msg = ("The constant target value must be present in " "the training data. You provided constant={}. " "Possible values are: {}." .format(self.constant, list(self.classes_[k]))) raise ValueError(err_msg) if self.n_outputs_ == 1: self.n_classes_ = self.n_classes_[0] self.classes_ = self.classes_[0] self.class_prior_ = self.class_prior_[0] return self def predict(self, X): """Perform classification on test vectors X. Parameters ---------- X : array-like of shape (n_samples, n_features) Test data. Returns ------- y : array-like of shape (n_samples,) or (n_samples, n_outputs) Predicted target values for X. """ check_is_fitted(self) # numpy random_state expects Python int and not long as size argument # under Windows n_samples = _num_samples(X) rs = check_random_state(self.random_state) n_classes_ = self.n_classes_ classes_ = self.classes_ class_prior_ = self.class_prior_ constant = self.constant if self.n_outputs_ == 1: # Get same type even for self.n_outputs_ == 1 n_classes_ = [n_classes_] classes_ = [classes_] class_prior_ = [class_prior_] constant = [constant] # Compute probability only once if self._strategy == "stratified": proba = self.predict_proba(X) if self.n_outputs_ == 1: proba = [proba] if self.sparse_output_: class_prob = None if self._strategy in ("most_frequent", "prior"): classes_ = [np.array([cp.argmax()]) for cp in class_prior_] elif self._strategy == "stratified": class_prob = class_prior_ elif self._strategy == "uniform": raise ValueError("Sparse target prediction is not " "supported with the uniform strategy") elif self._strategy == "constant": classes_ = [np.array([c]) for c in constant] y = _random_choice_csc(n_samples, classes_, class_prob, self.random_state) else: if self._strategy in ("most_frequent", "prior"): y = np.tile([classes_[k][class_prior_[k].argmax()] for k in range(self.n_outputs_)], [n_samples, 1]) elif self._strategy == "stratified": y = np.vstack([classes_[k][proba[k].argmax(axis=1)] for k in range(self.n_outputs_)]).T elif self._strategy == "uniform": ret = [classes_[k][rs.randint(n_classes_[k], size=n_samples)] for k in range(self.n_outputs_)] y = np.vstack(ret).T elif self._strategy == "constant": y = np.tile(self.constant, (n_samples, 1)) if self.n_outputs_ == 1: y = np.ravel(y) return y def predict_proba(self, X): """ Return probability estimates for the test vectors X. Parameters ---------- X : array-like of shape (n_samples, n_features) Test data. Returns ------- P : ndarray of shape (n_samples, n_classes) or list of such arrays Returns the probability of the sample for each class in the model, where classes are ordered arithmetically, for each output. """ check_is_fitted(self) # numpy random_state expects Python int and not long as size argument # under Windows n_samples = _num_samples(X) rs = check_random_state(self.random_state) n_classes_ = self.n_classes_ classes_ = self.classes_ class_prior_ = self.class_prior_ constant = self.constant if self.n_outputs_ == 1: # Get same type even for self.n_outputs_ == 1 n_classes_ = [n_classes_] classes_ = [classes_] class_prior_ = [class_prior_] constant = [constant] P = [] for k in range(self.n_outputs_): if self._strategy == "most_frequent": ind = class_prior_[k].argmax() out = np.zeros((n_samples, n_classes_[k]), dtype=np.float64) out[:, ind] = 1.0 elif self._strategy == "prior": out = np.ones((n_samples, 1)) * class_prior_[k] elif self._strategy == "stratified": out = rs.multinomial(1, class_prior_[k], size=n_samples) out = out.astype(np.float64) elif self._strategy == "uniform": out = np.ones((n_samples, n_classes_[k]), dtype=np.float64) out /= n_classes_[k] elif self._strategy == "constant": ind = np.where(classes_[k] == constant[k]) out = np.zeros((n_samples, n_classes_[k]), dtype=np.float64) out[:, ind] = 1.0 P.append(out) if self.n_outputs_ == 1: P = P[0] return P def predict_log_proba(self, X): """ Return log probability estimates for the test vectors X. Parameters ---------- X : {array-like, object with finite length or shape} Training data, requires length = n_samples Returns ------- P : ndarray of shape (n_samples, n_classes) or list of such arrays Returns the log probability of the sample for each class in the model, where classes are ordered arithmetically for each output. """ proba = self.predict_proba(X) if self.n_outputs_ == 1: return np.log(proba) else: return [np.log(p) for p in proba] def _more_tags(self): return { 'poor_score': True, 'no_validation': True, '_xfail_checks': { 'check_methods_subset_invariance': 'fails for the predict method', 'check_methods_sample_order_invariance': 'fails for the predict method' } } def score(self, X, y, sample_weight=None): """Returns the mean accuracy on the given test data and labels. In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted. Parameters ---------- X : None or array-like of shape (n_samples, n_features) Test samples. Passing None as test samples gives the same result as passing real test samples, since DummyClassifier operates independently of the sampled observations. y : array-like of shape (n_samples,) or (n_samples, n_outputs) True labels for X. sample_weight : array-like of shape (n_samples,), default=None Sample weights. Returns ------- score : float Mean accuracy of self.predict(X) wrt. y. """ if X is None: X = np.zeros(shape=(len(y), 1)) return super().score(X, y, sample_weight) class DummyRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator): """ DummyRegressor is a regressor that makes predictions using simple rules. This regressor is useful as a simple baseline to compare with other (real) regressors. Do not use it for real problems. Read more in the :ref:`User Guide <dummy_estimators>`. .. versionadded:: 0.13 Parameters ---------- strategy : {"mean", "median", "quantile", "constant"}, default="mean" Strategy to use to generate predictions. * "mean": always predicts the mean of the training set * "median": always predicts the median of the training set * "quantile": always predicts a specified quantile of the training set, provided with the quantile parameter. * "constant": always predicts a constant value that is provided by the user. constant : int or float or array-like of shape (n_outputs,), default=None The explicit constant as predicted by the "constant" strategy. This parameter is useful only for the "constant" strategy. quantile : float in [0.0, 1.0], default=None The quantile to predict using the "quantile" strategy. A quantile of 0.5 corresponds to the median, while 0.0 to the minimum and 1.0 to the maximum. Attributes ---------- constant_ : ndarray of shape (1, n_outputs) Mean or median or quantile of the training targets or constant value given by the user. n_outputs_ : int Number of outputs. Examples -------- >>> import numpy as np >>> from sklearn.dummy import DummyRegressor >>> X = np.array([1.0, 2.0, 3.0, 4.0]) >>> y = np.array([2.0, 3.0, 5.0, 10.0]) >>> dummy_regr = DummyRegressor(strategy="mean") >>> dummy_regr.fit(X, y) DummyRegressor() >>> dummy_regr.predict(X) array([5., 5., 5., 5.]) >>> dummy_regr.score(X, y) 0.0 """ def __init__(self, *, strategy="mean", constant=None, quantile=None): self.strategy = strategy self.constant = constant self.quantile = quantile def fit(self, X, y, sample_weight=None): """Fit the random regressor. Parameters ---------- X : array-like of shape (n_samples, n_features) Training data. y : array-like of shape (n_samples,) or (n_samples, n_outputs) Target values. sample_weight : array-like of shape (n_samples,), default=None Sample weights. Returns ------- self : object """ allowed_strategies = ("mean", "median", "quantile", "constant") if self.strategy not in allowed_strategies: raise ValueError("Unknown strategy type: %s, expected one of %s." % (self.strategy, allowed_strategies)) y = check_array(y, ensure_2d=False) self.n_features_in_ = None # No input validation is done for X if len(y) == 0: raise ValueError("y must not be empty.") if y.ndim == 1: y = np.reshape(y, (-1, 1)) self.n_outputs_ = y.shape[1] check_consistent_length(X, y, sample_weight) if sample_weight is not None: sample_weight = _check_sample_weight(sample_weight, X) if self.strategy == "mean": self.constant_ = np.average(y, axis=0, weights=sample_weight) elif self.strategy == "median": if sample_weight is None: self.constant_ = np.median(y, axis=0) else: self.constant_ = [_weighted_percentile(y[:, k], sample_weight, percentile=50.) for k in range(self.n_outputs_)] elif self.strategy == "quantile": if self.quantile is None or not np.isscalar(self.quantile): raise ValueError("Quantile must be a scalar in the range " "[0.0, 1.0], but got %s." % self.quantile) percentile = self.quantile * 100.0 if sample_weight is None: self.constant_ = np.percentile(y, axis=0, q=percentile) else: self.constant_ = [_weighted_percentile(y[:, k], sample_weight, percentile=percentile) for k in range(self.n_outputs_)] elif self.strategy == "constant": if self.constant is None: raise TypeError("Constant target value has to be specified " "when the constant strategy is used.") self.constant = check_array(self.constant, accept_sparse=['csr', 'csc', 'coo'], ensure_2d=False, ensure_min_samples=0) if self.n_outputs_ != 1 and self.constant.shape[0] != y.shape[1]: raise ValueError( "Constant target value should have " "shape (%d, 1)." % y.shape[1]) self.constant_ = self.constant self.constant_ = np.reshape(self.constant_, (1, -1)) return self def predict(self, X, return_std=False): """ Perform classification on test vectors X. Parameters ---------- X : array-like of shape (n_samples, n_features) Test data. return_std : bool, default=False Whether to return the standard deviation of posterior prediction. All zeros in this case. .. versionadded:: 0.20 Returns ------- y : array-like of shape (n_samples,) or (n_samples, n_outputs) Predicted target values for X. y_std : array-like of shape (n_samples,) or (n_samples, n_outputs) Standard deviation of predictive distribution of query points. """ check_is_fitted(self) n_samples = _num_samples(X) y = np.full((n_samples, self.n_outputs_), self.constant_, dtype=np.array(self.constant_).dtype) y_std = np.zeros((n_samples, self.n_outputs_)) if self.n_outputs_ == 1: y = np.ravel(y) y_std = np.ravel(y_std) return (y, y_std) if return_std else y def _more_tags(self): return {'poor_score': True, 'no_validation': True} def score(self, X, y, sample_weight=None): """Returns the coefficient of determination R^2 of the prediction. The coefficient R^2 is defined as (1 - u/v), where u is the residual sum of squares ((y_true - y_pred) ** 2).sum() and v is the total sum of squares ((y_true - y_true.mean()) ** 2).sum(). The best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of y, disregarding the input features, would get a R^2 score of 0.0. Parameters ---------- X : None or array-like of shape (n_samples, n_features) Test samples. Passing None as test samples gives the same result as passing real test samples, since DummyRegressor operates independently of the sampled observations. y : array-like of shape (n_samples,) or (n_samples, n_outputs) True values for X. sample_weight : array-like of shape (n_samples,), default=None Sample weights. Returns ------- score : float R^2 of self.predict(X) wrt. y. """ if X is None: X = np.zeros(shape=(len(y), 1)) return super().score(X, y, sample_weight)
module.exports = class L2Table { constructor () { this.table = new Map(); } setPort (addr, port) { this.table.set(addr, port); } getPort (addr) { return this.table.get(addr); } delPort (addr) { this.table.delete(addr); } };
import React from 'react'; import clsx from 'clsx'; import PropTypes from 'prop-types'; import { makeStyles } from '@material-ui/styles'; import { Card, CardContent, Grid, Typography, Avatar } from '@material-ui/core'; import ArrowDownwardIcon from '@material-ui/icons/ArrowDownward'; import MoneyIcon from '@material-ui/icons/Money'; const useStyles = makeStyles(theme => ({ root: { height: '100%' }, content: { alignItems: 'center', display: 'flex' }, title: { fontWeight: 700 }, avatar: { backgroundColor: theme.palette.error.main, height: 56, width: 56 }, icon: { height: 32, width: 32 }, difference: { marginTop: theme.spacing(2), display: 'flex', alignItems: 'center' }, differenceIcon: { color: theme.palette.error.dark }, differenceValue: { color: theme.palette.error.dark, marginRight: theme.spacing(1) } })); const Budget = props => { const { className, ...rest } = props; const classes = useStyles(); return ( <Card {...rest} className={clsx(classes.root, className)} > <CardContent> <Grid container justify="space-between" > <Grid item> <Typography className={classes.title} color="textSecondary" gutterBottom variant="body2" > BUDGET </Typography> <Typography variant="h3">1</Typography> </Grid> <Grid item> <Avatar className={classes.avatar}> <MoneyIcon className={classes.icon} /> </Avatar> </Grid> </Grid> <div className={classes.difference}> <ArrowDownwardIcon className={classes.differenceIcon} /> <Typography className={classes.differenceValue} variant="body2" > 100% </Typography> <Typography className={classes.caption} variant="caption" > Since last month </Typography> </div> </CardContent> </Card> ); }; Budget.propTypes = { className: PropTypes.string }; export default Budget;
/** * This represents a basic REST implementation of a resource using Orango. * The Resource model is in "strict" mode and will filter out all undeclared. */ const orango = require('orango') const app = require('../app') const Resource = orango.model('Resource') const User = orango.model('User') /** * Create resource */ app.post('/resources', async (req, res) => { try { let resource = new Resource(req.body) let doc = await resource.save().id() res.status(201).json(doc) } catch (e) { res.status(500).json({ error: e.message }) } }) /** * Update resource */ app.put('/resources/:id', async (req, res) => { try { let result = await Resource.findByIdAndUpdate(req.params.id, req.body) if (result.modified) { res.status(200).send('Ok') } else { res.status(404).send('Not found') } } catch (e) { res.status(500).json({ error: e.message }) } }) /** * Delete resource */ app.delete('/resources/:id', async (req, res) => { try { let result = await Resource.findByIdAndDelete(req.params.id) if (result.deleted) { res.status(200).send('Ok') } else { res.status(404).send('Not found') } } catch (e) { res.status(500).json({ error: e.message }) } }) /** * Get resources */ app.get('/resources', async (req, res) => { let query = {} let resources try { if (req.query.user) { // this is more optimized when we know that user is only one user and we know which user query.user = req.query.user resources = await Resource.findMany(query) .id() .limit(req.query.limit) .offset(req.query.offset) // declare a variable with a known document _key (id) .var('knownUser', User, req.query.user) // we then use that variable to populate the "user" property in resources (second parameter) .populate('user', 'knownUser', { id: true, select: '_key firstName lastName', computed: true, noDefaults: true }) // .toAQL() // RESULTS in the statement below // LET user = DOCUMENT('users/rob') // FOR doc IN resources // FILTER (doc.`user` == "rob") // RETURN MERGE(doc, { user: KEEP(user, '_key', 'firstName', 'lastName') }) } else { // we use this when the user could be one or more users, but we dont know which user resources = await Resource.findMany(query, { noDefaults: false }) .id() .limit(req.query.limit) .offset(req.query.offset) .populate('user', User, { // we are using the Model (as a lookup) in the 2nd param to auto populate id: true, select: '_key firstName lastName', computed: true, noDefaults: true }) // .toAQL() // RESULTS in the statement below // FOR doc IN resources // LET user = DOCUMENT(CONCAT('users/', doc.user)) // RETURN MERGE(doc, { user: KEEP(user, '_key', 'firstName', 'lastName') }) } res.send(resources) } catch (e) { res.status(500).send(e) } }) /** * Get resource */ app.get('/resources/:id', async (req, res) => { try { let resource = await Resource.findById(req.params.id, { noDefaults: false }) .id() .populate('user', User, { // we are using the var as the 2nd param in populate we declared above id: true, select: '_key firstName lastName', computed: true, noDefaults: true }) if (resource) { res.status(200).send(resource) } else { res.status(404).send('Not found') } } catch (e) { res.status(500).send(e) } })
import styled from 'styled-components'; export const Container = styled.div` width: 100%; max-width: 740px; margin: 64px auto; display: flex; align-items: center; flex-direction: column; `;
import { createVue, triggerEvent, destroyVM } from '../util'; const DELAY = 10; const testDataArr = []; const toArray = function(obj) { return [].slice.call(obj); }; const getTestData = function() { return [ { id: 1, name: 'Toy Story', release: '1995-11-22', director: 'John Lasseter', runtime: 80 }, { id: 2, name: 'A Bug\'s Life', release: '1998-11-25', director: 'John Lasseter', runtime: 95 }, { id: 3, name: 'Toy Story 2', release: '1999-11-24', director: 'John Lasseter', runtime: 92 }, { id: 4, name: 'Monsters, Inc.', release: '2001-11-2', director: 'Peter Docter', runtime: 92 }, { id: 5, name: 'Finding Nemo', release: '2003-5-30', director: 'Andrew Stanton', runtime: 100 } ]; }; getTestData().forEach(cur => { Object.keys(cur).forEach(prop => { testDataArr.push(cur[prop].toString()); }); }); describe('Table', () => { describe('rendering data is correct', () => { const vm = createVue({ template: ` <el-table :data="testData"> <el-table-column prop="id" /> <el-table-column prop="name" label="片名" /> <el-table-column prop="release" label="发行日期" /> <el-table-column prop="director" label="导演" /> <el-table-column prop="runtime" label="时长(分)" /> </el-table> `, created() { this.testData = getTestData(); } }); it('head', done => { setTimeout(_ => { const ths = toArray(vm.$el.querySelectorAll('thead th')); expect(ths.map(node => node.textContent).filter(o => o)) .to.eql(['片名', '发行日期', '导演', '时长(分)']); done(); }, DELAY); }); it('row length', () => { expect(vm.$el.querySelectorAll('.el-table__body-wrapper tbody tr')).to.length(getTestData().length); }); it('row data', () => { const cells = toArray(vm.$el.querySelectorAll('td .cell')) .map(node => node.textContent); expect(cells).to.eql(testDataArr); destroyVM(vm); }); }); describe('attributes', () => { const createTable = function(props, opts) { return createVue(Object.assign({ template: ` <el-table :data="testData" ${props}> <el-table-column prop="name" label="片名" /> <el-table-column prop="release" label="发行日期" /> <el-table-column prop="director" label="导演" /> <el-table-column prop="runtime" label="时长(分)" /> </el-table> `, created() { this.testData = getTestData(); } }, opts)); }; it('height', done => { const vm = createTable('height="134"'); setTimeout(_ => { expect(vm.$el.style.height).to.equal('134px'); destroyVM(vm); done(); }, DELAY); }); it('height as string', done => { const vm = createTable('height="100pt"'); setTimeout(_ => { expect(vm.$el.style.height).to.equal('100pt'); destroyVM(vm); done(); }, DELAY); }); it('maxHeight', done => { const vm = createTable('max-height="134"'); setTimeout(_ => { expect(vm.$el.style.maxHeight).to.equal('134px'); destroyVM(vm); done(); }, DELAY); }); it('stripe', done => { const vm = createTable('stripe'); setTimeout(_ => { expect(vm.$el.classList.contains('el-table--striped')).to.true; destroyVM(vm); done(); }, DELAY); }); it('border', done => { const vm = createTable('border'); setTimeout(_ => { expect(vm.$el.classList.contains('el-table--border')).to.true; destroyVM(vm); done(); }, DELAY); }); it('fit', done => { const vm = createTable(':fit="false"'); setTimeout(_ => { expect(vm.$el.classList.contains('el-table--fit')).to.false; destroyVM(vm); done(); }, DELAY); }); it('show-header', done => { const vm = createTable(':show-header="false"'); setTimeout(_ => { expect(vm.$el.querySelectorAll('.el-table__header-wrapper').length).to.equal(0); destroyVM(vm); done(); }, DELAY); }); it('tableRowClassName', done => { const vm = createTable(':row-class-name="tableRowClassName"', { methods: { tableRowClassName({row, rowIndex}) { if (rowIndex === 1) { return 'info-row'; } else if (rowIndex === 3) { return 'positive-row'; } return ''; } } }); setTimeout(_ => { expect(vm.$el.querySelectorAll('.info-row')).to.length(1); expect(vm.$el.querySelectorAll('.positive-row')).to.length(1); destroyVM(vm); done(); }, DELAY); }); it('tableRowStyle[Object]', done => { const vm = createTable(':row-style="{ height: \'60px\' }"', {}); setTimeout(_ => { expect(vm.$el.querySelector('.el-table__body tr').style.height).to.equal('60px'); destroyVM(vm); done(); }, DELAY); }); it('tableRowStyle[Function]', done => { const vm = createTable(':row-style="tableRowStyle"', { methods: { tableRowStyle({row, rowIndex}) { if (rowIndex === 1) { return { height: '60px' }; } return null; } } }); setTimeout(_ => { expect(vm.$el.querySelector('.el-table__body tr:nth-child(1)').style.height).to.equal(''); expect(vm.$el.querySelector('.el-table__body tr:nth-child(2)').style.height).to.equal('60px'); destroyVM(vm); done(); }, DELAY); }); it('current-row-key', done => { const vm = createVue({ template: ` <el-table :data="testData" row-key="id" highlight-current-row :current-row-key="currentRowKey"> <el-table-column prop="name" label="片名" /> <el-table-column prop="release" label="发行日期" /> <el-table-column prop="director" label="导演" /> <el-table-column prop="runtime" label="时长(分)" /> </el-table> `, created() { this.testData = getTestData(); }, data() { return { currentRowKey: null }; } }, true); setTimeout(_ => { vm.currentRowKey = 1; const tr = vm.$el.querySelector('.el-table__body-wrapper tbody tr'); setTimeout(_ => { expect(tr.classList.contains('current-row')).to.be.true; vm.currentRowKey = 2; const rows = vm.$el.querySelectorAll('.el-table__body-wrapper tbody tr'); setTimeout(_ => { expect(tr.classList.contains('current-row')).to.be.false; expect(rows[1].classList.contains('current-row')).to.be.true; destroyVM(vm); done(); }, DELAY); }, DELAY); }, DELAY); }); it('select-on-indeterminate', done => { const vm = createVue({ template: ` <el-table :data="testData" @selection-change="change" :select-on-indeterminate="false" ref="table"> <el-table-column type="selection" /> <el-table-column prop="name" label="name" /> <el-table-column prop="release" label="release" /> <el-table-column prop="director" label="director" /> <el-table-column prop="runtime" label="runtime" /> </el-table> `, created() { this.testData = getTestData(); }, mounted() { this.$refs.table.toggleRowSelection(this.testData[0]); }, data() { return { selected: [] }; }, methods: { change(val) { this.selected = val; } } }, true); setTimeout(_ => { vm.$el.querySelector('.el-checkbox').click(); setTimeout(_ => { expect(vm.selected).to.length(0); destroyVM(vm); done(); }, DELAY); }, DELAY); }); }); describe('filter', () => { let vm; beforeEach(done => { vm = createVue({ template: ` <el-table ref="table" :data="testData" @filter-change="handleFilterChange"> <el-table-column prop="name" label="片名" /> <el-table-column prop="release" label="发行日期" /> <el-table-column prop="director" column-key="director" :filters="[ { text: 'John Lasseter', value: 'John Lasseter' }, { text: 'Peter Docter', value: 'Peter Docter' }, { text: 'Andrew Stanton', value: 'Andrew Stanton' } ]" :filter-method="filterMethod" label="导演" /> <el-table-column prop="runtime" label="时长(分)" /> </el-table> `, created() { this.testData = getTestData(); }, methods: { filterMethod(value, row) { return value === row.director; }, handleFilterChange(filters) { this.filters = filters; } } }, true); setTimeout(done, DELAY); }); afterEach(() => destroyVM(vm)); it('render', () => { expect(vm.$el.querySelector('.el-table__column-filter-trigger')).to.exist; }); it('click dropdown', done => { const btn = vm.$el.querySelector('.el-table__column-filter-trigger'); triggerEvent(btn, 'click', true, false); setTimeout(_ => { const filter = document.body.querySelector('.el-table-filter'); expect(filter).to.exist; document.body.removeChild(filter); done(); }, 100); }); it('click filter', done => { const btn = vm.$el.querySelector('.el-table__column-filter-trigger'); triggerEvent(btn, 'click', true, false); setTimeout(_ => { const filter = document.body.querySelector('.el-table-filter'); // John Lasseter triggerEvent(filter.querySelector('.el-checkbox'), 'click', true, false); // confrim button setTimeout(_ => { triggerEvent(filter.querySelector('.el-table-filter__bottom button'), 'click', true, false); setTimeout(_ => { expect(vm.filters['director']).to.be.eql(['John Lasseter']); expect(vm.$el.querySelectorAll('.el-table__body-wrapper tbody tr')).to.length(3); document.body.removeChild(filter); done(); }, DELAY); }, 100); }, 100); }); it('click reset', done => { const btn = vm.$el.querySelector('.el-table__column-filter-trigger'); triggerEvent(btn, 'click', true, false); setTimeout(_ => { const filter = document.body.querySelector('.el-table-filter'); // John Lasseter triggerEvent(filter.querySelector('.el-checkbox'), 'click', true, false); setTimeout(_ => { // reset button triggerEvent(filter.querySelectorAll('.el-table-filter__bottom button')[1], 'click', true, false); setTimeout(_ => { expect(vm.filters['director']).to.be.eql([]); expect(filter.querySelector('.el-table-filter__bottom button').classList.contains('is-disabled')).to.true; document.body.removeChild(filter); destroyVM(vm); done(); }, DELAY); }, 100); }, 100); }); }); describe('events', () => { const createTable = function(prop = '', opts) { return createVue({ template: ` <el-table :data="testData" @${prop}="handleEvent"> <el-table-column type="selection" /> <el-table-column prop="name" /> <el-table-column prop="release" /> <el-table-column prop="director" /> <el-table-column prop="runtime"/> </el-table> `, methods: { handleEvent(...args) { this.result = args; } }, created() { this.testData = getTestData(); }, data() { return { result: '', testData: this.testData }; } }, true); }; it('select', done => { const vm = createTable('select'); setTimeout(_ => { vm.$el.querySelectorAll('.el-checkbox')[1].click(); expect(vm.result).to.length(2); expect(vm.result[1]).to.have.property('name').to.equal(getTestData()[0].name); destroyVM(vm); done(); }, DELAY); }); it('select-all', done => { const vm = createTable('select-all'); setTimeout(_ => { vm.$el.querySelector('.el-checkbox').click(); setTimeout(_ => { expect(vm.result).to.length(1); expect(vm.result[0]).to.length(getTestData().length); destroyVM(vm); done(); }, DELAY); }, DELAY); }); it('selection-change', done => { const vm = createTable('selection-change'); setTimeout(_ => { vm.$el.querySelectorAll('.el-checkbox')[1].click(); expect(vm.result).to.length(1); destroyVM(vm); done(); }, DELAY); }); it('cell-mouse-enter', done => { const vm = createTable('cell-mouse-enter'); setTimeout(_ => { const cell = vm.$el.querySelectorAll('.el-table__body .cell')[2]; // first row triggerEvent(cell.parentNode, 'mouseenter'); expect(vm.result).to.length(4); // row, column, cell, event expect(vm.result[0]).to.have.property('name').to.equal(getTestData()[0].name); destroyVM(vm); done(); }, DELAY); }); it('cell-mouse-leave', done => { const vm = createTable('cell-mouse-leave'); setTimeout(_ => { const cell = vm.$el.querySelectorAll('.el-table__body .cell')[7]; // second row const cell2 = vm.$el.querySelectorAll('.el-table__body .cell')[2]; // first row triggerEvent(cell2.parentNode, 'mouseenter'); triggerEvent(cell.parentNode, 'mouseleave'); expect(vm.result).to.length(4); // row, column, cell, event expect(vm.result[0]).to.have.property('name').to.equal(getTestData()[0].name); destroyVM(vm); done(); }, DELAY); }); it('cell-click', done => { const vm = createTable('cell-click'); setTimeout(_ => { const cell = vm.$el.querySelectorAll('.el-table__body .cell')[2]; // first row cell.parentNode.click(); expect(vm.result).to.length(4); // row, column, cell, event expect(vm.result[0]).to.have.property('name').to.equal(getTestData()[0].name); destroyVM(vm); done(); }, DELAY); }); it('row-click', done => { const vm = createTable('row-click'); setTimeout(_ => { const cell = vm.$el.querySelectorAll('.el-table__body .cell')[2]; // first row triggerEvent(cell.parentNode.parentNode, 'click'); expect(vm.result).to.length(3); // row, event, column expect(vm.result[0]).to.have.property('name').to.equal(getTestData()[0].name); destroyVM(vm); done(); }, DELAY); }); it('row-dblclick', done => { const vm = createTable('row-dblclick'); setTimeout(_ => { const cell = vm.$el.querySelectorAll('.el-table__body .cell')[2]; // first row triggerEvent(cell.parentNode.parentNode, 'dblclick'); expect(vm.result).to.length(3); // row, event, column expect(vm.result[0]).to.have.property('name').to.equal(getTestData()[0].name); destroyVM(vm); done(); }, DELAY); }); it('current-change', done => { const vm = createTable('current-change'); setTimeout(_ => { const cell = vm.$el.querySelectorAll('.el-table__body .cell')[2]; // first row triggerEvent(cell.parentNode.parentNode, 'click'); expect(vm.result).to.length(2); // currentRow, oldCurrentRow expect(vm.result[0]).to.have.property('name').to.equal(getTestData()[0].name); expect(vm.result[1]).to.equal(null); // clear data => current-change should fire again. const oldRow = vm.result[0]; vm.testData = []; setTimeout(() => { expect(vm.result).to.length(2); // currentRow, oldCurrentRow expect(vm.result[0]).to.equal(null); expect(vm.result[1]).to.equal(oldRow); destroyVM(vm); done(); }, DELAY); }, DELAY); }); it('header-click', done => { const vm = createTable('header-click'); setTimeout(_ => { const cell = vm.$el.querySelectorAll('.el-table__header th')[1]; // header[prop='name'] triggerEvent(cell, 'click'); expect(vm.result).to.length(2); // column, event expect(vm.result[0]).to.have.property('property').to.equal('name'); destroyVM(vm); done(); }, DELAY); }); }); describe('column attributes', () => { const createTable = function(props1, props2, props3, props4, opts, tableProps) { return createVue(Object.assign({ template: ` <el-table :data="testData" ${tableProps || ''}> <el-table-column prop="name" ${props1 || ''} /> <el-table-column prop="release" ${props2 || ''} /> <el-table-column prop="director" ${props3 || ''} /> <el-table-column prop="runtime" ${props4 || ''} /> </el-table> `, created() { this.testData = getTestData(); } }, opts)); }; it('label', done => { const vm = createTable('label="啊哈哈哈"', 'label="啊啦啦啦"'); setTimeout(_ => { const ths = toArray(vm.$el.querySelectorAll('thead th')) .map(node => node.textContent).filter(o => o); expect(ths).to.eql(['啊哈哈哈', '啊啦啦啦']); destroyVM(vm); done(); }, DELAY); }); it('width', done => { const vm = createTable('width="123px"', ':width="102"', 'width="39"'); setTimeout(_ => { const ths = toArray(vm.$el.querySelectorAll('.el-table__header-wrapper col')) .map(node => node.width).filter(o => o); expect(ths).to.include('123').include('102').include('39'); destroyVM(vm); done(); }, DELAY); }); it('fixed', done => { const vm = createTable( 'fixed label="test1"', 'fixed="right" label="test2"', 'fixed="left" label="test3"'); setTimeout(_ => { expect(toArray(vm.$el.querySelectorAll('.el-table__fixed th:not(.is-hidden)')) .map(node => node.textContent)) .to.eql(['test1', 'test3']); expect(toArray(vm.$el.querySelectorAll('.el-table__fixed-right th:not(.is-hidden)')) .map(node => node.textContent)) .to.eql(['test2']); expect(vm.$el.querySelector('.el-table__body-wrapper').style.height).to.equal(''); destroyVM(vm); done(); }, DELAY); }); it('resizable', done => { const vm = createTable( 'resizable', ':resizable="false"', '', '', {}, 'border'); setTimeout(_ => { const firstCol = vm.$el.querySelector('thead th'); triggerEvent(firstCol, 'mousemove'); triggerEvent(firstCol, 'mousedown'); destroyVM(vm); done(); }, DELAY); }); it('formatter', done => { const vm = createTable( ':formatter="renderCell"', '', '', '', { methods: { renderCell(row, column) { return `[${row.name}]`; } } }); setTimeout(_ => { const cells = toArray(vm.$el.querySelectorAll('.el-table__body-wrapper tbody tr td:first-child')); expect(cells.map(n => n.textContent)).to.eql(getTestData().map(o => `[${o.name}]`)); destroyVM(vm); done(); }, DELAY); }); it('show-overflow-tooltip', done => { const vm = createTable('show-overflow-tooltip'); setTimeout(_ => { expect(vm.$el.querySelectorAll('.el-tooltip')).to.length(5); destroyVM(vm); done(); }, DELAY); }); it('show-tooltip-when-overflow', done => { // old version prop name const vm = createTable('show-tooltip-when-overflow'); setTimeout(_ => { expect(vm.$el.querySelectorAll('.el-tooltip')).to.length(5); destroyVM(vm); done(); }, DELAY); }); it('render-header', done => { const vm = createVue({ template: ` <el-table :data="testData"> <el-table-column prop="name" :render-header="renderHeader" label="name"> </el-table-column> <el-table-column prop="release"/> <el-table-column prop="director"/> <el-table-column prop="runtime"/> </el-table> `, methods: { renderHeader(h, { column, $index }) { return '' + $index + ':' + column.label; } }, created() { this.testData = getTestData(); } }); setTimeout(_ => { const headerCell = vm.$el.querySelector('.el-table__header-wrapper thead tr th:first-child .cell'); expect(headerCell.textContent).to.equal('0:name'); destroyVM(vm); done(); }, DELAY); }); it('align', done => { const vm = createTable('align="left"', 'align="right"', 'align="center"'); setTimeout(_ => { var len = getTestData().length + 1; expect(vm.$el.querySelectorAll('.is-left')).to.length(len); expect(vm.$el.querySelectorAll('.is-right')).to.length(len); expect(vm.$el.querySelectorAll('.is-center')).to.length(len); destroyVM(vm); done(); }, DELAY); }); it('class-name', done => { const vm = createTable('class-name="column-1"', 'class-name="column-2 column-class-a"', 'class-name="column-class-a"'); setTimeout(_ => { var len = getTestData().length + 1; expect(vm.$el.querySelectorAll('.column-1')).to.length(len); expect(vm.$el.querySelectorAll('.column-2')).to.length(len); expect(vm.$el.querySelectorAll('.column-class-a')).to.length(len * 2); destroyVM(vm); done(); }, DELAY); }); it('selectable', done => { const vm = createVue({ template: ` <el-table :data="testData" @selection-change="change"> <el-table-column type="selection" :selectable="filterSelect" /> <el-table-column prop="name" label="name" /> <el-table-column prop="release" label="release" /> <el-table-column prop="director" label="director" /> <el-table-column prop="runtime" label="runtime" /> </el-table> `, created() { this.testData = getTestData(); }, data() { return { selected: [] }; }, methods: { change(rows) { this.selected = rows; }, filterSelect(row, index) { return index > 2; } } }, true); setTimeout(_ => { vm.$el.querySelector('.el-checkbox').click(); setTimeout(_ => { expect(vm.selected).to.length(2); destroyVM(vm); done(); }, DELAY); }, DELAY); }); it('selectable === false & check selectAll status', done => { const vm = createVue({ template: ` <el-table :data="testData" @selection-change="change"> <el-table-column type="selection" :selectable="filterSelect" /> <el-table-column prop="name" label="name" /> <el-table-column prop="release" label="release" /> <el-table-column prop="director" label="director" /> <el-table-column prop="runtime" label="runtime" /> </el-table> `, created() { }, data() { return { selected: [], testData: null }; }, methods: { change(rows) { this.selected = rows; }, filterSelect(row, index) { return false; } } }, true); vm.testData = getTestData(); setTimeout(_ => { expect(vm.$el.querySelector('.el-checkbox').__vue__.checked).to.be.false; setTimeout(_ => { expect(vm.selected).to.length(0); destroyVM(vm); done(); }, DELAY); }, DELAY); }); it('emit selection-change after row has been removed', done => { const vm = createVue({ template: ` <el-table :data="testData" @selection-change="change"> <el-table-column type="selection" /> <el-table-column prop="name" label="name" /> <el-table-column prop="release" label="release" /> <el-table-column prop="director" label="director" /> <el-table-column prop="runtime" label="runtime" /> </el-table> `, created() { this.testData = getTestData(); }, data() { return { selected: [], testData: null }; }, methods: { change(rows) { this.selected = rows; }, filterSelect(row, index) { return index > 2; } } }, true); setTimeout(_ => { vm.$el.querySelector('.el-checkbox').click(); setTimeout(_ => { expect(vm.selected).to.length(5); vm.testData.splice(0, 1); setTimeout(_ => { expect(vm.selected).to.length(4); destroyVM(vm); done(); }); }, DELAY); }, DELAY); }); describe('type', () => { const createTable = function(type) { return createVue({ template: ` <el-table :data="testData" @selection-change="change"> <el-table-column type="${type}" /> <el-table-column prop="name" label="name" /> <el-table-column prop="release" label="release" /> <el-table-column prop="director" label="director" /> <el-table-column prop="runtime" label="runtime" /> </el-table> `, created() { this.testData = getTestData(); }, data() { return { selected: [] }; }, methods: { change(rows) { this.selected = rows; } } }, true); }; describe('= selection', () => { const vm = createTable('selection'); it('render', done => { setTimeout(_ => { expect(vm.$el.querySelectorAll('.el-checkbox')).to.length(getTestData().length + 1); done(); }, DELAY); }); it('select all', done => { vm.$el.querySelector('.el-checkbox').click(); setTimeout(_ => { expect(vm.selected).to.length(getTestData().length); done(); }, DELAY); }); it('cancel all', done => { vm.$el.querySelector('.el-checkbox').click(); setTimeout(_ => { expect(vm.selected).to.length(0); destroyVM(vm); done(); }, DELAY); }); it('select one', done => { const vm2 = createTable('selection'); setTimeout(_ => { vm2.$el.querySelectorAll('.el-checkbox')[1].click(); setTimeout(_ => { expect(vm2.selected).to.length(1); expect(vm2.selected[0].name).to.equal(getTestData()[0].name); destroyVM(vm2); done(); }, DELAY); }, DELAY); }); }); describe('= index', () => { const vm = createTable('index'); it('render', done => { setTimeout(_ => { expect(toArray(vm.$el.querySelectorAll('.el-table__body-wrapper tbody tr td:first-child')) .map(node => node.textContent)).to.eql(['1', '2', '3', '4', '5']); destroyVM(vm); done(); }, DELAY); }); }); describe('= expand', () => { const createInstance = function(extra) { extra = extra || ''; return createVue({ template: ` <el-table row-key="id" :data="testData" @expand-change="handleExpand" ${extra}> <el-table-column type="expand"> <template slot-scope="props"> <div>{{props.row.name}}</div> </template> </el-table-column> <el-table-column prop="release" label="release" /> <el-table-column prop="director" label="director" /> <el-table-column prop="runtime" label="runtime" /> </el-table> `, created() { this.testData = getTestData(); }, data() { return { expandCount: 0, expandRowKeys: [] }; }, methods: { handleExpand() { this.expandCount++; } } }, true); }; it('works', done => { const vm = createInstance(); setTimeout(_ => { expect(vm.$el.querySelectorAll('td.el-table__expand-column').length).to.equal(5); destroyVM(vm); done(); }, DELAY); }); it('should expand when click icon', done => { const vm = createInstance(); setTimeout(_ => { vm.$el.querySelector('td.el-table__expand-column .el-table__expand-icon').click(); setTimeout(_ => { expect(vm.$el.querySelectorAll('.el-table__expanded-cell').length).to.equal(1); expect(vm.expandCount).to.equal(1); vm.$el.querySelector('td.el-table__expand-column .el-table__expand-icon').click(); setTimeout(_ => { expect(vm.$el.querySelectorAll('.el-table__expanded-cell').length).to.equal(0); expect(vm.expandCount).to.equal(2); destroyVM(vm); done(); }, DELAY); }, DELAY); }, DELAY); }); it('should set expanded rows using expandRowKeys', done => { const vm = createInstance(':expand-row-keys="expandRowKeys"'); setTimeout(_ => { vm.expandRowKeys = [1, 3]; setTimeout(_ => { expect(vm.$el.querySelectorAll('.el-table__expanded-cell').length).to.equal(2); vm.expandRowKeys = [2]; setTimeout(_ => { expect(vm.$el.querySelectorAll('.el-table__expanded-cell').length).to.equal(1); destroyVM(vm); done(); }, DELAY); }, DELAY); }, DELAY); }); it('should default-expand-all when default-expand-all is true', done => { const vm = createInstance('default-expand-all'); setTimeout(_ => { expect(vm.$el.querySelectorAll('.el-table__expanded-cell').length).to.equal(5); destroyVM(vm); done(); }, DELAY); }); }); }); describe('sortable', () => { it('render', done => { const vm = createTable('', '', '', 'sortable'); setTimeout(_ => { expect(vm.$el.querySelectorAll('.caret-wrapper')).to.length(1); destroyVM(vm); done(); }, DELAY); }); it('sortable method', done => { const vm = createTable( 'sortable :sort-method="sortMethod"', '', '', '', { methods: { sortMethod(a, b) { // sort method should return number if (a.runtime < b.runtime) { return 1; } if (a.runtime > b.runtime) { return -1; } return 0; } } }); setTimeout(_ => { const elm = vm.$el.querySelector('.caret-wrapper'); elm.click(); setTimeout(_ => { const lastCells = vm.$el.querySelectorAll('.el-table__body-wrapper tbody tr td:last-child'); expect(toArray(lastCells).map(node => node.textContent)).to.eql(['100', '95', '92', '92', '80']); destroyVM(vm); done(); }, DELAY); }, DELAY); }); it('sortable by method', done => { const vm = createTable( 'sortable :sort-by="sortBy"', '', '', '', { methods: { sortBy(a) { return -a.runtime; } } }); setTimeout(_ => { const elm = vm.$el.querySelector('.caret-wrapper'); elm.click(); setTimeout(_ => { const lastCells = vm.$el.querySelectorAll('.el-table__body-wrapper tbody tr td:last-child'); expect(toArray(lastCells).map(node => node.textContent)).to.eql(['100', '95', '92', '92', '80']); destroyVM(vm); done(); }, DELAY); }, DELAY); }); it('sortable by property', done => { const vm = createTable( 'sortable sort-by="runtime"', '', '', '', {}); setTimeout(_ => { const elm = vm.$el.querySelector('.caret-wrapper'); elm.click(); setTimeout(_ => { const lastCells = vm.$el.querySelectorAll('.el-table__body-wrapper tbody tr td:last-child'); expect(toArray(lastCells).map(node => node.textContent)).to.eql(['80', '92', '92', '95', '100']); destroyVM(vm); done(); }, DELAY); }, DELAY); }); it('sort-change', done => { let result; const vm = createTable('sortable="custom"', '', '', '', { methods: { sortChange(...args) { result = args; } } }, '@sort-change="sortChange"'); setTimeout(_ => { const elm = vm.$el.querySelector('.caret-wrapper'); elm.click(); setTimeout(_ => { expect(result).to.exist; destroyVM(vm); done(); }, DELAY); }, DELAY); }); }); describe('click sortable column', () => { const vm = createTable('', '', '', 'sortable'); it('ascending', done => { const elm = vm.$el.querySelector('.caret-wrapper'); elm.click(); setTimeout(_ => { const lastCells = vm.$el.querySelectorAll('.el-table__body-wrapper tbody tr td:last-child'); expect(toArray(lastCells).map(node => node.textContent)) .to.eql(['80', '92', '92', '95', '100']); done(); }, DELAY); }); it('descending', done => { const elm = vm.$el.querySelector('.caret-wrapper'); elm.click(); setTimeout(_ => { const lastCells = vm.$el.querySelectorAll('.el-table__body-wrapper tbody tr td:last-child'); expect(toArray(lastCells).map(node => node.textContent)) .to.eql(['100', '95', '92', '92', '80']); destroyVM(vm); done(); }, DELAY); }); }); }); describe('summary row', () => { it('should render', done => { const vm = createVue({ template: ` <el-table :data="testData" show-summary> <el-table-column prop="name" /> <el-table-column prop="release"/> <el-table-column prop="director"/> <el-table-column prop="runtime"/> </el-table> `, created() { this.testData = getTestData(); } }, true); setTimeout(_ => { const footer = vm.$el.querySelector('.el-table__footer'); expect(footer).to.exist; const cells = toArray(footer.querySelectorAll('.cell')); expect(cells[cells.length - 1].innerText).to.equal('459'); destroyVM(vm); done(); }, DELAY); }); it('custom sum text', done => { const vm = createVue({ template: ` <el-table :data="testData" show-summary sum-text="Time"> <el-table-column prop="name" /> <el-table-column prop="release"/> <el-table-column prop="director"/> <el-table-column prop="runtime"/> </el-table> `, created() { this.testData = getTestData(); } }, true); setTimeout(_ => { const cells = toArray(vm.$el.querySelectorAll('.el-table__footer .cell')); expect(cells[0].innerText).to.equal('Time'); destroyVM(vm); done(); }, DELAY); }); it('custom summary method', done => { const vm = createVue({ template: ` <el-table :data="testData" show-summary :summary-method="getSummary"> <el-table-column prop="name" /> <el-table-column prop="release"/> <el-table-column prop="director"/> <el-table-column prop="runtime"/> </el-table> `, created() { this.testData = getTestData(); }, methods: { getSummary(param) { const { columns, data } = param; const result = []; columns.forEach(column => { const prop = column.property; if (prop === 'release') { const dates = data.map(item => item[prop]); const releaseYears = dates.map(date => Number(date.slice(0, 4))); result.push(releaseYears.reduce((prev, curr) => { return prev + curr; })); } else { result.push(''); } }); return result; } } }, true); setTimeout(_ => { const cells = toArray(vm.$el.querySelectorAll('.el-table__footer .cell')); expect(cells[1].innerText).to.equal('9996'); destroyVM(vm); done(); }, DELAY); }); }); describe('multi level column', () => { it('should works', done => { const vm = createVue({ template: ` <el-table :data="testData"> <el-table-column prop="name" /> <el-table-column label="group"> <el-table-column prop="release"/> <el-table-column prop="director"/> </el-table-column> <el-table-column prop="runtime"/> </el-table> `, created() { this.testData = null; } }, true); setTimeout(_ => { const trs = vm.$el.querySelectorAll('.el-table__header tr'); expect(trs.length).equal(2); const firstRowHeader = trs[0].querySelectorAll('th .cell').length; const secondRowHeader = trs[1].querySelectorAll('th .cell').length; expect(firstRowHeader).to.equal(3); expect(secondRowHeader).to.equal(2); expect(trs[0].querySelector('th:first-child').getAttribute('rowspan')).to.equal('2'); expect(trs[0].querySelector('th:nth-child(2)').getAttribute('colspan')).to.equal('2'); destroyVM(vm); done(); }, DELAY); }); it('should works', done => { const vm = createVue({ template: ` <el-table :data="testData"> <el-table-column prop="name" /> <el-table-column label="group"> <el-table-column label="group's group"> <el-table-column prop="release" /> <el-table-column prop="runtime"/> </el-table-column> <el-table-column prop="director" /> </el-table-column> <el-table-column prop="runtime"/> </el-table> `, created() { this.testData = null; } }, true); setTimeout(_ => { const trs = vm.$el.querySelectorAll('.el-table__header tr'); expect(trs.length).equal(3); const firstRowHeader = trs[0].querySelectorAll('th .cell').length; const secondRowHeader = trs[1].querySelectorAll('th .cell').length; const thirdRowHeader = trs[2].querySelectorAll('th .cell').length; expect(firstRowHeader).to.equal(3); expect(secondRowHeader).to.equal(2); expect(thirdRowHeader).to.equal(2); expect(trs[0].querySelector('th:first-child').getAttribute('rowspan')).to.equal('3'); expect(trs[0].querySelector('th:nth-child(2)').getAttribute('colspan')).to.equal('3'); expect(trs[1].querySelector('th:first-child').getAttribute('colspan')).to.equal('2'); expect(trs[1].querySelector('th:nth-child(2)').getAttribute('rowspan')).to.equal('2'); destroyVM(vm); done(); }, DELAY); }); it('should work in one column', done => { const vm = createVue({ template: ` <el-table :data="testData"> <el-table-column label="group"> <el-table-column prop="release"/> </el-table-column> </el-table> `, created() { this.testData = null; } }, true); setTimeout(_ => { const trs = vm.$el.querySelectorAll('.el-table__header tr'); expect(trs.length).equal(2); const firstRowLength = trs[0].querySelectorAll('th .cell').length; const secondRowLength = trs[1].querySelectorAll('th .cell').length; expect(firstRowLength).to.equal(1); expect(secondRowLength).to.equal(1); expect(trs[0].querySelector('th:first-child').getAttribute('rowspan')).to.equal('1'); expect(trs[0].querySelector('th:first-child').getAttribute('colspan')).to.equal('1'); destroyVM(vm); done(); }, DELAY); }); }); describe('dynamic column attribtes', () => { const DELAY = 50; it('label', (done) => { const vm = createVue({ template: ` <el-table :data="testData"> <el-table-column prop="name" :label="label"/> <el-table-column prop="release" /> <el-table-column prop="director" /> <el-table-column prop="runtime" /> </el-table> `, data() { return { label: 'name' }; }, created() { this.testData = getTestData(); } }, true); setTimeout(() => { expect(vm.$el.querySelector('.el-table__header th .cell').textContent).to.equal('name'); vm.label = 'NAME'; vm.$nextTick(() => { expect(vm.$el.querySelector('.el-table__header th .cell').textContent).to.equal('NAME'); destroyVM(vm); done(); }); }, DELAY); }); it('align', (done) => { const vm = createVue({ template: ` <el-table :data="testData"> <el-table-column prop="name" :align="align"/> </el-table> `, data() { return { align: 'left' }; }, created() { this.testData = getTestData(); } }, true); setTimeout(() => { expect(vm.$el.querySelectorAll('.el-table__body td.is-right').length === 0).to.be.true; vm.align = 'right'; vm.$nextTick(() => { expect(vm.$el.querySelectorAll('.el-table__body td.is-right').length > 0).to.be.true; destroyVM(vm); done(); }); }, DELAY); }); it('header-align', (done) => { const vm = createVue({ template: ` <el-table :data="testData"> <el-table-column prop="name" :align="align" :header-align="headerAlign"/> </el-table> `, data() { return { align: 'left', headerAlign: null }; }, created() { this.testData = getTestData(); } }, true); vm.$nextTick(() => { expect(vm.$el.querySelectorAll('.el-table__header th.is-left').length).to.above(0); expect(vm.$el.querySelectorAll('.el-table__header th.is-center').length).to.equal(0); expect(vm.$el.querySelectorAll('.el-table__header th.is-right').length).to.equal(0); vm.align = 'right'; vm.$nextTick(() => { expect(vm.$el.querySelectorAll('.el-table__header th.is-left').length).to.equal(0); expect(vm.$el.querySelectorAll('.el-table__header th.is-center').length).to.equal(0); expect(vm.$el.querySelectorAll('.el-table__header th.is-right').length).to.above(0); vm.headerAlign = 'center'; vm.$nextTick(() => { expect(vm.$el.querySelectorAll('.el-table__header th.is-left').length).to.equal(0); expect(vm.$el.querySelectorAll('.el-table__header th.is-center').length).to.above(0); expect(vm.$el.querySelectorAll('.el-table__header th.is-right').length).to.equal(0); vm.headerAlign = null; vm.$nextTick(() => { expect(vm.$el.querySelectorAll('.el-table__header th.is-left').length).to.equal(0); expect(vm.$el.querySelectorAll('.el-table__header th.is-center').length).to.equal(0); expect(vm.$el.querySelectorAll('.el-table__header th.is-right').length).to.above(0); destroyVM(vm); done(); }); }); }); }); }); it('width', (done) => { const vm = createVue({ template: ` <el-table :data="testData" :fit="false"> <el-table-column prop="name" :width="width"/> </el-table> `, data() { return { width: 100 }; }, created() { this.testData = getTestData(); } }, true); setTimeout(() => { expect(vm.$el.querySelector('.el-table__body col').getAttribute('width')).to.equal('100'); vm.width = 200; setTimeout(() => { expect(vm.$el.querySelector('.el-table__body col').getAttribute('width')).to.equal('200'); destroyVM(vm); done(); }, 100); }, DELAY); }); it('min-width', (done) => { const vm = createVue({ template: ` <el-table :data="testData" :fit="false"> <el-table-column prop="name" :min-width="width"/> </el-table> `, data() { return { width: 100 }; }, created() { this.testData = getTestData(); } }, true); setTimeout(() => { expect(vm.$el.querySelector('.el-table__body col').getAttribute('width')).to.equal('100'); vm.width = 200; setTimeout(() => { expect(vm.$el.querySelector('.el-table__body col').getAttribute('width')).to.equal('200'); destroyVM(vm); done(); }, 100); }, DELAY); }); it('fixed', (done) => { const vm = createVue({ template: ` <el-table :data="testData"> <el-table-column :fixed="fixed" /> <el-table-column prop="release" /> <el-table-column prop="director" /> <el-table-column prop="runtime" /> </el-table> `, data() { return { fixed: false }; }, created() { this.testData = getTestData(); } }, true); setTimeout(() => { expect(!vm.$el.querySelector('.el-table__fixed')).to.be.true; vm.fixed = true; setTimeout(() => { expect(!!vm.$el.querySelector('.el-table__fixed')).to.be.true; destroyVM(vm); done(); }, 100); }, DELAY); }); it('prop', (done) => { const vm = createVue({ template: ` <el-table :data="testData"> <el-table-column :prop="prop" /> <el-table-column prop="release" /> <el-table-column prop="director" /> <el-table-column prop="runtime" /> </el-table> `, data() { return { prop: 'name' }; }, created() { this.testData = getTestData(); } }, true); setTimeout(() => { let firstColumnContent = vm.$el.querySelector('.el-table__body td .cell').textContent; let secondColumnContent = vm.$el.querySelector('.el-table__body td:nth-child(2) .cell').textContent; expect(firstColumnContent !== secondColumnContent).to.be.true; vm.prop = 'release'; setTimeout(() => { firstColumnContent = vm.$el.querySelector('.el-table__body td .cell').textContent; secondColumnContent = vm.$el.querySelector('.el-table__body td:nth-child(2) .cell').textContent; expect(firstColumnContent === secondColumnContent).to.be.true; destroyVM(vm); done(); }, 100); }, DELAY); }); }); describe('methods', () => { const createTable = function(prop = '', opts) { return createVue({ template: ` <el-table ref="table" :data="testData" @${prop}="handleEvent"> <el-table-column type="selection" /> <el-table-column prop="name" /> <el-table-column prop="release" /> <el-table-column prop="director" /> <el-table-column prop="runtime"/> </el-table> `, methods: { handleEvent(selection) { this.fireCount++; this.selection = selection; } }, created() { this.testData = getTestData(); }, data() { return { selection: null, testData: this.testData, fireCount: 0 }; } }, true); }; it('toggleRowSelection', () => { const vm = createTable('selection-change'); vm.$refs.table.toggleRowSelection(vm.testData[0]); expect(vm.selection).to.length(1); expect(vm.fireCount).to.equal(1); // test use second parameter vm.$refs.table.toggleRowSelection(vm.testData[0], true); expect(vm.fireCount).to.equal(1); vm.$refs.table.toggleRowSelection(vm.testData[0], false); expect(vm.fireCount).to.equal(2); expect(vm.selection).to.length(0); destroyVM(vm); }); it('clearSelection', () => { const vm = createTable('selection-change'); vm.$refs.table.toggleRowSelection(vm.testData[0]); expect(vm.selection).to.length(1); expect(vm.fireCount).to.equal(1); // clear selection vm.$refs.table.clearSelection(); expect(vm.fireCount).to.equal(2); expect(vm.selection).to.length(0); vm.$refs.table.clearSelection(); expect(vm.fireCount).to.equal(2); destroyVM(vm); }); }); it('hover', done => { const vm = createVue({ template: ` <el-table :data="testData"> <el-table-column prop="name" label="片名" fixed /> <el-table-column prop="release" label="发行日期" /> <el-table-column prop="director" label="导演" /> <el-table-column prop="runtime" label="时长(分)" /> </el-table> `, created() { this.testData = getTestData(); } }, true); setTimeout(_ => { const tr = vm.$el.querySelector('.el-table__body-wrapper tbody tr'); triggerEvent(tr, 'mouseenter', true, false); setTimeout(_ => { expect(tr.classList.contains('hover-row')).to.true; triggerEvent(tr, 'mouseleave', true, false); setTimeout(_ => { expect(tr.classList.contains('hover-row')).to.false; destroyVM(vm); done(); }, DELAY); }, DELAY); }, DELAY); }); it('highlight-current-row', done => { const vm = createVue({ template: ` <el-table :data="testData" highlight-current-row> <el-table-column prop="name" label="片名" /> <el-table-column prop="release" label="发行日期" /> <el-table-column prop="director" label="导演" /> <el-table-column prop="runtime" label="时长(分)" /> </el-table> `, created() { this.testData = getTestData(); } }, true); setTimeout(_ => { const tr = vm.$el.querySelector('.el-table__body-wrapper tbody tr'); triggerEvent(tr, 'click', true, false); setTimeout(_ => { expect(tr.classList.contains('current-row')).to.be.true; const rows = vm.$el.querySelectorAll('.el-table__body-wrapper tbody tr'); triggerEvent(rows[2], 'click', true, false); setTimeout(_ => { expect(tr.classList.contains('current-row')).to.be.false; expect(rows[2].classList.contains('current-row')).to.be.true; destroyVM(vm); done(); }, DELAY); }, DELAY); }, DELAY); }); });
module.exports = ['https://www.amazon.com/Best-Sellers-Amazon-Device-Adapters-Connectors/zgbs/amazon-devices/17942903011/','https://www.amazon.com/Best-Sellers-Amazon-Device-Audio-Accessories/zgbs/amazon-devices/1289283011/','https://www.amazon.com/Best-Sellers-Amazon-Device-Bases-Stands/zgbs/amazon-devices/16956974011/','https://www.amazon.com/Best-Sellers-Clocks/zgbs/amazon-devices/21579956011/','https://www.amazon.com/Best-Sellers-Controllers-Remote-Controls/zgbs/amazon-devices/16926004011/','https://www.amazon.com/Best-Sellers-Home-Security-Decals-Signs/zgbs/amazon-devices/17942905011/','https://www.amazon.com/Best-Sellers-Amazon-Device-Keyboards/zgbs/amazon-devices/16958810011/','https://www.amazon.com/Best-Sellers-Amazon-Device-Memory-Cards/zgbs/amazon-devices/10871379011/','https://www.amazon.com/Best-Sellers-Amazon-Device-Mounts/zgbs/amazon-devices/16956975011/','https://www.amazon.com/Best-Sellers-Power-Supplies-Chargers/zgbs/amazon-devices/1289282011/','https://www.amazon.com/Best-Sellers-Smart-Home-Security-Lighting/zgbs/amazon-devices/17386948011/','https://www.amazon.com/Best-Sellers-Echo-Smart-Speakers-Displays/zgbs/amazon-devices/9818047011/','https://www.amazon.com/Best-Sellers-Fire-TV/zgbs/amazon-devices/8521791011/','https://www.amazon.com/Best-Sellers-Fire-Tablets/zgbs/amazon-devices/6669703011/','https://www.amazon.com/Best-Sellers-Home-Wi-Fi-Networking/zgbs/amazon-devices/21579960011/','https://www.amazon.com/Best-Sellers-Programmable-Devices/zgbs/amazon-devices/21579957011/','https://www.amazon.com/Best-Sellers-Smart-Appliances/zgbs/amazon-devices/21579959011/','https://www.amazon.com/Best-Sellers-Amazon-Device-Bundles/zgbs/amazon-devices/16926003011/','https://www.amazon.com/Best-Sellers-Wearable-Technology/zgbs/amazon-devices/21579958011/','https://www.amazon.com/Best-Sellers-Appliances-Built-Dishwashers/zgbs/appliances/3741281/','https://www.amazon.com/Best-Sellers-Appliances-Countertop-Dishwashers/zgbs/appliances/19201451011/','https://www.amazon.com/Best-Sellers-Appliances-Portable-Dishwashers/zgbs/appliances/19201449011/','https://www.amazon.com/Best-Sellers-Appliances-Chest-Freezers/zgbs/appliances/3741341/','https://www.amazon.com/Best-Sellers-Appliances-Upright-Freezers/zgbs/appliances/3741351/','https://www.amazon.com/Best-Sellers-Appliances-Combination-Microwave-Wall-Ovens/zgbs/appliances/3741491/','https://www.amazon.com/Best-Sellers-Appliances-Double-Wall-Ovens/zgbs/appliances/3741501/','https://www.amazon.com/Best-Sellers-Appliances-Single-Wall-Ovens/zgbs/appliances/3741511/','https://www.amazon.com/Best-Sellers-Appliances-Clothes-Dryers/zgbs/appliances/13397481/','https://www.amazon.com/Best-Sellers-Appliances-Clothes-Washing-Machines/zgbs/appliances/13397491/','https://www.amazon.com/Best-Sellers-Appliances-Combination-Washers-Dryers/zgbs/appliances/13755271/','https://www.amazon.com/Best-Sellers-Appliances-Stacked-Washer-Dryer-Units/zgbs/appliances/2399957011/','https://www.amazon.com/Best-Sellers-Appliances-Portable-Clothes-Washing-Machines/zgbs/appliances/9709422011/','https://www.amazon.com/Best-Sellers-Appliances-Portable-Dryers/zgbs/appliances/21490694011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Small-Appliances/zgbs/home-garden/289913/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Built-Wine-Cellars/zgbs/kitchen/3741551/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Freestanding-Wine-Cellars/zgbs/kitchen/3741541/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Wine-Cellar-Cooling-Systems/zgbs/kitchen/3741581/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Beading-Supplies/zgbs/arts-crafts/8090707011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Beads-Bead-Assortments/zgbs/arts-crafts/12896121/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Jewelry-Making-Charms/zgbs/arts-crafts/262595011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Jewelry-Making-Engraving-Machines-Tools/zgbs/arts-crafts/12896151/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Fusible-Glass-Supplies/zgbs/arts-crafts/8090782011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Jewelry-Casting-Supplies/zgbs/arts-crafts/8090808011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Jewelry-Making-Findings/zgbs/arts-crafts/12896161/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Jewelry-Making-Display-Packaging-Supplies/zgbs/arts-crafts/8090796011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Jewelry-Making-Kits/zgbs/arts-crafts/12896171/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Jewelry-Making-Tools-Accessories/zgbs/arts-crafts/12896181/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Jewelry-Patterns/zgbs/arts-crafts/8090806011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Jewelry-Metal-Stamping-Tools/zgbs/arts-crafts/8090814011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Jewelry-Making-Polishing-Buffing/zgbs/arts-crafts/12896191/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Purse-Making-Supplies/zgbs/arts-crafts/3097796011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Beading-Storage/zgbs/arts-crafts/8090936011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Jewelry-Making-Wax-Molding-Materials/zgbs/arts-crafts/12896201/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Basket-Making-Supplies/zgbs/arts-crafts/12890801/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Candle-Making-Supplies/zgbs/arts-crafts/262597011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Ceramic-Pottery-Supplies/zgbs/arts-crafts/12896441/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Craft-Supplies/zgbs/arts-crafts/8090710011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Doll-Making-Supplies/zgbs/arts-crafts/262606011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Fabric-Ribbons/zgbs/arts-crafts/12899411/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Floral-Arranging-Supplies/zgbs/arts-crafts/262607011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Leathercraft-Supplies/zgbs/arts-crafts/12897111/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Mosaic-Making-Supplies/zgbs/arts-crafts/262611011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Paper-Craft-Supplies/zgbs/arts-crafts/12897981/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Picture-Framing-Materials/zgbs/arts-crafts/12896921/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Scratchboards-Foil-Engraving/zgbs/arts-crafts/8090713011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Sculpture-Supplies/zgbs/arts-crafts/12899021/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Soap-Making-Supplies/zgbs/arts-crafts/262710011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Stained-Glass-Making-Supplies/zgbs/arts-crafts/262714011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Suncatcher-Supplies/zgbs/arts-crafts/262609011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Weaving-Spinning-Supplies/zgbs/arts-crafts/12899571/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Wood-Craft-Supplies/zgbs/arts-crafts/262715011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Fabric-Painting-Dyeing-Tools/zgbs/arts-crafts/12896851/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Fabric-Dyes/zgbs/arts-crafts/12896861/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Fabric-Textile-Paints/zgbs/arts-crafts/12896871/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Fabric-Decorating-Kits/zgbs/arts-crafts/12896881/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Fabric-Painting-Dyeing-Fixatives/zgbs/arts-crafts/12896891/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Weaving-Ball-Winders/zgbs/arts-crafts/12899581/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Crochet-Hooks/zgbs/arts-crafts/262612011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Crochet-Kits/zgbs/arts-crafts/262613011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Crochet-Patterns/zgbs/arts-crafts/8090904011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Crochet-Thread/zgbs/arts-crafts/8291666011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Knitting-Crochet-Notions/zgbs/arts-crafts/5007594011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Knitting-Kits/zgbs/arts-crafts/262623011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Knitting-Looms-Boards/zgbs/arts-crafts/8090898011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Knitting-Needles/zgbs/arts-crafts/262624011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Knitting-Patterns/zgbs/arts-crafts/8090900011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Knitting-Crochet-Needle-Cases/zgbs/arts-crafts/8090902011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Yarn-Storage/zgbs/arts-crafts/262671011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Cross-Stitch-Supplies/zgbs/arts-crafts/12897241/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Embroidery-Supplies/zgbs/arts-crafts/12897251/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Felt-Applique-Kits/zgbs/arts-crafts/7756220011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Rug-Making-Supplies-Latch-Hook-Kits/zgbs/arts-crafts/12897271/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Needle-Felting-Supplies/zgbs/arts-crafts/8090910011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Needlepoint/zgbs/arts-crafts/262627011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Punch-Needle-Rug/zgbs/arts-crafts/8090714011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Tatting-Lacemaking-Supplies/zgbs/arts-crafts/8090934011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Art-Poster-Transport-Tubes/zgbs/arts-crafts/12896391/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Art-Tool-Sketch-Storage-Boxes/zgbs/arts-crafts/12896431/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Craft-Supplies-Storage/zgbs/arts-crafts/262666011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Drying-Print-Racks/zgbs/arts-crafts/12897061/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Flat-Vertical-Files/zgbs/arts-crafts/12897381/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Paint-Brush-Organizers-Holders/zgbs/arts-crafts/12897391/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Pen-Pencil-Marker-Cases/zgbs/arts-crafts/8090948011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Art-Portfolios/zgbs/arts-crafts/12896421/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Storage-Boxes-Organizers/zgbs/arts-crafts/8090944011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Art-Storage-Cabinets/zgbs/arts-crafts/12897361/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Art-Paper/zgbs/arts-crafts/2748212011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Artists-Boards-Canvas/zgbs/arts-crafts/12896211/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Art-Drawing-Supplies/zgbs/arts-crafts/12896641/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Easels/zgbs/arts-crafts/12897071/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Artists-Painting-Supplies/zgbs/arts-crafts/12897411/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Brush-Pen-Cleaners/zgbs/arts-crafts/12898741/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Etching-Supplies/zgbs/arts-crafts/12898501/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Heat-Press-Machines-Accessories/zgbs/arts-crafts/8090715011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Printing-Presses-Accessories/zgbs/arts-crafts/12898561/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Printmaking-Inks/zgbs/arts-crafts/12898571/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Relief-Block-Printing-Materials/zgbs/arts-crafts/12898581/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Screen-Printing-Supplies/zgbs/arts-crafts/12898641/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Craft-Bow-Makers/zgbs/arts-crafts/23539913011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Embroidery-Machines/zgbs/arts-crafts/12899111/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Industrial-Machines/zgbs/arts-crafts/11268062011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Quilting-Supplies/zgbs/arts-crafts/12897321/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Serger-Overlock-Machine-Accessories/zgbs/arts-crafts/7756234011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Sergers-Overlock-Machines/zgbs/arts-crafts/12899441/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Machine-Accessories/zgbs/arts-crafts/262697011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Machines/zgbs/arts-crafts/12899461/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Notions-Supplies/zgbs/arts-crafts/262690011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Patterns-Templates/zgbs/arts-crafts/8090971011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Project-Kits/zgbs/arts-crafts/12899531/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Storage-Furniture/zgbs/arts-crafts/8090725011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Trim-Embellishments/zgbs/arts-crafts/12899361/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Embroidery-Thread-Floss/zgbs/arts-crafts/262659011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Quilting-Thread/zgbs/arts-crafts/262660011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Serger-Thread/zgbs/arts-crafts/262661011/','https://www.amazon.com/Best-Sellers-Arts-Crafts-Sewing-Thread/zgbs/arts-crafts/12899561/','https://www.amazon.com/Best-Sellers-Automotive-Cleaning-Kits/zgbs/automotive/15718281/','https://www.amazon.com/Best-Sellers-Automotive-Exterior-Care-Products/zgbs/automotive/15718291/','https://www.amazon.com/Best-Sellers-Automotive-Fillers-Adhesives-Sealants/zgbs/automotive/21557050011/','https://www.amazon.com/Best-Sellers-Automotive-Finishing-Products/zgbs/automotive/15718501/','https://www.amazon.com/Best-Sellers-Automotive-Glass-Care-Products/zgbs/automotive/15718531/','https://www.amazon.com/Best-Sellers-Automotive-Interior-Care-Products/zgbs/automotive/15718541/','https://www.amazon.com/Best-Sellers-Automotive-Solvents/zgbs/automotive/15718631/','https://www.amazon.com/Best-Sellers-Automotive-Tire-Wheel-Care-Products/zgbs/automotive/15718641/','https://www.amazon.com/Best-Sellers-Automotive-Tools-Equipment/zgbs/automotive/15718651/','https://www.amazon.com/Best-Sellers-Automotive-Undercoatings/zgbs/automotive/15718781/','https://www.amazon.com/Best-Sellers-Automotive-Antenna-Toppers/zgbs/automotive/15735131/','https://www.amazon.com/Best-Sellers-Automotive-Body-Armor/zgbs/automotive/4939604011/','https://www.amazon.com/Best-Sellers-Automotive-Bumper-Stickers-Decals-Magnets/zgbs/automotive/15710001/','https://www.amazon.com/Best-Sellers-Automotive-Bumpers-Bumper-Accessories/zgbs/automotive/15735201/','https://www.amazon.com/Best-Sellers-Automotive-Cargo-Management-Products/zgbs/automotive/15735241/','https://www.amazon.com/Best-Sellers-Automotive-Exterior-Covers/zgbs/automotive/15857521/','https://www.amazon.com/Best-Sellers-Automotive-Deflectors-Shields/zgbs/automotive/15735601/','https://www.amazon.com/Best-Sellers-Automotive-Emblems/zgbs/automotive/3095127011/','https://www.amazon.com/Best-Sellers-Automotive-Fender-Flares-Trim/zgbs/automotive/15735691/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Fuel-Tank-Caps/zgbs/automotive/15723051/','https://www.amazon.com/Best-Sellers-Automotive-Gas-Tank-Doors/zgbs/automotive/318292011/','https://www.amazon.com/Best-Sellers-Automotive-Grilles-Grille-Guards/zgbs/automotive/15735981/','https://www.amazon.com/Best-Sellers-Automotive-Hood-Scoops-Vents/zgbs/automotive/15736031/','https://www.amazon.com/Best-Sellers-Automotive-Horns-Accessories/zgbs/automotive/15736071/','https://www.amazon.com/Best-Sellers-Automotive-License-Plate-Covers-Frames/zgbs/automotive/15736161/','https://www.amazon.com/Best-Sellers-Automotive-Exterior-Mirrors-Parts/zgbs/automotive/19408390011/','https://www.amazon.com/Best-Sellers-Automotive-Wheel-Tire-Mud-Flaps-Splash-Guards/zgbs/automotive/15706651/','https://www.amazon.com/Best-Sellers-Automotive-Roll-Bars-Cages-Covers/zgbs/automotive/15736601/','https://www.amazon.com/Best-Sellers-Automotive-Running-Boards-Steps/zgbs/automotive/15736611/','https://www.amazon.com/Best-Sellers-Automotive-Safety-Products/zgbs/automotive/15857541/','https://www.amazon.com/Best-Sellers-Automotive-Snow-Ice-Products/zgbs/automotive/15737021/','https://www.amazon.com/Best-Sellers-Automotive-Spare-Tire-Carriers/zgbs/automotive/15706921/','https://www.amazon.com/Best-Sellers-Automotive-Spoilers-Wings-Styling-Kits/zgbs/automotive/15737061/','https://www.amazon.com/Best-Sellers-Automotive-Towing-Products-Winches/zgbs/automotive/15737251/','https://www.amazon.com/Best-Sellers-Automotive-Trailer-Accessories/zgbs/automotive/15737621/','https://www.amazon.com/Best-Sellers-Automotive-Truck-Bed-Tailgate-Accessories/zgbs/automotive/15737781/','https://www.amazon.com/Best-Sellers-Automotive-Vinyl-Wraps-Accessories/zgbs/automotive/13924815011/','https://www.amazon.com/Best-Sellers-Automotive-Window-Louvers/zgbs/automotive/15737961/','https://www.amazon.com/Best-Sellers-Automotive-Air-Fresheners/zgbs/automotive/15735121/','https://www.amazon.com/Best-Sellers-Automotive-Antitheft-Products/zgbs/automotive/15735141/','https://www.amazon.com/Best-Sellers-Automotive-Racing-Apparel/zgbs/automotive/15736691/','https://www.amazon.com/Best-Sellers-Automotive-Ashtrays/zgbs/automotive/318293011/','https://www.amazon.com/Best-Sellers-Automotive-Compasses/zgbs/automotive/15735441/','https://www.amazon.com/Best-Sellers-Automotive-Consoles-Organizers/zgbs/automotive/15735451/','https://www.amazon.com/Best-Sellers-Automotive-Interior-Covers/zgbs/automotive/15735551/','https://www.amazon.com/Best-Sellers-Automotive-Cup-Holders/zgbs/automotive/318296011/','https://www.amazon.com/Best-Sellers-Automotive-Door-Entry-Guard/zgbs/automotive/3097820011/','https://www.amazon.com/Best-Sellers-Automotive-Electrical-Appliances/zgbs/automotive/15735661/','https://www.amazon.com/Best-Sellers-Automotive-Floor-Mats-Cargo-Liners/zgbs/automotive/15735731/','https://www.amazon.com/Best-Sellers-Automotive-Garbage-Cans/zgbs/automotive/318297011/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Instrument-Panel-Gauges/zgbs/automotive/15729701/','https://www.amazon.com/Best-Sellers-Automotive-Grab-Handles/zgbs/automotive/15710341/','https://www.amazon.com/Best-Sellers-Automotive-Gun-Racks/zgbs/automotive/11162632011/','https://www.amazon.com/Best-Sellers-Automotive-Insulation-Noise-Control/zgbs/automotive/15736121/','https://www.amazon.com/Best-Sellers-Automotive-Automobile-Interior-Sets/zgbs/automotive/23501462011/','https://www.amazon.com/Best-Sellers-Automotive-Key-Shells/zgbs/automotive/21551229011/','https://www.amazon.com/Best-Sellers-Automotive-Keychains/zgbs/automotive/318298011/','https://www.amazon.com/Best-Sellers-Automotive-Interior-Mirrors/zgbs/automotive/15710191/','https://www.amazon.com/Best-Sellers-Automotive-Pedals-Pedal-Accessories/zgbs/automotive/15736571/','https://www.amazon.com/Best-Sellers-Automotive-Interior-Safety-Products/zgbs/automotive/15857551/','https://www.amazon.com/Best-Sellers-Automotive-Seat-Covers-Accessories/zgbs/automotive/15736751/','https://www.amazon.com/Best-Sellers-Automotive-Shift-Boots-Knobs/zgbs/automotive/15736991/','https://www.amazon.com/Best-Sellers-Automotive-Steering-Wheels-Accessories/zgbs/automotive/15737141/','https://www.amazon.com/Best-Sellers-Automotive-Interior-Sun-Protection/zgbs/automotive/15737191/','https://www.amazon.com/Best-Sellers-Automotive-Light-Bulbs/zgbs/automotive/15736341/','https://www.amazon.com/Best-Sellers-Automotive-Accent-Off-Road-Lighting/zgbs/automotive/15736351/','https://www.amazon.com/Best-Sellers-Automotive-Light-Covers-Lenses/zgbs/automotive/15736471/','https://www.amazon.com/Best-Sellers-Automotive-Lighting-Assemblies/zgbs/automotive/3094869011/','https://www.amazon.com/Best-Sellers-Automotive-Lighting-Conversion-Kits/zgbs/automotive/9002280011/','https://www.amazon.com/Best-Sellers-Automotive-Towing-Trailer-Lighting/zgbs/automotive/9002281011/','https://www.amazon.com/Best-Sellers-Automotive-Warning-Emergency-Lights/zgbs/automotive/9002279011/','https://www.amazon.com/Best-Sellers-Automotive-Powersports-Parts/zgbs/automotive/404659011/','https://www.amazon.com/Best-Sellers-Automotive-Powersports-Protective-Gear/zgbs/automotive/404825011/','https://www.amazon.com/Best-Sellers-Automotive-Motorcycles-ATVs/zgbs/automotive/404817011/','https://www.amazon.com/Best-Sellers-Automotive-Powersports-Chemicals-Fluids/zgbs/automotive/404702011/','https://www.amazon.com/Best-Sellers-Automotive-Powersports-Accessories/zgbs/automotive/404632011/','https://www.amazon.com/Best-Sellers-Automotive-Oil-Fluid-Additives/zgbs/automotive/15718801/','https://www.amazon.com/Best-Sellers-Automotive-Antifreezes-Coolants/zgbs/automotive/15718901/','https://www.amazon.com/Best-Sellers-Automotive-Brake-Fluids/zgbs/automotive/15718941/','https://www.amazon.com/Best-Sellers-Automotive-Engine-Parts-Fluid-Cleaners/zgbs/automotive/15718971/','https://www.amazon.com/Best-Sellers-Automotive-Flushes/zgbs/automotive/15719091/','https://www.amazon.com/Best-Sellers-Automotive-Greases-Lubricants/zgbs/automotive/15719191/','https://www.amazon.com/Best-Sellers-Automotive-Oils/zgbs/automotive/15719331/','https://www.amazon.com/Best-Sellers-Automotive-Power-Steering-Fluids/zgbs/automotive/15719541/','https://www.amazon.com/Best-Sellers-Automotive-Radiator-Conditioners-Protectants/zgbs/automotive/15719551/','https://www.amazon.com/Best-Sellers-Automotive-Refrigerants/zgbs/automotive/15719561/','https://www.amazon.com/Best-Sellers-Automotive-Transmission-Fluids/zgbs/automotive/15719641/','https://www.amazon.com/Best-Sellers-Automotive-Windshield-Washer-Fluids/zgbs/automotive/15719651/','https://www.amazon.com/Best-Sellers-Automotive-Winter-Products/zgbs/automotive/15719661/','https://www.amazon.com/Best-Sellers-Automotive-Paints-Primers/zgbs/automotive/15709851/','https://www.amazon.com/Best-Sellers-Automotive-Body-Repair-Paint-Spray-Guns/zgbs/automotive/15707181/','https://www.amazon.com/Best-Sellers-Automotive-Performance-Batteries-Accessories/zgbs/automotive/15710451/','https://www.amazon.com/Best-Sellers-Automotive-Performance-Bearings-Seals/zgbs/automotive/15710561/','https://www.amazon.com/Best-Sellers-Automotive-Performance-Belts-Hoses-Pulleys/zgbs/automotive/15710591/','https://www.amazon.com/Best-Sellers-Automotive-Performance-Brake-System-Parts/zgbs/automotive/15710921/','https://www.amazon.com/Best-Sellers-Automotive-Performance-Drive-Train/zgbs/automotive/15711291/','https://www.amazon.com/Best-Sellers-Automotive-Performance-Emission-Systems/zgbs/automotive/15712291/','https://www.amazon.com/Best-Sellers-Automotive-Performance-Engine-Cooling-Systems/zgbs/automotive/15712301/','https://www.amazon.com/Best-Sellers-Automotive-Performance-Engines-Engine-Parts/zgbs/automotive/15712571/','https://www.amazon.com/Best-Sellers-Automotive-Exhaust-Systems-Parts/zgbs/automotive/15713821/','https://www.amazon.com/Best-Sellers-Automotive-Performance-Filters/zgbs/automotive/15714131/','https://www.amazon.com/Best-Sellers-Automotive-Performance-Fuel-Systems/zgbs/automotive/15714351/','https://www.amazon.com/Best-Sellers-Automotive-Performance-Gaskets/zgbs/automotive/15715291/','https://www.amazon.com/Best-Sellers-Automotive-Performance-Ignition-Electrical-Systems/zgbs/automotive/2286883011/','https://www.amazon.com/Best-Sellers-Automotive-Performance-Shocks-Struts-Suspension/zgbs/automotive/2286884011/','https://www.amazon.com/Best-Sellers-Automotive-Performance-Starters-Alternators/zgbs/automotive/193806011/','https://www.amazon.com/Best-Sellers-Automotive-Performance-Steering-System-Equipment/zgbs/automotive/15717271/','https://www.amazon.com/Best-Sellers-Automotive-Performance-Switches-Relays/zgbs/automotive/15718101/','https://www.amazon.com/Best-Sellers-Automotive-RV-Cleaning-Maintenance/zgbs/automotive/2258022011/','https://www.amazon.com/Best-Sellers-Automotive-RV-Electronics/zgbs/automotive/2504395011/','https://www.amazon.com/Best-Sellers-Automotive-RV-Exterior-Parts-Accessories/zgbs/automotive/21571968011/','https://www.amazon.com/Best-Sellers-Automotive-RV-Gas-Supply-Parts-Accessories/zgbs/automotive/21580671011/','https://www.amazon.com/Best-Sellers-Automotive-RV-Heating-Ventilation-Air-Conditioning/zgbs/automotive/155287011/','https://www.amazon.com/Best-Sellers-Automotive-RV-Interior-Parts-Accessories/zgbs/automotive/155302011/','https://www.amazon.com/Best-Sellers-Automotive-RV-Plumbing/zgbs/automotive/21571967011/','https://www.amazon.com/Best-Sellers-Automotive-RV-Power-Electrical-Supplies/zgbs/automotive/2258026011/','https://www.amazon.com/Best-Sellers-Automotive-RV-Safety-Security/zgbs/automotive/21580670011/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Batteries-Accessories/zgbs/automotive/15719911/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Bearings-Seals/zgbs/automotive/15720041/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Belts-Hoses-Pulleys/zgbs/automotive/15721321/','https://www.amazon.com/Best-Sellers-Automotive-Body-Parts-Trim/zgbs/automotive/13591417011/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Brake-System-Parts/zgbs/automotive/15721631/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Cables/zgbs/automotive/15722931/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Caps/zgbs/automotive/15723031/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Engine-Cooling-Climate-Control/zgbs/automotive/2286886011/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Engines-Engine-Parts/zgbs/automotive/15725501/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Emission-Exhaust-Products/zgbs/automotive/2286887011/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Filters/zgbs/automotive/15727061/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Fuel-System-Equipment/zgbs/automotive/15727321/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Gaskets/zgbs/automotive/15728301/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Ignition-Parts/zgbs/automotive/15728931/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Lighting-Electrical-Equipment/zgbs/automotive/15729591/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Motors/zgbs/automotive/15730381/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Sensors/zgbs/automotive/15730551/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Shocks-Struts-Suspension-Products/zgbs/automotive/2286889011/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Starters-Alternators/zgbs/automotive/193805011/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Steering-System-Equipment/zgbs/automotive/15731431/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Switches-Relays/zgbs/automotive/15732461/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Drive-Train-Parts/zgbs/automotive/15723911/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Window-Regulators-Motors/zgbs/automotive/3095176011/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Windshield-Wipers-Washers/zgbs/automotive/15734781/','https://www.amazon.com/Best-Sellers-Automotive-Air-Conditioning-Tools-Equipment/zgbs/automotive/15706951/','https://www.amazon.com/Best-Sellers-Automotive-Applicator-Tools/zgbs/automotive/15707051/','https://www.amazon.com/Best-Sellers-Automotive-Body-Repair-Tools/zgbs/automotive/15707071/','https://www.amazon.com/Best-Sellers-Automotive-Brake-Tools/zgbs/automotive/15707291/','https://www.amazon.com/Best-Sellers-Automotive-Bushing-Tools/zgbs/automotive/3097824011/','https://www.amazon.com/Best-Sellers-Automotive-Replacement-Clutch-Alignment-Tools/zgbs/automotive/15724031/','https://www.amazon.com/Best-Sellers-Automotive-Cooling-Water-Pump-Tools/zgbs/automotive/15707341/','https://www.amazon.com/Best-Sellers-Automotive-Diagnostic-Test-Measurement-Tools/zgbs/automotive/19366729011/','https://www.amazon.com/Best-Sellers-Automotive-Drive-Train-Tools/zgbs/automotive/15707521/','https://www.amazon.com/Best-Sellers-Automotive-Electrical-System-Tools/zgbs/automotive/15707531/','https://www.amazon.com/Best-Sellers-Automotive-Engine-Tools/zgbs/automotive/15707541/','https://www.amazon.com/Best-Sellers-Automotive-Flywheel-Locks/zgbs/automotive/15707631/','https://www.amazon.com/Best-Sellers-Automotive-Fuel-System-Tools/zgbs/automotive/15707641/','https://www.amazon.com/Best-Sellers-Automotive-Garage-Shop-Products/zgbs/automotive/15707701/','https://www.amazon.com/Best-Sellers-Automotive-Hand-Tools/zgbs/automotive/15708141/','https://www.amazon.com/Best-Sellers-Automotive-Hose-Repair-Kits/zgbs/automotive/15708661/','https://www.amazon.com/Best-Sellers-Automotive-Jump-Starters-Battery-Chargers/zgbs/automotive/387679011/','https://www.amazon.com/Best-Sellers-Automotive-Lockout-Kits/zgbs/automotive/15708701/','https://www.amazon.com/Best-Sellers-Automotive-Muffler-Tools/zgbs/automotive/15707621/','https://www.amazon.com/Best-Sellers-Automotive-Oil-System-Tools/zgbs/automotive/15708801/','https://www.amazon.com/Best-Sellers-Automotive-Oxygen-Sensor-Removers/zgbs/automotive/15708831/','https://www.amazon.com/Best-Sellers-Automotive-Parts-Washers/zgbs/automotive/15708841/','https://www.amazon.com/Best-Sellers-Automotive-Pullers/zgbs/automotive/15708851/','https://www.amazon.com/Best-Sellers-Automotive-Riveters/zgbs/automotive/15708911/','https://www.amazon.com/Best-Sellers-Automotive-Spark-Plug-Ignition-Tools/zgbs/automotive/15708921/','https://www.amazon.com/Best-Sellers-Automotive-Steering-Suspension-Tools/zgbs/automotive/15708931/','https://www.amazon.com/Best-Sellers-Automotive-Strut-Compressors/zgbs/automotive/15709061/','https://www.amazon.com/Best-Sellers-Automotive-Thread-Repair-Kits/zgbs/automotive/15709071/','https://www.amazon.com/Best-Sellers-Automotive-Tire-Wheel-Tools/zgbs/automotive/15709111/','https://www.amazon.com/Best-Sellers-Automotive-Wheel-Tire-Air-Compressors-Inflators/zgbs/automotive/155346011/','https://www.amazon.com/Best-Sellers-Automotive-Tool-Boxes/zgbs/automotive/13400721/','https://www.amazon.com/Best-Sellers-Automotive-Tool-Sets/zgbs/automotive/15709191/','https://www.amazon.com/Best-Sellers-Automotive-Tool-Trays/zgbs/automotive/15709201/','https://www.amazon.com/Best-Sellers-Automotive-Welding-Equipment/zgbs/automotive/13400481/','https://www.amazon.com/Best-Sellers-Automotive-Windshield-Wiper-Tools/zgbs/automotive/15709221/','https://www.amazon.com/Best-Sellers-Automotive-Tires/zgbs/automotive/353609011/','https://www.amazon.com/Best-Sellers-Automotive-Wheels/zgbs/automotive/353596011/','https://www.amazon.com/Best-Sellers-Automotive-Wheel-Tire-Accessories-Parts/zgbs/automotive/15706581/','https://www.amazon.com/Best-Sellers-Automotive-Tire-Wheel-Assemblies/zgbs/automotive/353661011/','https://www.amazon.com/Best-Sellers-Baby-Stationary-Activity-Centers/zgbs/baby-products/21315185011/','https://www.amazon.com/Best-Sellers-Baby-Gyms-Playmats/zgbs/baby-products/196609011/','https://www.amazon.com/Best-Sellers-Baby-Bouncers-Jumpers-Swings/zgbs/baby-products/166850011/','https://www.amazon.com/Best-Sellers-Baby-Infant-Floor-Seats-Loungers/zgbs/baby-products/723032011/','https://www.amazon.com/Best-Sellers-Baby-Playard-Bedding/zgbs/baby-products/166761011/','https://www.amazon.com/Best-Sellers-Baby-Walkers/zgbs/baby-products/322268011/','https://www.amazon.com/Best-Sellers-Baby-Bathing-Products/zgbs/baby-products/17720256011/','https://www.amazon.com/Best-Sellers-Baby-Grooming-Skin-Care-Products/zgbs/baby-products/17720257011/','https://www.amazon.com/Best-Sellers-Baby-Hair-Care/zgbs/baby-products/23508739011/','https://www.amazon.com/Best-Sellers-Baby-Health-Care-Products/zgbs/baby-products/17720258011/','https://www.amazon.com/Best-Sellers-Baby-Pacifiers-Teethers-Teething-Relief-Products/zgbs/baby-products/17720259011/','https://www.amazon.com/Best-Sellers-Baby-Car-Seats/zgbs/baby-products/1272297011/','https://www.amazon.com/Best-Sellers-Baby-Child-Safety-Car-Seat-Bases/zgbs/baby-products/8457150011/','https://www.amazon.com/Best-Sellers-Baby-Child-Safety-Car-Seat-Accessories/zgbs/baby-products/166836011/','https://www.amazon.com/Best-Sellers-Baby-Diaper-Changing-Table-Covers-Pads/zgbs/baby-products/166765011/','https://www.amazon.com/Best-Sellers-Baby-Diaper-Changing-Tables/zgbs/baby-products/166811011/','https://www.amazon.com/Best-Sellers-Baby-Cloth-Diaper-Accessories/zgbs/baby-products/6104946011/','https://www.amazon.com/Best-Sellers-Baby-Cloth-Diapers/zgbs/baby-products/166771011/','https://www.amazon.com/Best-Sellers-Baby-Diaper-Bags/zgbs/baby-products/166767011/','https://www.amazon.com/Best-Sellers-Baby-Diaper-Creams/zgbs/baby-products/322263011/','https://www.amazon.com/Best-Sellers-Baby-Diaper-Pails-Refills/zgbs/baby-products/166768011/','https://www.amazon.com/Best-Sellers-Baby-Diaper-Stackers-Caddies/zgbs/baby-products/166769011/','https://www.amazon.com/Best-Sellers-Baby-Disposable-Diapers/zgbs/baby-products/166772011/','https://www.amazon.com/Best-Sellers-Baby-Portable-Changing-Pads/zgbs/baby-products/2237474011/','https://www.amazon.com/Best-Sellers-Baby-Powders/zgbs/baby-products/322266011/','https://www.amazon.com/Best-Sellers-Baby-Diaper-Wipes-Accessories/zgbs/baby-products/166776011/','https://www.amazon.com/Best-Sellers-Baby-Foods/zgbs/baby-products/16323111/','https://www.amazon.com/Best-Sellers-Baby-Bibs-Burp-Cloths/zgbs/baby-products/7874755011/','https://www.amazon.com/Best-Sellers-Baby-Bottle-Feeding-Supplies/zgbs/baby-products/166779011/','https://www.amazon.com/Best-Sellers-Baby-Breastfeeding-Supplies/zgbs/baby-products/166784011/','https://www.amazon.com/Best-Sellers-Baby-Food-Mills/zgbs/baby-products/379026011/','https://www.amazon.com/Best-Sellers-Baby-Food-Storage-Containers/zgbs/baby-products/379027011/','https://www.amazon.com/Best-Sellers-Baby-Highchairs-Booster-Seats/zgbs/baby-products/166793011/','https://www.amazon.com/Best-Sellers-Baby-Breast-Feeding-Pillows-Pillow-Covers/zgbs/baby-products/166798011/','https://www.amazon.com/Best-Sellers-Baby-Toddler-Feeding-Supplies/zgbs/baby-products/166799011/','https://www.amazon.com/Best-Sellers-Baby-Home-Family-Planning-Tests/zgbs/baby-products/8622315011/','https://www.amazon.com/Best-Sellers-Baby-Maternity-Pillows/zgbs/baby-products/382727011/','https://www.amazon.com/Best-Sellers-Baby-Prenatal-Monitoring-Devices/zgbs/baby-products/379028011/','https://www.amazon.com/Best-Sellers-Baby-Maternity-Skin-Care/zgbs/baby-products/11062371/','https://www.amazon.com/Best-Sellers-Baby-Albums-Frames-Journals/zgbs/baby-products/239231011/','https://www.amazon.com/Best-Sellers-Baby-Gift-Baskets/zgbs/baby-products/394314011/','https://www.amazon.com/Best-Sellers-Baby-Gift-Sets/zgbs/baby-products/239229011/','https://www.amazon.com/Best-Sellers-Baby-Keepsake-Products/zgbs/baby-products/239228011/','https://www.amazon.com/Best-Sellers-Baby-Rattles-Plush-Rings/zgbs/baby-products/196612011/','https://www.amazon.com/Best-Sellers-Baby-Nursery-Bedding-Mattresses/zgbs/baby-products/11625834011/','https://www.amazon.com/Best-Sellers-Baby-Nursery-Furniture/zgbs/baby-products/166809011/','https://www.amazon.com/Best-Sellers-Baby-Nursery-D%C3%A9cor/zgbs/baby-products/166875011/','https://www.amazon.com/Best-Sellers-Baby-Nursery-Safety-Equipment/zgbs/baby-products/17272665011/','https://www.amazon.com/Best-Sellers-Baby-Toilet-Training-Potties-Seats/zgbs/baby-products/166889011/','https://www.amazon.com/Best-Sellers-Baby-Toilet-Training-Seat-Covers/zgbs/baby-products/166888011/','https://www.amazon.com/Best-Sellers-Baby-Toilet-Training-Pants/zgbs/baby-products/166891011/','https://www.amazon.com/Best-Sellers-Baby-Travel-Potties/zgbs/baby-products/2237485011/','https://www.amazon.com/Best-Sellers-Baby-Kids-Bathroom-Safety-Products/zgbs/baby-products/166864011/','https://www.amazon.com/Best-Sellers-Baby-Cabinet-Locks-Straps/zgbs/baby-products/166865011/','https://www.amazon.com/Best-Sellers-Baby-Crib-Netting/zgbs/baby-products/2237482011/','https://www.amazon.com/Best-Sellers-Baby-Furniture-Corner-Edge-Safety-Bumpers/zgbs/baby-products/166866011/','https://www.amazon.com/Best-Sellers-Baby-Electrical-Safety-Products/zgbs/baby-products/166867011/','https://www.amazon.com/Best-Sellers-Baby-Indoor-Safety-Gates-Gate-Extensions/zgbs/baby-products/166868011/','https://www.amazon.com/Best-Sellers-Baby-Toddler-Safety-Harnesses-Leashes/zgbs/baby-products/2237486011/','https://www.amazon.com/Best-Sellers-Baby-Hearing-Protection-Earmuffs/zgbs/baby-products/21393842011/','https://www.amazon.com/Best-Sellers-Baby-Stove-Safety-Covers-Appliance-Latches/zgbs/baby-products/166869011/','https://www.amazon.com/Best-Sellers-Baby-Monitors/zgbs/baby-products/166870011/','https://www.amazon.com/Best-Sellers-Baby-Kids-Bed-Rails-Rail-Guards/zgbs/baby-products/166872011/','https://www.amazon.com/Best-Sellers-Baby-Sleep-Positioners/zgbs/baby-products/166874011/','https://www.amazon.com/Best-Sellers-Baby-Jogger-Strollers/zgbs/baby-products/166846011/','https://www.amazon.com/Best-Sellers-Baby-Lightweight-Strollers/zgbs/baby-products/370094011/','https://www.amazon.com/Best-Sellers-Baby-Pram-Strollers/zgbs/baby-products/166847011/','https://www.amazon.com/Best-Sellers-Baby-Standard-Strollers/zgbs/baby-products/166845011/','https://www.amazon.com/Best-Sellers-Baby-Tandem-Strollers/zgbs/baby-products/173210011/','https://www.amazon.com/Best-Sellers-Baby-Stroller-Travel-Systems/zgbs/baby-products/166849011/','https://www.amazon.com/Best-Sellers-Baby-Child-Carrier-Products/zgbs/baby-products/166829011/','https://www.amazon.com/Best-Sellers-Baby-Bike-Child-Seats/zgbs/baby-products/3403281/','https://www.amazon.com/Best-Sellers-Baby-Shopping-Cart-Seat-Covers/zgbs/baby-products/373743011/','https://www.amazon.com/Best-Sellers-Baby-Strollers-Accessories/zgbs/baby-products/8446318011/','https://www.amazon.com/Best-Sellers-Baby-Infant-Toddler-Travel-Bed-Products/zgbs/baby-products/21364146011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Bath-Products/zgbs/hpc/11056211/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Bathing-Accessories/zgbs/hpc/11056491/','https://www.amazon.com/Best-Sellers-Beauty-Foot-Hand-Care/zgbs/beauty/11062211/','https://www.amazon.com/Best-Sellers-Beauty-Nail-Polish-Decoration-Products/zgbs/beauty/11059311/','https://www.amazon.com/Best-Sellers-Beauty-Nail-Care-Products/zgbs/beauty/11062291/','https://www.amazon.com/Best-Sellers-Beauty-Hand-Foot-Nail-Tools/zgbs/beauty/11063461/','https://www.amazon.com/Best-Sellers-Beauty-Childrens-Fragrance/zgbs/beauty/11056711/','https://www.amazon.com/Best-Sellers-Beauty-Fragrance-Dusting-Powders/zgbs/beauty/10292709011/','https://www.amazon.com/Best-Sellers-Beauty-Mens-Fragrances/zgbs/beauty/11056761/','https://www.amazon.com/Best-Sellers-Beauty-Fragrance-Sets/zgbs/beauty/11056891/','https://www.amazon.com/Best-Sellers-Beauty-Womens-Fragrances/zgbs/beauty/11056931/','https://www.amazon.com/Best-Sellers-Beauty-Hair-Extensions-Wigs-Accessories/zgbs/beauty/13105931/','https://www.amazon.com/Best-Sellers-Beauty-Hair-Styling-Accessories/zgbs/beauty/11057971/','https://www.amazon.com/Best-Sellers-Beauty-Hair-Coloring-Products/zgbs/beauty/11057451/','https://www.amazon.com/Best-Sellers-Beauty-Hair-Cutting-Tools/zgbs/beauty/10676449011/','https://www.amazon.com/Best-Sellers-Beauty-Hair-Loss-Products/zgbs/beauty/10898755011/','https://www.amazon.com/Best-Sellers-Beauty-Hair-Treatment-Masks/zgbs/beauty/10666437011/','https://www.amazon.com/Best-Sellers-Beauty-Hair-Perms-Relaxers-Texturizers/zgbs/beauty/16236250011/','https://www.amazon.com/Best-Sellers-Beauty-Hair-Regrowth-Devices/zgbs/beauty/13861664011/','https://www.amazon.com/Best-Sellers-Beauty-Hair-Treatment-Oils/zgbs/beauty/10666439011/','https://www.amazon.com/Best-Sellers-Beauty-Scalp-Treatments/zgbs/beauty/23561814011/','https://www.amazon.com/Best-Sellers-Beauty-Shampoo-Conditioner/zgbs/beauty/17911764011/','https://www.amazon.com/Best-Sellers-Beauty-Hair-Styling-Products/zgbs/beauty/11057841/','https://www.amazon.com/Best-Sellers-Beauty-Styling-Tools-Appliances/zgbs/beauty/11058091/','https://www.amazon.com/Best-Sellers-Beauty-Body-Makeup/zgbs/beauty/11058291/','https://www.amazon.com/Best-Sellers-Beauty-Eye-Makeup/zgbs/beauty/11058331/','https://www.amazon.com/Best-Sellers-Beauty-Face-Makeup/zgbs/beauty/11058691/','https://www.amazon.com/Best-Sellers-Beauty-Lip-Makeup/zgbs/beauty/11059031/','https://www.amazon.com/Best-Sellers-Beauty-Makeup-Palettes/zgbs/beauty/2265896011/','https://www.amazon.com/Best-Sellers-Beauty-Makeup-Remover/zgbs/beauty/11059231/','https://www.amazon.com/Best-Sellers-Beauty-Makeup-Sets/zgbs/beauty/11059301/','https://www.amazon.com/Best-Sellers-Beauty-Body-Skin-Care-Products/zgbs/beauty/11060521/','https://www.amazon.com/Best-Sellers-Beauty-Eye-Treatment-Products/zgbs/beauty/11061941/','https://www.amazon.com/Best-Sellers-Beauty-Facial-Skin-Care-Products/zgbs/beauty/11060711/','https://www.amazon.com/Best-Sellers-Beauty-Lip-Care-Products/zgbs/beauty/3761351/','https://www.amazon.com/Best-Sellers-Beauty-Maternity-Skin-Care/zgbs/beauty/11062371/','https://www.amazon.com/Best-Sellers-Beauty-Skin-Care-Sets-Kits/zgbs/beauty/11062581/','https://www.amazon.com/Best-Sellers-Beauty-Sun-Skin-Care/zgbs/beauty/11062591/','https://www.amazon.com/Best-Sellers-Beauty-Makeup-Bags-Cases/zgbs/beauty/11062751/','https://www.amazon.com/Best-Sellers-Beauty-Bathing-Accessories/zgbs/beauty/11056491/','https://www.amazon.com/Best-Sellers-Beauty-Cotton-Balls-Swabs/zgbs/beauty/3784921/','https://www.amazon.com/Best-Sellers-Beauty-Makeup-Brushes-Tools/zgbs/beauty/11059391/','https://www.amazon.com/Best-Sellers-Beauty-Personal-Mirrors/zgbs/beauty/11063411/','https://www.amazon.com/Best-Sellers-Beauty-Salon-Spa-Equipment/zgbs/beauty/15144566011/','https://www.amazon.com/Best-Sellers-Beauty-Shaving-Hair-Removal-Products/zgbs/beauty/3778591/','https://www.amazon.com/Best-Sellers-Beauty-Skin-Care-Tools/zgbs/beauty/13861652011/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Video-Accessory-Bundles/zgbs/electronics/7242007011/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Bags-Cases/zgbs/electronics/172437/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Camcorder-Batteries-Chargers/zgbs/electronics/13535371/','https://www.amazon.com/Best-Sellers-Electronics-Binocular-Accessories/zgbs/electronics/3345801/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Photo-Blank-Media/zgbs/electronics/172840/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Photo-Cables-Cords/zgbs/electronics/14015081/','https://www.amazon.com/Best-Sellers-Electronics-Camcorder-Accessories/zgbs/electronics/505106/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Photo-Cleaners/zgbs/electronics/172426/','https://www.amazon.com/Best-Sellers-Electronics-Darkroom-Supplies/zgbs/electronics/3348501/','https://www.amazon.com/Best-Sellers-Electronics-Digital-Camera-Accessories/zgbs/electronics/505110/','https://www.amazon.com/Best-Sellers-Electronics-Digital-Picture-Frame-Screen-Protector-Foils/zgbs/electronics/3109899011/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Photo-Filters/zgbs/electronics/499262/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Flash-Accessories/zgbs/electronics/3346401/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Flashes/zgbs/electronics/172447/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Lens-Accessories/zgbs/electronics/525898/','https://www.amazon.com/Best-Sellers-Electronics-Lighting-Studio-Equipment/zgbs/electronics/7161086011/','https://www.amazon.com/Best-Sellers-Electronics-Professional-Video-Accessories/zgbs/electronics/196569011/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Photo-Case-Bag-Rain-Covers/zgbs/electronics/3346261/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Camcorder-Remote-Controls/zgbs/electronics/14015071/','https://www.amazon.com/Best-Sellers-Electronics-Telescope-Microscope-Accessories/zgbs/electronics/7161068011/','https://www.amazon.com/Best-Sellers-Electronics-Tripod-Accessories/zgbs/electronics/3347771/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Tripods-Monopods/zgbs/electronics/499306/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Camcorder-Viewfinders/zgbs/electronics/14015021/','https://www.amazon.com/Best-Sellers-Electronics-Slide-Projectors/zgbs/electronics/525464/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Photo-Case-Bag-Accessories/zgbs/electronics/3346201/','https://www.amazon.com/Best-Sellers-Electronics-Binocular-Cases/zgbs/electronics/499142/','https://www.amazon.com/Best-Sellers-Electronics-Binocular-Camera-Camcorder-Straps/zgbs/electronics/3345831/','https://www.amazon.com/Best-Sellers-Electronics-Camcorder-Cases/zgbs/electronics/499234/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Cases/zgbs/electronics/3345931/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Filter-Bags-Cases/zgbs/electronics/3346191/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Lens-Bags-Cases/zgbs/electronics/3346101/','https://www.amazon.com/Best-Sellers-Electronics-Telescope-Cases/zgbs/electronics/3346091/','https://www.amazon.com/Best-Sellers-Electronics-Tripod-Monopod-Cases/zgbs/electronics/3346131/','https://www.amazon.com/Best-Sellers-Electronics-Binoculars/zgbs/electronics/297842/','https://www.amazon.com/Best-Sellers-Electronics-Gun-Scopes/zgbs/electronics/162020011/','https://www.amazon.com/Best-Sellers-Electronics-Laser-Rangefinders/zgbs/electronics/162019011/','https://www.amazon.com/Best-Sellers-Electronics-Microscopes/zgbs/electronics/499170/','https://www.amazon.com/Best-Sellers-Electronics-Monoculars/zgbs/electronics/3168051/','https://www.amazon.com/Best-Sellers-Electronics-Hunting-Night-Vision/zgbs/electronics/3304289011/','https://www.amazon.com/Best-Sellers-Electronics-Opera-Glasses/zgbs/electronics/3381367011/','https://www.amazon.com/Best-Sellers-Electronics-Spotting-Scopes/zgbs/electronics/3168061/','https://www.amazon.com/Best-Sellers-Electronics-Telescopes/zgbs/electronics/281063/','https://www.amazon.com/Best-Sellers-Electronics-Video-Equipment/zgbs/electronics/7161073011/','https://www.amazon.com/Best-Sellers-Electronics-Body-Mounted-Video-Cameras/zgbs/electronics/10048714011/','https://www.amazon.com/Best-Sellers-Electronics-Camcorder-Bundles/zgbs/electronics/4943760011/','https://www.amazon.com/Best-Sellers-Electronics-Camcorder-Lenses/zgbs/electronics/172427/','https://www.amazon.com/Best-Sellers-Electronics-Video-Camera-Supports-Stabilizers/zgbs/electronics/7161077011/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Photo-Lighting/zgbs/electronics/3347871/','https://www.amazon.com/Best-Sellers-Electronics-Professional-Grade-Video-Cameras/zgbs/electronics/7161075011/','https://www.amazon.com/Best-Sellers-Electronics-Quadcopters-Accessories/zgbs/electronics/11910405011/','https://www.amazon.com/Best-Sellers-Electronics-Sports-Action-Video-Cameras/zgbs/electronics/7161074011/','https://www.amazon.com/Best-Sellers-Electronics-Video-Studio-Equipment/zgbs/electronics/7161087011/','https://www.amazon.com/Best-Sellers-Electronics-Digital-Cameras/zgbs/electronics/281052/','https://www.amazon.com/Best-Sellers-Electronics-Instant-Digital-Cameras/zgbs/electronics/21488767011/','https://www.amazon.com/Best-Sellers-Electronics-Mirrorless-Cameras/zgbs/electronics/3109924011/','https://www.amazon.com/Best-Sellers-Electronics-Digital-Point-Shoot-Cameras/zgbs/electronics/330405011/','https://www.amazon.com/Best-Sellers-Electronics-Photo-Studio-Equipment/zgbs/electronics/3443921/','https://www.amazon.com/Best-Sellers-Electronics-Photographic-Storage-Materials/zgbs/electronics/3443931/','https://www.amazon.com/Best-Sellers-Electronics-Archival-Photo-Storage-Boxes/zgbs/electronics/3444131/','https://www.amazon.com/Best-Sellers-Electronics-Storage-Presentation-Portfolios/zgbs/electronics/3444181/','https://www.amazon.com/Best-Sellers-Electronics-Photographic-Storage-Pages/zgbs/electronics/3444001/','https://www.amazon.com/Best-Sellers-Electronics-Archival-Photo-Storage-Binders/zgbs/electronics/3444101/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Lenses/zgbs/electronics/562261011/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Camcorder-Lens-Bundles/zgbs/electronics/7242009011/','https://www.amazon.com/Best-Sellers-Electronics-DSLR-Cameras/zgbs/electronics/3017941/','https://www.amazon.com/Best-Sellers-Electronics-Video-Surveillance-Equipment/zgbs/electronics/7161091011/','https://www.amazon.com/Best-Sellers-Electronics-Bullet-Surveillance-Cameras/zgbs/electronics/14241331/','https://www.amazon.com/Best-Sellers-Electronics-Dome-Surveillance-Cameras/zgbs/electronics/14241151/','https://www.amazon.com/Best-Sellers-Electronics-Hidden-Cameras/zgbs/electronics/12909791/','https://www.amazon.com/Best-Sellers-Electronics-Hunting-Trail-Cameras/zgbs/electronics/3413551/','https://www.amazon.com/Best-Sellers-Cell-Phone-Adhesive-Card-Holders/zgbs/wireless/21209106011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Automobile-Accessories/zgbs/wireless/2407759011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Cables-Adapters/zgbs/wireless/21209107011/','https://www.amazon.com/Best-Sellers-Camera-Privacy-Covers/zgbs/wireless/21103668011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Chargers-Power-Adapters/zgbs/wireless/2407761011/','https://www.amazon.com/Best-Sellers-Cell-Phone-D%C3%A9cor/zgbs/wireless/21209101011/','https://www.amazon.com/Best-Sellers-Item-Finders/zgbs/wireless/18022313011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Gaming-Accessories/zgbs/wireless/21209102011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Grips/zgbs/wireless/21209098011/','https://www.amazon.com/Best-Sellers-Audio-Headphones/zgbs/wireless/172541/','https://www.amazon.com/Best-Sellers-Cell-Phone-Lanyards-Wrist-Straps/zgbs/wireless/21209103011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Maintenance-Upkeep-Repairs/zgbs/wireless/21209105011/','https://www.amazon.com/Best-Sellers-Micro-SD-Memory-Cards/zgbs/wireless/3015433011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Photo-Video-Accessories/zgbs/wireless/21209100011/','https://www.amazon.com/Best-Sellers-Portable-Cell-Phone-MP3-Player-Speakers-Audio-Docks/zgbs/wireless/689637011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Screen-Expanders-Magnifiers/zgbs/wireless/21209099011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Signal-Boosters/zgbs/wireless/2407782011/','https://www.amazon.com/Best-Sellers-Single-Ear-Bluetooth-Cell-Phone-Headsets/zgbs/wireless/18021376011/','https://www.amazon.com/Best-Sellers-Smartwatch-Accessories/zgbs/wireless/7939902011/','https://www.amazon.com/Best-Sellers-Smartwatches/zgbs/wireless/7939901011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Stands/zgbs/wireless/7073961011/','https://www.amazon.com/Best-Sellers-Styluses/zgbs/wireless/11548954011/','https://www.amazon.com/Best-Sellers-UV-Phone-Sterilizer-Boxes/zgbs/wireless/21268231011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Virtual-Reality-VR-Headsets/zgbs/wireless/14775002011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Armbands/zgbs/wireless/7073962011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Basic-Cases/zgbs/wireless/3081461011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Battery-Charger-Cases/zgbs/wireless/7073958011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Bumpers/zgbs/wireless/17875442011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Case-Cover-Bundles/zgbs/wireless/21209096011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Crossbody-Lanyard-Cases/zgbs/wireless/21209095011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Dry-Bags/zgbs/wireless/17875443011/','https://www.amazon.com/Best-Sellers-Flip-Cell-Phone-Cases/zgbs/wireless/9931389011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Holsters/zgbs/wireless/2407765011/','https://www.amazon.com/Best-Sellers-Cell-Phone-Sleeves/zgbs/wireless/9414313011/','https://www.amazon.com/Best-Sellers-Prepaid-Cell-Phone-Minutes/zgbs/wireless/2483609011/','https://www.amazon.com/Best-Sellers-Cell-Phone-SIM-Cards/zgbs/wireless/14674870011/','https://www.amazon.com/Best-Sellers-Baby-Girls-Clothing-Shoes/zgbs/fashion/7628012011/','https://www.amazon.com/Best-Sellers-Baby-Boys-Clothing-Shoes/zgbs/fashion/7628013011/','https://www.amazon.com/Best-Sellers-Boys-Clothing/zgbs/fashion/1040666/','https://www.amazon.com/Best-Sellers-Boys-Shoes/zgbs/fashion/679182011/','https://www.amazon.com/Best-Sellers-Boys-Watches/zgbs/fashion/6358551011/','https://www.amazon.com/Best-Sellers-Boys-Accessories/zgbs/fashion/2474939011/','https://www.amazon.com/Best-Sellers-Boys-Jewelry/zgbs/fashion/3880611/','https://www.amazon.com/Best-Sellers-Boys-Shops/zgbs/fashion/7581671011/','https://www.amazon.com/Best-Sellers-Womens-Costumes-Accessories/zgbs/fashion/14194713011/','https://www.amazon.com/Best-Sellers-Mens-Costumes-Accessories/zgbs/fashion/14194728011/','https://www.amazon.com/Best-Sellers-Kids-Babies-Costumes-Accessories/zgbs/fashion/14194742011/','https://www.amazon.com/Best-Sellers-Costume-Makeup-Facial-Hair-Adhesives/zgbs/fashion/14194763011/','https://www.amazon.com/Best-Sellers-Costume-Props/zgbs/fashion/14194766011/','https://www.amazon.com/Best-Sellers-Girls-Clothing/zgbs/fashion/1040664/','https://www.amazon.com/Best-Sellers-Girls-Shoes/zgbs/fashion/679217011/','https://www.amazon.com/Best-Sellers-Girls-Jewelry/zgbs/fashion/3880961/','https://www.amazon.com/Best-Sellers-Girls-Watches/zgbs/fashion/6358547011/','https://www.amazon.com/Best-Sellers-Girls-Accessories/zgbs/fashion/2474938011/','https://www.amazon.com/Best-Sellers-Girls-Shops/zgbs/fashion/7581670011/','https://www.amazon.com/Best-Sellers-Backpacks/zgbs/fashion/360832011/','https://www.amazon.com/Best-Sellers-Briefcases/zgbs/fashion/2204831011/','https://www.amazon.com/Best-Sellers-Gym-Bags/zgbs/fashion/15743181/','https://www.amazon.com/Best-Sellers-Laptop-Bags/zgbs/fashion/9971584011/','https://www.amazon.com/Best-Sellers-Luggage/zgbs/fashion/15743251/','https://www.amazon.com/Best-Sellers-Messenger-Bags/zgbs/fashion/15743231/','https://www.amazon.com/Best-Sellers-Travel-Accessories/zgbs/fashion/15743971/','https://www.amazon.com/Best-Sellers-Travel-Duffel-Bags/zgbs/fashion/15743211/','https://www.amazon.com/Best-Sellers-Travel-Tote-Bags/zgbs/fashion/15743241/','https://www.amazon.com/Best-Sellers-Rain-Umbrellas/zgbs/fashion/15744111/','https://www.amazon.com/Best-Sellers-Fashion-Waist-Packs/zgbs/fashion/2477385011/','https://www.amazon.com/Best-Sellers-Mens-Clothing/zgbs/fashion/1040658/','https://www.amazon.com/Best-Sellers-Mens-Shoes/zgbs/fashion/679255011/','https://www.amazon.com/Best-Sellers-Mens-Jewelry/zgbs/fashion/3887881/','https://www.amazon.com/Best-Sellers-Mens-Watches/zgbs/fashion/6358539011/','https://www.amazon.com/Best-Sellers-Mens-Accessories/zgbs/fashion/2474937011/','https://www.amazon.com/Best-Sellers-Mens-Shops/zgbs/fashion/7581669011/','https://www.amazon.com/Best-Sellers-Mens-Handbags-Shoulder-Bags/zgbs/fashion/14864589011/','https://www.amazon.com/Best-Sellers-Novelty-Clothing-More/zgbs/fashion/12035955011/','https://www.amazon.com/Best-Sellers-Novelty-Watches/zgbs/fashion/5262066011/','https://www.amazon.com/Best-Sellers-Jewelry-Accessories/zgbs/fashion/9616098011/','https://www.amazon.com/Best-Sellers-Shoe-Care-Accessories/zgbs/fashion/9616100011/','https://www.amazon.com/Best-Sellers-Watch-Accessories/zgbs/fashion/9616099011/','https://www.amazon.com/Best-Sellers-Uniforms-Work-Safety-Footwear/zgbs/fashion/7586145011/','https://www.amazon.com/Best-Sellers-Uniforms-Work-Safety-Clothing/zgbs/fashion/1265851011/','https://www.amazon.com/Best-Sellers-Womens-Clothing/zgbs/fashion/1040660/','https://www.amazon.com/Best-Sellers-Womens-Shoes/zgbs/fashion/679337011/','https://www.amazon.com/Best-Sellers-Womens-Jewelry/zgbs/fashion/7192394011/','https://www.amazon.com/Best-Sellers-Womens-Watches/zgbs/fashion/6358543011/','https://www.amazon.com/Best-Sellers-Womens-Handbags-Purses-Wallets/zgbs/fashion/15743631/','https://www.amazon.com/Best-Sellers-Womens-Accessories/zgbs/fashion/2474936011/','https://www.amazon.com/Best-Sellers-Womens-Shops/zgbs/fashion/7581668011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Audio-Video-Accessories/zgbs/electronics/11548951011/','https://www.amazon.com/Best-Sellers-Electronics-Blank-Media-Products/zgbs/electronics/281408/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Blue-Light-Blocking-Glasses/zgbs/electronics/17919093011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Security-Cables/zgbs/electronics/11036541/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Cables-Interconnects/zgbs/electronics/172463/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Cleaning-Repair/zgbs/electronics/281501/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Cable-Adapters/zgbs/electronics/172472/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Game-Hardware/zgbs/electronics/172487/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Hard-Drive-Accessories/zgbs/electronics/11548952011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Input-Devices/zgbs/electronics/172493/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Keyboards-Mice-Accessories/zgbs/electronics/11548956011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Memory-Card-Accessories/zgbs/electronics/11548957011/','https://www.amazon.com/Best-Sellers-Electronics-Memory-Cards/zgbs/electronics/516866/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Monitor-Accessories/zgbs/electronics/281062/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Printer-Parts-Accessories/zgbs/electronics/172636/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Printer-Ink-Toner/zgbs/electronics/172638/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Racks-Cabinets/zgbs/electronics/1086958/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Scanner-Accessories/zgbs/electronics/172585/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Uninterruptible-Power-Supply-Units/zgbs/electronics/764572/','https://www.amazon.com/Best-Sellers-Electronics-USB-Gadgets/zgbs/electronics/11548961011/','https://www.amazon.com/Best-Sellers-Electronics-USB-Hubs/zgbs/electronics/17387627011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Video-Projector-Accessories/zgbs/electronics/1232269011/','https://www.amazon.com/Best-Sellers-Electronics-Replacement-Computer-Screws/zgbs/electronics/3012917011/','https://www.amazon.com/Best-Sellers-Electronics-Desktop-Barebones/zgbs/electronics/3015426011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-External-Components/zgbs/electronics/3012292011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Internal-Components/zgbs/electronics/17923671011/','https://www.amazon.com/Best-Sellers-Electronics-Laptop-Computer-Replacement-Parts/zgbs/electronics/6795229011/','https://www.amazon.com/Best-Sellers-Electronics-Single-Board-Computers/zgbs/electronics/17441247011/','https://www.amazon.com/Best-Sellers-Electronics-External-Hard-Drives/zgbs/electronics/595048/','https://www.amazon.com/Best-Sellers-Electronics-External-Solid-State-Drives/zgbs/electronics/3015429011/','https://www.amazon.com/Best-Sellers-Electronics-External-Zip-Drives/zgbs/electronics/1193862/','https://www.amazon.com/Best-Sellers-Electronics-Floppy-Tape-Drives/zgbs/electronics/6795226011/','https://www.amazon.com/Best-Sellers-Electronics-Internal-Hard-Drives/zgbs/electronics/1254762011/','https://www.amazon.com/Best-Sellers-Electronics-Internal-Solid-State-Drives/zgbs/electronics/1292116011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Network-Attached-Storage/zgbs/electronics/13436301/','https://www.amazon.com/Best-Sellers-Electronics-Tape-Libraries/zgbs/electronics/6795227011/','https://www.amazon.com/Best-Sellers-Electronics-USB-Flash-Drives/zgbs/electronics/3151491/','https://www.amazon.com/Best-Sellers-Electronics-Computers-Tablets/zgbs/electronics/13896617011/','https://www.amazon.com/Best-Sellers-Electronics-All-One-Computers/zgbs/electronics/13896603011/','https://www.amazon.com/Best-Sellers-Electronics-Mini-Computers/zgbs/electronics/13896591011/','https://www.amazon.com/Best-Sellers-Electronics-Tower-Computers/zgbs/electronics/13896597011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Components/zgbs/electronics/193870011/','https://www.amazon.com/Best-Sellers-Computers-Accessories-Computer-Cases/zgbs/pc/572238/','https://www.amazon.com/Best-Sellers-Computers-Accessories-External-Hard-Drives/zgbs/pc/595048/','https://www.amazon.com/Best-Sellers-Computers-Accessories-External-Solid-State-Drives/zgbs/pc/3015429011/','https://www.amazon.com/Best-Sellers-Computers-Accessories-External-Sound-Cards/zgbs/pc/3015427011/','https://www.amazon.com/Best-Sellers-Computers-Accessories-External-TV-Tuners/zgbs/pc/3015428011/','https://www.amazon.com/Best-Sellers-Computers-Accessories-KVM-Switches/zgbs/pc/13983771/','https://www.amazon.com/Best-Sellers-Computers-Accessories-External-Optical-Drives/zgbs/pc/1292112011/','https://www.amazon.com/Best-Sellers-Electronics-Laptop-Bags-Cases-Sleeves/zgbs/electronics/172470/','https://www.amazon.com/Best-Sellers-Electronics-Laptop-Batteries/zgbs/electronics/720576/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Privacy-Covers/zgbs/electronics/21103668011/','https://www.amazon.com/Best-Sellers-Electronics-Laptop-Chargers-Adapters/zgbs/electronics/11041841/','https://www.amazon.com/Best-Sellers-Electronics-Laptop-Cooling-Pads-External-Fans/zgbs/electronics/2243862011/','https://www.amazon.com/Best-Sellers-Electronics-Laptop-Docking-Stations/zgbs/electronics/778660/','https://www.amazon.com/Best-Sellers-Electronics-Lap-Desks/zgbs/electronics/490924011/','https://www.amazon.com/Best-Sellers-Electronics-Laptop-Mounts/zgbs/electronics/3015408011/','https://www.amazon.com/Best-Sellers-Electronics-Laptop-Replacement-Screens/zgbs/electronics/2612045011/','https://www.amazon.com/Best-Sellers-Electronics-Laptop-Screen-Filters/zgbs/electronics/3012922011/','https://www.amazon.com/Best-Sellers-Electronics-Laptop-Screen-Protectors/zgbs/electronics/3012923011/','https://www.amazon.com/Best-Sellers-Electronics-Laptop-Security-Locks/zgbs/electronics/3012924011/','https://www.amazon.com/Best-Sellers-Electronics-Laptop-Skins-Decals/zgbs/electronics/3011392011/','https://www.amazon.com/Best-Sellers-Electronics-Laptop-Stands/zgbs/electronics/3015409011/','https://www.amazon.com/Best-Sellers-Electronics-Laptop-Computers/zgbs/electronics/13896609011/','https://www.amazon.com/Best-Sellers-Electronics-Traditional-Laptop-Computers/zgbs/electronics/13896615011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Accessories-Peripherals/zgbs/electronics/172456/','https://www.amazon.com/Best-Sellers-Electronics-Data-Storage/zgbs/electronics/1292110011/','https://www.amazon.com/Best-Sellers-Electronics-Laptop-Accessories/zgbs/electronics/3011391011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Networking/zgbs/electronics/172504/','https://www.amazon.com/Best-Sellers-Electronics-Power-Strips-Surge-Protectors/zgbs/electronics/17854127011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Printers/zgbs/electronics/172635/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Scanners/zgbs/electronics/172584/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Servers/zgbs/electronics/11036071/','https://www.amazon.com/Best-Sellers-Electronics-Tablet-Accessories/zgbs/electronics/2348628011/','https://www.amazon.com/Best-Sellers-Electronics-Tablet-Replacement-Parts/zgbs/electronics/15524379011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Warranties-Services/zgbs/electronics/16285851/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Networking-Device-Servers/zgbs/electronics/13983751/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Networking-Hubs/zgbs/electronics/281413/','https://www.amazon.com/Best-Sellers-Electronics-Mobile-Broadband-Devices/zgbs/electronics/5005583011/','https://www.amazon.com/Best-Sellers-Electronics-Modem-Router-Combos/zgbs/electronics/17442743011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Networking-Modems/zgbs/electronics/284715/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Network-Adapters/zgbs/electronics/490499011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Networking-Antennas/zgbs/electronics/3015438011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Networking-Transceivers/zgbs/electronics/537316/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Networking-Print-Servers/zgbs/electronics/13983761/','https://www.amazon.com/Best-Sellers-Electronics-Repeaters/zgbs/electronics/3015439011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Routers/zgbs/electronics/300189/','https://www.amazon.com/Best-Sellers-Electronics-Streaming-Media-Players/zgbs/electronics/13447451/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Networking-Switches/zgbs/electronics/281414/','https://www.amazon.com/Best-Sellers-Electronics-Whole-Home-Mesh-Wi-Fi-Systems/zgbs/electronics/17935294011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Networking-Wireless-Access-Points/zgbs/electronics/1194486/','https://www.amazon.com/Best-Sellers-Office-Products-Printers-Accessories/zgbs/office-products/9424016011/','https://www.amazon.com/Best-Sellers-Office-Products-Dot-Matrix-Computer-Printers/zgbs/office-products/3012931011/','https://www.amazon.com/Best-Sellers-Office-Products-Inkjet-Computer-Printers/zgbs/office-products/172646/','https://www.amazon.com/Best-Sellers-Office-Products-Desktop-Label-Printers/zgbs/office-products/8553181011/','https://www.amazon.com/Best-Sellers-Office-Products-Laser-Computer-Printers/zgbs/office-products/172648/','https://www.amazon.com/Best-Sellers-Office-Products-Photo-Printers/zgbs/office-products/17939179011/','https://www.amazon.com/Best-Sellers-Office-Products-Wide-Format-Plotter-Printers/zgbs/office-products/17933140011/','https://www.amazon.com/Best-Sellers-Computers-Accessories-Computer-Networking-Device-Servers/zgbs/pc/13983751/','https://www.amazon.com/Best-Sellers-Computers-Accessories-Computer-Networking-Hubs/zgbs/pc/281413/','https://www.amazon.com/Best-Sellers-Computers-Accessories-Mobile-Broadband-Devices/zgbs/pc/5005583011/','https://www.amazon.com/Best-Sellers-Computers-Accessories-Modem-Router-Combos/zgbs/pc/17442743011/','https://www.amazon.com/Best-Sellers-Computers-Accessories-Computer-Networking-Modems/zgbs/pc/284715/','https://www.amazon.com/Best-Sellers-Computers-Accessories-Computer-Network-Adapters/zgbs/pc/490499011/','https://www.amazon.com/Best-Sellers-Computers-Accessories-Computer-Networking-Antennas/zgbs/pc/3015438011/','https://www.amazon.com/Best-Sellers-Computers-Accessories-Computer-Network-Attached-Storage/zgbs/pc/13436301/','https://www.amazon.com/Best-Sellers-Computers-Accessories-Computer-Networking-Transceivers/zgbs/pc/537316/','https://www.amazon.com/Best-Sellers-Computers-Accessories-Computer-Networking-Print-Servers/zgbs/pc/13983761/','https://www.amazon.com/Best-Sellers-Computers-Accessories-Repeaters/zgbs/pc/3015439011/','https://www.amazon.com/Best-Sellers-Computers-Accessories-Streaming-Media-Players/zgbs/pc/13447451/','https://www.amazon.com/Best-Sellers-Computers-Accessories-Computer-Networking-Switches/zgbs/pc/281414/','https://www.amazon.com/Best-Sellers-Computers-Accessories-Whole-Home-Mesh-Wi-Fi-Systems/zgbs/pc/17935294011/','https://www.amazon.com/Best-Sellers-Computers-Accessories-Computer-Networking-Wireless-Access-Points/zgbs/pc/1194486/','https://www.amazon.com/Best-Sellers-Office-Products-Scanners-Accessories/zgbs/office-products/9277898011/','https://www.amazon.com/Best-Sellers-Office-Products-Business-Card-Scanners/zgbs/office-products/5728046011/','https://www.amazon.com/Best-Sellers-Office-Products-Document-Scanners/zgbs/office-products/5728047011/','https://www.amazon.com/Best-Sellers-Office-Products-Flatbed-Scanners/zgbs/office-products/5728048011/','https://www.amazon.com/Best-Sellers-Office-Products-Slide-Negative-Scanners/zgbs/office-products/5728049011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Monitors/zgbs/electronics/1292115011/','https://www.amazon.com/Best-Sellers-Electronics-Tablet-Bags-Cases-Sleeves/zgbs/electronics/2348629011/','https://www.amazon.com/Best-Sellers-Electronics-Tablet-Chargers-Adapters/zgbs/electronics/2516700011/','https://www.amazon.com/Best-Sellers-Electronics-Tablet-Keyboard-Cases/zgbs/electronics/11548963011/','https://www.amazon.com/Best-Sellers-Electronics-Tablet-Keyboards/zgbs/electronics/11548965011/','https://www.amazon.com/Best-Sellers-Electronics-Tablet-Mounts/zgbs/electronics/11548967011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Mobile-Device-Repair-Kits/zgbs/electronics/13825561/','https://www.amazon.com/Best-Sellers-Electronics-Tablet-Screen-Filters/zgbs/electronics/11548971011/','https://www.amazon.com/Best-Sellers-Electronics-Tablet-Screen-Protectors/zgbs/electronics/2348631011/','https://www.amazon.com/Best-Sellers-Electronics-Tablet-Stands/zgbs/electronics/3015412011/','https://www.amazon.com/Best-Sellers-Electronics-Styluses/zgbs/electronics/11548954011/','https://www.amazon.com/Best-Sellers-Electronics-Desktop-Computers/zgbs/electronics/565098/','https://www.amazon.com/Best-Sellers-Electronics-Laptop-Computers/zgbs/electronics/565108/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Equipment-Warranties/zgbs/electronics/917652/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Equipment-Installation-Services/zgbs/electronics/2632818011/','https://www.amazon.com/Best-Sellers-Electronics-Computer-Service-Plans-Add-Ons/zgbs/electronics/16285871/','https://www.amazon.com/Best-Sellers-Classroom-Attendance/zgbs/digital-educational-resources/18591123011/','https://www.amazon.com/Best-Sellers-Classroom-Behavior-Management/zgbs/digital-educational-resources/18591124011/','https://www.amazon.com/Best-Sellers-Generic-Classroom-Materials/zgbs/digital-educational-resources/18591125011/','https://www.amazon.com/Best-Sellers-Classroom-Incentives/zgbs/digital-educational-resources/18591126011/','https://www.amazon.com/Best-Sellers-Classroom-Templates/zgbs/digital-educational-resources/18591128011/','https://www.amazon.com/Best-Sellers-Basic-Computer-Operations/zgbs/digital-educational-resources/18591131011/','https://www.amazon.com/Best-Sellers-Multimedia-Presentation/zgbs/digital-educational-resources/18591133011/','https://www.amazon.com/Best-Sellers-Networks-Internet/zgbs/digital-educational-resources/18591134011/','https://www.amazon.com/Best-Sellers-Programming-Design/zgbs/digital-educational-resources/18591136011/','https://www.amazon.com/Best-Sellers-Word-Processing/zgbs/digital-educational-resources/18591145011/','https://www.amazon.com/Best-Sellers-English-Second-Language-ESL/zgbs/digital-educational-resources/18591147011/','https://www.amazon.com/Best-Sellers-Literature-Poetry/zgbs/digital-educational-resources/18591152011/','https://www.amazon.com/Best-Sellers-Reading-Literacy/zgbs/digital-educational-resources/18591158011/','https://www.amazon.com/Best-Sellers-Spelling-Grammar-Syntax/zgbs/digital-educational-resources/18591148011/','https://www.amazon.com/Best-Sellers-Writing/zgbs/digital-educational-resources/18591169011/','https://www.amazon.com/Best-Sellers-Anthropology-Sociology/zgbs/digital-educational-resources/18591200011/','https://www.amazon.com/Best-Sellers-Economics/zgbs/digital-educational-resources/18591201011/','https://www.amazon.com/Best-Sellers-Geography-Maps/zgbs/digital-educational-resources/18591202011/','https://www.amazon.com/Best-Sellers-History/zgbs/digital-educational-resources/18591203011/','https://www.amazon.com/Best-Sellers-Political-Science-Civics/zgbs/digital-educational-resources/18591219011/','https://www.amazon.com/Best-Sellers-Counting-Patterns/zgbs/digital-educational-resources/18591221011/','https://www.amazon.com/Best-Sellers-Number-Concepts-Operations/zgbs/digital-educational-resources/18591226011/','https://www.amazon.com/Best-Sellers-Measurement-Data/zgbs/digital-educational-resources/18591240011/','https://www.amazon.com/Best-Sellers-Pre-Algebra/zgbs/digital-educational-resources/18591245011/','https://www.amazon.com/Best-Sellers-Algebra/zgbs/digital-educational-resources/18591266011/','https://www.amazon.com/Best-Sellers-Geometry/zgbs/digital-educational-resources/18591286011/','https://www.amazon.com/Best-Sellers-Trigonometry/zgbs/digital-educational-resources/18591307011/','https://www.amazon.com/Best-Sellers-Pre-Calculus/zgbs/digital-educational-resources/18591312011/','https://www.amazon.com/Best-Sellers-Astronomy/zgbs/digital-educational-resources/18591334011/','https://www.amazon.com/Best-Sellers-Basic-Science/zgbs/digital-educational-resources/18591340011/','https://www.amazon.com/Best-Sellers-Biology-Life-Sciences/zgbs/digital-educational-resources/18591341011/','https://www.amazon.com/Best-Sellers-Chemistry/zgbs/digital-educational-resources/18591351011/','https://www.amazon.com/Best-Sellers-Engineering/zgbs/digital-educational-resources/18591360011/','https://www.amazon.com/Best-Sellers-Earth-Science/zgbs/digital-educational-resources/18591361011/','https://www.amazon.com/Best-Sellers-History-Science/zgbs/digital-educational-resources/18591362011/','https://www.amazon.com/Best-Sellers-Physics-Physical-Science/zgbs/digital-educational-resources/18591363011/','https://www.amazon.com/Best-Sellers-Health-Sex-Ed/zgbs/digital-educational-resources/18591375011/','https://www.amazon.com/Best-Sellers-Physical-Education/zgbs/digital-educational-resources/18591377011/','https://www.amazon.com/Best-Sellers-Shop/zgbs/digital-educational-resources/18591378011/','https://www.amazon.com/Best-Sellers-Speech/zgbs/digital-educational-resources/18591379011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Alternative-Rock/zgbs/dmusic/195212011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Blues/zgbs/dmusic/195223011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Broadway-Vocalists/zgbs/dmusic/195235011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Christian/zgbs/dmusic/195244011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Classic-Rock/zgbs/dmusic/195254011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Classical/zgbs/dmusic/195264011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Country/zgbs/dmusic/195311011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Dance-Electronic/zgbs/dmusic/195322011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Folk/zgbs/dmusic/195336011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Gospel/zgbs/dmusic/6127487011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Hard-Rock-Metal/zgbs/dmusic/195343011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-International/zgbs/dmusic/195352011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Jazz/zgbs/dmusic/195368011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Miscellaneous/zgbs/dmusic/196371011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-New-Age/zgbs/dmusic/196367011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Opera-Vocal/zgbs/dmusic/195391011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Pop/zgbs/dmusic/195407011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-R-B/zgbs/dmusic/195419011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Rap-Hip-Hop/zgbs/dmusic/195430011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Rock/zgbs/dmusic/195441011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Soundtracks/zgbs/dmusic/195455011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Alternative-Rock/zgbs/dmusic/324384011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Blues/zgbs/dmusic/324396011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Broadway-Vocalists/zgbs/dmusic/324409011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Christian/zgbs/dmusic/324420011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Classic-Rock/zgbs/dmusic/324431011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Classical/zgbs/dmusic/324442011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Country/zgbs/dmusic/324492011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Dance-Electronic/zgbs/dmusic/324504011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Folk/zgbs/dmusic/324519011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Gospel/zgbs/dmusic/6127488011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Hard-Rock-Metal/zgbs/dmusic/324527011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-International/zgbs/dmusic/324537011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Jazz/zgbs/dmusic/324552011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Miscellaneous/zgbs/dmusic/324577011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-New-Age/zgbs/dmusic/324586011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Opera-Vocal/zgbs/dmusic/324591011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Pop/zgbs/dmusic/324608011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-R-B/zgbs/dmusic/324621011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Rap-Hip-Hop/zgbs/dmusic/324633011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Rock/zgbs/dmusic/324645011/','https://www.amazon.com/Best-Sellers-MP3-Downloads-Soundtracks/zgbs/dmusic/324660011/','https://www.amazon.com/Best-Sellers-Electronics-Audio-Video-Accessories/zgbs/electronics/172532/','https://www.amazon.com/Best-Sellers-Electronics-Camera-Photo-Accessories/zgbs/electronics/172435/','https://www.amazon.com/Best-Sellers-Electronics-Cell-Phone-Accessories/zgbs/electronics/2407755011/','https://www.amazon.com/Best-Sellers-Electronics-GPS-System-Accessories/zgbs/electronics/559942/','https://www.amazon.com/Best-Sellers-Electronics-Home-Audio-Accessories/zgbs/electronics/3236443011/','https://www.amazon.com/Best-Sellers-Electronics-Office-Accessories/zgbs/electronics/172575/','https://www.amazon.com/Best-Sellers-Electronics-Car-Accessories/zgbs/electronics/10981291/','https://www.amazon.com/Best-Sellers-Electronics-Telephone-Accessories/zgbs/electronics/172607/','https://www.amazon.com/Best-Sellers-Electronics-TV-Accessories/zgbs/electronics/3230976011/','https://www.amazon.com/Best-Sellers-Electronics-Cables/zgbs/electronics/12954861/','https://www.amazon.com/Best-Sellers-Electronics-Mounts/zgbs/electronics/10966911/','https://www.amazon.com/Best-Sellers-Electronics-Consumer-Installation-Services/zgbs/electronics/2632817011/','https://www.amazon.com/Best-Sellers-Electronics-Recording-Microphones-Accessories/zgbs/electronics/11974521/','https://www.amazon.com/Best-Sellers-Electronics-Power-Protection-Products/zgbs/electronics/2223901011/','https://www.amazon.com/Best-Sellers-Electronics-Electrical-Cord-Management/zgbs/electronics/11042051/','https://www.amazon.com/Best-Sellers-Electronics-Cable-Organizer-Bags-Cases/zgbs/electronics/290458/','https://www.amazon.com/Best-Sellers-Electronics-Binoculars-Telescopes-Optics/zgbs/electronics/499320/','https://www.amazon.com/Best-Sellers-Electronics-Film-Photography/zgbs/electronics/7161070011/','https://www.amazon.com/Best-Sellers-Electronics-Camcorder-Camera-Lenses/zgbs/electronics/499248/','https://www.amazon.com/Best-Sellers-Electronics-Photo-Printers-Scanners/zgbs/electronics/499328/','https://www.amazon.com/Best-Sellers-Electronics-Simulated-Surveillance-Cameras/zgbs/electronics/14241441/','https://www.amazon.com/Best-Sellers-Electronics-Underwater-Photography-Products/zgbs/electronics/3350161/','https://www.amazon.com/Best-Sellers-Electronics-Car-Audio/zgbs/electronics/226184/','https://www.amazon.com/Best-Sellers-Electronics-Car-Security-Products/zgbs/electronics/3008971/','https://www.amazon.com/Best-Sellers-Electronics-Car-Video/zgbs/electronics/10980521/','https://www.amazon.com/Best-Sellers-Electronics-Portable-CB-Radios/zgbs/electronics/226183/','https://www.amazon.com/Best-Sellers-Electronics-GPS-Trackers/zgbs/electronics/617650011/','https://www.amazon.com/Best-Sellers-Electronics-Car-Audio-Video-Dash-Mounting-Kits/zgbs/electronics/10981321/','https://www.amazon.com/Best-Sellers-Electronics-Car-Audio-Video-Installation-Products/zgbs/electronics/10981311/','https://www.amazon.com/Best-Sellers-Electronics-Radar-Detectors/zgbs/electronics/172529/','https://www.amazon.com/Best-Sellers-Electronics-Portable-FRS-Two-Way-Radios/zgbs/electronics/912322/','https://www.amazon.com/Best-Sellers-Electronics-Cell-Phones/zgbs/electronics/7072561011/','https://www.amazon.com/Best-Sellers-Electronics-Cell-Phone-Cases-Covers/zgbs/electronics/2407760011/','https://www.amazon.com/Best-Sellers-Electronics-Marine-GPS-Units-Chartplotters/zgbs/electronics/551462/','https://www.amazon.com/Best-Sellers-Electronics-Item-Finders/zgbs/electronics/18022313011/','https://www.amazon.com/Best-Sellers-Electronics-GPS-Units/zgbs/electronics/219536011/','https://www.amazon.com/Best-Sellers-Electronics-Vehicle-GPS-Units-Equipment/zgbs/electronics/559938/','https://www.amazon.com/Best-Sellers-Electronics-Earbud-Ear-Headphones/zgbs/electronics/12097478011/','https://www.amazon.com/Best-Sellers-Electronics-Ear-Headphones/zgbs/electronics/12097480011/','https://www.amazon.com/Best-Sellers-Electronics-Over-Ear-Headphones/zgbs/electronics/12097479011/','https://www.amazon.com/Best-Sellers-Electronics-Compact-Radios-Stereos/zgbs/electronics/9977441011/','https://www.amazon.com/Best-Sellers-Electronics-Home-Theater-Audio/zgbs/electronics/9977442011/','https://www.amazon.com/Best-Sellers-Electronics-Home-Audio-Speakers/zgbs/electronics/172563/','https://www.amazon.com/Best-Sellers-Electronics-Home-Stereo-System-Components/zgbs/electronics/12097483011/','https://www.amazon.com/Best-Sellers-Electronics-Turntables-Accessories/zgbs/electronics/9977443011/','https://www.amazon.com/Best-Sellers-Electronics-Wireless-Streaming-Audio-Systems/zgbs/electronics/322215011/','https://www.amazon.com/Best-Sellers-Electronics-Boating-Autopilots/zgbs/electronics/3398301/','https://www.amazon.com/Best-Sellers-Electronics-Fish-Finders-Depth/zgbs/electronics/551460/','https://www.amazon.com/Best-Sellers-Electronics-Marine-Amplifiers/zgbs/electronics/2383694011/','https://www.amazon.com/Best-Sellers-Electronics-Boat-Antennas/zgbs/electronics/3398291/','https://www.amazon.com/Best-Sellers-Electronics-Marine-GPS-Accessories/zgbs/electronics/719943011/','https://www.amazon.com/Best-Sellers-Electronics-Marine-Speakers/zgbs/electronics/10980871/','https://www.amazon.com/Best-Sellers-Electronics-Marine-Stereo-Receivers/zgbs/electronics/10980641/','https://www.amazon.com/Best-Sellers-Electronics-Marine-Subwoofers/zgbs/electronics/1293681011/','https://www.amazon.com/Best-Sellers-Electronics-Marine-Two-Way-Radios/zgbs/electronics/2623486011/','https://www.amazon.com/Best-Sellers-Electronics-Marine-Electronic-Radar-Systems/zgbs/electronics/319575011/','https://www.amazon.com/Best-Sellers-Office-Products-Cable-Organizer-Bags-Cases/zgbs/office-products/290458/','https://www.amazon.com/Best-Sellers-Office-Products-Calculators/zgbs/office-products/172518/','https://www.amazon.com/Best-Sellers-Office-Products-Copiers/zgbs/office-products/172576/','https://www.amazon.com/Best-Sellers-Office-Products-Document-Cameras/zgbs/office-products/5728045011/','https://www.amazon.com/Best-Sellers-Office-Products-Dictionaries-Thesauri-Translators/zgbs/office-products/11072581/','https://www.amazon.com/Best-Sellers-Office-Products-Fax-Machines/zgbs/office-products/172582/','https://www.amazon.com/Best-Sellers-Office-Products-Other-Equipment/zgbs/office-products/281418/','https://www.amazon.com/Best-Sellers-Office-Products-Handhelds-PDAs/zgbs/office-products/172594/','https://www.amazon.com/Best-Sellers-Office-Products-Point-Sale-POS-Equipment/zgbs/office-products/15442734011/','https://www.amazon.com/Best-Sellers-Office-Products-Presentation/zgbs/office-products/300333/','https://www.amazon.com/Best-Sellers-Office-Products-Telephones/zgbs/office-products/172606/','https://www.amazon.com/Best-Sellers-Office-Products-Video-Projectors-Accessories/zgbs/office-products/14759145011/','https://www.amazon.com/Best-Sellers-Electronics-Boomboxes/zgbs/electronics/172633/','https://www.amazon.com/Best-Sellers-Electronics-CB-Two-Way-Radios/zgbs/electronics/172654/','https://www.amazon.com/Best-Sellers-Electronics-Portable-Cassette-Players-Recorders/zgbs/electronics/172628/','https://www.amazon.com/Best-Sellers-Electronics-Digital-Voice-Recorders/zgbs/electronics/227758/','https://www.amazon.com/Best-Sellers-Electronics-MP3-MP4-Players/zgbs/electronics/1264866011/','https://www.amazon.com/Best-Sellers-Electronics-MP3-MP4-Player-Accessories/zgbs/electronics/290438/','https://www.amazon.com/Best-Sellers-Electronics-Portable-Microcassette-Recorders/zgbs/electronics/172632/','https://www.amazon.com/Best-Sellers-Electronics-Portable-Minidisc-Players/zgbs/electronics/172631/','https://www.amazon.com/Best-Sellers-Electronics-Portable-Handheld-TVs/zgbs/electronics/979930011/','https://www.amazon.com/Best-Sellers-Electronics-Portable-CD-Players/zgbs/electronics/465608/','https://www.amazon.com/Best-Sellers-Electronics-Portable-DVD-Players/zgbs/electronics/172521/','https://www.amazon.com/Best-Sellers-Electronics-Portable-Cell-Phone-MP3-Player-Speakers-Audio-Docks/zgbs/electronics/689637011/','https://www.amazon.com/Best-Sellers-Electronics-Portable-Radios/zgbs/electronics/172681/','https://www.amazon.com/Best-Sellers-Electronics-Security-Surveillance-Accessories/zgbs/electronics/11041121/','https://www.amazon.com/Best-Sellers-Electronics-Security-Surveillance-Biometrics/zgbs/electronics/14241141/','https://www.amazon.com/Best-Sellers-Electronics-Home-Security-Systems/zgbs/electronics/3180341/','https://www.amazon.com/Best-Sellers-Electronics-Security-Horns-Sirens/zgbs/electronics/11041181/','https://www.amazon.com/Best-Sellers-Electronics-Motion-Detectors/zgbs/electronics/11040971/','https://www.amazon.com/Best-Sellers-Electronics-Radio-Scanners/zgbs/electronics/172530/','https://www.amazon.com/Best-Sellers-Electronics-Surveillance-Security-Cameras/zgbs/electronics/898400/','https://www.amazon.com/Best-Sellers-Electronics-Surveillance-Video-Equipment/zgbs/electronics/14248481/','https://www.amazon.com/Best-Sellers-Electronics-Service-Plans/zgbs/electronics/16285931/','https://www.amazon.com/Best-Sellers-Electronics-Analog-Digital-DTV-Converters/zgbs/electronics/979935011/','https://www.amazon.com/Best-Sellers-Electronics-Audio-Video-Receivers-Amplifiers/zgbs/electronics/3213035011/','https://www.amazon.com/Best-Sellers-Electronics-Blu-ray-Players-Recorders/zgbs/electronics/3213025011/','https://www.amazon.com/Best-Sellers-Electronics-DVD-Players-Recorders/zgbs/electronics/3213027011/','https://www.amazon.com/Best-Sellers-Electronics-DVD-VCR-Combos/zgbs/electronics/886258/','https://www.amazon.com/Best-Sellers-Electronics-HD-DVD-Players/zgbs/electronics/352696011/','https://www.amazon.com/Best-Sellers-Electronics-Home-Theater-Systems/zgbs/electronics/281056/','https://www.amazon.com/Best-Sellers-Electronics-Video-Projection-Screens/zgbs/electronics/1286610011/','https://www.amazon.com/Best-Sellers-Electronics-Video-Projectors/zgbs/electronics/300334/','https://www.amazon.com/Best-Sellers-Electronics-Satellite-Television-Products/zgbs/electronics/400080/','https://www.amazon.com/Best-Sellers-Electronics-Televisions/zgbs/electronics/172659/','https://www.amazon.com/Best-Sellers-Electronics-TV-DVD-Combinations/zgbs/electronics/578960/','https://www.amazon.com/Best-Sellers-Electronics-VCRs/zgbs/electronics/172669/','https://www.amazon.com/Best-Sellers-Electronics-Video-Display-Glasses/zgbs/electronics/3213034011/','https://www.amazon.com/Best-Sellers-Electronics-Fire-TV-Devices-Accessories/zgbs/electronics/8946437011/','https://www.amazon.com/Best-Sellers-Electronics-PlayStation-Consoles-Accessories/zgbs/electronics/7926842011/','https://www.amazon.com/Best-Sellers-Electronics-PlayStation-Consoles-Accessories/zgbs/electronics/7926843011/','https://www.amazon.com/Best-Sellers-Electronics-Xbox-One-Consoles-Accessories/zgbs/electronics/7926844011/','https://www.amazon.com/Best-Sellers-Electronics-Xbox-360-Consoles-Accessories/zgbs/electronics/7926846011/','https://www.amazon.com/Best-Sellers-Electronics-Nintendo-Switch-Consoles-Accessories/zgbs/electronics/16227139011/','https://www.amazon.com/Best-Sellers-Electronics-Wii-Consoles-Accessories/zgbs/electronics/7926848011/','https://www.amazon.com/Best-Sellers-Electronics-Wii-Consoles-Accessories/zgbs/electronics/7926847011/','https://www.amazon.com/Best-Sellers-Electronics-Nintendo-3DS-Consoles-Accessories/zgbs/electronics/7926850011/','https://www.amazon.com/Best-Sellers-Electronics-Nintendo-DS-Consoles-Accessories/zgbs/electronics/7926849011/','https://www.amazon.com/Best-Sellers-Electronics-PlayStation-Vita-Consoles-Accessories/zgbs/electronics/7926852011/','https://www.amazon.com/Best-Sellers-Electronics-Sony-PSP-Consoles-Accessories/zgbs/electronics/7926851011/','https://www.amazon.com/Best-Sellers-Electronics-Smart-Clips-Arm-Wristbands/zgbs/electronics/10048706011/','https://www.amazon.com/Best-Sellers-Electronics-Smart-Glasses/zgbs/electronics/10048708011/','https://www.amazon.com/Best-Sellers-Electronics-Smart-Rings/zgbs/electronics/10048711011/','https://www.amazon.com/Best-Sellers-Electronics-Smartwatches/zgbs/electronics/7939901011/','https://www.amazon.com/Best-Sellers-Electronics-Wearable-Tech-Accessories/zgbs/electronics/10048701011/','https://www.amazon.com/Best-Sellers-Electronics-Wearable-Tech-Virtual-Reality-Gear/zgbs/electronics/14775003011/','https://www.amazon.com/Best-Sellers-Electronics-eBook-Readers/zgbs/electronics/2642129011/','https://www.amazon.com/Best-Sellers-Electronics-eBook-Reader-Accessory-Bundles/zgbs/electronics/2642130011/','https://www.amazon.com/Best-Sellers-Electronics-eBook-Reader-Covers/zgbs/electronics/2642131011/','https://www.amazon.com/Best-Sellers-Electronics-eBook-Reader-Power-Adapters/zgbs/electronics/2642132011/','https://www.amazon.com/Best-Sellers-Electronics-eBook-Reader-Power-Cables/zgbs/electronics/2642133011/','https://www.amazon.com/Best-Sellers-Electronics-eBook-Reading-Lights/zgbs/electronics/2642134011/','https://www.amazon.com/Best-Sellers-Electronics-eBook-Reader-Screen-Protectors/zgbs/electronics/2642135011/','https://www.amazon.com/Best-Sellers-Electronics-eBook-Reader-Skins/zgbs/electronics/2642136011/','https://www.amazon.com/Best-Sellers-Electronics-eBook-Reader-Sleeves/zgbs/electronics/2642137011/','https://www.amazon.com/Best-Sellers-Electronics-eBook-Reader-Stands/zgbs/electronics/2642138011/','https://www.amazon.com/Best-Sellers-Entertainment-Collectibles-Collectible-Animation-Cels/zgbs/entertainment-collectibles/5931156011/','https://www.amazon.com/Best-Sellers-Entertainment-Collectibles-Collectible-Animation-Backgrounds/zgbs/entertainment-collectibles/7501403011/','https://www.amazon.com/Best-Sellers-Entertainment-Collectibles-Collectible-Animation-Concept-Art-Storyboards/zgbs/entertainment-collectibles/7501404011/','https://www.amazon.com/Best-Sellers-Entertainment-Collectibles-Collectible-Animation-Production-Art/zgbs/entertainment-collectibles/7501407011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Beer/zgbs/grocery/2983385011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Cocktail-Mixers/zgbs/grocery/119342011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Liquor-Spirits/zgbs/grocery/2983387011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Wine/zgbs/grocery/2983386011/','https://www.amazon.com/Best-Sellers-Baby-Beverages/zgbs/baby-products/16323201/','https://www.amazon.com/Best-Sellers-Baby-Cereal/zgbs/baby-products/16323151/','https://www.amazon.com/Best-Sellers-Baby-Toddler-Formula/zgbs/baby-products/16323121/','https://www.amazon.com/Best-Sellers-Baby-Food-Meals/zgbs/baby-products/14804133011/','https://www.amazon.com/Best-Sellers-Baby-Snack-Foods/zgbs/baby-products/6520541011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Bottled-Beverages-Water-Drink-Mixes/zgbs/grocery/14808787011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Coffee-Tea-Cocoa/zgbs/grocery/16521305011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Bakery-Dessert-Gifts/zgbs/grocery/2255576011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Bakery-Breadcrumbs-Stuffing/zgbs/grocery/6548768011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Breads/zgbs/grocery/18776870011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Bakery-Breadsticks/zgbs/grocery/6548769011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Cakes/zgbs/grocery/347681011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Cookies/zgbs/grocery/18774312011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Bakery-Desserts/zgbs/grocery/6548788011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Breakfast-Bakery/zgbs/grocery/6548770011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Pastry-Shells-Crusts/zgbs/grocery/6548861011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Pizza-Crusts/zgbs/grocery/291442011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Refrigerated-Doughs/zgbs/grocery/6520474011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Applesauce-Fruit-Cups/zgbs/grocery/6524414011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Breakfast-Cereal-Bars/zgbs/grocery/387559011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Breakfast-Syrups-Toppings/zgbs/grocery/11713214011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Breakfast-Cereals/zgbs/grocery/16318891/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Instant-Breakfast-Drinks/zgbs/grocery/347684011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Breakfast-Pancake-Waffle-Baking-Mixes/zgbs/grocery/11713205011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Toaster-Pastries/zgbs/grocery/295346011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Brittle-Caramel-Toffee-Candy/zgbs/grocery/17369012011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Candy-Chocolate-Coated-Fruits-Nuts-Snacks/zgbs/grocery/6558929011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Candy-Chocolate-Assortments-Samplers/zgbs/grocery/6558922011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Candy-Chocolate-Bars/zgbs/grocery/6558923011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Candy-Chocolate-Gifts/zgbs/grocery/2255572011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Chewing-Gum/zgbs/grocery/16322471/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Chocolate-Fudge-Candy/zgbs/grocery/17369014011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Ginger-Candy/zgbs/grocery/7514604011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Hard-Candy-Suckers-Lollipops/zgbs/grocery/17369015011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Jelly-Beans-Chewy-Gummy-Candy/zgbs/grocery/17369013011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Marshmallows/zgbs/grocery/724726011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Candy-Mints/zgbs/grocery/16322531/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Sour-Flavored-Candies/zgbs/grocery/6558939011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Traditional-International-Sweets/zgbs/grocery/17369017011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Butter-Margarine/zgbs/grocery/6520421011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Cheeses/zgbs/grocery/6520456011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Cheese-Charcuterie-Gifts/zgbs/grocery/2255573011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Cheese-Assortments-Samplers/zgbs/grocery/2256190011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Refrigerated-Cheese-Dips-Spreads/zgbs/grocery/6523347011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Cottage-Cheeses/zgbs/grocery/6520428011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Cream-Cheeses/zgbs/grocery/6520429011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Dairy-Free-Cheese-Substitutes/zgbs/grocery/21332137011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Eggs-Egg-Substitutes/zgbs/grocery/371464011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Milks-Creams/zgbs/grocery/6520435011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Non-Dairy-Milks/zgbs/grocery/119343011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Refrigerated-Snack-Packs-Lunches/zgbs/grocery/10802559011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Sour-Creams/zgbs/grocery/6520504011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Whipped-Toppings/zgbs/grocery/6520505011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Yogurt/zgbs/grocery/6520506011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Prepared-Appetizers/zgbs/grocery/10759242011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Prepared-Box-Lunches/zgbs/grocery/10763290011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Prepared-Breakfast-Foods/zgbs/grocery/10764355011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Prepared-Casseroles-Pot-Pies-Quiches/zgbs/grocery/10764480011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Deli-Meats-Cheeses/zgbs/grocery/18773725011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Prepared-Deli-Salads/zgbs/grocery/10770975011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Prepared-Dips-Salsas-Spreads/zgbs/grocery/10770560011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Prepared-Entrees/zgbs/grocery/10770668011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Prepared-Pasta-Sauces/zgbs/grocery/10770824011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Prepared-Risotto/zgbs/grocery/21349994011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Antipasto/zgbs/grocery/9847696011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Prepared-Sandwiches-Wraps/zgbs/grocery/10771131011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Prepared-Side-Dishes/zgbs/grocery/10771164011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Prepared-Soups-Stews-Chili/zgbs/grocery/10771239011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Assortments-Variety-Gifts/zgbs/grocery/12011207011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Coffee-Tea-Gifts/zgbs/grocery/2255575011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fruit-Nut-Gifts/zgbs/grocery/2255577011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Herb-Spice-Seasoning-Gifts/zgbs/grocery/2255584011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Jam-Jelly-Sweet-Spread-Gifts/zgbs/grocery/2255578011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Meat-Seafood-Gifts/zgbs/grocery/2255579011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Sauce-Gravy-Marinade-Gifts/zgbs/grocery/2255580011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Snack-Gifts/zgbs/grocery/2255582011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Flower-Plant-Centerpieces/zgbs/grocery/6558998011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Cut-Flowers/zgbs/grocery/12902901/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Flower-Plant-Sprays/zgbs/grocery/6559011011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Flower-Plant-Wreaths/zgbs/grocery/6559012011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Live-Indoor-House-Plants/zgbs/grocery/3744981/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Frozen-Appetizers-Snacks/zgbs/grocery/6459123011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Frozen-Bread-Dough/zgbs/grocery/6459132011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Frozen-Breakfast-Foods/zgbs/grocery/6459139011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Frozen-Desserts-Toppings/zgbs/grocery/6459150011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Frozen-Fruits/zgbs/grocery/6459159011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Ice-Creams-Frozen-Novelties/zgbs/grocery/6459171011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Frozen-Juices/zgbs/grocery/6459193011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Frozen-Meals-Entrees/zgbs/grocery/6459203011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Frozen-Meat/zgbs/grocery/6459214011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Frozen-Pasta-Sauces/zgbs/grocery/6459227011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Frozen-Pizzas/zgbs/grocery/6459230011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Frozen-Potatoes-Onion-Rings/zgbs/grocery/6459234011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Frozen-Seafood/zgbs/grocery/6459241011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Frozen-Vegetables/zgbs/grocery/6459248011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Beer-Brewing-Ingredients/zgbs/grocery/979862011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Beer-Brewing-Recipe-Kits/zgbs/grocery/979870011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Winemaking-Ingredients/zgbs/grocery/979878011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Bacon/zgbs/grocery/2256164011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Beef/zgbs/grocery/371470011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Chicken/zgbs/grocery/2256156011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Foie-Gras-P%C3%A2t%C3%A9s/zgbs/grocery/6518760011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Hot-Dogs-Franks/zgbs/grocery/6518846011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Lamb-Meat/zgbs/grocery/6518852011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Pork-Meat/zgbs/grocery/6519153011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Sausages/zgbs/grocery/371476011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Seafood/zgbs/grocery/371477011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Turducken/zgbs/grocery/6519646011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Turkey/zgbs/grocery/2256158011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Veal-Meats/zgbs/grocery/6519828011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Wild-Game-Fowl-Meat/zgbs/grocery/6519832011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Meatless-Bacon/zgbs/grocery/6515618011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Meatless-Burgers-Patties/zgbs/grocery/6518860011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Meatless-Deli-Slices/zgbs/grocery/17867428011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Meatless-Hot-Dogs-Links-Sausages/zgbs/grocery/6518863011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Meatless-Jerky/zgbs/grocery/17867430011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Meatless-Loaves-Roasts/zgbs/grocery/17867431011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Meatless-Meatballs-Chunks-Crumbles/zgbs/grocery/17867436011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Meatless-Nuggets-Wings/zgbs/grocery/17867443011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Meatless-Pulled-Flaked-Meats/zgbs/grocery/17867448011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Seitan/zgbs/grocery/6507195011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Meatless-Strips-Cutlets/zgbs/grocery/17867453011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Tempeh/zgbs/grocery/6507196011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Tofu/zgbs/grocery/6507197011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Canned-Jarred-Packaged-Foods/zgbs/grocery/6464939011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Condiments-Salad-Dressings/zgbs/grocery/16320321/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Cooking-Baking-Supplies/zgbs/grocery/16310221/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Dried-Beans-Lentils-Peas/zgbs/grocery/18787304011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Dried-Grains-Rice/zgbs/grocery/6464122011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Herbs-Spices-Seasonings/zgbs/grocery/16310281/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Jams-Jellies-Sweet-Spreads/zgbs/grocery/16320071/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Nut-Seed-Butters/zgbs/grocery/345830011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Olives-Pickles-Relishes/zgbs/grocery/16319771/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Pasta-Noodles/zgbs/grocery/6502933011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Sauces-Gravies-Marinades/zgbs/grocery/6502765011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Soups-Stocks-Broths/zgbs/grocery/16319621/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Dried-Fruits-Vegetables/zgbs/grocery/9865332011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Fruits/zgbs/grocery/16318981/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Herbs/zgbs/grocery/6507079011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Vegetables/zgbs/grocery/16319281/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Cooking-Baking-Nuts-Seeds/zgbs/grocery/16322881/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Packaged-Produce/zgbs/grocery/6507187011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fresh-Vegetarian-Proteins/zgbs/grocery/6507194011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Granola-Nutrition-Bars/zgbs/grocery/6524464011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Breadsticks/zgbs/grocery/347682011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Chips-Crisps/zgbs/grocery/16322741/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Snack-Crackers/zgbs/grocery/16322781/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Dried-Fruits-Raisins/zgbs/grocery/6524459011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fruit-Leathers/zgbs/grocery/724730011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Fruit-Snacks/zgbs/grocery/6524463011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Ice-Cream-Cones-Toppings/zgbs/grocery/6459175011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Meat-Snacks/zgbs/grocery/21412375011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Snack-Nuts-Seeds/zgbs/grocery/11437481011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Party-Mix/zgbs/grocery/724731011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Popcorn/zgbs/grocery/16322991/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Snack-Pretzels/zgbs/grocery/16323081/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Puffed-Snacks/zgbs/grocery/173354011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Rice-Cakes-Chips-Crackers/zgbs/grocery/6524481011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Snack-Salsas-Dips-Spreads/zgbs/grocery/6523475011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Seaweed-Snacks/zgbs/grocery/14864739011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Snack-Trail-Mixes/zgbs/grocery/16323101/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Snack-Cakes-Pastries/zgbs/grocery/11437484011/','https://www.amazon.com/Best-Sellers-Grocery-Gourmet-Food-Wasabi-Peas/zgbs/grocery/6524485011/','https://www.amazon.com/Best-Sellers-Handmade-Baby-Toddler-Toys/zgbs/handmade/14351279011/','https://www.amazon.com/Best-Sellers-Handmade-Baby-Clothing-Shoes-Accessories/zgbs/handmade/17714705011/','https://www.amazon.com/Best-Sellers-Handmade-Child-Carriers-Slings/zgbs/handmade/14344204011/','https://www.amazon.com/Best-Sellers-Handmade-Diaper-Changing/zgbs/handmade/14344205011/','https://www.amazon.com/Best-Sellers-Handmade-Baby-Health-Bathing-Skin-Care/zgbs/handmade/19530400011/','https://www.amazon.com/Best-Sellers-Handmade-Baby-Nursery-Products/zgbs/handmade/19530402011/','https://www.amazon.com/Best-Sellers-Handmade-Baby-Toddler-Feeding-Supplies/zgbs/handmade/14344219011/','https://www.amazon.com/Best-Sellers-Handmade-Pacifiers-Teethers/zgbs/handmade/14344237011/','https://www.amazon.com/Best-Sellers-Handmade-Personal-Fragrances/zgbs/handmade/15970077011/','https://www.amazon.com/Best-Sellers-Handmade-Hair-Care/zgbs/handmade/15970107011/','https://www.amazon.com/Best-Sellers-Handmade-Makeup/zgbs/handmade/15970212011/','https://www.amazon.com/Best-Sellers-Handmade-Shaving-Hair-Removal/zgbs/handmade/15970341011/','https://www.amazon.com/Best-Sellers-Handmade-Skin-Care/zgbs/handmade/15970391011/','https://www.amazon.com/Best-Sellers-Handmade-Beauty-Grooming-Tools-Accessories/zgbs/handmade/15970504011/','https://www.amazon.com/Best-Sellers-Handmade-Womens-Fashion/zgbs/handmade/17714783011/','https://www.amazon.com/Best-Sellers-Handmade-Mens-Fashion/zgbs/handmade/17714749011/','https://www.amazon.com/Best-Sellers-Handmade-Girls-Fashion/zgbs/handmade/17714734011/','https://www.amazon.com/Best-Sellers-Handmade-Boys-Fashion/zgbs/handmade/17714716011/','https://www.amazon.com/Best-Sellers-Handmade-Hair-Styling-Accessories/zgbs/handmade/14344534011/','https://www.amazon.com/Best-Sellers-Handmade-Handbags-Shoulder-Bags/zgbs/handmade/14344548011/','https://www.amazon.com/Best-Sellers-Handmade-Insoles-Shoe-Accessories/zgbs/handmade/16355338011/','https://www.amazon.com/Best-Sellers-Handmade-Luggage-Travel-Gear/zgbs/handmade/14344560011/','https://www.amazon.com/Best-Sellers-Handmade-Camera-Photo-Accessories/zgbs/handmade/14345424011/','https://www.amazon.com/Best-Sellers-Handmade-Cell-Phone-Accessories/zgbs/handmade/14345426011/','https://www.amazon.com/Best-Sellers-Handmade-Computer-Accessories/zgbs/handmade/14345430011/','https://www.amazon.com/Best-Sellers-Handmade-Fitness-Tracker-Bands-Straps/zgbs/handmade/18730253011/','https://www.amazon.com/Best-Sellers-Handmade-Laptop-Accessories/zgbs/handmade/14345439011/','https://www.amazon.com/Best-Sellers-Handmade-Personal-Care-Products/zgbs/handmade/15970298011/','https://www.amazon.com/Best-Sellers-Handmade-Wellness-Relaxation/zgbs/handmade/15970530011/','https://www.amazon.com/Best-Sellers-Handmade-Artwork/zgbs/handmade/11433412011/','https://www.amazon.com/Best-Sellers-Handmade-Bath-Products/zgbs/handmade/11433420011/','https://www.amazon.com/Best-Sellers-Handmade-Bedding/zgbs/handmade/11433437011/','https://www.amazon.com/Best-Sellers-Handmade-Cleaning-Supplies/zgbs/handmade/18200958011/','https://www.amazon.com/Best-Sellers-Handmade-Furniture/zgbs/handmade/11433453011/','https://www.amazon.com/Best-Sellers-Handmade-Home-D%C3%A9cor/zgbs/handmade/11434552011/','https://www.amazon.com/Best-Sellers-Handmade-Kitchen-Dining/zgbs/handmade/11434959011/','https://www.amazon.com/Best-Sellers-Handmade-Lighting-Products/zgbs/handmade/11403482011/','https://www.amazon.com/Best-Sellers-Handmade-Patio-Lawn-Garden/zgbs/handmade/11435248011/','https://www.amazon.com/Best-Sellers-Handmade-Storage-Organization/zgbs/handmade/11435533011/','https://www.amazon.com/Best-Sellers-Handmade-Rings/zgbs/handmade/11435897011/','https://www.amazon.com/Best-Sellers-Handmade-Earrings/zgbs/handmade/11435874011/','https://www.amazon.com/Best-Sellers-Handmade-Necklaces/zgbs/handmade/11435888011/','https://www.amazon.com/Best-Sellers-Handmade-Bracelets/zgbs/handmade/11435858011/','https://www.amazon.com/Best-Sellers-Handmade-Jewelry-Charms/zgbs/handmade/11435868011/','https://www.amazon.com/Best-Sellers-Handmade-Body-Jewelry/zgbs/handmade/11435854011/','https://www.amazon.com/Best-Sellers-Handmade-Hair-Jewelry/zgbs/handmade/11435881011/','https://www.amazon.com/Best-Sellers-Handmade-Jewelry-Sets/zgbs/handmade/11435887011/','https://www.amazon.com/Best-Sellers-Handmade-Prayer-Meditation-Beads/zgbs/handmade/18730240011/','https://www.amazon.com/Best-Sellers-Handmade-Watches/zgbs/handmade/18730241011/','https://www.amazon.com/Best-Sellers-Handmade-Brooches-Buttons-Pins/zgbs/handmade/11435865011/','https://www.amazon.com/Best-Sellers-Handmade-Cufflinks-Shirt-Accessories/zgbs/handmade/11435869011/','https://www.amazon.com/Best-Sellers-Handmade-Jewelry-Accessories/zgbs/handmade/11435850011/','https://www.amazon.com/Best-Sellers-Handmade-Dog-Supplies/zgbs/handmade/15735406011/','https://www.amazon.com/Best-Sellers-Handmade-Cat-Supplies/zgbs/handmade/15735293011/','https://www.amazon.com/Best-Sellers-Handmade-Camping-Hiking-Equipment/zgbs/handmade/14351406011/','https://www.amazon.com/Best-Sellers-Handmade-Car-Vehicle-Accessories/zgbs/handmade/14345425011/','https://www.amazon.com/Best-Sellers-Handmade-Cycling-Equipment/zgbs/handmade/14351408011/','https://www.amazon.com/Best-Sellers-Handmade-Fishing-Equipment/zgbs/handmade/14351413011/','https://www.amazon.com/Best-Sellers-Handmade-Hunting-Shooting-Equipment/zgbs/handmade/14351417011/','https://www.amazon.com/Best-Sellers-Handmade-Sports-Fitness-Equipment/zgbs/handmade/14351414011/','https://www.amazon.com/Best-Sellers-Handmade-Party-Supplies/zgbs/handmade/11435471011/','https://www.amazon.com/Best-Sellers-Handmade-Pens-Pencils/zgbs/handmade/11435481011/','https://www.amazon.com/Best-Sellers-Handmade-Stationery/zgbs/handmade/11435484011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Diaper/zgbs/hpc/16014841/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Baby-Child-Products/zgbs/hpc/16025501/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Baby-Child-Products/zgbs/hpc/16025511/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Alternative-Medicine-Products/zgbs/hpc/13052911/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Diabetic-Products/zgbs/hpc/3761401/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Ear-Products/zgbs/hpc/3779681/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Eye-Products/zgbs/hpc/3779691/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Feminine/zgbs/hpc/3779501/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-First-Aid-Supplies/zgbs/hpc/3762591/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Foot-Products/zgbs/hpc/3779911/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Incontinence-Ostomy-Products/zgbs/hpc/3763261/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Insect-Pest-Repellents/zgbs/hpc/3762971/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-OTC-Medications-Treatments/zgbs/hpc/10079990011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Respiratory-Aids-Accessories/zgbs/hpc/8627102011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Sleep-Snoring-Aids/zgbs/hpc/3764271/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Smoking-Cessation-Products/zgbs/hpc/3764401/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Womens-Products/zgbs/hpc/386373011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Air-Freshener-Supplies/zgbs/hpc/15356121/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Household-Cleaning-Tools/zgbs/hpc/15342831/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Dishwashing-Supplies/zgbs/hpc/15693761/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Household-Batteries/zgbs/hpc/15745581/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Household-Battery-Chargers/zgbs/hpc/10063711011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Household-Cleaning/zgbs/hpc/15342821/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Indoor-Insect-Pest-Control/zgbs/hpc/23537011011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Laundry-Supplies/zgbs/hpc/15356111/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Light-Bulbs/zgbs/hpc/322525011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Lighters-Matches/zgbs/hpc/10342347011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Paper-Plastic-Household-Supplies/zgbs/hpc/15342841/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Tobacco-Related-Products/zgbs/hpc/10342472011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Toothpicks/zgbs/hpc/7083335011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Braces-Splints-Supports/zgbs/hpc/3775541/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Cloth-Face-Masks-Accessories/zgbs/hpc/21233677011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Medical-Procedure-Masks/zgbs/hpc/16035056011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Funeral-Products/zgbs/hpc/8622234011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Activity-Wellness-Monitors/zgbs/hpc/3777131/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Home-Medical-Tests/zgbs/hpc/3777241/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Medical-Compression-Garments/zgbs/hpc/23461496011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Mobility-Daily-Living-Aids/zgbs/hpc/8624314011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Occupational-Physical-Therapy-Aids/zgbs/hpc/3776531/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Breath-Fresheners/zgbs/hpc/3777911/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Childrens-Dental-Products/zgbs/hpc/13213837011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Dental-Floss-Picks/zgbs/hpc/13213824011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Denture/zgbs/hpc/3778111/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Dry-Mouth-Relief-Products/zgbs/hpc/14255252011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Gum-Stimulators/zgbs/hpc/3778081/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Mouthwashes/zgbs/hpc/3778161/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Oral-Pain-Treatments/zgbs/hpc/3764051/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Orthodontic-Supplies/zgbs/hpc/4986869011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Dental-Sensitivity-Treatments/zgbs/hpc/13213849011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Anti-Grinding-Teeth-Protectors/zgbs/hpc/3764091/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Teeth-Whitening-Products/zgbs/hpc/3778441/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Tongue-Brushes-Scrapers-Cleaners/zgbs/hpc/3777991/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Toothbrushes-Accessories/zgbs/hpc/18065341011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Toothpaste/zgbs/hpc/3778371/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Bath-Bathing-Accessories/zgbs/hpc/11055991/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Deodorants-Antiperspirants/zgbs/hpc/3778451/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Hair-Products/zgbs/hpc/11057241/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Lip-Products/zgbs/hpc/3761351/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Piercing-Tattoo-Supplies/zgbs/hpc/13106041/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Shaving-Hair-Removal-Products/zgbs/hpc/3778591/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Skin-Products/zgbs/hpc/11060451/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Safer-Sex-Products/zgbs/hpc/3777411/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Bondage-Gear-Accessories/zgbs/hpc/3777791/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Fetish-Jewelry/zgbs/hpc/1243845011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Sex-Novelties/zgbs/hpc/1243866011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Sensual-Delights/zgbs/hpc/3777591/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Sex-Furniture/zgbs/hpc/1243736011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Sexual-Enhancers/zgbs/hpc/3777681/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Amino-Acid-Nutritional-Supplements/zgbs/hpc/10781161/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Sports-Nutrition-Endurance-Energy-Products/zgbs/hpc/6973669011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Sports-Nutrition-Fat-Burners-Thermogenics/zgbs/hpc/6973679011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Sports-Nutrition-Healthy-Snacks-Beverages/zgbs/hpc/6973683011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Sports-Nutrition-Hydration-Products/zgbs/hpc/6973693011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Sports-Nutrition-Bars/zgbs/hpc/7309635011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Sports-Nutrition-Pre-Workout-Products/zgbs/hpc/6973697011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Sports-Nutrition-Post-Workout-Recovery-Products/zgbs/hpc/6973701011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Sports-Nutrition-Protein/zgbs/hpc/6973704011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Sports-Nutrition-Testosterone-Boosters/zgbs/hpc/6973724011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Sports-Nutrition-Weight-Gainers/zgbs/hpc/6973725011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Contact-Lens-Products/zgbs/hpc/3779701/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Medical-Eye-Patches/zgbs/hpc/21190396011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Eyeglass-Products/zgbs/hpc/3779771/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Reading-Glasses/zgbs/hpc/3779821/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Vitamin-Supplements/zgbs/hpc/6936790011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Mineral-Supplements/zgbs/hpc/3774271/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Blended-Vitamin-Mineral-Supplements/zgbs/hpc/3773931/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Nutritional-Supplements/zgbs/hpc/6939426011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Herbal-Supplements/zgbs/hpc/3764461/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Weight-Loss-Products/zgbs/hpc/3774931/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-App-Enabled-Activity-Trackers/zgbs/hpc/10048704011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Fitness-Activity-Monitors/zgbs/hpc/10079998011/','https://www.amazon.com/Best-Sellers-Health-Personal-Care-Massage-Tools-Equipment/zgbs/hpc/10080000011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bath-Linen-Sets/zgbs/home-garden/3731671/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bath-Rugs/zgbs/home-garden/1063242/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bathroom-Accessories/zgbs/home-garden/1063238/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bathroom-Furniture-Sets/zgbs/home-garden/3732921/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bathroom-Shelves/zgbs/home-garden/335116011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Kids-Bath/zgbs/home-garden/3263108011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bathroom-Towels/zgbs/home-garden/1063244/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bedding-Sets-Collections/zgbs/home-garden/3732131/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bedspreads-Coverlets-Sets/zgbs/home-garden/10671038011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bedding-Comforters-Sets/zgbs/home-garden/2224405011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Quilts-Sets/zgbs/home-garden/10671039011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Kids-Bedding/zgbs/home-garden/1063268/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Nursery-Bedding/zgbs/home-garden/166742011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bedding-Sheets-Pillowcases/zgbs/home-garden/1063274/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Blankets-Throws/zgbs/home-garden/1063280/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bed-Pillows-Positioners/zgbs/home-garden/1199122/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Decorative-Pillows-Inserts-Covers/zgbs/home-garden/1063262/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bed-Canopies-Drapes/zgbs/home-garden/3732201/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bed-Runners-Scarves/zgbs/home-garden/16175638011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bed-Skirts/zgbs/home-garden/3732211/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Air-Mattresses-Accessories/zgbs/home-garden/562190/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bedding-Accessories/zgbs/home-garden/3732231/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Mattress-Pads-Toppers/zgbs/home-garden/17874224011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Mattress-Protectors-Encasements/zgbs/home-garden/17874225011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bedding-Duvet-Covers-Sets/zgbs/home-garden/21404094011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bedding-Duvets-Down-Comforters/zgbs/home-garden/10671048011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Air-Freshener-Supplies/zgbs/home-garden/15356121/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Household-Cleaning-Brushes/zgbs/home-garden/15342891/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Dusting-Tools/zgbs/home-garden/15356181/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Household-Cleaning-Gloves/zgbs/home-garden/15342901/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Household-Cleaning/zgbs/home-garden/15342821/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Household-Mops-Buckets-Accessories/zgbs/home-garden/2245503011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Paper-Towels/zgbs/home-garden/15347401/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Household-Cleaning-Sponges/zgbs/home-garden/15754811/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Household-Squeegees/zgbs/home-garden/2245500011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Household-Brooms-Dustpans-Accessories/zgbs/home-garden/2245502011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Trash-Bags/zgbs/home-garden/15342971/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bedroom-Furniture/zgbs/home-garden/1063308/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Living-Room-Furniture/zgbs/home-garden/1063318/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Dining-Room-Furniture/zgbs/home-garden/3733781/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Office-Furniture/zgbs/home-garden/1063312/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Kids-Furniture/zgbs/home-garden/1063314/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Entryway-Furniture/zgbs/home-garden/3249856011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Game-Recreation-Room-Furniture/zgbs/home-garden/5422303011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bathroom-Furniture/zgbs/home-garden/5392425011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Nursery-Furniture/zgbs/home-garden/13552765011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Accent-Furniture/zgbs/home-garden/16543322011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Furniture-Replacement-Parts/zgbs/home-garden/8516080011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Room-Air-Conditioners/zgbs/home-garden/14554126011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Air-Purifiers/zgbs/home-garden/267554011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Dehumidifiers/zgbs/home-garden/267557011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Household-Fans/zgbs/home-garden/3737601/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Humidifiers/zgbs/home-garden/17685839011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Indoor-Thermometers/zgbs/home-garden/4536988011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Indoor-Space-Heaters/zgbs/home-garden/510182/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Stoves-Fireplaces/zgbs/home-garden/1063284/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Heating-Cooling-Parts-Accessories/zgbs/home-garden/19149190011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Artificial-Plants-Flowers/zgbs/home-garden/14087351/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Candles-Candleholders/zgbs/home-garden/1063282/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Clocks/zgbs/home-garden/542938/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Outdoor-Doormats/zgbs/home-garden/3742271/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Door-Stops/zgbs/home-garden/1069196/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Under-Door-Draft-Stoppers/zgbs/home-garden/3291684011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Dried-Preserved-Flora/zgbs/home-garden/23556836011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-D%C3%A9cor-Accents/zgbs/home-garden/3735061/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Fragrance-Products/zgbs/home-garden/3734741/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Indoor-Fountains-Accessories/zgbs/home-garden/510236/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Kids-Room-D%C3%A9cor/zgbs/home-garden/404454011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Lamp-Shades/zgbs/home-garden/10727221/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Mirrors/zgbs/home-garden/3736371/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Nursery-D%C3%A9cor/zgbs/home-garden/166875011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Baby-Keepsake-Products/zgbs/home-garden/239228011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Oil-Lamps-Accessories/zgbs/home-garden/10133745011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Photo-Albums-Frames-Accessories/zgbs/home-garden/21557027011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Poufs/zgbs/home-garden/16183925011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Rugs-Pads-Protectors/zgbs/home-garden/21487702011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Slipcovers/zgbs/home-garden/1063300/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Tapestries/zgbs/home-garden/3736091/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Vase-Fillers/zgbs/home-garden/8149151011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Vases/zgbs/home-garden/3745451/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Window-Treatment-Hardware/zgbs/home-garden/3736311/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Window-Treatments/zgbs/home-garden/1063302/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Clothes-Ironing-Accessories/zgbs/home-garden/3737851/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Ironing-Board-Covers/zgbs/home-garden/3737871/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Ironing-Boards/zgbs/home-garden/510246/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Irons/zgbs/home-garden/510242/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Garment-Steamer-Accessories/zgbs/home-garden/3737861/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Garment-Steamers/zgbs/home-garden/510248/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Travel-Garment-Steamers/zgbs/home-garden/3737831/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Trouser-Pressers/zgbs/home-garden/3737881/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Kids-Baking-Supplies/zgbs/home-garden/2231407011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Toddler-Utensils/zgbs/home-garden/166803011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Nursery-Furniture/zgbs/home-garden/166809011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bakeware/zgbs/home-garden/289668/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Coffee-Tea-Espresso/zgbs/home-garden/915194/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Cookware/zgbs/home-garden/289814/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Cutlery-Knife-Accessories/zgbs/home-garden/289851/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Dining-Entertaining/zgbs/home-garden/13162311/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Food-Service-Equipment-Supplies/zgbs/home-garden/6054382011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Brewing-Wine-Making/zgbs/home-garden/979832011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Table-Linens/zgbs/home-garden/1063916/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Utensils-Gadgets/zgbs/home-garden/289754/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Small-Appliance-Parts-Accessories/zgbs/home-garden/1267449011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Storage-Organization/zgbs/home-garden/510136/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Travel-Go-Drinkware/zgbs/home-garden/9630569011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Water-Coolers-Filters/zgbs/home-garden/510202/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Wine-Accessories/zgbs/home-garden/13299291/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Advent-Calendars/zgbs/home-garden/3256921011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Artificial-Snow/zgbs/home-garden/15704031/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Decorative-Seasonal-Bows-Ribbons/zgbs/home-garden/17296066011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Christmas-Candleholders/zgbs/home-garden/15704041/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Seasonal-Celebration-Candles/zgbs/home-garden/3734581/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Christmas-Collectible-Buildings/zgbs/home-garden/1258670011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Christmas-Collectible-Figurines/zgbs/home-garden/1258672011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Nativity-Sets-Figures/zgbs/home-garden/702628011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Christmas-Nutcrackers/zgbs/home-garden/15704431/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Ornament-Hooks/zgbs/home-garden/16175652011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Christmas-Ornaments/zgbs/home-garden/12659354011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Outdoor-Holiday-Decorations/zgbs/home-garden/285033011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Seasonal-Lighting/zgbs/home-garden/3736751/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Christmas-Snow-Globes/zgbs/home-garden/15704441/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Christmas-Stockings-Holders/zgbs/home-garden/13744821/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Seasonal-Tinsel/zgbs/home-garden/17296068011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Holiday-Tree-Care-Watering/zgbs/home-garden/17296069011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Christmas-Tree-Skirts/zgbs/home-garden/15704451/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Christmas-Tree-Stands/zgbs/home-garden/13350211/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Christmas-Tree-Toppers/zgbs/home-garden/13744831/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Holiday-Tree-Trays-Mats/zgbs/home-garden/17296071011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Christmas-Trees/zgbs/home-garden/13679421/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Wreath-Hangers/zgbs/home-garden/16175650011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Christmas-Wreaths-Garlands-Swags/zgbs/home-garden/13679411/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Storage-Baskets-Bins-Containers/zgbs/home-garden/2422430011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bathroom-Storage-Organization/zgbs/home-garden/2422451011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Clothing-Closet-Storage/zgbs/home-garden/2423187011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Decorative-Wreath-Storage/zgbs/home-garden/16175640011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Garage-Storage-Organization-Products/zgbs/home-garden/165112011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Gift-Wrap-Storage/zgbs/home-garden/16175642011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Holiday-D%C3%A9cor-Storage/zgbs/home-garden/2423741011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Storage-Hooks/zgbs/home-garden/3744261/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Jewelry-Boxes-Organizers/zgbs/home-garden/3743851/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Laundry-Storage-Products/zgbs/home-garden/3744341/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Office-Storage-Organization/zgbs/home-garden/11601921011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Storage-Racks-Shelves-Drawers/zgbs/home-garden/2422463011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Storage-Trunks/zgbs/home-garden/3734271/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Trash-Recycling-Containers/zgbs/home-garden/2422453011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Household-Vacuum-Cleaners/zgbs/home-garden/3743521/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Vacuum-Parts-Accessories/zgbs/home-garden/510128/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Carpet-Upholstery-Cleaners-Accessories/zgbs/home-garden/11333721011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Floor-Buffing-Machines-Parts/zgbs/home-garden/510118/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Steam-Cleaners-Mops-Accessories/zgbs/home-garden/11333725011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Floor-Sweepers-Accessories/zgbs/home-garden/510094/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Drawings/zgbs/home-garden/13340241/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Mixed-Media-Artwork/zgbs/home-garden/13337281/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Paintings/zgbs/home-garden/13336081/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Photographs/zgbs/home-garden/13337971/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Posters-Prints/zgbs/home-garden/381142011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Abrasive-Accessories/zgbs/industrial/401506011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Sander-Belts/zgbs/industrial/3442587011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Abrasive-Brushes/zgbs/industrial/256168011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Abrasive-Mounted-Points/zgbs/industrial/401518011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Abrasive-Wheels-Discs/zgbs/industrial/2665570011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Abrasive-Finishing-Products/zgbs/industrial/2734049011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-3D-Printers/zgbs/industrial/6066127011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-3D-Printing-Pens/zgbs/industrial/21125282011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-3D-Printer-Parts-Accessories/zgbs/industrial/6066132011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-3D-Printing-Supplies/zgbs/industrial/6066128011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-3D-Scanners/zgbs/industrial/8481412011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Adhesive-Accelerators/zgbs/industrial/401522011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Adhesive-Dispensers-Accessories/zgbs/industrial/14138146011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Adhesive-Dots/zgbs/industrial/401523011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Adhesive-Primers/zgbs/industrial/401524011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Adhesive-Tapes/zgbs/industrial/256159011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Aerosol-Adhesives/zgbs/industrial/401541011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Anti-Seizes/zgbs/industrial/401525011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Catalysts/zgbs/industrial/401526011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Caulk/zgbs/industrial/256233011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Coatings/zgbs/industrial/16413451/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Contact-Cements/zgbs/industrial/256242011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Cyanoacrylate-Adhesives/zgbs/industrial/256243011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Epoxy-Adhesives/zgbs/industrial/256244011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Craft-Glue-Gun-Sticks/zgbs/industrial/705364011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Adhesives/zgbs/industrial/19619894011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Lubricants/zgbs/industrial/401536011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Sealants/zgbs/industrial/401538011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Light-Cure-Pens/zgbs/industrial/401537011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Retaining-Compounds/zgbs/industrial/256231011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Silicone-Adhesives/zgbs/industrial/256251011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Lawn-Watering-Equipment/zgbs/lawn-garden/553958/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Automatic-Irrigation-Accessories/zgbs/lawn-garden/13400241/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Automatic-Drip-Irrigation-Kits/zgbs/lawn-garden/13400251/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Automatic-Irrigation-Drippers/zgbs/lawn-garden/3480700011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Automatic-Irrigation-Controllers/zgbs/lawn-garden/3480701011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Automatic-Irrigation-Tubing/zgbs/lawn-garden/13400261/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Automatic-Irrigation-Sprinkler-Heads/zgbs/lawn-garden/3480702011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Automatic-Underground-Sprinkler-Systems/zgbs/lawn-garden/13400281/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Commercial-Access-Control/zgbs/industrial/10773803011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Commercial-Door-Hardware/zgbs/industrial/10773891011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Commercial-Doors/zgbs/industrial/10773965011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Commercial-Bay-Lighting/zgbs/hi/5772194011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Commercial-Emergency-Light-Fixtures/zgbs/hi/5772196011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Commercial-Lighted-Exit-Signs/zgbs/hi/5772198011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Commercial-Street-Area-Lighting/zgbs/hi/5772200011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Commercial-Strobe-Lights/zgbs/hi/5772202011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Band-Saw-Blades/zgbs/industrial/552288/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Boring-Bars/zgbs/industrial/256257011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Brazed-Tools/zgbs/industrial/340029011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Broaches/zgbs/industrial/340030011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Counterbores/zgbs/industrial/256258011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Countersinks/zgbs/industrial/256259011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Cutting-Burrs/zgbs/industrial/256263011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Cutting-Tool-Coolants/zgbs/industrial/401548011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Deburring-Cutters/zgbs/industrial/340035011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Drill-Tap-Sets/zgbs/industrial/8906585011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Drill-Adapters/zgbs/industrial/340037011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Fixturing-Clamps/zgbs/industrial/401581011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hole-Saws-Accessories/zgbs/industrial/552402/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Indexable-Insert-Holders/zgbs/industrial/257513011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Indexable-Inserts/zgbs/industrial/257519011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Drill-Bits/zgbs/industrial/256264011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Live-Centers/zgbs/industrial/1265143011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Metal-Cutting-Circular-Saw-Blades/zgbs/industrial/9627233011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Metal-Cutting-Circular-Saws/zgbs/industrial/9627231011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Power-Milling-Machine-Accessories/zgbs/industrial/5825198011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Port-Contour-Cutters/zgbs/industrial/340038011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hand-Punches/zgbs/industrial/2225051011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Reamers/zgbs/industrial/256295011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Router-Bits/zgbs/industrial/3116511/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Shell-Reamer-Arbors/zgbs/industrial/340039011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Slotting-Cutters/zgbs/industrial/256311011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Thread-Mills/zgbs/industrial/256319011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Thread-Repair-Kits/zgbs/industrial/15709071/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Threading-Dies/zgbs/industrial/256320011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Threading-Taps/zgbs/industrial/256324011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Tool-Holders/zgbs/industrial/401549011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Commercial-TVs-Displays/zgbs/industrial/18746933011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Digital-Kiosks-Interactive-Displays/zgbs/industrial/18746935011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Digital-Signage-Display-Mounts/zgbs/industrial/18746937011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Digital-Signage-Media-Players/zgbs/industrial/18746939011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Video-Wall-Controllers/zgbs/industrial/18746941011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Video-Wall-Mounts/zgbs/industrial/18746945011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Video-Walls/zgbs/industrial/18746943011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Bolts/zgbs/industrial/17290024011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Screws/zgbs/industrial/17290023011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hardware-Nuts/zgbs/industrial/16409861/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Nut-Bolt-Assortment-Sets/zgbs/industrial/383887011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Anchors/zgbs/industrial/16409341/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Collated-Hardware-Fasteners/zgbs/industrial/552420/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hardware-Nails/zgbs/industrial/511338/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hardware-Pins/zgbs/industrial/16410171/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Retaining-Rings/zgbs/industrial/16410451/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Rivets/zgbs/industrial/16410461/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Spacers-Standoffs/zgbs/industrial/16413321/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Threaded-Inserts/zgbs/industrial/16410701/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Staples/zgbs/industrial/17290519011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Threaded-Rods-Studs/zgbs/industrial/16410711/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hardware-Washers/zgbs/industrial/16410821/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Screw-Bolt-Assortment-Sets/zgbs/industrial/6809678011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Compressed-Air-Filtration/zgbs/industrial/3419728011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Furnace-Filters/zgbs/industrial/13399891/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hydraulic-Filtration/zgbs/industrial/3419746011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Process-Filtration/zgbs/industrial/3419742011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Lab-Filters/zgbs/industrial/318079011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Plumbing-Strainers/zgbs/industrial/5760169011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Water-Filtration-Softeners/zgbs/industrial/13397631/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Concession-Vending-Equipment/zgbs/industrial/5315091011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Commercial-Cookware-Bakeware-Tools/zgbs/industrial/18098901011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Food-Service-Displayware-Signage/zgbs/industrial/5298059011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Food-Service-Disposables/zgbs/industrial/6134197011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Food-Service-Furniture/zgbs/industrial/6054389011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Restaurant-Appliances-Equipment/zgbs/industrial/18098890011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Commercial-Food-Storage-Transport/zgbs/industrial/18098914011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Tabletop-Serveware/zgbs/industrial/18098905011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Fittings/zgbs/industrial/3021480011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hose-Nozzles/zgbs/industrial/5760175011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hydraulic-Equipment/zgbs/industrial/3754081/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Pneumatic-Equipment/zgbs/industrial/1265132011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Protective-Caps/zgbs/industrial/4650341011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Pumps/zgbs/industrial/1265113011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Push-Plugs/zgbs/industrial/4650342011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Seals-Rings/zgbs/industrial/16413421/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Tubes-Pipes-Hoses/zgbs/industrial/9631359011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Circuit-Protection-Products/zgbs/industrial/306507011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Electrical-Controls-Indicators/zgbs/industrial/306528011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Decade-Boxes/zgbs/industrial/1265103011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Fiber-Optic-Products/zgbs/industrial/306611011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Lighting-Components/zgbs/industrial/6355949011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Optoelectronic-Products/zgbs/industrial/306743011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Electrical-Passive-Components/zgbs/industrial/306767011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Semiconductor-Products/zgbs/industrial/306831011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Electronic-Component-Sensors/zgbs/industrial/306923011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Thermal-Management-Products/zgbs/industrial/306943011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Interconnects/zgbs/industrial/306629011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Biscuits-Plugs/zgbs/industrial/16409481/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Braces-Joist-Hangers/zgbs/industrial/16412261/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hardware-Brackets/zgbs/industrial/16412271/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hardware-Bumpers/zgbs/industrial/16412281/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hardware-Catches/zgbs/industrial/16412341/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hardware-Chains/zgbs/industrial/16412351/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Cabinet-Furniture-Drawer-Slides/zgbs/industrial/511238/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Flexible-Support-Arms/zgbs/industrial/16412431/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Grommets/zgbs/industrial/16409771/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Handles-Pulls/zgbs/industrial/16412441/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hardware-Hasps/zgbs/industrial/511384/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hinges/zgbs/industrial/16412531/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hooks/zgbs/industrial/16412711/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Knobs-Hand-Wheels/zgbs/industrial/16412791/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Latches/zgbs/industrial/16412911/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Lock-Bolts/zgbs/industrial/16409851/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Snaps/zgbs/industrial/16410641/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Commercial-Cleaning-Chemicals/zgbs/industrial/3310240011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Commercial-Cleaning-Tools/zgbs/industrial/3310260011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Commercial-Floor-Mats-Matting/zgbs/industrial/3310283011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Floor-Stand-Signs/zgbs/industrial/3310282011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Commercial-Laundry-Cleaning-Supplies/zgbs/industrial/3310248011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Commercial-Mopping-Supplies/zgbs/industrial/3278156011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Commercial-Odor-Drain-Maintainers/zgbs/industrial/3310284011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Bulk-Quantity-Paper-Products/zgbs/industrial/3310293011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Bulk-Quantity-Personal-Care-Products/zgbs/industrial/3310301011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Commercial-Restroom-Fixtures/zgbs/industrial/3310316011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Commercial-Sweeping-Supplies/zgbs/industrial/3278163011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Commercial-Vacuum-Floor-Cleaning-Machines/zgbs/industrial/16115424011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Commercial-Waste-Receptacles-Liners/zgbs/industrial/3310326011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Glassware-Labware/zgbs/industrial/318049011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Lab-Chemicals/zgbs/industrial/3013597011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Lab-Furniture/zgbs/industrial/318031011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Lab-Instruments-Equipment/zgbs/industrial/317980011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Lab-Supplies/zgbs/industrial/7301207011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Life-Science-Supplies/zgbs/industrial/393446011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Electrical-Cable-Ties/zgbs/industrial/507844/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Casters/zgbs/industrial/16412291/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Coil-Chains/zgbs/industrial/16412371/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Drum-Pail-Handling-Equipment/zgbs/industrial/401559011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Drywall-Lifts/zgbs/industrial/553518/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Forklift-Booms/zgbs/industrial/3003667011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Forklifts/zgbs/industrial/256350011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-HVAC-Equipment/zgbs/industrial/720590011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hydraulic-Lifting-Cylinders/zgbs/industrial/256361011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hydraulic-Lifting-Pumps/zgbs/industrial/256362011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Light-Towers/zgbs/industrial/3003668011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Magnets/zgbs/industrial/1265128011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Load-Binders/zgbs/industrial/256382011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Loading-Dock-Bumpers/zgbs/industrial/1265124011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Loading-Dock-Levelers/zgbs/industrial/1265125011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Loading-Dock-Plates/zgbs/industrial/1265126011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Wheel-Immobilizers-Chocks/zgbs/industrial/15708131/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Material-Transport-Equipment/zgbs/industrial/19502226011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Pallet-Strappers/zgbs/industrial/401572011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Pallets/zgbs/industrial/256384011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Personnel-Lifts/zgbs/industrial/3003670011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Pulling-Lifting/zgbs/industrial/383596011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Ramps/zgbs/industrial/256393011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Roller-Stands/zgbs/industrial/256399011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Securing-Straps/zgbs/industrial/256400011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Shelves-Racking-Systems/zgbs/industrial/18697914011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Material-Handling-Wheels/zgbs/industrial/16413351/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Emergency-Response-Equipment/zgbs/industrial/393317011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Facility-Safety-Products/zgbs/industrial/7459506011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hazardous-Material-Handling-Products/zgbs/industrial/393321011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Lockout-Tagout-Products/zgbs/industrial/1265106011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Personal-Protective-Equipment-Safety-Gear/zgbs/industrial/486555011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Safety-Signs-Signals/zgbs/industrial/3430070011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Safety-Training/zgbs/industrial/7564842011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Bulk-Bubble-Pack-Supplies/zgbs/industrial/8553207011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Packing-Tape/zgbs/industrial/1068982/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Carton-Sealing-Tape-Dispensers/zgbs/industrial/8553233011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Corrugated-Packaging-Boxes/zgbs/industrial/8553213011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Corrugated-Packaging-Pads/zgbs/industrial/8553215011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Packaging-Dunnage-Protectors/zgbs/industrial/8553217011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Shrink-Wrap-Supplies/zgbs/industrial/8553221011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Stretch-Wrap-Supplies/zgbs/industrial/8553227011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Labels-Labeling-Equipment/zgbs/industrial/8553202011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Shipping-Mailers/zgbs/industrial/8553199011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Packaging-Labels-Tags/zgbs/industrial/8553200011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Poly-Plastic-Packaging-Bags/zgbs/industrial/8553245011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Packaging-Strapping/zgbs/industrial/8553249011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Hand-Tools/zgbs/industrial/2233994011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Power-Tools/zgbs/industrial/2234002011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Metalworking-Workholding-Equipment/zgbs/industrial/979147011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Bearings/zgbs/industrial/16410991/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Drive-Belts/zgbs/industrial/16411341/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Brakes-Clutches/zgbs/industrial/16411471/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Power-Transmission-Chains/zgbs/industrial/16411631/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Mechanical-Control-Cables-Accessories/zgbs/industrial/16411671/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Couplings-Collars-Universal-Joiners/zgbs/industrial/16411711/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Power-Transmission-Enclosures-Cases/zgbs/industrial/16412021/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Gear-Stock-Pinion-Wire/zgbs/industrial/16412061/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Gearboxes-Gearheads-Speed-Reducers/zgbs/industrial/16412071/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Mechanical-Gears/zgbs/industrial/16412081/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Linear-Motion-Products/zgbs/industrial/16411201/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Mechanical-Lubricants-Oils/zgbs/industrial/16414281/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Metal-Alloy-Magnet-Wire/zgbs/industrial/310354011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Mechanical-Power-Take-Offs-PTOs/zgbs/industrial/16412221/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Mechanical-Pulleys/zgbs/industrial/1258851011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Mechanical-Ratchets-Pawls/zgbs/industrial/16412231/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Mechanical-Roller-Chain-Sprockets/zgbs/industrial/16411641/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Mechanical-Shafting/zgbs/industrial/16413661/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Mechanical-Shock-Vibration-Control/zgbs/industrial/16413711/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Mechanical-Springs/zgbs/industrial/16413811/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Mechanical-Worm-Wheels/zgbs/industrial/16412241/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Dental-Anesthesia/zgbs/industrial/8297384011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Dental-Apparel-Protective-Gear/zgbs/industrial/11322159011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Dental-Bonding-Agents-Adhesives/zgbs/industrial/8297385011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Dental-Consumables/zgbs/industrial/8297387011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Dental-Cosmetics-Restoratives/zgbs/industrial/8297386011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Endodontics/zgbs/industrial/8297389011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Dental-Evacuation/zgbs/industrial/8297390011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Dental-Finishing-Polishing/zgbs/industrial/8297391011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Dental-Implants-Surgical-Supplies/zgbs/industrial/11322256011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Dental-Impression-Materials-Accessories/zgbs/industrial/8297394011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Dental-Infection-Control/zgbs/industrial/8297395011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Dental-Handpieces-Instruments/zgbs/industrial/8297393011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Dental-Lab-Materials-Small-Equipment/zgbs/industrial/11322221011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Oral-Hygiene-Preventive-Care/zgbs/industrial/8297396011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Orthodontic-Supplies/zgbs/industrial/8297397011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Dental-Radiology-Imaging/zgbs/industrial/8297388011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Medical-Record-Keeping-Labels/zgbs/industrial/8297380011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Dental-Treatment-Room-Furniture-Lighting/zgbs/industrial/8297392011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Dental-Water-Treatment-Equipment/zgbs/industrial/11322307011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Medical-Apparel-Gloves/zgbs/industrial/8297372011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Medical-Diagnostics-Screening/zgbs/industrial/8297373011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Durable-Medical-Equipment/zgbs/industrial/10287908011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Medical-Examination-Supplies-Consumables/zgbs/industrial/8297374011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Medical-Fluid-Administration-Collection/zgbs/industrial/8297375011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Medical-Furniture-Patient-Transport/zgbs/industrial/8297376011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Incontinence-Ostomy-Products/zgbs/industrial/3763261/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Medical-Instruments-Surgical-Tools/zgbs/industrial/8297377011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Medical-Lab-Supplies/zgbs/industrial/18442168011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Occupational-Physical-Therapy-Aids/zgbs/industrial/3776531/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Patient-Monitoring-Treatment-Equipment/zgbs/industrial/8297378011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Patient-Treatment-Equipment/zgbs/industrial/11312453011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Radiology-Imaging/zgbs/industrial/8297379011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Respiratory-Anesthesia-Equipment/zgbs/industrial/8297381011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Sterilization-Infection-Prevention/zgbs/industrial/8297382011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Surgical-Equipment/zgbs/industrial/11312409011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Surgical-Supplies/zgbs/industrial/11312434011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Wound-Care-Dressings/zgbs/industrial/8297383011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Raw-Ceramics-Glass-Gems/zgbs/industrial/6469731011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Cork-Raw-Materials/zgbs/industrial/6469725011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Expanded-Perforated-Sheets/zgbs/industrial/6469722011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Fabrics-Fibers-Textiles-Raw-Materials/zgbs/industrial/16414051/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Floor-Grating/zgbs/industrial/18734405011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Foam-Raw-Materials/zgbs/industrial/6469723011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Graphite-Raw-Materials/zgbs/industrial/6901870011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Metal-Alloy-Wire/zgbs/industrial/16414431/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Laminates-Composites-Raw-Materials/zgbs/industrial/6469727011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Mesh-Wire-Cloth/zgbs/industrial/6469724011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Metal-Alloy-Raw-Materials/zgbs/industrial/16414131/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Plastic-Raw-Materials/zgbs/industrial/16414291/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Rubber-Raw-Materials/zgbs/industrial/350666011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Shims-Shim-Stock-Raw-Materials/zgbs/industrial/16413251/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Wood-Raw-Materials/zgbs/industrial/16414441/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Retail-Anti-Theft-Equipment/zgbs/industrial/8615539011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Clothing-Forms/zgbs/industrial/8615559011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Retail-Mannequins/zgbs/industrial/8615560011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Point-Sale-POS-Equipment-Accessories/zgbs/industrial/18715221011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Retail-Pricing-Supplies/zgbs/industrial/8615542011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Retail-Bags-Boxes/zgbs/industrial/8615540011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Retail-Displays-Racks/zgbs/industrial/8615543011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Retail-Shelving-Wall-Displays/zgbs/industrial/8615544011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Retail-Shopping-Baskets-Carts/zgbs/industrial/8615548011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Store-Signs-Displays/zgbs/industrial/2747494011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Robot-Parts-Accessories/zgbs/industrial/8498887011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Security-Surveillance-Robots/zgbs/industrial/8498891011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Unmanned-Aerial-Vehicles-UAVs/zgbs/industrial/8498892011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Science-Education-Charts-Posters/zgbs/industrial/6651003011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Early-Childhood-Education-Materials/zgbs/industrial/12900351/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Science-Fossils/zgbs/industrial/6651011011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Science-Education-Insect-Kits/zgbs/industrial/6651004011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Science-Education-Magnets-Magnetism-Kits/zgbs/industrial/6651005011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Science-Classroom-Measurement-Kits/zgbs/industrial/6651010011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Microscope-Sample-Slides/zgbs/industrial/6651008011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Microscopes/zgbs/industrial/499170/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Animal-Anatomical-Models/zgbs/industrial/6651006011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Science-Classroom-Optics-Kits/zgbs/industrial/6651007011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-School-Scales/zgbs/industrial/12900271/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Science-Classroom-Specimens/zgbs/industrial/6651009011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Telescopes/zgbs/industrial/281063/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Airflow-Air-Quality/zgbs/industrial/5006563011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Calibration-Products/zgbs/industrial/4989307011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Dimensional-Measurement/zgbs/industrial/4989299011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Electrical-Testing/zgbs/industrial/5011659011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Inspection-Analysis/zgbs/industrial/4989315011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Lab-Photometers-Light-Meters/zgbs/industrial/393278011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Motion-Speed-Force/zgbs/industrial/5006560011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Network-Cable-Testers/zgbs/industrial/7701919011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Pressure-Vacuum-Measurement/zgbs/industrial/5006545011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Recorders-Data-Acquisition/zgbs/industrial/5006548011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Scales-Balances/zgbs/industrial/4989331011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Sound-Noise-Meters/zgbs/industrial/7701920011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Substance-Analysis-Instrumentation/zgbs/industrial/19568045011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Surface-Hardness-Testing/zgbs/industrial/4989319011/','https://www.amazon.com/Best-Sellers-Industrial-Scientific-Temperature-Humidity-Measurement/zgbs/industrial/5006566011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bakers-Casseroles/zgbs/home-garden/289671/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bakeware-Sets/zgbs/home-garden/289669/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Baking-Cookie-Sheets/zgbs/home-garden/289674/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Baking-Tools-Accessories/zgbs/home-garden/289719/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bread-Loaf-Pans/zgbs/home-garden/289675/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Cake-Pans/zgbs/home-garden/289679/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Electric-Cake-Pop-Mini-Makers/zgbs/home-garden/8614937011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Candy-Making-Supplies/zgbs/home-garden/2231404011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Decorating-Tools/zgbs/home-garden/289727/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Jelly-Roll-Pans/zgbs/home-garden/3736941/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Mixing-Bowls/zgbs/home-garden/289696/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Muffin-Cupcake-Pans/zgbs/home-garden/289700/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Pastry-Baking-Molds/zgbs/home-garden/289714/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Pie-Tart-Quiche-Pans/zgbs/home-garden/289701/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Pizza-Pans-Stones/zgbs/home-garden/383850011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Popover-Pans/zgbs/home-garden/5038552011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Ramekins-Souffl%C3%A9-Dishes/zgbs/home-garden/289672/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Roasting-Pans/zgbs/home-garden/289826/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Bar-Tools/zgbs/kitchen/17867731011/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Beer-Glasses/zgbs/kitchen/13217731/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Beer-Mugs-Steins/zgbs/kitchen/13217761/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Cocktail-Drinkware/zgbs/kitchen/17867732011/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Liqueur-Spirits-Glasses/zgbs/kitchen/17867735011/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Wine-Champagne-Glasses/zgbs/kitchen/16861787011/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Tea-Espresso-Beverage-Warmers/zgbs/kitchen/3737031/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Coffee-Makers/zgbs/kitchen/7740213011/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Electric-Coffee-Blade-Grinders/zgbs/kitchen/14092831/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Burr-Coffee-Grinders/zgbs/kitchen/14092821/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Espresso-Machine-Coffeemaker-Combos/zgbs/kitchen/14163731/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Espresso-Machines/zgbs/kitchen/289748/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Kettles-Tea-Machines/zgbs/kitchen/19309415011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Cookware-Sets/zgbs/home-garden/289816/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Pots-Pans/zgbs/home-garden/19343857011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Canning-Products/zgbs/home-garden/2237238011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Tea-Kettles/zgbs/home-garden/289833/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Pot-Racks/zgbs/home-garden/289824/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Griddles/zgbs/home-garden/289821/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Fondue-Sets-Accessories/zgbs/home-garden/289820/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Toaster-Oven-Cookware/zgbs/home-garden/300193/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Disposable-Cookware/zgbs/home-garden/6054383011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Cookware-Bakeware-Lids/zgbs/home-garden/289823/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Specialty-Cookware/zgbs/home-garden/289830/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Cookware-Accessories/zgbs/home-garden/3737201/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Asian-Knives/zgbs/home-garden/289852/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Boning-Knives/zgbs/home-garden/19290350011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bread-Knives/zgbs/home-garden/720777011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Cake-Knives/zgbs/home-garden/3737381/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Carving-Knives-Forks/zgbs/home-garden/289856/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Chefs-Knives/zgbs/home-garden/289857/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Cleavers/zgbs/home-garden/289858/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Cutting-Boards/zgbs/home-garden/289863/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Electric-Knives/zgbs/home-garden/3737391/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Fillet-Knives/zgbs/home-garden/19290351011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Knife-Accessories/zgbs/home-garden/3737361/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Knife-Blocks-Storage/zgbs/home-garden/289870/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Knife-Sets/zgbs/home-garden/289864/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Knife-Sharpeners/zgbs/home-garden/289867/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Paring-Knives/zgbs/home-garden/289859/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Shears/zgbs/home-garden/289860/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Specialty-Knives/zgbs/home-garden/289862/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Steak-Knives/zgbs/home-garden/289861/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Utility-Knives/zgbs/home-garden/498926/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bar-Tools-Drinkware/zgbs/home-garden/289728/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Dinnerware/zgbs/home-garden/17913622011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Flatware/zgbs/home-garden/13218891/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Glassware-Drinkware/zgbs/home-garden/13217501/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Novelty-Dining-Entertaining/zgbs/home-garden/9298963011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Serveware/zgbs/home-garden/367165011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Tabletop-Accessories/zgbs/home-garden/3194593011/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Drinking-Jars/zgbs/kitchen/17867734011/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Goblets/zgbs/kitchen/13694091/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Growlers/zgbs/kitchen/16188241011/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Iced-Tea-Glasses/zgbs/kitchen/13218151/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Kiddush-Cups-Sets/zgbs/kitchen/16961529011/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Mixed-Drinkware-Sets/zgbs/kitchen/13218751/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Sake-Cups/zgbs/kitchen/3136596011/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Sake-Sets/zgbs/kitchen/3136597011/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Stemmed-Water-Glasses/zgbs/kitchen/16188242011/','https://www.amazon.com/Best-Sellers-Kitchen-Dining-Tumblers-Water-Glasses/zgbs/kitchen/13218451/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Beer-Brewing-Equipment/zgbs/home-garden/979833011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Brewing-Cleaning-Sanitation/zgbs/home-garden/979845011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Brewing-Fermentation-Equipment/zgbs/home-garden/979846011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Brewing-Fermentation-Labeling-Supplies/zgbs/home-garden/979844011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Beer-Brewing-Wine-Making-Testing/zgbs/home-garden/2252009011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Brewing-Wine-Making-Racks-Storage/zgbs/home-garden/979852011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Wine-Making-Equipment/zgbs/home-garden/979854011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Aprons/zgbs/home-garden/668145011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Chair-Pads/zgbs/home-garden/3735851/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Cloth-Napkins/zgbs/home-garden/3741981/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Dish-Cloths-Towels/zgbs/home-garden/3741991/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Disposable-Table-Covers/zgbs/home-garden/6054384011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Linen-Sets/zgbs/home-garden/3741961/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Rugs/zgbs/home-garden/644050011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Place-Mats/zgbs/home-garden/3742001/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Potholders-Oven-Mitts/zgbs/home-garden/3742011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Table-Runners/zgbs/home-garden/3742021/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Tablecloths/zgbs/home-garden/3742031/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Tea-Cozies/zgbs/home-garden/3118182011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Table-Linen-Accessories/zgbs/home-garden/3741971/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Cooking-Utensils/zgbs/home-garden/16439841/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Measuring-Tools-Scales/zgbs/home-garden/289785/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Cooks-Tool-Gadget-Sets/zgbs/home-garden/760354/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Graters-Peelers-Slicers/zgbs/home-garden/16439851/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Can-Openers/zgbs/home-garden/289755/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Jar-Openers/zgbs/home-garden/17548243011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Salt-Pepper-Mills-Shakers-Sets/zgbs/home-garden/289802/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Seasoning-Spice-Tools/zgbs/home-garden/289779/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Colanders-Food-Strainers/zgbs/home-garden/16439831/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Specialty-Tools-Gadgets/zgbs/home-garden/3737191/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Thermometers-Timers/zgbs/home-garden/289807/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Oil-Sprayers-Dispensers/zgbs/home-garden/289789/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bar-Wine-Tools/zgbs/home-garden/760384/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Fruit-Vegetable-Tools/zgbs/home-garden/760356/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Pasta-Pizza-Tools/zgbs/home-garden/289790/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Meat-Poultry-Tools/zgbs/home-garden/760358/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Salad-Tools-Spinners/zgbs/home-garden/289798/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Cheese-Tools/zgbs/home-garden/289758/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Grilling-BBQ-Utensils/zgbs/home-garden/553762/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Accessories/zgbs/home-garden/16439891/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Drinking-Straws/zgbs/home-garden/21331299011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Beverage-Refrigerators/zgbs/home-garden/2686328011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Household-Blenders/zgbs/home-garden/289914/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Bread-Machines/zgbs/home-garden/289917/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Coffee-Tea-Espresso-Appliances/zgbs/home-garden/289742/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Compact-Refrigerators/zgbs/home-garden/678542011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Contact-Grills/zgbs/home-garden/289925/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Countertop-Burners/zgbs/home-garden/13838451/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Electric-Griddles/zgbs/home-garden/13838461/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Electric-Pressure-Cookers/zgbs/home-garden/3117954011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Electric-Skillets/zgbs/home-garden/13838481/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Electric-Woks/zgbs/home-garden/13838491/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Food-Processors/zgbs/home-garden/289920/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Fryers/zgbs/home-garden/17659095011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Electric-Hot-Pots/zgbs/home-garden/3117951011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Ice-Cream-Machines/zgbs/home-garden/289924/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Juicers/zgbs/home-garden/289926/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Kegerators/zgbs/home-garden/2686378011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Microwave-Ovens/zgbs/home-garden/289935/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Household-Mixers/zgbs/home-garden/289929/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Ovens-Toasters/zgbs/home-garden/289933/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Rice-Cookers/zgbs/home-garden/678540011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Slow-Cookers/zgbs/home-garden/289940/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Soda-Makers/zgbs/home-garden/7956268011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Specialty-Appliances/zgbs/home-garden/289941/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Food-Steamers/zgbs/home-garden/678541011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Waffle-Irons/zgbs/home-garden/289942/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Wine-Cellars/zgbs/home-garden/3741521/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Cabinet-Organizers/zgbs/home-garden/3743971/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Countertop-Wall-Organization/zgbs/home-garden/9768328011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Dinnerware-Stemware-Storage/zgbs/home-garden/9768329011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Flatware-Utensil-Storage/zgbs/home-garden/16188246011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Food-Storage/zgbs/home-garden/9768326011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Storage-Accessories/zgbs/home-garden/3744031/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Vacuum-Flasks/zgbs/home-garden/21613418011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Lunch-Boxes-Bags/zgbs/home-garden/8841480011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Wine-Racks-Cabinets/zgbs/home-garden/3744251/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Corkscrews-Openers/zgbs/home-garden/289734/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Ice-Buckets/zgbs/home-garden/678496011/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Wine-Chillers/zgbs/home-garden/13299331/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Wine-Decanters/zgbs/home-garden/13217531/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Wine-Glasses/zgbs/home-garden/13218541/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Wine-Stoppers-Pourers/zgbs/home-garden/289737/','https://www.amazon.com/Best-Sellers-Home-Kitchen-Wine-Accessory-Sets/zgbs/home-garden/13299321/','https://www.amazon.com/Best-Sellers-Office-Products-Art-Supplies-Craft/zgbs/office-products/490778011/','https://www.amazon.com/Best-Sellers-Office-Products-Classroom-Furniture/zgbs/office-products/6650975011/','https://www.amazon.com/Best-Sellers-Office-Products-School-Science-Supplies/zgbs/office-products/12900221/','https://www.amazon.com/Best-Sellers-Office-Products-Nameplates-Desk-Tapes/zgbs/office-products/12900881/','https://www.amazon.com/Best-Sellers-Office-Products-Early-Childhood-Education-Materials/zgbs/office-products/12900351/','https://www.amazon.com/Best-Sellers-Office-Products-Filing/zgbs/office-products/1069554/','https://www.amazon.com/Best-Sellers-Office-Products-Workplace-First-Aid-Kits/zgbs/office-products/3465341/','https://www.amazon.com/Best-Sellers-Office-Products-Foreign-Language-Materials/zgbs/office-products/6650985011/','https://www.amazon.com/Best-Sellers-Office-Products-Geography-Materials/zgbs/office-products/12900311/','https://www.amazon.com/Best-Sellers-Office-Products-Hall-Passes/zgbs/office-products/6650987011/','https://www.amazon.com/Best-Sellers-Office-Products-Math-Materials/zgbs/office-products/12900191/','https://www.amazon.com/Best-Sellers-Office-Products-Classroom-Pocket-Charts/zgbs/office-products/490790011/','https://www.amazon.com/Best-Sellers-Office-Products-Reading-Writing-Materials/zgbs/office-products/6650988011/','https://www.amazon.com/Best-Sellers-Office-Products-Reading-Guide-Strips-Pages/zgbs/office-products/6650989011/','https://www.amazon.com/Best-Sellers-Office-Products-Special-Education-School-Supplies/zgbs/office-products/12900371/','https://www.amazon.com/Best-Sellers-Office-Products-Students-Round-Edge-Scissors/zgbs/office-products/1084736/','https://www.amazon.com/Best-Sellers-Office-Products-Teaching-Materials/zgbs/office-products/1068990/','https://www.amazon.com/Best-Sellers-Office-Products-Writing-Supplies-Correction/zgbs/office-products/1069784/','https://www.amazon.com/Best-Sellers-Office-Products-Envelope-Stamp-Moisteners/zgbs/office-products/12900631/','https://www.amazon.com/Best-Sellers-Office-Products-Mailing-Envelopes/zgbs/office-products/1069694/','https://www.amazon.com/Best-Sellers-Office-Products-Mail-Bags-Transit-Sacks/zgbs/office-products/490796011/','https://www.amazon.com/Best-Sellers-Office-Products-Mail-Sorters/zgbs/office-products/1085674/','https://www.amazon.com/Best-Sellers-Office-Products-Mailers/zgbs/office-products/1068976/','https://www.amazon.com/Best-Sellers-Office-Products-Letter-Openers/zgbs/office-products/1069366/','https://www.amazon.com/Best-Sellers-Office-Products-Packing-Materials/zgbs/office-products/12900681/','https://www.amazon.com/Best-Sellers-Office-Products-Paper-Folding-Machines/zgbs/office-products/12900731/','https://www.amazon.com/Best-Sellers-Office-Products-Postage-Stamps/zgbs/office-products/23483496011/','https://www.amazon.com/Best-Sellers-Office-Products-Postal-Scales/zgbs/office-products/1068986/','https://www.amazon.com/Best-Sellers-Office-Products-Cabinets-Racks-Shelves/zgbs/office-products/1069108/','https://www.amazon.com/Best-Sellers-Office-Products-Carts-Stands/zgbs/office-products/1069114/','https://www.amazon.com/Best-Sellers-Office-Products-Chairs-Sofas/zgbs/office-products/1069122/','https://www.amazon.com/Best-Sellers-Office-Products-Desks-Workstations/zgbs/office-products/12900751/','https://www.amazon.com/Best-Sellers-Office-Products-Furniture-Accessories/zgbs/office-products/1069190/','https://www.amazon.com/Best-Sellers-Office-Products-Home-Furniture-Sets/zgbs/office-products/3733661/','https://www.amazon.com/Best-Sellers-Office-Products-Tables/zgbs/office-products/1069222/','https://www.amazon.com/Best-Sellers-Office-Products-Desk-Lamps/zgbs/office-products/1063292/','https://www.amazon.com/Best-Sellers-Office-Products-Floor-Lamps/zgbs/office-products/1063294/','https://www.amazon.com/Best-Sellers-Office-Products-Under-Counter-Light-Fixtures/zgbs/office-products/3736741/','https://www.amazon.com/Best-Sellers-Office-Products-Binder-Supplies/zgbs/office-products/1069556/','https://www.amazon.com/Best-Sellers-Office-Products-Book-Covers-Accessories/zgbs/office-products/17581329011/','https://www.amazon.com/Best-Sellers-Office-Products-Calendars-Planners-Organizers/zgbs/office-products/1069454/','https://www.amazon.com/Best-Sellers-Office-Products-Carrying-Cases/zgbs/office-products/1069424/','https://www.amazon.com/Best-Sellers-Office-Products-Cutting-Tools/zgbs/office-products/490579011/','https://www.amazon.com/Best-Sellers-Office-Products-Desk-Accessories-Workspace-Organizers/zgbs/office-products/1069514/','https://www.amazon.com/Best-Sellers-Office-Products-Forms-Recordkeeping-Money-Handling/zgbs/office-products/1069376/','https://www.amazon.com/Best-Sellers-Office-Products-Labelers-Label-Rolls/zgbs/office-products/490540011/','https://www.amazon.com/Best-Sellers-Office-Products-Storage-Supplies/zgbs/office-products/1069652/','https://www.amazon.com/Best-Sellers-Office-Products-Paper-Printable-Media/zgbs/office-products/1069664/','https://www.amazon.com/Best-Sellers-Office-Products-Computer-Printer-Ink-Toner/zgbs/office-products/172638/','https://www.amazon.com/Best-Sellers-Office-Products-Staplers-Hole-Punches/zgbs/office-products/1069342/','https://www.amazon.com/Best-Sellers-Office-Products-Store-Signs-Displays/zgbs/office-products/2747494011/','https://www.amazon.com/Best-Sellers-Office-Products-Tape-Adhesives-Fasteners/zgbs/office-products/1069320/','https://www.amazon.com/Best-Sellers-Office-Products-Time-Clocks-Cards/zgbs/office-products/1085696/','https://www.amazon.com/Best-Sellers-Office-Products-Bulletin-Boards/zgbs/office-products/1069306/','https://www.amazon.com/Best-Sellers-Office-Products-Chalkboards/zgbs/office-products/1069310/','https://www.amazon.com/Best-Sellers-Office-Products-Changeable-Letter-Boards/zgbs/office-products/490769011/','https://www.amazon.com/Best-Sellers-Office-Products-Combination-Presentation-Boards/zgbs/office-products/15755081/','https://www.amazon.com/Best-Sellers-Office-Products-Display-Booths/zgbs/office-products/490771011/','https://www.amazon.com/Best-Sellers-Office-Products-Dry-Erase-Boards/zgbs/office-products/1069312/','https://www.amazon.com/Best-Sellers-Office-Products-Easel-Style-Dry-Erase-Boards/zgbs/office-products/490773011/','https://www.amazon.com/Best-Sellers-Office-Products-Foam-Boards/zgbs/office-products/1069258/','https://www.amazon.com/Best-Sellers-Office-Products-Message-Boards-Signs/zgbs/office-products/1069296/','https://www.amazon.com/Best-Sellers-Office-Products-Poster-Boards/zgbs/office-products/1069266/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Agricultural-Construction-Machinery/zgbs/lawn-garden/5743799011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Agriculture-Grounds-Management/zgbs/lawn-garden/5743764011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Beekeeping-Supplies/zgbs/lawn-garden/4619353011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Livestock-Care-Supplies/zgbs/lawn-garden/4619355011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Agricultural-Material-Transport/zgbs/lawn-garden/5743826011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Agriculture-Plant-Germination-Equipment/zgbs/lawn-garden/5743847011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Plants-Seeds-Bulbs/zgbs/lawn-garden/3480662011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Poultry-Care-Supplies/zgbs/lawn-garden/4619362011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Soils-Fertilizers-Mulches/zgbs/lawn-garden/3752871/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Agricultural-Structures-Hardware/zgbs/lawn-garden/5743829011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Composting-Yard-Waste-Bins/zgbs/lawn-garden/9001142011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Sculptures-Statues/zgbs/lawn-garden/553802/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Gardening-Gloves-Protective-Gear/zgbs/lawn-garden/9001141011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Gardening-Hand-Tools/zgbs/lawn-garden/128061011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Lawn-Mulch-Paint/zgbs/lawn-garden/14100828011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Gardening-Carts/zgbs/lawn-garden/917870/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Plant-Covers/zgbs/lawn-garden/3563987011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Plant-Support-Structures/zgbs/lawn-garden/14106461/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Gardening-Pots-Planters-Accessories/zgbs/lawn-garden/3480694011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Potting-Benches-Tables/zgbs/lawn-garden/16135368011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Gardening-Sprayers-Accessories/zgbs/lawn-garden/9001143011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Lawn-Spreaders/zgbs/lawn-garden/553928/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Pond-Equipment/zgbs/lawn-garden/13764241/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Weed-Moss-Control/zgbs/lawn-garden/3480706011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Greenhouses-Plant-Germination-Equipment/zgbs/lawn-garden/23539045011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Hydroponics/zgbs/lawn-garden/23539044011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Generators/zgbs/lawn-garden/348967011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Power-Inverters/zgbs/lawn-garden/583328/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Solar-Wind-Power/zgbs/lawn-garden/3236381/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Generator-Accessories/zgbs/lawn-garden/16381051/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Fryers/zgbs/lawn-garden/553776/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Cooking-Fuel-Firestarters/zgbs/lawn-garden/13638730011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Grills-Smokers/zgbs/lawn-garden/328983011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Cooking-Replacement-Parts/zgbs/lawn-garden/3742161/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Cooking-Tools-Accessories/zgbs/lawn-garden/13299251/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Kitchen-Appliances-Storage/zgbs/lawn-garden/2253417011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Lawn-Mowers-Tractors/zgbs/lawn-garden/128066011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-String-Trimmers/zgbs/lawn-garden/553954/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Power-Chain-Saws/zgbs/lawn-garden/552918/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Power-Edgers/zgbs/lawn-garden/553914/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Power-Hedge-Trimmers/zgbs/lawn-garden/553938/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Power-Tool-Battery-Packs-Chargers/zgbs/lawn-garden/13638731011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Leaf-Blowers-Vacuums/zgbs/lawn-garden/553910/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Power-Log-Splitters/zgbs/lawn-garden/1091946/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Metal-Detectors/zgbs/lawn-garden/554036/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Power-Pole-Saws/zgbs/lawn-garden/3753651/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Pressure-Washers/zgbs/lawn-garden/552856/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Power-Tillers/zgbs/lawn-garden/553956/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Weed-Torches/zgbs/lawn-garden/3480723011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Wood-Chippers-Shredders-Mulchers/zgbs/lawn-garden/3753621/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Powertool-Parts-Accessories/zgbs/lawn-garden/553898/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Electric-Pruning-Shears-Parts-Accessories/zgbs/lawn-garden/21580218011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Decorative-Address-Signs/zgbs/lawn-garden/16135371011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Artificial-Grass/zgbs/lawn-garden/21592042011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Backyard-Birding-Wildlife/zgbs/lawn-garden/553632/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Wind-Chimes/zgbs/lawn-garden/553806/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Cupolas-Accessories/zgbs/lawn-garden/13839651/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Decorative-Fences/zgbs/lawn-garden/3742341/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Decorative-Stakes/zgbs/lawn-garden/16164098011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Decorative-Stools/zgbs/lawn-garden/3563985011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Doormats/zgbs/lawn-garden/3742271/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Flagpole-Hardware/zgbs/lawn-garden/13923601/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Flags-Banners/zgbs/lawn-garden/553792/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Fountain-Accessories/zgbs/lawn-garden/13400901/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Fountains/zgbs/lawn-garden/14083101/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Garage-Door-Decorations/zgbs/lawn-garden/16926105011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Bridges/zgbs/lawn-garden/14008361/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-D%C3%A9corative-Lighting/zgbs/lawn-garden/14107631/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Decorative-Mailbox-Accessories/zgbs/lawn-garden/16135373011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Mailbox-Covers/zgbs/lawn-garden/9628874011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Clocks/zgbs/lawn-garden/553794/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Curtains/zgbs/lawn-garden/3480737011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Hanging-Brackets/zgbs/lawn-garden/21208375011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Holiday-Decorations/zgbs/lawn-garden/285033011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Rugs/zgbs/lawn-garden/16509767011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Shepherds-Hooks/zgbs/lawn-garden/21208376011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Plaques-Wall-Art/zgbs/lawn-garden/3742281/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Rain-Chains/zgbs/lawn-garden/3480736011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Sundial-Clocks/zgbs/lawn-garden/3735001/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Thermometers-Weather-Instruments/zgbs/lawn-garden/554038/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Weathervanes/zgbs/lawn-garden/13827291/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Yard-Signs/zgbs/lawn-garden/14083111/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Decorative-Fire-Pit-Glass-Pellets/zgbs/lawn-garden/9001154011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Fire-Pit-Fireplace-Parts/zgbs/lawn-garden/10253330011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Fire-Pit-Covers/zgbs/lawn-garden/3480670011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Fire-Pit-Spark-Screens/zgbs/lawn-garden/3480671011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Fire-Pits-Fireplaces/zgbs/lawn-garden/9001138011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Firewood-Racks/zgbs/lawn-garden/3563995011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Misting-Fans/zgbs/lawn-garden/15194371011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Misting-Parts-Accessories/zgbs/lawn-garden/15194373011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Misting-Systems/zgbs/lawn-garden/15194372011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Patio-Heater-Covers/zgbs/lawn-garden/13638748011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Heater-Replacement-Parts/zgbs/lawn-garden/10425201011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Heaters/zgbs/lawn-garden/553782/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Carports/zgbs/lawn-garden/13638750011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Deck-Boxes/zgbs/lawn-garden/671804011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Houses/zgbs/lawn-garden/21424007011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Storage-Benches/zgbs/lawn-garden/671803011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Storage-Sheds/zgbs/lawn-garden/13400671/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Tiny-House-Kits/zgbs/lawn-garden/21424006011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Canopies-Gazebos-Pergolas/zgbs/lawn-garden/14135021011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Hammocks-Stands-Accessories/zgbs/lawn-garden/553836/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Patio-Furniture-Covers/zgbs/lawn-garden/13749551/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Patio-Furniture-Sets/zgbs/lawn-garden/3742441/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Patio-Seating/zgbs/lawn-garden/9001152011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Picnic-Baskets-Tables-Accessories/zgbs/lawn-garden/361425011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Privacy-Screens-Protection/zgbs/lawn-garden/21389656011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Tables/zgbs/lawn-garden/553832/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Patio-Umbrellas-Shade/zgbs/lawn-garden/14135022011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Pest-Control-Baits-Lures/zgbs/lawn-garden/3737941/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Beneficial-Pest-Control-Insects/zgbs/lawn-garden/13837441/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Bug-Zappers/zgbs/lawn-garden/3738021/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Fly-Swatters/zgbs/lawn-garden/13638746011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Pest-Control-Foggers/zgbs/lawn-garden/707166011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Pest-Repellents/zgbs/lawn-garden/3737951/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Pest-Control-Traps/zgbs/lawn-garden/3737901/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Pest-Control-Accessories/zgbs/lawn-garden/911952/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Pool-Cleaning-Tools-Chemicals/zgbs/lawn-garden/1272944011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Swimming-Pools/zgbs/lawn-garden/166442011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Hot-Tubs/zgbs/lawn-garden/2475557011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Saunas/zgbs/lawn-garden/2475549011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Filters-Filter-Media/zgbs/lawn-garden/1273004011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Swimming-Pool-Heaters-Accessories/zgbs/lawn-garden/1272946011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Pool-Pump-Replacement-Parts-Accessories/zgbs/lawn-garden/1273011011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Pool-Spa-Parts-Accessories/zgbs/lawn-garden/4623183011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Icers-Salt-Spreaders/zgbs/lawn-garden/3753721/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Snow-Blowers/zgbs/lawn-garden/3043481/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Snow-Thrower-Yard-Equipment-Chains/zgbs/lawn-garden/2539199011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Snow-Plows/zgbs/lawn-garden/3753731/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Snow-Rakes/zgbs/lawn-garden/3043491/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Snow-Shovels/zgbs/lawn-garden/13755561/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Snow-Blower-Accessories/zgbs/lawn-garden/492200011/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Snow-Plow-Attachments-Accessories/zgbs/lawn-garden/15737051/','https://www.amazon.com/Best-Sellers-Garden-Outdoor-Snow-Blower-Replacement-Parts/zgbs/lawn-garden/9425942011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Bird-Food/zgbs/pet-supplies/2975238011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Bird-Treats/zgbs/pet-supplies/3024125011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Birdcages-Accessories/zgbs/pet-supplies/2975222011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Bird-Carriers/zgbs/pet-supplies/2975233011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Bird-Feeding-Watering/zgbs/pet-supplies/2975234011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Bird-Health/zgbs/pet-supplies/2975239011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Bird-Toys/zgbs/pet-supplies/2975240011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Cat-Apparel/zgbs/pet-supplies/2975242011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Cat-Beds-Furniture/zgbs/pet-supplies/2975243011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Cameras-Monitors/zgbs/pet-supplies/17440052011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Cat-Carriers-Strollers/zgbs/pet-supplies/2975250011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Cat-Doors-Enclosures-Steps/zgbs/pet-supplies/2975251011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Cat-Collars-Harnesses-Leashes/zgbs/pet-supplies/2975252011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Cat-Feeding-Watering/zgbs/pet-supplies/2975259011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Cat-Flea-Tick-Control/zgbs/pet-supplies/2975280011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Cat-Food/zgbs/pet-supplies/2975265011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Cat-Grooming/zgbs/pet-supplies/2975268011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Cat-Health/zgbs/pet-supplies/2975276011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Cat-Litter-Housebreaking/zgbs/pet-supplies/2975296011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Cat-Memorials/zgbs/pet-supplies/2975302011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Cat-Repellents-Training-Aids/zgbs/pet-supplies/2975258011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Cat-Toys/zgbs/pet-supplies/2975303011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Cat-Treats/zgbs/pet-supplies/2975309011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Dog-Food/zgbs/pet-supplies/2975359011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Dog-Treats/zgbs/pet-supplies/2975434011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Dog-Apparel-Accessories/zgbs/pet-supplies/2975313011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Dog-Beds-Furniture/zgbs/pet-supplies/2975326011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Dog-Carriers-Travel-Products/zgbs/pet-supplies/2975333011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Dog-Collars-Harnesses-Leashes/zgbs/pet-supplies/2975339011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Dog-Crates-Houses-Pens/zgbs/pet-supplies/2975400011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Dog-Doors-Gates-Ramps/zgbs/pet-supplies/2975346011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Dog-Feeding-Watering/zgbs/pet-supplies/2975351011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Dog-Flea-Tick-Control/zgbs/pet-supplies/2975384011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Dog-Grooming/zgbs/pet-supplies/2975362011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Dog-Health/zgbs/pet-supplies/2975377011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Dog-Housebreaking/zgbs/pet-supplies/2975405011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Dog-Memorials/zgbs/pet-supplies/2975412011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Dog-Toys/zgbs/pet-supplies/2975413011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Dog-Training-Behavior-Aids/zgbs/pet-supplies/2975420011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Aquarium-Cleaners/zgbs/pet-supplies/2975464011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Aquarium-D%C3%A9cor/zgbs/pet-supplies/2975448011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Aquarium-Heaters-Chillers/zgbs/pet-supplies/19171761011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Aquarium-Hoods/zgbs/pet-supplies/2975457011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Aquarium-Hydrometers/zgbs/pet-supplies/3048857011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Aquarium-Lights/zgbs/pet-supplies/2975458011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Aquarium-Pumps-Filters/zgbs/pet-supplies/2975469011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Aquarium-Stands/zgbs/pet-supplies/2975459011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Aquarium-Substrate/zgbs/pet-supplies/2975476011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Aquarium-Test-Kits/zgbs/pet-supplies/3048858011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Aquarium-Thermometers/zgbs/pet-supplies/2975477011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Aquarium-Water-Treatments/zgbs/pet-supplies/2975478011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Aquariums-Fish-Bowls/zgbs/pet-supplies/7955292011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Automatic-Fish-Feeders/zgbs/pet-supplies/2975462011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Fish-Breeding-Tanks/zgbs/pet-supplies/2975463011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Fish-Food/zgbs/pet-supplies/2975479011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Fish-Medication-Health/zgbs/pet-supplies/21238281011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Horse-Food/zgbs/pet-supplies/3085142011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Horse-Treats/zgbs/pet-supplies/3085136011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Horse-Blankets-Sheets/zgbs/pet-supplies/3407521/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Horse-Boots-Wraps/zgbs/pet-supplies/8399138011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Farrier/zgbs/pet-supplies/8399143011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Horse-Grooming-Bathing/zgbs/pet-supplies/8399155011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Horse-Health/zgbs/pet-supplies/3085139011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Horse-Pest-Control/zgbs/pet-supplies/8399179011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Horse-Stable/zgbs/pet-supplies/8399184011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Horse-Toys/zgbs/pet-supplies/8399196011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Reptile-Amphibian-Food/zgbs/pet-supplies/2975505011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Reptile-Amphibian-Habitat-D%C3%A9cor/zgbs/pet-supplies/2975510011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Reptile-Amphibian-Habitat-Lighting/zgbs/pet-supplies/2975515011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Reptile-Amphibian-Health/zgbs/pet-supplies/2975506011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Terrarium-Bedding-Sand-Substrate/zgbs/pet-supplies/2975508011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Terrarium-Bowls/zgbs/pet-supplies/2975509011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Terrarium-Covers/zgbs/pet-supplies/2975517011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Terrarium-Heat-Lamps-Mats/zgbs/pet-supplies/2975516011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Terrarium-Hygrometers/zgbs/pet-supplies/3048869011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Terrarium-Thermometers/zgbs/pet-supplies/2975519011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Reptile-Terrariums/zgbs/pet-supplies/2975518011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Small-Animal-Food/zgbs/pet-supplies/2975528011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Small-Animal-Treats/zgbs/pet-supplies/3048877011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Small-Animal-Carriers/zgbs/pet-supplies/2975521011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Small-Animal-Collars-Leashes-Harnesses/zgbs/pet-supplies/2975522011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Small-Animal-Exercise-Wheels/zgbs/pet-supplies/2975523011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Small-Animal-Feeding-Watering/zgbs/pet-supplies/2975524011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Small-Animal-Grooming/zgbs/pet-supplies/2975529011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Small-Animal-Health/zgbs/pet-supplies/2975534011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Small-Animal-Houses-Habitats/zgbs/pet-supplies/2975535011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Small-Animal-Odor-Stain-Removers/zgbs/pet-supplies/2975539011/','https://www.amazon.com/Best-Sellers-Pet-Supplies-Small-Animal-Toys/zgbs/pet-supplies/2975540011/','https://www.amazon.com/Best-Sellers-Software-Business-Accounting/zgbs/software/283001/','https://www.amazon.com/Best-Sellers-Software-Check-Printing/zgbs/software/283002/','https://www.amazon.com/Best-Sellers-Software-Inventory-Management/zgbs/software/15699241/','https://www.amazon.com/Best-Sellers-Software-Payroll/zgbs/software/283000/','https://www.amazon.com/Best-Sellers-Software-Personal-Finance/zgbs/software/229540/','https://www.amazon.com/Best-Sellers-Software-Point-Sale/zgbs/software/11024791/','https://www.amazon.com/Best-Sellers-Software-Antivirus/zgbs/software/2251986011/','https://www.amazon.com/Best-Sellers-Software-Internet-Security-Suites/zgbs/software/2251987011/','https://www.amazon.com/Best-Sellers-Software-Parental-Control/zgbs/software/2251988011/','https://www.amazon.com/Best-Sellers-Software-Business-Marketing-Plans/zgbs/software/5223261011/','https://www.amazon.com/Best-Sellers-Software-Business-Office-Communication/zgbs/software/229636/','https://www.amazon.com/Best-Sellers-Software-Scheduling-Contact-Management/zgbs/software/229543/','https://www.amazon.com/Best-Sellers-Software-Database-Management/zgbs/software/229668/','https://www.amazon.com/Best-Sellers-Software-Document-Management/zgbs/software/229538/','https://www.amazon.com/Best-Sellers-Software-Legal/zgbs/software/15699361/','https://www.amazon.com/Best-Sellers-Software-Note-Taking/zgbs/software/8842491011/','https://www.amazon.com/Best-Sellers-Software-Business-Office-Management/zgbs/software/283891/','https://www.amazon.com/Best-Sellers-Software-Password-Management/zgbs/software/8842492011/','https://www.amazon.com/Best-Sellers-Software-Project-Management/zgbs/software/229542/','https://www.amazon.com/Best-Sellers-Software-Reports-Forms/zgbs/software/283013/','https://www.amazon.com/Best-Sellers-Software-Resumes/zgbs/software/8842493011/','https://www.amazon.com/Best-Sellers-Software-Spreadsheets/zgbs/software/229544/','https://www.amazon.com/Best-Sellers-Software-Business-Training-Tutorials/zgbs/software/229546/','https://www.amazon.com/Best-Sellers-Software-Presentations/zgbs/software/229541/','https://www.amazon.com/Best-Sellers-Software-Voice-Recognition/zgbs/software/229678/','https://www.amazon.com/Best-Sellers-Software-Word-Processing/zgbs/software/229547/','https://www.amazon.com/Best-Sellers-Software-Childrens-Art-Creativity/zgbs/software/229549/','https://www.amazon.com/Best-Sellers-Software-Childrens-Early-Learning/zgbs/software/229550/','https://www.amazon.com/Best-Sellers-Software-Childrens-Social-Studies/zgbs/software/229554/','https://www.amazon.com/Best-Sellers-Software-Childrens-Math/zgbs/software/229558/','https://www.amazon.com/Best-Sellers-Software-Childrens-Reading-Language/zgbs/software/229559/','https://www.amazon.com/Best-Sellers-Software-Childrens-Science-Nature/zgbs/software/229561/','https://www.amazon.com/Best-Sellers-Software-Childrens-Problem-Solving/zgbs/software/229557/','https://www.amazon.com/Best-Sellers-Software-Animation-Anime/zgbs/software/229616/','https://www.amazon.com/Best-Sellers-Software-CAD-Graphic-Design/zgbs/software/229617/','https://www.amazon.com/Best-Sellers-Software-Home-Design/zgbs/software/229630/','https://www.amazon.com/Best-Sellers-Software-Illustration/zgbs/software/229620/','https://www.amazon.com/Best-Sellers-Software-Graphics-Training-Tutorials/zgbs/software/15699351/','https://www.amazon.com/Best-Sellers-Software-Arts-Culture/zgbs/software/229564/','https://www.amazon.com/Best-Sellers-Software-Mapping/zgbs/software/229569/','https://www.amazon.com/Best-Sellers-Software-Dictionaries/zgbs/software/229565/','https://www.amazon.com/Best-Sellers-Software-Encyclopedias/zgbs/software/8842494011/','https://www.amazon.com/Best-Sellers-Software-History/zgbs/software/229568/','https://www.amazon.com/Best-Sellers-Software-Foreign-Language-Instruction/zgbs/software/229567/','https://www.amazon.com/Best-Sellers-Software-Math-Educational/zgbs/software/5304309011/','https://www.amazon.com/Best-Sellers-Software-Religious-Education-Reference/zgbs/software/229634/','https://www.amazon.com/Best-Sellers-Software-Science-Education-Reference/zgbs/software/229570/','https://www.amazon.com/Best-Sellers-Software-Script-Screen-Writing/zgbs/software/497644/','https://www.amazon.com/Best-Sellers-Software-Test-Preparation/zgbs/software/229572/','https://www.amazon.com/Best-Sellers-Software-Typing-Instruction/zgbs/software/229573/','https://www.amazon.com/Best-Sellers-Software-Writing-Literature/zgbs/software/229574/','https://www.amazon.com/Best-Sellers-Software-Family-Geneology/zgbs/software/229627/','https://www.amazon.com/Best-Sellers-Software-Fashion-Style/zgbs/software/229628/','https://www.amazon.com/Best-Sellers-Software-Home-Publishing/zgbs/software/229619/','https://www.amazon.com/Best-Sellers-Software-Sewing/zgbs/software/8842499011/','https://www.amazon.com/Best-Sellers-Software-Client-Access-Licenses/zgbs/software/15699261/','https://www.amazon.com/Best-Sellers-Software-Firewalls/zgbs/software/289978/','https://www.amazon.com/Best-Sellers-Software-LAN/zgbs/software/289976/','https://www.amazon.com/Best-Sellers-Software-Network-Enterprise-Management/zgbs/software/491966/','https://www.amazon.com/Best-Sellers-Software-Networking-Security/zgbs/software/289979/','https://www.amazon.com/Best-Sellers-Software-VPN/zgbs/software/289977/','https://www.amazon.com/Best-Sellers-Software-Server/zgbs/software/5223264011/','https://www.amazon.com/Best-Sellers-Software-Development-Utilities/zgbs/software/229669/','https://www.amazon.com/Best-Sellers-Software-Programming-Languages/zgbs/software/229670/','https://www.amazon.com/Best-Sellers-Software-Programming-Training-Tutorials/zgbs/software/229671/','https://www.amazon.com/Best-Sellers-Software-Web-Design/zgbs/software/497024/','https://www.amazon.com/Best-Sellers-Software-Web-Site-Hosting/zgbs/software/289975/','https://www.amazon.com/Best-Sellers-Software-Backup-Recovery/zgbs/software/229673/','https://www.amazon.com/Best-Sellers-Software-Drivers-Driver-Recovery/zgbs/software/8842503011/','https://www.amazon.com/Best-Sellers-Software-File-Compression-Decompression/zgbs/software/283901/','https://www.amazon.com/Best-Sellers-Software-File-Conversion/zgbs/software/283900/','https://www.amazon.com/Best-Sellers-Software-Internet-Utilities/zgbs/software/229640/','https://www.amazon.com/Best-Sellers-Software-Memory-Management/zgbs/software/283905/','https://www.amazon.com/Best-Sellers-Software-Handheld-Utilities/zgbs/software/600526/','https://www.amazon.com/Best-Sellers-Software-PC-Maintenance/zgbs/software/229674/','https://www.amazon.com/Best-Sellers-Software-Computer-Disk-Partitioning/zgbs/software/283898/','https://www.amazon.com/Best-Sellers-Software-Computer-Screen-Savers/zgbs/software/229675/','https://www.amazon.com/Best-Sellers-Software-Video-Compositing-Special-Effects/zgbs/software/567570/','https://www.amazon.com/Best-Sellers-Software-Video-Encoding/zgbs/software/567870/','https://www.amazon.com/Best-Sellers-Software-Video-Editing/zgbs/software/567572/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Auto-Accessories/zgbs/sporting-goods/374773011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Bags-Packs-Accessories/zgbs/sporting-goods/5768574011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Caps-Hats/zgbs/sporting-goods/5768995011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Cell-Phone-Accessories/zgbs/sporting-goods/3209246011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Clothing/zgbs/sporting-goods/374742011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Clothing-Accessories/zgbs/sporting-goods/2431377011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Electronics/zgbs/sporting-goods/2311740011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Fabric/zgbs/sporting-goods/18882554011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Footwear/zgbs/sporting-goods/374747011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Gameday-Tailgating-Gear/zgbs/sporting-goods/375518011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Golf-Store/zgbs/sporting-goods/5769001011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Home-Kitchen/zgbs/sporting-goods/374819011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Jewelry-Watches/zgbs/sporting-goods/374916011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Office-Products/zgbs/sporting-goods/2309018011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Patio-Lawn-Garden-Products/zgbs/sporting-goods/374893011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Pet-Gear/zgbs/sporting-goods/5769002011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Equipment/zgbs/sporting-goods/374927011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Souvenirs/zgbs/sporting-goods/374783011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Tools-Home-Improvement/zgbs/sporting-goods/2309443011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fan-Toys-Game-Room/zgbs/sporting-goods/375519011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Outdoor-Recreation-Clothing/zgbs/sporting-goods/11443874011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Camping-Hiking-Equipment/zgbs/sporting-goods/3400371/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Climbing-Equipment/zgbs/sporting-goods/3402401/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Cycling-Equipment/zgbs/sporting-goods/3403201/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Skates-Skateboards-Scooters/zgbs/sporting-goods/11051398011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Water/zgbs/sporting-goods/11051399011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Winter-Equipment/zgbs/sporting-goods/2204518011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Outdoor-Recreation-Accessories/zgbs/sporting-goods/11051400011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Hiking-Clothing/zgbs/sporting-goods/2371054011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Boating-Sailing/zgbs/sporting-goods/3421331/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Fitness-Clothing/zgbs/sporting-goods/11444071011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Exercise-Fitness-Equipment/zgbs/sporting-goods/3407731/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Golf-Equipment/zgbs/sporting-goods/3410851/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Hunting-Fishing/zgbs/sporting-goods/706813011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Airsoft-Paintball-Equipment/zgbs/sporting-goods/706815011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Running-Equipment/zgbs/sporting-goods/3416071/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Swimming-Equipment/zgbs/sporting-goods/3418761/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Team/zgbs/sporting-goods/706809011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Tennis-Racquet-Sport-Equipment/zgbs/sporting-goods/706816011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Yoga-Equipment/zgbs/sporting-goods/3422251/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Other-Types/zgbs/sporting-goods/706810011/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Accessories/zgbs/sporting-goods/3394801/','https://www.amazon.com/Best-Sellers-Sports-Outdoors-Medicine-Products/zgbs/sporting-goods/3422351/','https://www.amazon.com/Best-Sellers-Sports-Collectibles-Collectible-Boxing-Robes/zgbs/sports-collectibles/7702508011/','https://www.amazon.com/Best-Sellers-Sports-Collectibles-Collectible-Pants/zgbs/sports-collectibles/7702509011/','https://www.amazon.com/Best-Sellers-Sports-Collectibles-Collectible-Shirts/zgbs/sports-collectibles/7702510011/','https://www.amazon.com/Best-Sellers-Sports-Collectibles-Collectible-Shorts-Trunks/zgbs/sports-collectibles/7702511011/','https://www.amazon.com/Best-Sellers-Sports-Collectibles-Collectible-Full-Sized-Helmets/zgbs/sports-collectibles/3311055011/','https://www.amazon.com/Best-Sellers-Sports-Collectibles-Collectible-Mini-Helmets/zgbs/sports-collectibles/3311056011/','https://www.amazon.com/Best-Sellers-Sports-Collectibles-Collectible-Media-Guides/zgbs/sports-collectibles/7702513011/','https://www.amazon.com/Best-Sellers-Sports-Collectibles-Collectible-Single-Trading-Cards/zgbs/sports-collectibles/9430228011/','https://www.amazon.com/Best-Sellers-Sports-Collectibles-Collectible-Trading-Card-Packs-Boxes/zgbs/sports-collectibles/9430235011/','https://www.amazon.com/Best-Sellers-Sports-Collectibles-Collectible-Trading-Card-Cases/zgbs/sports-collectibles/9430237011/','https://www.amazon.com/Best-Sellers-Sports-Collectibles-Collectible-Trading-Card-Sets/zgbs/sports-collectibles/9430238011/','https://www.amazon.com/Best-Sellers-Sports-Collectibles-Collectible-Trading-Card-Lots/zgbs/sports-collectibles/9430244011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Air-Compressors-Inflators/zgbs/hi/552660/','https://www.amazon.com/Best-Sellers-Home-Improvement-Air-Powered-Blow-Guns/zgbs/hi/3753851/','https://www.amazon.com/Best-Sellers-Home-Improvement-Air-Powered-Caulking-Guns/zgbs/hi/552686/','https://www.amazon.com/Best-Sellers-Home-Improvement-Air-Powered-Chisels/zgbs/hi/3753861/','https://www.amazon.com/Best-Sellers-Home-Improvement-Collated-Nails/zgbs/hi/552424/','https://www.amazon.com/Best-Sellers-Home-Improvement-Collated-Staples/zgbs/hi/552454/','https://www.amazon.com/Best-Sellers-Home-Improvement-Air-Powered-Tool-Combo-Packs/zgbs/hi/552688/','https://www.amazon.com/Best-Sellers-Home-Improvement-Air-Powered-Sprayers/zgbs/hi/552712/','https://www.amazon.com/Best-Sellers-Home-Improvement-Air-Powered-Ratchet-Wrenches/zgbs/hi/3753881/','https://www.amazon.com/Best-Sellers-Home-Improvement-Air-Sanders-Grinders/zgbs/hi/552716/','https://www.amazon.com/Best-Sellers-Home-Improvement-Air-Powered-Saws/zgbs/hi/3753891/','https://www.amazon.com/Best-Sellers-Home-Improvement-Air-Powered-Screwdrivers/zgbs/hi/552718/','https://www.amazon.com/Best-Sellers-Home-Improvement-Air-Powered-Texture-Guns/zgbs/hi/552730/','https://www.amazon.com/Best-Sellers-Home-Improvement-Room-Air-Conditioners-Accessories/zgbs/hi/19149191011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Cooktops/zgbs/hi/3741261/','https://www.amazon.com/Best-Sellers-Home-Improvement-Dishwashers/zgbs/hi/3741271/','https://www.amazon.com/Best-Sellers-Home-Improvement-Freezers/zgbs/hi/3741331/','https://www.amazon.com/Best-Sellers-Home-Improvement-Furnace-Filters/zgbs/hi/13399891/','https://www.amazon.com/Best-Sellers-Home-Improvement-Parts-Accessories/zgbs/hi/3741181/','https://www.amazon.com/Best-Sellers-Home-Improvement-Range-Hoods/zgbs/hi/3741441/','https://www.amazon.com/Best-Sellers-Home-Improvement-Ranges/zgbs/hi/3741411/','https://www.amazon.com/Best-Sellers-Home-Improvement-Refrigerator-Water-Filters/zgbs/hi/3741161/','https://www.amazon.com/Best-Sellers-Home-Improvement-Refrigerators/zgbs/hi/3741361/','https://www.amazon.com/Best-Sellers-Home-Improvement-Trash-Compactors/zgbs/hi/3741451/','https://www.amazon.com/Best-Sellers-Home-Improvement-Wall-Ovens/zgbs/hi/3741481/','https://www.amazon.com/Best-Sellers-Home-Improvement-Washers-Dryers/zgbs/hi/2383576011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Wine-Cellars/zgbs/hi/3741521/','https://www.amazon.com/Best-Sellers-Home-Improvement-Building-Materials/zgbs/hi/13397641/','https://www.amazon.com/Best-Sellers-Home-Improvement-HVAC/zgbs/hi/495346/','https://www.amazon.com/Best-Sellers-Home-Improvement-Job-Site-Security-Lighting/zgbs/hi/553504/','https://www.amazon.com/Best-Sellers-Home-Improvement-Ladders/zgbs/hi/553470/','https://www.amazon.com/Best-Sellers-Home-Improvement-Material-Handling/zgbs/hi/553516/','https://www.amazon.com/Best-Sellers-Home-Improvement-Scaffolding-Equipment/zgbs/hi/553490/','https://www.amazon.com/Best-Sellers-Home-Improvement-Electrical-Ballasts/zgbs/hi/5789850011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Breakers-Load-Centers-Fuses/zgbs/hi/6369357011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Electrical-Cord-Management/zgbs/hi/11042051/','https://www.amazon.com/Best-Sellers-Home-Improvement-Electrical-Cords-Adapters-Multi-Outlets/zgbs/hi/6396121011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Doorbells/zgbs/hi/495320/','https://www.amazon.com/Best-Sellers-Home-Improvement-Electrical-Boxes-Conduits-Fittings/zgbs/hi/6369359011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Electrical-Connectors/zgbs/hi/6426213011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Electrical-Wire/zgbs/hi/495310/','https://www.amazon.com/Best-Sellers-Home-Improvement-Electric-Motors/zgbs/hi/3753381/','https://www.amazon.com/Best-Sellers-Home-Improvement-Automation-Devices/zgbs/hi/6478739011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Light-Sockets/zgbs/hi/14328101/','https://www.amazon.com/Best-Sellers-Home-Improvement-Electric-Outlets-Accessories/zgbs/hi/495334/','https://www.amazon.com/Best-Sellers-Home-Improvement-Electric-Plugs/zgbs/hi/6396120011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Power-Strips-Surge-Protectors/zgbs/hi/17854127011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Recessed-Light-Fixtures/zgbs/hi/3736711/','https://www.amazon.com/Best-Sellers-Home-Improvement-Electrical-Switches-Dimmers/zgbs/hi/495324/','https://www.amazon.com/Best-Sellers-Home-Improvement-Interconnect-Terminals/zgbs/hi/306719011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Electrical-Testers/zgbs/hi/495336/','https://www.amazon.com/Best-Sellers-Home-Improvement-Electrical-Timers/zgbs/hi/495340/','https://www.amazon.com/Best-Sellers-Home-Improvement-Electrical-Tools-Hardware/zgbs/hi/6396126011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Electrical-Wall-Plates-Accessories/zgbs/hi/6497674011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Hardware-Adhesives-Sealers/zgbs/hi/13397651/','https://www.amazon.com/Best-Sellers-Home-Improvement-Bathroom-Hardware/zgbs/hi/3755001/','https://www.amazon.com/Best-Sellers-Home-Improvement-Braces-Joist-Hangers/zgbs/hi/16412261/','https://www.amazon.com/Best-Sellers-Home-Improvement-Cabinet-Hardware/zgbs/hi/2380871011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Electrical-Cable-Ties/zgbs/hi/507844/','https://www.amazon.com/Best-Sellers-Home-Improvement-Clock-Hardware/zgbs/hi/17568921011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Door-Hardware-Locks/zgbs/hi/511276/','https://www.amazon.com/Best-Sellers-Home-Improvement-Flashlights/zgbs/hi/3180261/','https://www.amazon.com/Best-Sellers-Home-Improvement-Furniture-Hardware/zgbs/hi/2380872011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Gate-Hardware/zgbs/hi/511364/','https://www.amazon.com/Best-Sellers-Home-Improvement-Grommets/zgbs/hi/16409771/','https://www.amazon.com/Best-Sellers-Home-Improvement-Industrial-Hooks/zgbs/hi/16412711/','https://www.amazon.com/Best-Sellers-Home-Improvement-House-Numbers-Plaques-Signs/zgbs/hi/21579610011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Mailboxes-Accessories/zgbs/hi/3742321/','https://www.amazon.com/Best-Sellers-Home-Improvement-Fasteners/zgbs/hi/383599011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Padlocks-Hasps/zgbs/hi/511378/','https://www.amazon.com/Best-Sellers-Home-Improvement-Picture-Hanging-Hardware/zgbs/hi/511352/','https://www.amazon.com/Best-Sellers-Home-Improvement-Hardware-Plugs/zgbs/hi/2257857011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Shelf-Brackets-Supports/zgbs/hi/517826/','https://www.amazon.com/Best-Sellers-Home-Improvement-Snaps/zgbs/hi/16410641/','https://www.amazon.com/Best-Sellers-Home-Improvement-Tarps-Tie-Downs/zgbs/hi/511388/','https://www.amazon.com/Best-Sellers-Home-Improvement-Window-Hardware/zgbs/hi/517828/','https://www.amazon.com/Best-Sellers-Home-Improvement-Bathroom-Fixtures/zgbs/hi/680350011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Kitchen-Fixtures/zgbs/hi/680340011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Water-Filtration-Softeners/zgbs/hi/13397631/','https://www.amazon.com/Best-Sellers-Home-Improvement-Laundry-Utility-Room-Fixtures/zgbs/hi/680338011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Ceiling-Fans-Lights/zgbs/hi/495362/','https://www.amazon.com/Best-Sellers-Home-Improvement-Ceiling-Light-Fixtures/zgbs/hi/5486428011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Commercial-Lighting-Products/zgbs/hi/5772192011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Lamps-Bases-Shades/zgbs/hi/3736561/','https://www.amazon.com/Best-Sellers-Home-Improvement-Lighting-Accessories/zgbs/hi/3736551/','https://www.amazon.com/Best-Sellers-Home-Improvement-Novelty-Lighting/zgbs/hi/3736531/','https://www.amazon.com/Best-Sellers-Home-Improvement-Outdoor-Lighting-Products/zgbs/hi/495236/','https://www.amazon.com/Best-Sellers-Home-Improvement-Wall-Light-Fixtures/zgbs/hi/5486429011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Calipers/zgbs/hi/256411011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Carpentry-Squares/zgbs/hi/3006710011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Laser-Levels/zgbs/hi/11646386011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Levels/zgbs/hi/553256/','https://www.amazon.com/Best-Sellers-Home-Improvement-Linear-Measurement/zgbs/hi/11646393011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Construction-Marking-Tools/zgbs/hi/553268/','https://www.amazon.com/Best-Sellers-Home-Improvement-Measuring-Wheels/zgbs/hi/3753421/','https://www.amazon.com/Best-Sellers-Home-Improvement-Pipe-Locators/zgbs/hi/3006708011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Plumb-Bobs/zgbs/hi/3006709011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Construction-Protractors/zgbs/hi/553274/','https://www.amazon.com/Best-Sellers-Home-Improvement-Saw-Gauges/zgbs/hi/552474/','https://www.amazon.com/Best-Sellers-Home-Improvement-Scanners-Testers/zgbs/hi/2380875011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Sound-Noise-Meters/zgbs/hi/7701920011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Household-Finishes-Sealers-Stains/zgbs/hi/17881622011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Paint-Primer/zgbs/hi/13399631/','https://www.amazon.com/Best-Sellers-Home-Improvement-Household-Painting-Supplies-Tools/zgbs/hi/17881623011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Wall-Stickers-Murals/zgbs/hi/2445485011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Wallpaper-Wallpapering-Supplies/zgbs/hi/17881625011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Gardening-Hand-Tools/zgbs/hi/128061011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Hand-Tools/zgbs/hi/551238/','https://www.amazon.com/Best-Sellers-Home-Improvement-Power-Tool-Parts-Accessories/zgbs/hi/552262/','https://www.amazon.com/Best-Sellers-Home-Improvement-Power-Tools/zgbs/hi/551236/','https://www.amazon.com/Best-Sellers-Home-Improvement-Tool-Organizers/zgbs/hi/13400691/','https://www.amazon.com/Best-Sellers-Home-Improvement-Drain-Cleaning-Equipment/zgbs/hi/680332011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Faucet-Parts/zgbs/hi/680334011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Garbage-Disposals-Parts/zgbs/hi/680343011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Pipe-Fittings-Pipes/zgbs/hi/680333011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Toilet-Urinal-Parts/zgbs/hi/680991011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Household-Rough-Plumbing-Valves/zgbs/hi/3227016011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Water-Heaters-Parts/zgbs/hi/3227006011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Water-Pumps-Parts-Accessories/zgbs/hi/601479011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Child-Safety-Equipment/zgbs/hi/7483665011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Emergency-Kits-Supplies/zgbs/hi/7483666011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Facility-Safety-Products/zgbs/hi/7459506011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Fire-Safety/zgbs/hi/486547011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Workplace-First-Aid-Kits/zgbs/hi/3465341/','https://www.amazon.com/Best-Sellers-Home-Improvement-Security-Surveillance-Systems/zgbs/hi/7459508011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Household-Sensors-Alarms/zgbs/hi/486548011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Lockout-Tagout-Products/zgbs/hi/1265106011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Personal-Defense-Equipment/zgbs/hi/3222127011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Personal-Protective-Equipment-Safety-Gear/zgbs/hi/486555011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Safes-Safe-Accessories/zgbs/hi/3180371/','https://www.amazon.com/Best-Sellers-Home-Improvement-Closet-Storage-Organization-Systems/zgbs/hi/165119011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Garage-Storage-Organization-Products/zgbs/hi/165112011/','https://www.amazon.com/Best-Sellers-Home-Improvement-Outdoor-Storage-Housing/zgbs/hi/13400641/']
import logging import multiprocessing from riptide import TimeSeries, ffa_search, find_peaks log = logging.getLogger('riptide.worker_pool') class WorkerPool(object): """ deredden_params : dict range_confs : list of dicts List of dicts from the 'ranges' section of the YAML config file loader : func Function that takes a file path as its only argument, and returns a TimeSeries object processes : int Number of parallel processes fmt : str TimeSeries file format """ TIMESERIES_LOADERS = { 'sigproc': TimeSeries.from_sigproc, 'presto': TimeSeries.from_presto_inf } def __init__(self, deredden_params, range_confs, processes=1, fmt='presto'): self.deredden_params = deredden_params self.range_confs = range_confs self.loader = self.TIMESERIES_LOADERS[fmt] self.processes = int(processes) def process_fname_list(self, fnames): pool = multiprocessing.Pool(processes=self.processes) # results is a list of lists of Detections results = pool.map(self.process_fname, fnames) # NOTE: don't forget to close the pool to free up RAM # NOTE: and don't forget to join, otherwise the coverage module # does not properly report coverage for sub-processes spawned by # the pool pool.close() pool.join() return [det for dlist in results for det in dlist] def process_fname(self, fname): allpeaks = [] ts = self.loader(fname) dm = ts.metadata['dm'] log.debug("Searching DM = {:.3f}".format(dm)) # Make pre-processing common to all ranges to save time ts = ts.deredden( self.deredden_params['rmed_width'], minpts=self.deredden_params['rmed_minpts'] ) ts = ts.normalise() for conf in self.range_confs: kw_search = dict(conf['ffa_search']) kw_search.update({ 'deredden': False, 'already_normalised': True }) tsdr, pgram = ffa_search(ts, **kw_search) peaks, polycos = find_peaks(pgram, **conf['find_peaks']) allpeaks.extend(peaks) del tsdr, pgram, peaks, polycos # Free RAM ASAP log.debug(f"Done searching DM = {dm:.3f}, peaks found: {len(allpeaks)}") return allpeaks
/*jsl:ignore*/ /* * Globalize Culture id * * http://github.com/jquery/globalize * * Copyright Software Freedom Conservancy, Inc. * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * This file was generated by the Globalize Culture Generator * Translation: bugs found in this file need to be fixed in the generator */ (function( window, undefined ) { var Globalize; if ( typeof require !== "undefined" && typeof exports !== "undefined" && typeof module !== "undefined" ) { // Assume CommonJS Globalize = require( "globalize" ); } else { // Global variable Globalize = window.Globalize; } Globalize.addCultureInfo( "id", "default", { name: "id", englishName: "Indonesian", nativeName: "Bahasa Indonesia", language: "id", numberFormat: { ",": ".", ".": ",", percent: { ",": ".", ".": "," }, currency: { decimals: 0, ",": ".", ".": ",", symbol: "Rp" } }, calendars: { standard: { firstDay: 1, days: { names: ["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"], namesAbbr: ["Minggu","Sen","Sel","Rabu","Kamis","Jumat","Sabtu"], namesShort: ["M","S","S","R","K","J","S"] }, months: { names: ["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","Nopember","Desember",""], namesAbbr: ["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agust","Sep","Okt","Nop","Des",""] }, AM: null, PM: null, patterns: { d: "dd/MM/yyyy", D: "dd MMMM yyyy", t: "H:mm", T: "H:mm:ss", f: "dd MMMM yyyy H:mm", F: "dd MMMM yyyy H:mm:ss", M: "dd MMMM", Y: "MMMM yyyy" } } } }); }( this )); /*jsl:end*/
"use strict"; let fileUtils = require("././util/fileUtils"); let stringUtils = require("././util/stringUtils"); let jsonUtils = require("././util/jsonUtils"); const newLine = /\r?\n/; const defaultFieldDelimiter = ";"; class CsvToJson { formatValueByType() { this.printValueFormatByType = true; return this; } fieldDelimiter(delimieter) { this.delimiter = delimieter; return this; } generateJsonFileFromCsv(fileInputName, fileOutputName) { let jsonStringified = this.getJsonFromCsvStringified(fileInputName); fileUtils.writeFile(jsonStringified, fileOutputName); } getJsonFromCsvStringified(fileInputName) { let json = this.getJsonFromCsv(fileInputName); let jsonStringified = JSON.stringify(json, undefined, 1); jsonUtils.validateJson(jsonStringified); return jsonStringified; } getJsonFromCsv(fileInputName) { let parsedCsv = fileUtils.readFile(fileInputName); return this.csvToJson(parsedCsv); } csvStringToJson(csvString) { return this.csvToJson(csvString); } csvToJson(parsedCsv) { let lines = parsedCsv.split(newLine); let fieldDelimiter = this.getFieldDelimiter(); let headers = lines[0].split(fieldDelimiter); let jsonResult = []; for (let i = 1; i < lines.length; i++) { let currentLine = lines[i].split(fieldDelimiter); if (stringUtils.hasContent(currentLine)) { jsonResult.push(this.buildJsonResult(headers, currentLine)); } } return jsonResult; } getFieldDelimiter() { if (this.delimiter) { return this.delimiter; } return defaultFieldDelimiter; } buildJsonResult(headers, currentLine) { let jsonObject = {}; for (let j = 0; j < headers.length; j++) { let propertyName = stringUtils.trimPropertyName(headers[j]); let value = currentLine[j]; if (this.printValueFormatByType) { value = stringUtils.getValueFormatByType(currentLine[j]); } jsonObject[propertyName] = value; } return jsonObject; } } module.exports = new CsvToJson();
""" Base class for a Noon line. """ from .entity import NoonEntity import asyncio from typing import Dict import logging from .const import Guid from .entity import NoonEntity from .event import NoonEvent from .exceptions import NoonInvalidJsonError _LOGGER = logging.getLogger(__name__) LINE_STATE_ON = "on" LINE_STATE_OFF = "off" ATTR_LINE_STATE = "lineState" ATTR_DIM_LEVEL = "dimmingLevel" class NoonLine(NoonEntity): class Event(NoonEvent): """Output events that can be generated. DIM_LEVEL_CHANGED: The dim level of this line has changed. Params: dimLevel: New dim level percent (integer) """ DIM_LEVEL_CHANGED = 1 """ LINE_STATE_CHANGED: The line lights have turned or off. Params: lineState: Line State (string - 'on' or 'off') """ LINE_STATE_CHANGED = 2 @property def line_state(self) -> str: return self._line_state async def set_line_state(self, value:str): value_changed = (self._line_state != value) self._line_state = value if value_changed: await self._dispatch_event(NoonLine.Event.LINE_STATE_CHANGED, {ATTR_LINE_STATE: self._line_state}) @property def parent_space(self): return self._parent_space @property def dimming_level(self) -> int: return self._dimming_level async def set_dimming_level(self, value: int): value_changed = (self._dimming_level != value) self._dimming_level = value if value_changed: await self._dispatch_event(NoonLine.Event.DIM_LEVEL_CHANGED, {ATTR_DIM_LEVEL: self._dimming_level}) async def set_brightness(self, brightness_level: int, transition_time:int=None): """ (Re)authenticate if needed """ await self._noon.authenticate() """ Send the command """ _LOGGER.debug("Setting brightness to {}% with transition time {}s".format(brightness_level, transition_time)) actionUrl = "{}/api/action/line/lightLevel".format(self._noon._endpoints["action"]) json = {"line": self.guid, "lightLevel": brightness_level, "tid": 55555} if transition_time is not None: json["transitionTime"] = transition_time async with self._noon.session.post(actionUrl, headers={"Authorization": "Token {}".format(self._noon._token)}, json=json, raise_for_status=True) as raw_response: _LOGGER.debug("Got set_brightness result {}: {}".format(raw_response.status, raw_response)) async def turn_on(self): await self.set_brightness(100) async def turn_off(self): await self.set_brightness(0) def __init__(self, noon, parent_space, guid: Guid, name: str, dimming_level: int=None, line_state: bool=None): super().__init__(noon, guid, name) """Initializes the Line.""" self._line_state = None self._dimming_level = None self._parent_space = parent_space self._line_state = line_state self._dimming_level = dimming_level async def handle_update(self, changed_fields): """Handle an update from an event notification.""" _LOGGER.debug("Asked to update with {}".format(changed_fields)) for changed_field in changed_fields: if changed_field["name"] == ATTR_LINE_STATE: await self.set_line_state(changed_field["value"]) elif changed_field["name"] == ATTR_DIM_LEVEL: await self.set_dimming_level(changed_field["value"]) else: _LOGGER.warn("Unhandled change to field '{}'".format(changed_field["name"])) @classmethod async def from_json(cls, noon, space, json): """Construct a Line from a JSON payload.""" # Sanity - should be parsed assert isinstance(json, Dict), "JSON is not parsed - expected a Dict but got {}".format(type(json)) """Basics""" guid = json.get("guid", None) name = json.get("displayName", "Unknown") if guid is None: _LOGGER.debug("Invalid JSON payload: {}".format(json)) raise NoonInvalidJsonError line_state = json.get("lineState", None) dimming_level = json.get("dimmingLevel", None) new_line = NoonLine(noon, space, guid, name, dimming_level, line_state) return new_line def __str__(self): """Returns a pretty-printed string for this object.""" return 'Line name: "%s" lights on: %s, dim level: "%s"' % ( self.name, self._line_state, self._dimming_level) def __repr__(self): """Returns a stringified representation of this object.""" return str({'name': self.name, 'dimmingLevel': self._dimming_level, 'lightsOn': self._line_state, 'id': self._guid})
export default { 'allContent---docusaurus-debug-content-246-9aa': [() => import(/* webpackChunkName: 'allContent---docusaurus-debug-content-246-9aa' */ "~debug/default/docusaurus-debug-all-content-673.json"), "~debug/default/docusaurus-debug-all-content-673.json", require.resolveWeak("~debug/default/docusaurus-debug-all-content-673.json")], 'archive---blog-archiveb-2-f-393': [() => import(/* webpackChunkName: 'archive---blog-archiveb-2-f-393' */ "~blog/default/blog-archive-80c.json"), "~blog/default/blog-archive-80c.json", require.resolveWeak("~blog/default/blog-archive-80c.json")], 'component---site-src-pages-index-tsx-1-df-d3e': [() => import(/* webpackChunkName: 'component---site-src-pages-index-tsx-1-df-d3e' */ "@site/src/pages/index.tsx"), "@site/src/pages/index.tsx", require.resolveWeak("@site/src/pages/index.tsx")], 'component---theme-blog-archive-page-9-e-4-1d8': [() => import(/* webpackChunkName: 'component---theme-blog-archive-page-9-e-4-1d8' */ "@theme/BlogArchivePage"), "@theme/BlogArchivePage", require.resolveWeak("@theme/BlogArchivePage")], 'component---theme-blog-list-pagea-6-a-7ba': [() => import(/* webpackChunkName: 'component---theme-blog-list-pagea-6-a-7ba' */ "@theme/BlogListPage"), "@theme/BlogListPage", require.resolveWeak("@theme/BlogListPage")], 'component---theme-blog-post-pageccc-cab': [() => import(/* webpackChunkName: 'component---theme-blog-post-pageccc-cab' */ "@theme/BlogPostPage"), "@theme/BlogPostPage", require.resolveWeak("@theme/BlogPostPage")], 'component---theme-blog-tags-list-page-01-a-d0b': [() => import(/* webpackChunkName: 'component---theme-blog-tags-list-page-01-a-d0b' */ "@theme/BlogTagsListPage"), "@theme/BlogTagsListPage", require.resolveWeak("@theme/BlogTagsListPage")], 'component---theme-blog-tags-posts-page-687-b6c': [() => import(/* webpackChunkName: 'component---theme-blog-tags-posts-page-687-b6c' */ "@theme/BlogTagsPostsPage"), "@theme/BlogTagsPostsPage", require.resolveWeak("@theme/BlogTagsPostsPage")], 'component---theme-debug-config-23-a-2ff': [() => import(/* webpackChunkName: 'component---theme-debug-config-23-a-2ff' */ "@theme/DebugConfig"), "@theme/DebugConfig", require.resolveWeak("@theme/DebugConfig")], 'component---theme-debug-contentba-8-ce7': [() => import(/* webpackChunkName: 'component---theme-debug-contentba-8-ce7' */ "@theme/DebugContent"), "@theme/DebugContent", require.resolveWeak("@theme/DebugContent")], 'component---theme-debug-global-dataede-0fa': [() => import(/* webpackChunkName: 'component---theme-debug-global-dataede-0fa' */ "@theme/DebugGlobalData"), "@theme/DebugGlobalData", require.resolveWeak("@theme/DebugGlobalData")], 'component---theme-debug-registry-679-501': [() => import(/* webpackChunkName: 'component---theme-debug-registry-679-501' */ "@theme/DebugRegistry"), "@theme/DebugRegistry", require.resolveWeak("@theme/DebugRegistry")], 'component---theme-debug-routes-946-699': [() => import(/* webpackChunkName: 'component---theme-debug-routes-946-699' */ "@theme/DebugRoutes"), "@theme/DebugRoutes", require.resolveWeak("@theme/DebugRoutes")], 'component---theme-debug-site-metadata-68-e-3d4': [() => import(/* webpackChunkName: 'component---theme-debug-site-metadata-68-e-3d4' */ "@theme/DebugSiteMetadata"), "@theme/DebugSiteMetadata", require.resolveWeak("@theme/DebugSiteMetadata")], 'component---theme-doc-item-178-a40': [() => import(/* webpackChunkName: 'component---theme-doc-item-178-a40' */ "@theme/DocItem"), "@theme/DocItem", require.resolveWeak("@theme/DocItem")], 'component---theme-doc-page-1-be-9be': [() => import(/* webpackChunkName: 'component---theme-doc-page-1-be-9be' */ "@theme/DocPage"), "@theme/DocPage", require.resolveWeak("@theme/DocPage")], 'component---theme-doc-tags-list-page-372-89e': [() => import(/* webpackChunkName: 'component---theme-doc-tags-list-page-372-89e' */ "@theme/DocTagsListPage"), "@theme/DocTagsListPage", require.resolveWeak("@theme/DocTagsListPage")], 'component---theme-mdx-page-1-f-3-b90': [() => import(/* webpackChunkName: 'component---theme-mdx-page-1-f-3-b90' */ "@theme/MDXPage"), "@theme/MDXPage", require.resolveWeak("@theme/MDXPage")], 'config---5-e-9-4f3': [() => import(/* webpackChunkName: 'config---5-e-9-4f3' */ "@generated/docusaurus.config"), "@generated/docusaurus.config", require.resolveWeak("@generated/docusaurus.config")], 'content---blog-766-e3c': [() => import(/* webpackChunkName: 'content---blog-766-e3c' */ "@site/blog/2021-08-26-welcome/index.md?truncated=true"), "@site/blog/2021-08-26-welcome/index.md?truncated=true", require.resolveWeak("@site/blog/2021-08-26-welcome/index.md?truncated=true")], 'content---blog-871-381': [() => import(/* webpackChunkName: 'content---blog-871-381' */ "@site/blog/2019-05-29-long-blog-post.md?truncated=true"), "@site/blog/2019-05-29-long-blog-post.md?truncated=true", require.resolveWeak("@site/blog/2019-05-29-long-blog-post.md?truncated=true")], 'content---blog-925-e00': [() => import(/* webpackChunkName: 'content---blog-925-e00' */ "@site/blog/2019-05-28-first-blog-post.md?truncated=true"), "@site/blog/2019-05-28-first-blog-post.md?truncated=true", require.resolveWeak("@site/blog/2019-05-28-first-blog-post.md?truncated=true")], 'content---blog-first-blog-poste-27-4a1': [() => import(/* webpackChunkName: 'content---blog-first-blog-poste-27-4a1' */ "@site/blog/2019-05-28-first-blog-post.md"), "@site/blog/2019-05-28-first-blog-post.md", require.resolveWeak("@site/blog/2019-05-28-first-blog-post.md")], 'content---blog-long-blog-post-736-bc7': [() => import(/* webpackChunkName: 'content---blog-long-blog-post-736-bc7' */ "@site/blog/2019-05-29-long-blog-post.md"), "@site/blog/2019-05-29-long-blog-post.md", require.resolveWeak("@site/blog/2019-05-29-long-blog-post.md")], 'content---blog-mdx-blog-post-593-37b': [() => import(/* webpackChunkName: 'content---blog-mdx-blog-post-593-37b' */ "@site/blog/2021-08-01-mdx-blog-post.mdx"), "@site/blog/2021-08-01-mdx-blog-post.mdx", require.resolveWeak("@site/blog/2021-08-01-mdx-blog-post.mdx")], 'content---blog-welcomed-9-f-ffb': [() => import(/* webpackChunkName: 'content---blog-welcomed-9-f-ffb' */ "@site/blog/2021-08-26-welcome/index.md"), "@site/blog/2021-08-26-welcome/index.md", require.resolveWeak("@site/blog/2021-08-26-welcome/index.md")], 'content---blogf-4-f-cd7': [() => import(/* webpackChunkName: 'content---blogf-4-f-cd7' */ "@site/blog/2021-08-01-mdx-blog-post.mdx?truncated=true"), "@site/blog/2021-08-01-mdx-blog-post.mdx?truncated=true", require.resolveWeak("@site/blog/2021-08-01-mdx-blog-post.mdx?truncated=true")], 'content---docs-intro-0-e-3-be1': [() => import(/* webpackChunkName: 'content---docs-intro-0-e-3-be1' */ "@site/docs/intro.md"), "@site/docs/intro.md", require.resolveWeak("@site/docs/intro.md")], 'content---docs-tutorial-basics-congratulations-822-958': [() => import(/* webpackChunkName: 'content---docs-tutorial-basics-congratulations-822-958' */ "@site/docs/tutorial-basics/congratulations.md"), "@site/docs/tutorial-basics/congratulations.md", require.resolveWeak("@site/docs/tutorial-basics/congratulations.md")], 'content---docs-tutorial-basics-create-a-blog-post-533-e85': [() => import(/* webpackChunkName: 'content---docs-tutorial-basics-create-a-blog-post-533-e85' */ "@site/docs/tutorial-basics/create-a-blog-post.md"), "@site/docs/tutorial-basics/create-a-blog-post.md", require.resolveWeak("@site/docs/tutorial-basics/create-a-blog-post.md")], 'content---docs-tutorial-basics-create-a-document-1-e-4-078': [() => import(/* webpackChunkName: 'content---docs-tutorial-basics-create-a-document-1-e-4-078' */ "@site/docs/tutorial-basics/create-a-document.md"), "@site/docs/tutorial-basics/create-a-document.md", require.resolveWeak("@site/docs/tutorial-basics/create-a-document.md")], 'content---docs-tutorial-basics-create-a-page-5-c-8-e19': [() => import(/* webpackChunkName: 'content---docs-tutorial-basics-create-a-page-5-c-8-e19' */ "@site/docs/tutorial-basics/create-a-page.md"), "@site/docs/tutorial-basics/create-a-page.md", require.resolveWeak("@site/docs/tutorial-basics/create-a-page.md")], 'content---docs-tutorial-basics-deploy-your-sitef-55-a3f': [() => import(/* webpackChunkName: 'content---docs-tutorial-basics-deploy-your-sitef-55-a3f' */ "@site/docs/tutorial-basics/deploy-your-site.md"), "@site/docs/tutorial-basics/deploy-your-site.md", require.resolveWeak("@site/docs/tutorial-basics/deploy-your-site.md")], 'content---docs-tutorial-basics-markdown-features-18-c-a79': [() => import(/* webpackChunkName: 'content---docs-tutorial-basics-markdown-features-18-c-a79' */ "@site/docs/tutorial-basics/markdown-features.mdx"), "@site/docs/tutorial-basics/markdown-features.mdx", require.resolveWeak("@site/docs/tutorial-basics/markdown-features.mdx")], 'content---docs-tutorial-extras-manage-docs-versionsdff-6d4': [() => import(/* webpackChunkName: 'content---docs-tutorial-extras-manage-docs-versionsdff-6d4' */ "@site/docs/tutorial-extras/manage-docs-versions.md"), "@site/docs/tutorial-extras/manage-docs-versions.md", require.resolveWeak("@site/docs/tutorial-extras/manage-docs-versions.md")], 'content---docs-tutorial-extras-translate-your-sitee-44-ddf': [() => import(/* webpackChunkName: 'content---docs-tutorial-extras-translate-your-sitee-44-ddf' */ "@site/docs/tutorial-extras/translate-your-site.md"), "@site/docs/tutorial-extras/translate-your-site.md", require.resolveWeak("@site/docs/tutorial-extras/translate-your-site.md")], 'content---markdown-page-393-028': [() => import(/* webpackChunkName: 'content---markdown-page-393-028' */ "@site/src/pages/markdown-page.md"), "@site/src/pages/markdown-page.md", require.resolveWeak("@site/src/pages/markdown-page.md")], 'metadata---blog-tags-docusaurusa-80-728': [() => import(/* webpackChunkName: 'metadata---blog-tags-docusaurusa-80-728' */ "~blog/default/blog-tags-docusaurus-0e0.json"), "~blog/default/blog-tags-docusaurus-0e0.json", require.resolveWeak("~blog/default/blog-tags-docusaurus-0e0.json")], 'metadata---blog-tags-facebook-031-c52': [() => import(/* webpackChunkName: 'metadata---blog-tags-facebook-031-c52' */ "~blog/default/blog-tags-facebook-038.json"), "~blog/default/blog-tags-facebook-038.json", require.resolveWeak("~blog/default/blog-tags-facebook-038.json")], 'metadata---blog-tags-hello-30-a-bed': [() => import(/* webpackChunkName: 'metadata---blog-tags-hello-30-a-bed' */ "~blog/default/blog-tags-hello-039.json"), "~blog/default/blog-tags-hello-039.json", require.resolveWeak("~blog/default/blog-tags-hello-039.json")], 'metadata---blog-tags-holae-16-18a': [() => import(/* webpackChunkName: 'metadata---blog-tags-holae-16-18a' */ "~blog/default/blog-tags-hola-ea2.json"), "~blog/default/blog-tags-hola-ea2.json", require.resolveWeak("~blog/default/blog-tags-hola-ea2.json")], 'metadata---blogb-2-b-df1': [() => import(/* webpackChunkName: 'metadata---blogb-2-b-df1' */ "~blog/default/blog-c06.json"), "~blog/default/blog-c06.json", require.resolveWeak("~blog/default/blog-c06.json")], 'sidebar---blog-814-8ac': [() => import(/* webpackChunkName: 'sidebar---blog-814-8ac' */ "~blog/default/blog-post-list-prop-default.json"), "~blog/default/blog-post-list-prop-default.json", require.resolveWeak("~blog/default/blog-post-list-prop-default.json")], 'tags---blog-tagsa-70-da2': [() => import(/* webpackChunkName: 'tags---blog-tagsa-70-da2' */ "~blog/default/blog-tags-tags-4c2.json"), "~blog/default/blog-tags-tags-4c2.json", require.resolveWeak("~blog/default/blog-tags-tags-4c2.json")], 'tags---docs-tags-559-5e5': [() => import(/* webpackChunkName: 'tags---docs-tags-559-5e5' */ "~docs/default/tags-list-current-prop-15a.json"), "~docs/default/tags-list-current-prop-15a.json", require.resolveWeak("~docs/default/tags-list-current-prop-15a.json")], 'versionMetadata---docs-935-398': [() => import(/* webpackChunkName: 'versionMetadata---docs-935-398' */ "~docs/default/version-current-metadata-prop-751.json"), "~docs/default/version-current-metadata-prop-751.json", require.resolveWeak("~docs/default/version-current-metadata-prop-751.json")],};
from django.db import models import datetime as dt from django.contrib.auth.models import User from tinymce.models import HTMLField from vote.models import VoteModel from vote.managers import VotableManager # Create your models here. class Profile(models.Model): photo = models.ImageField(upload_to='images', blank =True, null = True) Bio = models.TextField(max_length=1500) user = models.OneToOneField(User,on_delete=models.CASCADE,primary_key=True) def __str__(self): return self.Bio def save_profile(self): self.save() def delete_profile(self): self.delete() @classmethod def update_bio(cls,id,bio): update_profile = cls.objects.filter(id = id).update(bio =bio) return update_profile @classmethod def get_all_profiles(cls): profile = Profile.objects.all() return profile @classmethod def search_user(cls,user): return cls.objects.filter(user__username__icontains = user).all() class Picture(VoteModel,models.Model): image = models.ImageField(upload_to = 'images/',blank = False, null = True) name = models.CharField(max_length = 100) caption = models.CharField(max_length = 100) profile = models.ForeignKey(User,on_delete = models.CASCADE) like_add = models.IntegerField(default=0) date_uploaded = models.DateTimeField(auto_now_add=True) # comments = models.CharField(max_length = 1500) def __str__(self): return self.name def save_image(self): self.save() def delete_image(self): self.delete() @classmethod def update_caption(self,caption): updated_cap = cls.objects.filter(id = id).update(caption = caption) return updated_cap @classmethod def get_all_images(cls): image = cls.objects.all() return image @classmethod def get_image_by_id(cls,id): image = cls.objects.filter(id= id).all() return image @classmethod def search_by_profile(cls,name): profile = Profile.objects.filter(user__name__icontains = name) return profile @classmethod def get_one_image(cls,id): image = cls.objects.get(id = id) return image class Meta: ordering = ['-date_uploaded'] class Comments(models.Model): comment = models.CharField(max_length = 50, blank=True) posted = models.DateTimeField(auto_now_add=True) image = models.ForeignKey(Picture, on_delete=models.CASCADE) user = models.ForeignKey(User, on_delete=models.CASCADE) def save_comment(self): self.save() def delete_comment(self): self.delete() @classmethod def get_comments(cls,id): comments = cls.objects.filter(image__id=id) return comments def __str__(self): return self.comment class Likes(models.Model): image = models.ForeignKey(Picture, on_delete=models.CASCADE) user = models.ForeignKey(User, on_delete=models.CASCADE) def save_likes(self): self.save() def delete_like(self): self.delete() def count_likes(self): likes = self.likes.count() return likes
import getScaleFactor from './getScaleFactor'; describe('Utils : getScaleFactor', () => { test('Correct values', () => { expect(getScaleFactor(0.5, 10, 10, 20, 20)).toBe(1); expect(getScaleFactor(0.1, 10, 10, 20, 20)).toBe(0.2); expect(getScaleFactor(0.1, 1, 10, 20, 20)).toBe(0.2); expect(getScaleFactor(0.1, 10, 1, 20, 20)).toBe(0.2); }); test('Incorrect values', () => { expect(() => getScaleFactor(-1, 10, 10, 20, 20)).toThrow(); expect(() => getScaleFactor(0.5, -1, 10, 20, 20)).toThrow(); expect(() => getScaleFactor(0.5, 10, -0, 20, 20)).toThrow(); expect(() => getScaleFactor(0.5, 10, 10, -1, 20)).toThrow(); expect(() => getScaleFactor(0.5, 10, 10, 20, -1)).toThrow(); }); });
from matplotlib import cm import openmesh as om import numpy as np __all__ = ['colormap_vertex_color'] def colormap_vertex_color(fn, v0, f0, scalar_field, scalar_min=None, scalar_max=None): if scalar_min is None and scalar_max is None: field = scalar_field.copy() else: field = np.clip(scalar_field, scalar_min, scalar_max) m0 = field.min() m1 = field.max() field = (field - m0) / (m1 - m0) mesh = om.PolyMesh(v0, f0) # mesh.request_vertex_colors() for vh in mesh.vertices(): c = cm.jet(field[vh.idx()]) mesh.set_color(vh, c) om.write_mesh(fn, mesh, vertex_color=True)
var mysql = require('mysql') const jwt = require('jsonwebtoken') const {decode} = require("jsonwebtoken"); const nodemailer = require("nodemailer"); var pool = require('./mysqlConnector') let today = new Date().toISOString().slice(0, 10) const time = new Date().toISOString().slice(0, 19).replace('T', ' ') const transporter = nodemailer.createTransport({ host: "smtpout.secureserver.net", port: 465, secure: true, auth: { user: '[email protected]', pass: 'contactus@123', debug: true }, tls:{ rejectUnauthorized: false, secureProtocol: "TLSv1_method" } }); const fs = require('fs') const storage = './public/images/' function printError(mesg){ console.log('mesg', mesg) } function getBalance(id) { return new Promise((resolve, reject) => { let sql = `SELECT balance from wallets WHERE userId = '${id}';` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results[0]){ resolve(results[0].balance ) }else{ resolve(0)} }catch(e){ logError(e);return; } }); }); } function getInstitute(id) { return new Promise((resolve, reject) => { let sql = `SELECT id, type, name, email, phone, status, updated_at from institutes WHERE id = '${id}'` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results[0] ) } }catch(e){ logError(e); return; } }); }); } function getQuestion(id) { return new Promise((resolve, reject) => { let sql = `SELECT a.id, a.board, a.classes, a.subject, a.topic, a.subtopic, a.question, a.options, a.answer, a.difficulty, a.type, a.marks, a.source, a.status, a.owner, a.updated_at, b.name as className, c.name as subjectName, d.name as topicName, e.name as subTopicName, f.name as difficultyName, g.name as typeName from questionBank as a left join basics as b on b.id = a.classes left join basics as c on c.id = a.subject left join basics as d on d.id = a.topic left join basics as e on e.id = a.subtopic left join basics as f on f.id = a.difficulty left join basics as g on g.id = a.type WHERE a.id = '${id}';` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results[0] ) } }catch(e){ logError(e);return; } }); }); } function getQuestions(data) { return new Promise((resolve, reject) => { let sql = `SELECT a.id, a.type, a.question, a.options, a.answer, a.marks, b.name as typeName from questionbank as a left join basics as b on b.id = a.type where a.id IN (${data}) ;` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results ) } }catch(e){ logError(e);return; } }); }); } function createTest(data) { return new Promise((resolve, reject) => { let sql = `SELECT id, answer, marks from questionBank WHERE JSON_CONTAINS(board, '${data[0]}') = 1 AND classes = '${data[1]}' AND subject='${data[2]}' AND topic IN (${data[3]}) AND subTopic IN (${data[4]}) AND difficulty = '${data[5]}' AND type='${data[6]}' ORDER by RAND() LIMIT ${data[7]} ;` pool.query(sql, (err, results) => { try{ if(err){ throw err } var questions = [] var solution = [] var marks = [] var total = 0 results.forEach(i => { questions.push(i.id) solution.push(i.answer) marks.push(i.marks) total = total + i.marks }); if(results){ resolve([questions, solution, marks, total] ) } }catch(e){ logError(e);return; } }); }); } function calculateScore(solution, answer, marks) { return new Promise((resolve, reject) => { var score = 0 solution.forEach((i,index) => { if(i==answer[index]){ score = score + marks[index] } }); resolve(score) }) } function sameQuestion(id) { return new Promise((resolve, reject) => { let sql = `SELECT id, question, options, answer as solution, marks from questionBank WHERE id=${id};` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results[0]) } }catch(e){ logError(e);return; } }); }); } function increaseScore(id, marks) { return new Promise((resolve, reject) => { let sql = `UPDATE dailypractice SET score = score + ${marks} WHERE id=${id};` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results[0]) } }catch(e){ logError(e);return; } }); }); } function getNewQuestion(subTopic, exclude) { if(exclude.length){ var excludeCheck = `AND id NOT IN (${exclude})` }else{ var excludeCheck = '' } return new Promise((resolve, reject) => { let sql = `SELECT id, question, options, answer as solution, marks from questionBank WHERE subTopic IN (${subTopic}) AND type=25 ${excludeCheck} ORDER by RAND() LIMIT 1;` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results[0] ) } }catch(e){ logError(e);return; } }); }); } function dpPreview(id) { return new Promise((resolve, reject) => { let sql = `SELECT id, question, options, answer as solution, marks from questionBank WHERE id = ${id};` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results[0] ) } }catch(e){ logError(e);return; } }); }); } function insertPractice(userId, data) { return new Promise((resolve, reject) => { let post= { 'userId': userId, 'date': today, 'questions': JSON.stringify([data[0]]), 'solution': JSON.stringify([data[1]]), 'marks': JSON.stringify([data[2]]), 'total': data[2], "created_at": time, "updated_at": time, } let sql = `INSERT INTO dailypractice SET ?` pool.query(sql, post, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results ) } }catch(e){ logError(e); return; } }); }); } function updatePractice(userId, data) { return new Promise((resolve, reject) => { let sql = `SELECT questions, solution, marks, total FROM dailypractice WHERE userId=${userId} AND date = '${today}';` pool.query(sql, async(err, results) => { try{ if(err){ throw err } if(results && results[0]){ var questions = JSON.parse(results[0].questions); questions.push(data[0]) var solution = JSON.parse(results[0].solution); solution.push(data[1]) var marks = JSON.parse(results[0].marks); marks.push(data[2]) var total = results[0].total + data[2] let post= { 'questions': JSON.stringify(questions), 'solution': JSON.stringify(solution), 'marks': JSON.stringify(marks), 'total': total, "updated_at": time, } let sql = `UPDATE dailypractice SET ? WHERE userId=${userId} AND date = '${today}';` pool.query(sql, post, (err, results) => { try{ if(err){ throw err } if(results){ resolve([questions, solution, marks] ) } }catch(e){ logError(e);return; } }); }else{ resolve([]) } }catch(e){ logError(e); return; } }); }) } function getdpDetails(id) { return new Promise((resolve, reject) => { let sql = `SELECT questions, solution, marks, answer, total, score FROM dailypractice WHERE id=${id};` pool.query(sql, async(err, results) => { try{ if(err){ throw err } if(results && results[0]){resolve(results[0])}else{ resolve([]) } }catch(e){ logError(e); return; } }); }) } function blogMetaData(id) { return new Promise((resolve, reject) => { let sql = `SELECT title, url FROM blogs ORDER BY id DESC; SELECT name, url FROM blog_metas WHERE type = 'category'; SELECT name, url FROM blog_metas WHERE type = 'tag'; SELECT id, blogId, c_order, commentId, user, email, comment, updated_at FROM comments WHERE blogId = '${id}' AND status='1' AND c_order= '0' ORDER BY id DESC; SELECT id, blogId, c_order, commentId, user, email, comment, updated_at FROM comments WHERE blogId = '${id}' AND status='1' AND c_order= '1' ORDER BY id ASC` pool.query(sql, [1, 2, 3, 4, 5], (err, results) => { try{ if(err){ throw err } if(results){ resolve(results ) } }catch(e){ logError(e); return; } }); }); } function suggestBlogs() { return new Promise((resolve, reject) => { let sql = `SELECT a.id, a.title, a.url, a.coverImg, a.content, a.updated_at, b.image FROM blogs as a left join media as b on b.id = a.coverImg ORDER by RAND() LIMIT 6;` pool.query(sql, (err, rows) => { try{ if(err){ throw err } if(rows){ resolve(rows ) } }catch(e){ logError(e); return; } }); }); } function uploadImage(file, folder){ return new Promise((resolve, reject) => { // var filename = file.name var filename = Date.now() + '-' + file.name; file.mv(storage+folder+'/'+filename, function(err){ if(err){ logError(err) } }) let post= { 'image' : filename, 'fileURL' : storage+folder+'/'+filename, "created_at": time, "updated_at": time, } let sql = `INSERT INTO media SET ?` pool.query(sql, post, (err, results) => { try{ if(err){ throw err } if(results){ resolve( results.insertId ) } }catch(e){ logError(e); return; } }) }); } function uploadDeleteImage(file, folder, id, image){ return new Promise((resolve, reject) => { // var filename = file.name var filename = Date.now() + '-' + file.name; file.mv(storage+folder+'/'+filename, function(err){ if(err){ logError(err) } }) let post= { 'image' : filename, 'fileURL' : storage+folder+'/'+filename, "updated_at": time, } let sql = `UPDATE media SET ? WHERE id = ${id}`; pool.query(sql, post, (err, results) => { try{ if(err){ throw err } if(results){ if (fs.existsSync(storage+folder+'/'+image)) { fs.unlinkSync(storage+folder+'/'+image) } resolve( true ) } }catch(e){ logError(e); return; } }) }); } function blogMetaName(type, data) { var list = [] return new Promise((resolve, reject) => { if(data.length>0){ for(var i = 0; i < data.length; i++){ let sql = `SELECT name, id, url FROM blog_metas WHERE type = '${type}' AND id = '${data[i]}';` pool.query(sql, (err, results) => { try{ if(err) throw err; list.push(results[0]) if(i == data.length){ resolve(list) } }catch(e){ logError(e); return; } }); } }else{ resolve(list) } }); } // School Functions function getSchoolBasic(id) { return new Promise((resolve, reject) => { let sql = `SELECT a.id, a.schoolId, a.type, a.name, a.tab1, a.tab2, a.tab3, a.updated_at, b.name as tab1Name, c.name as tab2Name, d.name as tab3Name FROM schoolbasics as a left join schoolbasics as b on b.id = a.tab1 left join schoolbasics as c on c.id = a.tab2 left join schoolbasics as d on d.id = a.tab3 WHERE a.id = ${id};` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results[0] ) } }catch(e){ logError(e);return; } }); }); } function getSchoolGroup(id) { return new Promise((resolve, reject) => { let sql = `SELECT id, name, schoolId, students, teachers FROM groups WHERE id = ${id};` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results[0] ) } }catch(e){ logError(e);return; } }); }); } function getNames(data) { return new Promise((resolve, reject) => { if(JSON.parse(data).length){ let sql = `SELECT id, name FROM schoolbasics WHERE id IN (${JSON.parse(data)});` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results ) } }catch(e){ logError(e);return; } }); }else{ resolve([]) } }); } function getSingleLead(id) { return new Promise((resolve, reject) => { let sql = `SELECT a.id, a.schoolId, a.name, a.email, a.phone, a.source, a.status, a.counsellor, a.updated_at, b.name as counsellorName, b.role as counsellorRole FROM leads as a left join users as b on b.id= a.counsellor WHERE a.id = ${id}` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results[0] ) } }catch(e){ logError(e);return; } }); }); } function changeUserStatus(id, status) { return new Promise((resolve, reject) => { let sql = `UPDATE users SET status = ${status} WHERE id = ${id};` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results[0] ) } }catch(e){ logError(e); return; } }); }); } function getTeamMember(id) { return new Promise((resolve, reject) => { let sql = `SELECT a.id as teamId, a.schoolId, a.userId, a.changeroles, a.sendemail, a.sendsms, a.sendwhatsapp, a.status as teamStatus, a.updated_at, b.name, b.email, b.role, b.status FROM team as a left JOIN users as b on b.id = a.userId WHERE a.id = '${id}';` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results[0] ) } }catch(e){ logError(e);return; } }); }); } function updateRole(id, role) { return new Promise((resolve, reject) => { let sql = `UPDATE users SET role = '${role}' WHERE id = ${id};` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results[0] ) } }catch(e){ logError(e); return; } }); }); } function getUpdatedLeads(idArray) { return new Promise((resolve, reject) => { let sql = `SELECT id, schoolId, name, email, phone, source, status, counsellor, updated_at FROM leads WHERE id IN (${JSON.parse(idArray)});` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results ) } }catch(e){ logError(e);return; } }); }); } function getLead(id) { return new Promise((resolve, reject) => { let sql = `SELECT id, schoolId, name, email, phone, source, status, counsellor, updated_at FROM leads WHERE id = '${id}'` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results[0] ) } }catch(e){ logError(e); return; } }); }); } function addLog(log) { return new Promise((resolve, reject) => { let sql = `INSERT INTO leadlog SET ?` pool.query(sql, log, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results[0] ) } }catch(e){ logError(e); return; } }); }); } function getFeeDetails(id) { return new Promise((resolve, reject) => { let sql = `SELECT a.id, a.schoolID, a.student, a.classes, a.mode, a.fees, a.feeAmount as feeCollected, a.remarks, a.updated_at, b.name as studentName, b.tab1, c.name as className, d.name as feeName, d.period, d.amount as feeAmount from feerecords as a left join schoolbasics as b on b.id = a.student left join schoolbasics as c on c.id = a.classes left join fees as d on d.id = a.fees WHERE a.id = '${id}';` pool.query(sql, (err, results) => { try{ if(err){ throw err } if(results){ resolve(results[0] ) } }catch(e){ logError(e); return; } }); }); } function checkFeeRecord(post) { return new Promise(async(resolve, reject) => { let sql = `SELECT id, period, amount FROM feeregister WHERE schoolId = '${post.schoolId}' AND studentId = '${post.studentId}' AND classes = '${post.classes}' AND year = '${post.year}' AND type = '${post.type}';` pool.query(sql, post, async(err, results) => { try{ if(err){ throw err } if(results && results.length){ resolve(results[0] ) }else{ resolve([]) } }catch(e){ logError(e); return; } }); }); } function insertFeeRecord(post) { return new Promise(async(resolve, reject) => { let sql = `INSERT INTO feeregister SET ?` pool.query(sql, post, async(err, results) => { try{ if(err){ throw err } if(results){ resolve(results[0] ) } }catch(e){ logError(e); return; } }); }); } function getFeeStructure(id){ return new Promise((resolve, reject) => { let sql = `SELECT a.id, a.schoolId, a.name, a.classes, a.period, a.amount, a.status, a.updated_at, b.name as className FROM fees as a left join schoolbasics as b on b.id = a.classes WHERE a.id=${id};` pool.query(sql, async(err, results) => { try{ if(err){ throw err } if(results){ resolve(results[0]) } }catch(e){ logError(e); return; } }); }) } // School Functions // Generic Functions function sendMailOnError(e) { const mailBody =` <h2><strong>Hi</h2> <p>There has been error in India Enigma. Please check if website is running or not.</p> <p>Then check the log</p> ${e}<br/> // ${func} <p>Warm Regards</p> <p>Team AmitKK</p> ` let mailOptions = { to: '[email protected]', from: '[email protected]', subject: "Error on ✔ www.indiaenigma.com", html: mailBody } transporter.sendMail( mailOptions, (error, info)=>{ res.send({ success: true, message: "Please check your mail" }) }) } function logError(e){ // sendMailOnError(e) printError(e) } function verifyToken(req, res, next){ const bearerHeader = req.headers['authorization']; if(bearerHeader) { const bearer = bearerHeader.split(' '); const bearerToken = bearer[1]; const exp = decode(bearerHeader) req.token = bearerToken; next(); }else { res.redirect('/login?e=' + encodeURIComponent('LoggedOut')); } } function verifyAdmin(req, res, next){ const bearerHeader = req.headers['authorization']; if(bearerHeader) { try{ const bearer = bearerHeader.split(' '); const bearerToken = bearer[1]; const user = jwt.verify(bearerToken,'secretkey') if (user.user.role=='Admin'){ next(); } else{ res.redirect('/blog'); res.end(); return; } } catch(e){ logError(e); res.redirect('/blog'); return; } }else { res.redirect('/blog'); } } function verifyInsti(req, res, next){ const bearerHeader = req.headers['authorization']; if(bearerHeader) { try{ const bearer = bearerHeader.split(' '); const bearerToken = bearer[1]; const user = jwt.verify(bearerToken,'secretkey') if (user.user.role=='School'){ next(); } else{ res.redirect('/blog'); res.end(); return; } } catch(e){ logError(e); res.redirect('/blog'); return; } }else { res.redirect('/blog'); } } function getUserId(req, res, next){ if(req.cookies.jwt){ const bearerHeader = req.cookies.jwt try{ const user = jwt.verify(bearerHeader,'secretkey') if (user.user.role!=='Admin'){ res.redirect('/blog') res.end() return; } next(); } catch(e){ logError(e, 'Function verifyAdmin in Index'); res.status(403); return; } }else{ res.redirect('/login?e=' + encodeURIComponent('LoggedOut')); } } module.exports = {verifyToken, verifyAdmin, verifyInsti, getUserId, getBalance, printError, logError, storage, uploadImage, uploadDeleteImage, blogMetaName, blogMetaData, suggestBlogs, getInstitute, getQuestion, createTest, getQuestions, calculateScore, getNewQuestion, insertPractice, updatePractice, sameQuestion, increaseScore, getdpDetails, dpPreview, getSchoolBasic, getSchoolGroup, getNames, getSingleLead, changeUserStatus, getTeamMember, updateRole, getUpdatedLeads, getLead, addLog, getFeeDetails, insertFeeRecord, checkFeeRecord, getFeeStructure };
(function(t){function e(e){for(var r,i,s=e[0],u=e[1],c=e[2],l=0,f=[];l<s.length;l++)i=s[l],Object.prototype.hasOwnProperty.call(a,i)&&a[i]&&f.push(a[i][0]),a[i]=0;for(r in u)Object.prototype.hasOwnProperty.call(u,r)&&(t[r]=u[r]);d&&d(e);while(f.length)f.shift()();return o.push.apply(o,c||[]),n()}function n(){for(var t,e=0;e<o.length;e++){for(var n=o[e],r=!0,i=1;i<n.length;i++){var s=n[i];0!==a[s]&&(r=!1)}r&&(o.splice(e--,1),t=u(u.s=n[0]))}return t}var r={},i={app:0},a={app:0},o=[];function s(t){return u.p+"js/"+({}[t]||t)+"."+{"chunk-2b280eaa":"caa68250","chunk-594d6d48":"92b6657f","chunk-073bf657":"fa8815df","chunk-6b5460af":"c961fd42","chunk-d01f6c98":"09ca9727","chunk-c0b933ac":"6369d1a6","chunk-a98a3a5e":"325d3e15"}[t]+".js"}function u(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,u),n.l=!0,n.exports}u.e=function(t){var e=[],n={"chunk-2b280eaa":1,"chunk-073bf657":1,"chunk-6b5460af":1,"chunk-d01f6c98":1,"chunk-c0b933ac":1,"chunk-a98a3a5e":1};i[t]?e.push(i[t]):0!==i[t]&&n[t]&&e.push(i[t]=new Promise((function(e,n){for(var r="css/"+({}[t]||t)+"."+{"chunk-2b280eaa":"6539624b","chunk-594d6d48":"31d6cfe0","chunk-073bf657":"92647ec0","chunk-6b5460af":"c5ac3915","chunk-d01f6c98":"f7f9318b","chunk-c0b933ac":"0f19b9da","chunk-a98a3a5e":"09ea4c13"}[t]+".css",a=u.p+r,o=document.getElementsByTagName("link"),s=0;s<o.length;s++){var c=o[s],l=c.getAttribute("data-href")||c.getAttribute("href");if("stylesheet"===c.rel&&(l===r||l===a))return e()}var f=document.getElementsByTagName("style");for(s=0;s<f.length;s++){c=f[s],l=c.getAttribute("data-href");if(l===r||l===a)return e()}var d=document.createElement("link");d.rel="stylesheet",d.type="text/css",d.onload=e,d.onerror=function(e){var r=e&&e.target&&e.target.src||a,o=new Error("Loading CSS chunk "+t+" failed.\n("+r+")");o.code="CSS_CHUNK_LOAD_FAILED",o.request=r,delete i[t],d.parentNode.removeChild(d),n(o)},d.href=a;var p=document.getElementsByTagName("head")[0];p.appendChild(d)})).then((function(){i[t]=0})));var r=a[t];if(0!==r)if(r)e.push(r[2]);else{var o=new Promise((function(e,n){r=a[t]=[e,n]}));e.push(r[2]=o);var c,l=document.createElement("script");l.charset="utf-8",l.timeout=120,u.nc&&l.setAttribute("nonce",u.nc),l.src=s(t);var f=new Error;c=function(e){l.onerror=l.onload=null,clearTimeout(d);var n=a[t];if(0!==n){if(n){var r=e&&("load"===e.type?"missing":e.type),i=e&&e.target&&e.target.src;f.message="Loading chunk "+t+" failed.\n("+r+": "+i+")",f.name="ChunkLoadError",f.type=r,f.request=i,n[1](f)}a[t]=void 0}};var d=setTimeout((function(){c({type:"timeout",target:l})}),12e4);l.onerror=l.onload=c,document.head.appendChild(l)}return Promise.all(e)},u.m=t,u.c=r,u.d=function(t,e,n){u.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},u.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},u.t=function(t,e){if(1&e&&(t=u(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(u.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)u.d(n,r,function(e){return t[e]}.bind(null,r));return n},u.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return u.d(e,"a",e),e},u.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},u.p="/",u.oe=function(t){throw console.error(t),t};var c=window["webpackJsonp"]=window["webpackJsonp"]||[],l=c.push.bind(c);c.push=e,c=c.slice();for(var f=0;f<c.length;f++)e(c[f]);var d=l;o.push([0,"chunk-vendors"]),n()})({0:function(t,e,n){t.exports=n("56d7")},"0efd":function(t,e,n){"use strict";var r=n("cd1f"),i=n.n(r);i.a},1597:function(t,e,n){},"4ba2":function(t,e,n){},"56d7":function(t,e,n){"use strict";n.r(e);n("e260"),n("e6cf"),n("cca6"),n("a79d");var r=n("2b0e"),i=n("8c4f"),a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("router-view")},o=[],s={},u=s,c=n("2877"),l=Object(c["a"])(u,a,o,!1,null,null,null),f=l.exports,d=(n("d3b7"),n("96cf"),n("1da1")),p=n("2f62"),m=n("bc3a"),h=n.n(m),g="http://localhost:7000",b={token:localStorage.getItem("token")||"",user:{},user_groups:[],files:[],status:"",error:null},v={isLoggedIn:function(t){return!!t.token},authState:function(t){return t.status},user:function(t){return t.user},user_groups:function(t){return t.user_groups},files:function(t){return t.files},error:function(t){return t.error}},k={login:function(t,e){return Object(d["a"])(regeneratorRuntime.mark((function n(){var r,i,a,o;return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return r=t.commit,r("auth_request"),n.prev=2,n.next=5,h.a.post("".concat(g,"/api/login"),e);case 5:return i=n.sent,i.data.success&&(a=i.data.token,o=i.data.user,localStorage.setItem("token",a),h.a.defaults.headers.common["Authorization"]=a,r("auth_success",a,o)),n.abrupt("return",i);case 10:n.prev=10,n.t0=n["catch"](2),r("auth_error",n.t0);case 13:case"end":return n.stop()}}),n,null,[[2,10]])})))()},loginAmazon:function(t){return Object(d["a"])(regeneratorRuntime.mark((function e(){var n,r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=t.commit,n("auth_request"),e.prev=2,e.next=5,h.a.get("".concat(g,"/api/login/amazon"));case 5:return r=e.sent,e.abrupt("return",r);case 9:e.prev=9,e.t0=e["catch"](2),n("auth_error",e.t0);case 12:case"end":return e.stop()}}),e,null,[[2,9]])})))()},register:function(t,e){return Object(d["a"])(regeneratorRuntime.mark((function n(){var r,i;return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return r=t.commit,n.prev=1,r("register_request"),n.next=5,h.a.post("".concat(g,"/api/register"),e);case 5:return i=n.sent,void 0!==i.data.success&&r("register_success"),n.abrupt("return",i);case 10:n.prev=10,n.t0=n["catch"](1),r("register_error",n.t0);case 13:case"end":return n.stop()}}),n,null,[[1,10]])})))()},getProfile:function(t){return Object(d["a"])(regeneratorRuntime.mark((function e(){var n,r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=t.commit,n("profile_request"),e.next=4,h.a.get("".concat(g,"/api/profile"));case 4:return r=e.sent,n("user_profile",r.data.user),e.abrupt("return",r);case 7:case"end":return e.stop()}}),e)})))()},getUserGroups:function(t){return Object(d["a"])(regeneratorRuntime.mark((function e(){var n,r,i;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=t.commit,r=t.state,n("group_request"),e.next=4,h.a.post("".concat(g,"/api/groups"),{id:r.user._id});case 4:return i=e.sent,n("user_groups",i.data),e.abrupt("return",i);case 7:case"end":return e.stop()}}),e)})))()},getFiles:function(t){return Object(d["a"])(regeneratorRuntime.mark((function e(){var n,r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=t.commit,t.state,n("file_request"),e.next=4,h.a.get("".concat(g,"/api/files"));case 4:return r=e.sent,localStorage.setItem("files",JSON.stringify(r.data)),n("files",r.data),e.abrupt("return",r);case 8:case"end":return e.stop()}}),e)})))()},getLocalFiles:function(t){return Object(d["a"])(regeneratorRuntime.mark((function e(){var n,r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=t.commit,t.state,n("file_request"),e.next=4,JSON.parse(localStorage.getItem("files"));case 4:return r=e.sent,n("files",r),e.abrupt("return",r);case 7:case"end":return e.stop()}}),e)})))()},setFiles:function(t,e){return Object(d["a"])(regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return r=t.commit,t.state,r("file_request"),localStorage.setItem("files",JSON.stringify(e)),r("files",e),n.abrupt("return",e);case 5:case"end":return n.stop()}}),n)})))()},logout:function(t){return Object(d["a"])(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=t.commit,e.next=3,localStorage.removeItem("token");case 3:return n("logout"),delete h.a.defaults.headers.common["Authorization"],router.push("/login"),e.abrupt("return");case 7:case"end":return e.stop()}}),e)})))()}},y={auth_request:function(t){t.error=null,t.status="loading"},auth_success:function(t,e,n){t.token=e,t.user=n,t.status="success",t.error=null},auth_error:function(t,e){t.error=e.response.data.msg},register_request:function(t){t.error=null,t.status="loading"},register_success:function(t){t.error=null,t.status="success"},register_error:function(t,e){t.error=e.response.data.msg},logout:function(t){t.error=null,t.status="",t.token="",t.user=""},profile_request:function(t){t.status="loading"},group_request:function(t){t.status="loading"},file_request:function(t){t.status="loading"},user_profile:function(t,e){t.user=e},user_groups:function(t,e){t.user_groups=e},files:function(t,e){t.files=e}},_={state:b,actions:k,mutations:y,getters:v};r["default"].use(p["a"]);var w=new p["a"].Store({modules:{Auth:_},state:{},mutations:{},actions:{}}),S=[{path:"/",name:"login",component:function(){return Promise.all([n.e("chunk-2b280eaa"),n.e("chunk-6b5460af")]).then(n.bind(null,"013f"))},meta:{requiresGuest:!0}},{path:"/dashboard",name:"Dashboard",component:function(){return Promise.all([n.e("chunk-2b280eaa"),n.e("chunk-594d6d48"),n.e("chunk-073bf657")]).then(n.bind(null,"ec95"))},meta:{requiresAuth:!0}},{path:"/new-snippet",name:"New Snippet",component:function(){return Promise.all([n.e("chunk-d01f6c98"),n.e("chunk-594d6d48"),n.e("chunk-c0b933ac")]).then(n.bind(null,"c9e6"))},meta:{requiresAuth:!0}},{path:"/existing-snippet",name:"Existing Snippets",component:function(){return Promise.all([n.e("chunk-d01f6c98"),n.e("chunk-a98a3a5e")]).then(n.bind(null,"56bb"))},meta:{requiresAuth:!0}}],x=S,O=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"click-outside",rawName:"v-click-outside",value:t.closeDropDown,expression:"closeDropDown"}],staticClass:"dropdown",class:{open:t.isOpen},on:{click:t.toggleDropDown}},[t._t("title",[n("a",{staticClass:"dropdown-toggle",attrs:{"data-toggle":"dropdown",href:"javascript:void(0)"}},[n("i",{class:t.icon}),n("p",{staticClass:"notification"},[t._v(" "+t._s(t.title)+" "),n("b",{staticClass:"caret"})])])]),t._t("default")],2)},j=[],C={name:"drop-down",props:{title:String,icon:String},data:function(){return{isOpen:!1}},methods:{toggleDropDown:function(){this.isOpen=!this.isOpen},closeDropDown:function(){this.isOpen=!1}}},A=C,$=Object(c["a"])(A,O,j,!1,null,null,null),P=$.exports,N={install:function(t){t.component("drop-down",P)}},q=N,E=n("c7db"),R={install:function(t){t.directive("click-outside",E["directive"])}},D=R,I=n("43f9"),L=n.n(I),T=(n("43f4"),n("1597"),n("54ba"),{install:function(t){t.use(L.a)}}),z=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"sidebar",style:t.sidebarStyle,attrs:{"data-color":t.sidebarItemColor,"data-image":t.sidebarBackgroundImage}},[n("div",{staticClass:"logo"},[n("a",{staticClass:"simple-text logo-mini",attrs:{href:"#"}},[n("div",{staticClass:"logo-img"},[n("img",{attrs:{src:t.imgLogo,alt:""}})])]),n("a",{staticClass:"simple-text logo-normal",attrs:{href:"https://www.creative-tim.com/product/vue-material-dashboard",target:"_blank"}},[t._v(" "+t._s(t.title)+" ")])]),n("div",{staticClass:"sidebar-wrapper"},[t._t("content"),n("md-list",{staticClass:"nav"},[t._t("default",t._l(t.sidebarLinks,(function(t,e){return n("sidebar-link",{key:t.name+e,attrs:{to:t.path,link:t}})})))],2)],2)])},M=[],B=(n("c975"),function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("li",{staticClass:"md-list-item"},[n("router-link",t._b({staticClass:"md-list-item-router md-list-item-container md-button-clean",on:{click:t.hideSidebar}},"router-link",t.$attrs,!1),[n("div",{staticClass:"md-list-item-content md-ripple"},[t._t("default",[n("md-icon",[t._v(t._s(t.link.icon))]),n("p",[t._v(t._s(t.link.name))])])],2)])],1)}),H=[],J={inject:{autoClose:{default:!0}},props:{link:{type:[String,Object],default:function(){return{name:"",path:"",icon:""}}},tag:{type:String,default:"router-link"}},methods:{hideSidebar:function(){this.autoClose&&this.$sidebar&&!0===this.$sidebar.showSidebar&&this.$sidebar.displaySidebar(!1)}}},F=J,G=Object(c["a"])(F,B,H,!1,null,null,null),U=G.exports,K={components:{SidebarLink:U},props:{title:{type:String,default:"Vue MD"},sidebarBackgroundImage:{type:String,default:n("9524")},imgLogo:{type:String,default:n("fdbc")},sidebarItemColor:{type:String,default:"dodger-blue",validator:function(t){var e=["","dodger-blue","purple","blue","green","orange","red"];return-1!==e.indexOf(t)}},sidebarLinks:{type:Array,default:function(){return[]}},autoClose:{type:Boolean,default:!0}},provide:function(){return{autoClose:this.autoClose}},computed:{sidebarStyle:function(){return{backgroundImage:"url(".concat(this.sidebarBackgroundImage,")")}}}},V=K,Q=(n("0efd"),Object(c["a"])(V,z,M,!1,null,null,null)),W=Q.exports,X={showSidebar:!1,displaySidebar:function(t){this.showSidebar=t}},Y={install:function(t){t.mixin({data:function(){return{sidebarStore:X}}}),Object.defineProperty(t.prototype,"$sidebar",{get:function(){return this.$root.sidebarStore}}),t.component("side-bar",W),t.component("sidebar-link",U)}},Z=Y,tt=(n("c740"),n("4160"),n("a434"),n("159b"),function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"notifications"},[n("transition-group",{attrs:{name:"list"}},t._l(t.notifications,(function(e){return n("notification",{key:e.timestamp.getTime(),attrs:{message:e.message,icon:e.icon,type:e.type,timestamp:e.timestamp,"vertical-align":e.verticalAlign,"horizontal-align":e.horizontalAlign},on:{"on-close":t.removeNotification}})})),1)],1)}),et=[],nt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"alert open alert-with-icon",class:[t.verticalAlign,t.horizontalAlign,t.alertType],style:t.customPosition,attrs:{"data-notify":"container",role:"alert","data-notify-position":"top-center"},on:{click:function(e){return t.close()}}},[n("button",{staticClass:"close",attrs:{type:"button","aria-hidden":"true","data-notify":"dismiss"},on:{click:t.close}},[t._v(" × ")]),n("i",{staticClass:"material-icons",attrs:{"data-notify":"icon"}},[t._v(t._s(t.icon))]),n("span",{attrs:{"data-notify":"message"},domProps:{innerHTML:t._s(t.message)}})])},rt=[],it=(n("4de4"),n("a9e3"),{name:"notification",props:{message:String,icon:String,verticalAlign:{type:String,default:"top"},horizontalAlign:{type:String,default:"center"},type:{type:String,default:"info"},timeout:{type:Number,default:2500},timestamp:{type:Date,default:function(){return new Date}}},data:function(){return{elmHeight:0}},computed:{hasIcon:function(){return this.icon&&this.icon.length>0},alertType:function(){return"alert-".concat(this.type)},customPosition:function(){var t=this,e=20,n=this.elmHeight+10,r=this.$notifications.state.filter((function(e){return e.horizontalAlign===t.horizontalAlign&&e.verticalAlign===t.verticalAlign&&e.timestamp<=t.timestamp})).length,i=(r-1)*n+e,a={};return"top"===this.verticalAlign?a.top="".concat(i,"px"):a.bottom="".concat(i,"px"),a}},methods:{close:function(){this.$emit("on-close",this.timestamp)}},mounted:function(){this.elmHeight=this.$el.clientHeight,this.timeout&&setTimeout(this.close,this.timeout)}}),at=it,ot=(n("7b35"),Object(c["a"])(at,nt,rt,!1,null,"3b98be06",null)),st=ot.exports,ut={components:{Notification:st},data:function(){return{notifications:this.$notifications.state}},methods:{removeNotification:function(t){this.$notifications.removeNotification(t)}}},ct=ut,lt=(n("6ae5"),Object(c["a"])(ct,tt,et,!1,null,null,null)),ft=lt.exports,dt={state:[],removeNotification:function(t){var e=this.state.findIndex((function(e){return e.timestamp===t}));-1!==e&&this.state.splice(e,1)},addNotification:function(t){t.timestamp=new Date,t.timestamp.setMilliseconds(t.timestamp.getMilliseconds()+this.state.length),this.state.push(t)},notify:function(t){var e=this;Array.isArray(t)?t.forEach((function(t){e.addNotification(t)})):this.addNotification(t)}},pt={install:function(t){t.mixin({data:function(){return{notificationStore:dt}},methods:{notify:function(t){this.notificationStore.notify(t)}}}),Object.defineProperty(t.prototype,"$notify",{get:function(){return this.$root.notify}}),Object.defineProperty(t.prototype,"$notifications",{get:function(){return this.$root.notificationStore}}),t.component("Notifications",ft)}},mt=pt;r["default"].config.productionTip=!1,r["default"].prototype.$http=h.a;var ht=localStorage.getItem("token");ht&&(r["default"].prototype.$http.defaults.headers.common["Authorization"]=ht);var gt=new i["a"]({routes:x,linkExactActiveClass:"nav-item active"});r["default"].use(i["a"]),r["default"].use(q),r["default"].use(D),r["default"].use(T),r["default"].use(Z),r["default"].use(mt),new r["default"]({el:"#app",router:gt,store:w,render:function(t){return t(f)},data:{}})},"6ae5":function(t,e,n){"use strict";var r=n("b5b2"),i=n.n(r);i.a},"7b35":function(t,e,n){"use strict";var r=n("4ba2"),i=n.n(r);i.a},9524:function(t,e,n){t.exports=n.p+"img/sidebar-2.32103624.jpg"},b5b2:function(t,e,n){},cd1f:function(t,e,n){},fdbc:function(t,e,n){t.exports=n.p+"img/vue-logo.c2a605fb.png"}}); //# sourceMappingURL=app.21f6279c.js.map
module.exports = { pathPrefix: '/', siteMetadata: { title: `Blog`, author: { name: `zhangyangyang`, summary: `who lives and works in HangZhou building useful things.`, }, description: `A starter blog demonstrating what Gatsby can do.`, siteUrl: `https://zyycode.github.com/Note`, social: { twitter: '2020Yang', github: 'zyycode' }, }, plugins: [ { resolve: `gatsby-source-filesystem`, options: { path: `${__dirname}/content/blog`, name: `blog`, }, }, { resolve: `gatsby-source-filesystem`, options: { path: `${__dirname}/content/assets`, name: `assets`, }, }, { resolve: `gatsby-transformer-remark`, options: { plugins: [ { resolve: `gatsby-remark-images`, options: { maxWidth: 590, }, }, { resolve: `gatsby-remark-responsive-iframe`, options: { wrapperStyle: `margin-bottom: 1.0725rem`, }, }, `gatsby-remark-prismjs`, `gatsby-remark-copy-linked-files`, `gatsby-remark-smartypants`, ], }, }, `gatsby-transformer-sharp`, `gatsby-plugin-sharp`, { resolve: `gatsby-plugin-google-analytics`, options: { //trackingId: `ADD YOUR TRACKING ID HERE`, }, }, `gatsby-plugin-feed`, { resolve: `gatsby-plugin-manifest`, options: { name: `Gatsby Starter Blog`, short_name: `GatsbyJS`, start_url: `/Note`, background_color: `#ffffff`, theme_color: `#663399`, display: `minimal-ui`, icon: `content/assets/gatsby-icon.png`, }, }, `gatsby-plugin-react-helmet`, { resolve: `gatsby-plugin-typography`, options: { pathToConfigModule: `src/utils/typography`, }, }, // this (optional) plugin enables Progressive Web App + Offline functionality // To learn more, visit: https://gatsby.dev/offline // `gatsby-plugin-offline`, ], }
from enum import IntEnum, IntFlag import numpy as np from ..data_blocks.compiled_file_header import InfoBlock from ...utils.byte_io_mdl import ByteIO from ...utils.thirdparty.lz4_wrapper import LZ4ChainDecoder, LZ4Wrapper def uncompress(compressed_data, _b, decompressed_size): decoder = LZ4Wrapper() return decoder.decompress_safe(compressed_data, decompressed_size) class KVFlag(IntFlag): Nothing = 0 Resource = 1 DeferredResource = 2 class KVType(IntEnum): STRING_MULTI = 0 # STRING_MULTI doesn't have an ID NULL = 1 BOOLEAN = 2 INT64 = 3 UINT64 = 4 DOUBLE = 5 STRING = 6 BINARY_BLOB = 7 ARRAY = 8 OBJECT = 9 ARRAY_TYPED = 10 INT32 = 11 UINT32 = 12 BOOLEAN_TRUE = 13 BOOLEAN_FALSE = 14 INT64_ZERO = 15 INT64_ONE = 16 DOUBLE_ZERO = 17 DOUBLE_ONE = 18 UNK = 21 class BinaryKeyValue: KV3_ENCODING_BINARY_BLOCK_COMPRESSED = ( 0x46, 0x1A, 0x79, 0x95, 0xBC, 0x95, 0x6C, 0x4F, 0xA7, 0x0B, 0x05, 0xBC, 0xA1, 0xB7, 0xDF, 0xD2) KV3_ENCODING_BINARY_UNCOMPRESSED = ( 0x00, 0x05, 0x86, 0x1B, 0xD8, 0xF7, 0xC1, 0x40, 0xAD, 0x82, 0x75, 0xA4, 0x82, 0x67, 0xE7, 0x14) KV3_ENCODING_BINARY_BLOCK_LZ4 = ( 0x8A, 0x34, 0x47, 0x68, 0xA1, 0x63, 0x5C, 0x4F, 0xA1, 0x97, 0x53, 0x80, 0x6F, 0xD9, 0xB1, 0x19) KV3_FORMAT_GENERIC = ( 0x7C, 0x16, 0x12, 0x74, 0xE9, 0x06, 0x98, 0x46, 0xAF, 0xF2, 0xE6, 0x3E, 0xB5, 0x90, 0x37, 0xE7) KV3_SIG = (0x56, 0x4B, 0x56, 0x03) VKV3_SIG = (0x01, 0x33, 0x56, 0x4B) VKV3_v2_SIG = (0x02, 0x33, 0x56, 0x4B) KNOWN_SIGNATURES = [KV3_SIG, VKV3_SIG, VKV3_v2_SIG] indent = 0 def __init__(self, block_info: InfoBlock = None): super().__init__() self.block_info = block_info self.mode = 0 self.strings = [] self.types = np.array([]) self.current_type = 0 self.kv = [] self.flags = 0 self.buffer = ByteIO() # type: ByteIO self.bin_blob_count = 0 self.bin_blob_offset = -1 self.int_count = 0 self.int_offset = -1 self.double_count = 0 self.double_offset = -1 self.byte_buffer = ByteIO() self.int_buffer = ByteIO() self.double_buffer = ByteIO() self.block_data = bytearray() self.block_reader = ByteIO() self.block_sizes = [] self.next_block_id = 0 def read(self, reader: ByteIO): fourcc = reader.read(4) assert tuple(fourcc) in self.KNOWN_SIGNATURES, 'Invalid KV Signature' if tuple(fourcc) == self.VKV3_SIG: self.read_v1(reader) if tuple(fourcc) == self.VKV3_v2_SIG: self.read_v2(reader) elif tuple(fourcc) == self.KV3_SIG: self.read_v3(reader) def block_decompress(self, reader): self.flags = reader.read(4) if self.flags[3] & 0x80: self.buffer.write_bytes(reader.read(-1)) working = True while reader.tell() != reader.size() and working: block_mask = reader.read_uint16() for i in range(16): if block_mask & (1 << i) > 0: offset_and_size = reader.read_uint16() offset = ((offset_and_size & 0xFFF0) >> 4) + 1 size = (offset_and_size & 0x000F) + 3 lookup_size = offset if offset < size else size entry = self.buffer.tell() self.buffer.seek(entry - offset) data = self.buffer.read(lookup_size) self.buffer.seek(entry) while size > 0: self.buffer.write_bytes(data[:lookup_size if lookup_size < size else size]) size -= lookup_size else: data = reader.read_int8() self.buffer.write_int8(data) if self.buffer.size() == (self.flags[2] << 16) + (self.flags[1] << 8) + self.flags[0]: working = False break self.buffer.seek(0) def decompress_lz4(self, reader): decompressed_size = reader.read_uint32() compressed_size = reader.size() - reader.tell() data = reader.read(-1) data = uncompress(data, compressed_size, decompressed_size) self.buffer.write_bytes(data) self.buffer.seek(0) def read_v3(self, reader): encoding = reader.read(16) assert tuple(encoding) in [ self.KV3_ENCODING_BINARY_BLOCK_COMPRESSED, self.KV3_ENCODING_BINARY_BLOCK_LZ4, self.KV3_ENCODING_BINARY_UNCOMPRESSED, ], 'Unrecognized KV3 Encoding' fmt = reader.read(16) assert tuple(fmt) == self.KV3_FORMAT_GENERIC, 'Unrecognised KV3 Format' if tuple(encoding) == self.KV3_ENCODING_BINARY_BLOCK_COMPRESSED: self.block_decompress(reader) elif tuple(encoding) == self.KV3_ENCODING_BINARY_BLOCK_LZ4: self.decompress_lz4(reader) elif tuple(encoding) == self.KV3_ENCODING_BINARY_UNCOMPRESSED: self.buffer.write_bytes(reader.read(-1)) self.buffer.seek(0) string_count = self.buffer.read_uint32() for _ in range(string_count): self.strings.append(self.buffer.read_ascii_string()) self.int_buffer = self.buffer self.double_buffer = self.buffer self.byte_buffer = self.buffer self.parse(self.buffer, self.kv, True) assert len(self.kv) == 1, "Never yet seen that state of vkv3 v1" self.kv = self.kv[0] self.buffer.close() del self.buffer def read_v1(self, reader: ByteIO): fmt = reader.read(16) assert tuple(fmt) == self.KV3_FORMAT_GENERIC, 'Unrecognised KV3 Format' compression_method = reader.read_uint32() self.bin_blob_count = reader.read_uint32() self.int_count = reader.read_uint32() self.double_count = reader.read_uint32() if compression_method == 0: length = reader.read_uint32() self.buffer.write_bytes(reader.read(length)) elif compression_method == 1: uncompressed_size = reader.read_uint32() compressed_size = self.block_info.block_size - reader.tell() data = reader.read(compressed_size) u_data = uncompress(data, compressed_size, uncompressed_size) assert len(u_data) == uncompressed_size, "Decompressed data size does not match expected size" self.buffer.write_bytes(u_data) else: raise NotImplementedError("Unknown KV3 compression method") self.buffer.seek(0) self.byte_buffer.write_bytes(self.buffer.read(self.bin_blob_count)) self.byte_buffer.seek(0) if self.buffer.tell() % 4 != 0: self.buffer.seek(self.buffer.tell() + (4 - (self.buffer.tell() % 4))) self.int_buffer.write_bytes(self.buffer.read(self.int_count * 4)) self.int_buffer.seek(0) if self.buffer.tell() % 8 != 0: self.buffer.seek(self.buffer.tell() + (8 - (self.buffer.tell() % 8))) self.double_buffer.write_bytes(self.buffer.read(self.double_count * 8)) self.double_buffer.seek(0) for _ in range(self.int_buffer.read_uint32()): self.strings.append(self.buffer.read_ascii_string()) types_len = self.buffer.size() - self.buffer.tell() - 4 self.types = np.frombuffer(self.buffer.read(types_len), np.uint8) self.parse(self.buffer, self.kv, True) self.kv = self.kv[0] self.buffer.close() del self.buffer self.byte_buffer.close() del self.byte_buffer self.int_buffer.close() del self.int_buffer self.double_buffer.close() del self.double_buffer def read_v2(self, reader: ByteIO): fmt = reader.read(16) assert tuple(fmt) == self.KV3_FORMAT_GENERIC, 'Unrecognised KV3 Format' compression_method = reader.read_uint32() compression_dict_id = reader.read_uint16() compression_frame_size = reader.read_uint16() self.bin_blob_count = reader.read_uint32() self.int_count = reader.read_uint32() self.double_count = reader.read_uint32() string_and_types_buffer_size, b, c = reader.read_fmt('I2H') uncompressed_size = reader.read_uint32() compressed_size = reader.read_uint32() block_count = reader.read_uint32() block_total_size = reader.read_uint32() if compression_method == 0: if compression_dict_id != 0: raise NotImplementedError('Unknown compression method in KV3 v2 block') if compression_frame_size != 0: raise NotImplementedError('Unknown compression method in KV3 v2 block') self.buffer.write_bytes(reader.read(compressed_size)) elif compression_method == 1: if compression_dict_id != 0: raise NotImplementedError('Unknown compression method in KV3 v2 block') if compression_frame_size != 16384: raise NotImplementedError('Unknown compression method in KV3 v2 block') data = reader.read(compressed_size) u_data = uncompress(data, compressed_size, uncompressed_size) assert len(u_data) == uncompressed_size, "Decompressed data size does not match expected size" self.buffer.write_bytes(u_data) else: raise NotImplementedError("Unknown KV3 compression method") self.buffer.seek(0) self.byte_buffer.write_bytes(self.buffer.read(self.bin_blob_count)) self.byte_buffer.seek(0) if self.buffer.tell() % 4 != 0: self.buffer.seek(self.buffer.tell() + (4 - (self.buffer.tell() % 4))) self.int_buffer.write_bytes(self.buffer.read(self.int_count * 4)) self.int_buffer.seek(0) if self.buffer.tell() % 8 != 0: self.buffer.seek(self.buffer.tell() + (8 - (self.buffer.tell() % 8))) self.double_buffer.write_bytes(self.buffer.read(self.double_count * 8)) self.double_buffer.seek(0) string_start = self.buffer.tell() for _ in range(self.int_buffer.read_uint32()): self.strings.append(self.buffer.read_ascii_string()) types_len = string_and_types_buffer_size - (self.buffer.tell() - string_start) self.types = np.frombuffer(self.buffer.read(types_len), np.uint8) if block_count == 0: assert self.buffer.read_uint32() == 0xFFEEDD00, 'Invalid terminator' self.parse(self.buffer, self.kv, True) self.kv = self.kv[0] else: self.block_sizes = [self.buffer.read_uint32() for _ in range(block_count)] assert self.buffer.read_uint32() == 0xFFEEDD00, 'Invalid terminator' cd = LZ4ChainDecoder(block_total_size, 0) for uncompressed_block_size in self.block_sizes: if compression_method == 0: self.block_data += reader.read(uncompressed_block_size) elif compression_method == 1: compressed_block_size = self.buffer.read_uint16() data = reader.read(compressed_block_size) data = cd.decompress(data, uncompressed_block_size) self.block_data += data else: raise NotImplementedError("Unknown KV3 compression method") self.block_reader.write_bytes(self.block_data) self.block_reader.seek(0) self.parse(self.buffer, self.kv, True) self.kv = self.kv[0] self.buffer.close() del self.buffer self.byte_buffer.close() del self.byte_buffer self.int_buffer.close() del self.int_buffer self.double_buffer.close() del self.double_buffer def read_type(self, reader: ByteIO): if self.types.shape[0] > 0: data_type = self.types[self.current_type] self.current_type += 1 else: data_type = reader.read_int8() flag_info = KVFlag.Nothing if data_type & 0x80: data_type &= 0x7F if self.types.shape[0] > 0: flag_info = KVFlag(self.types[self.current_type]) self.current_type += 1 else: flag_info = KVFlag(reader.read_int8()) return KVType(data_type), flag_info def parse(self, reader: ByteIO, parent=None, in_array=False): name = None if not in_array: str_id = self.int_buffer.read_uint32() name = self.strings[str_id] if str_id != -1 else "" data_type, flag_info = self.read_type(reader) self.read_value(name, reader, data_type, parent, in_array) def read_value(self, name, reader: ByteIO, data_type: KVType, parent, is_array=False): def add(v): if not is_array: parent.update({name: v}) else: parent.append(v) if data_type == KVType.NULL: add(None) return elif data_type == KVType.DOUBLE: add(self.double_buffer.read_double()) return elif data_type == KVType.BOOLEAN: add(self.byte_buffer.read_int8() == 1) return elif data_type == KVType.BOOLEAN_TRUE: add(True) return elif data_type == KVType.BOOLEAN_FALSE: add(False) return elif data_type == KVType.INT64: add(self.double_buffer.read_int64()) return elif data_type == KVType.UINT64: add(self.double_buffer.read_uint64()) return elif data_type == KVType.DOUBLE_ZERO: add(0.0) return elif data_type == KVType.INT64_ZERO: add(0) return elif data_type == KVType.INT64_ONE: add(1) return elif data_type == KVType.DOUBLE_ONE: add(1.0) return elif data_type == KVType.INT32: add(self.int_buffer.read_int32()) return elif data_type == KVType.STRING: string_id = self.int_buffer.read_int32() if string_id == -1: add(None) return add(self.strings[string_id]) return elif data_type == KVType.ARRAY: size = self.int_buffer.read_uint32() arr = [] for _ in range(size): self.parse(reader, arr, True) add(arr) return elif data_type == KVType.OBJECT: size = self.int_buffer.read_uint32() tmp = {} for _ in range(size): self.parse(reader, tmp, False) add(tmp) if not parent: parent = tmp elif data_type == KVType.ARRAY_TYPED: t_array_size = self.int_buffer.read_uint32() sub_type, sub_flag = self.read_type(reader) tmp = [] for _ in range(t_array_size): self.read_value(name, reader, sub_type, tmp, True) if sub_type in (KVType.DOUBLE, KVType.DOUBLE_ONE, KVType.DOUBLE_ZERO): tmp = np.array(tmp, dtype=np.float64) add(tmp) elif data_type == KVType.BINARY_BLOB: if self.block_reader.size() != 0: data = self.block_reader.read(self.block_sizes[self.next_block_id]) self.next_block_id += 1 add(data) else: size = self.int_buffer.read_uint32() add(self.byte_buffer.read(size)) return else: raise NotImplementedError("Unknown KVType.{}".format(data_type.name)) return parent
macDetailCallback("0080c6000000/24",[{"d":"2000-09-08","t":"add","a":"2F, 28, INDUSTRY EAST 9TH RD.\nSCIENCE PARK, HSIN-CHU\n\n","c":"TAIWAN 30077, R.O.C.","o":"NATIONAL DATACOMM CORPORATION"},{"d":"2001-10-24","t":"change","a":"2F, 28, INDUSTRY EAST 9TH RD.\nSCIENCE PARK, HSIN-CHU\n\n","c":"TAIWAN 30077 TAIWAN 30077 R.O.C.","o":"NATIONAL DATACOMM CORPORATION"},{"d":"2005-07-21","t":"change","a":"2F, 28, INDUSTRY EAST 9TH RD.\nSCIENCE PARK, HSIN-CHU\nTAIWAN 30077 TAIWAN 30077 R.O.C.\n","c":"TAIWAN, REPUBLIC OF CHINA","o":"NATIONAL DATACOMM CORPORATION"},{"d":"2012-11-29","t":"change","a":"2F, 28, INDUSTRY EAST 9TH RD.\nSCIENCE PARK, HSIN-CHU\nTAIWAN 30077 TAIWAN 30077 R.O.C.\n","c":"TAIWAN, PROVINCE OF CHINA","o":"NATIONAL DATACOMM CORPORATION"},{"d":"2015-08-27","t":"change","a":"2F, 28, INDUSTRY EAST 9TH RD. TAIWAN 30077 TAIWAN 30077 TW R.O.C.","c":"TW","o":"NATIONAL DATACOMM CORPORATION"}]);
import "./notecard.css"; import React, { Component } from 'react'; import Card from './card' import DrawButton from "./nextbutton"; export default class NoteCards extends Component { constructor() { super(); this.state = { cards: [ { question: '404', choice1: 'Not found', } ], currentCard: {} } this.updateCard = this.updateCard.bind(this); } //this is called a lifecycle hook componentDidMount() { console.log(this.props.questionArray); const currentCards = this.state.cards; this.props.questionArray.forEach(function (item) { currentCards.push({ question: item.question, choice1: item.choice1 }); }); this.setState({ cards: currentCards, currentCard: this.getRandomCard(currentCards) }); } getRandomCard(currentCards) { let card = currentCards[Math.floor(Math.random() * currentCards.length)]; return card; } updateCard() { const currentCards = this.state.cards; this.setState({ currentCard: this.getRandomCard(currentCards) }) } render() { return ( <div className='Flashcard'> <div className='card-row'> <Card question={this.state.currentCard.question} answer={this.state.currentCard.choice1} // description={this.state.currentCard.description} /> </div> <div className='button-row'> <DrawButton drawCard={this.updateCard} /> </div> </div> ); } }
tinyMCE.addI18n('ja.advanced', { "nos_clipboard_msg":"\u30b3\u30d4\u30fc\/\u5207\u308a\u53d6\u308a\/\u8cbc\u308a\u4ed8\u3051\u306fMozilla\u3068Firefox\u3067\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002\n\u3053\u306e\u554f\u984c\u306e\u8a73\u7d30\u3092\u77e5\u308a\u305f\u3044\u3067\u3059\u304b?", "media_title":"\u57cb\u3081\u8fbc\u307f\u30e1\u30c7\u30a3\u30a2\u3092\u633f\u5165\uff0f\u7de8\u96c6", "media_label":"\u57cb\u3081\u8fbc\u307f\u30e1\u30c7\u30a3\u30a2" });
const shell = require('shelljs'); const os = require('os'); const path = require('path'); function prebuild(opt){ return new Promise((resolve,reject)=>{ let plat = os.platform(); let arch = os.arch(); if(plat == opt.platform && arch == opt.arch){ console.log(`TARGET: ${opt.name}-${process.env.npm_package_version} ${opt.platform}_${opt.arch}`); console.log(`SRC_DIR: ${process.cwd()}`); resolve(''); }else{ reject(`You are trying to build ${opt.platform}_${opt.arch} release on ${plat}_${arch}, this may cause unexpected results.`); } }); } function build(command){ return new Promise((resolve,reject)=>{ console.log(`CMD: ${command}`); shell.exec(command,{silent:true},(code,stdout,stderr)=>{ if(code === 0){ console.log(`FILES GENERATED`); resolve(''); }else{ reject(stderr); } }); }); } function postbuild(opt){ return new Promise((resolve,reject)=>{ let dir = path.join(process.cwd(),'release-builds',opt.version,`${opt.name}-${opt.platform}-${opt.arch}`); let pth; opt.remove.forEach((ele)=>{ pth = path.join(dir,ele); console.log(`RM: ${pth}`); result = shell.rm('-rf',pth); if(result.code !== 0){ reject(`failed to remove ${ele}, ${result.stderr}`); } }); resolve(''); }); } module.exports = {prebuild,build,postbuild};
import {ContentIndexService} from '/gen/third_party/blink/public/mojom/content_index/content_index.mojom.m.js'; // Returns a promise if the chromium based browser fetches icons for // content-index. export async function fetchesIcons() { const remote = ContentIndexService.getRemote(); const {iconSizes} = await remote.getIconSizes(); return iconSizes.length > 0; };
import numpy as np import matplotlib.pyplot as plt import os my_path = os.path.dirname(__file__) output = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'output')) data = np.load(os.path.join(my_path, 'bm-R1.npz')) ticks = [str(tuple(size)) for size in data["SIZES"]] algo = ["Path-Alg", "P-PDS", "DR", "CVX"] fig = plt.figure() for i, name in enumerate(["T_pa", "T_pds", "T_dr", "T_cvx"]): T = data[name] N_size, N_data = T.shape mean = np.mean(T, axis=1) std = np.std(T, axis=1)/np.sqrt(N_data) label = algo[i] plt.errorbar(range(N_size), mean, yerr=std, label=label) plt.yscale("log") plt.title("Running time (in seconds)") plt.xticks(range(N_size), ticks) plt.xlabel("(n, d)") plt.ylabel("running time (in seconds)") plt.legend() plt.tight_layout() plt.savefig(os.path.join(output, "bm-R1-times.png")) plt.close() ref = np.min( [np.mean(data[name], axis=1) for name in ["L_pa", "L_pds", "L_dr", "L_cvx"] ], axis=0) for i, name in enumerate(["L_pa", "L_pds", "L_dr", "L_cvx"]): L = data[name] N_size, N_data = L.shape mean = np.mean(L, axis=1) label = algo[i] plt.plot(range(N_size), mean - ref, label=label) plt.title("Loss - minimum(loss)") plt.xticks(range(N_size), ticks) plt.xlabel("(n, d)") plt.ylabel("loss function") plt.legend() plt.tight_layout() plt.savefig(os.path.join(output, "bm-R1-losses.png")) plt.close() for i, name in enumerate(["C_pa", "C_pds", "C_dr", "C_cvx"]): C = data[name] N_size, N_data = C.shape mean = np.mean(C, axis=1) std = np.std(C, axis=1)/np.sqrt(N_data) label = algo[i] plt.plot(range(N_size), mean, label=label) plt.title("Value of norm(Cbeta)") plt.xticks(range(N_size), ticks) plt.xlabel("(n, d)") plt.ylabel("norm(Cbeta)") plt.legend() plt.tight_layout() plt.savefig(os.path.join(output, "bm-R1-constraint.png")) plt.close()
E = int(input()) English = set(input().split()) F = int(input()) French = set(input().split()) print (len(English & French))
import logging import psycopg2 import yaml from amg_cursor import AmgCursor class DbConnection(object): """Wrapper class for holding a Redshift database connection. """ # TODO: move the logic to the AmgCursor class and have DbConnection call # the cursor code. This will allow the caller to customize how their # transactions are grouped. DEFAULT_AUTOCOMMIT = True @classmethod def from_yaml(cls, file_path, *yaml_scope): """Returns new DbConnection instance from the yaml file. Required values: host, database, user, password, port Optional values: autocommit :param file_path: path to the yaml configuration file. :param yaml_scope: the section of the yaml file to look into. :return: a new DbConnection instance. """ logging.debug( 'Creating DbConnection from %s[%s]', file_path, '->'.join(yaml_scope)) info = yaml.safe_load(file(file_path)) for scope in yaml_scope: info = info[scope] return DbConnection( host=info['host'], database=info['database'], user=info.get('username', ''), password=info['password'], port=info.get('port', 5432), autocommit=info.get('autocommit', cls.DEFAULT_AUTOCOMMIT)) def __init__( self, host, database, user, password, port, autocommit=DEFAULT_AUTOCOMMIT): # TODO: add statement_timeout option self.host = host self.database = database self.user = user self.password = password self.port = port self.autocommit = autocommit self.cache = {} # Cache for holding some query results. self.conn = None def __enter__(self): self.connect() return self def __exit__(self, exc_type, exc_val, exc_tb): self.close() def is_connected(self): """Returns true if the database is actively connected.""" return self.conn is not None and self.conn.closed == 0 def connect(self): """Reconnects the database connection.""" if self.is_connected(): self.close() logging.info( 'Connecting to %s:%s/%s...', self.host, self.port, self.database) self.conn = psycopg2.connect( host=self.host, database=self.database, user=self.user, password=self.password, port=self.port, cursor_factory=AmgCursor) self.conn.autocommit = self.autocommit def close(self): """Disconnect the database connection.""" logging.debug( 'Closing connection to %s:%s/%s...', self.host, self.port, self.database) self.conn.close() def new_cursor(self): """Returns a new cursor from the database connection.""" if not self.is_connected(): logging.info('No connection to get a cursor from. Reconnecting...') self.connect() return self.conn.cursor() def execute_sql(self, query, params=None, return_results=False): """Execute arbitrary query using a new cursor. :param query: sql string to execute. :param params: dictionary of values to use in the corresponding sql. :param return_results: if True, function will return the results of the query. :return: the query results or None. """ with self.new_cursor() as cursor: cursor.execute(query, params) results = cursor.fetchall() if return_results else None return results def execute_sql_file(self, file_path, params=None, return_results=False): """Execute contents of a sql file using a new cursor. :param file_path: path of sql file to execute. :param params: dictionary of values to use in the corresponding sql. :param return_results: if True, function will return the results of the query. :return: the query results or None. """ logging.info('Executing sql file: %s', file_path) with open(file_path, 'r') as exec_f: return self.execute_sql(exec_f.read(), params, return_results) def execute_unload( self, select_query, s3_conn, s3_prefix, unload_options=()): """Execute a Redshift UNLOAD statement using a new cursor. :param select_query: query string to unload. :param s3_conn: S3Connection object where output will go. :param s3_prefix: prefix string where the files will go. :param unload_options: additional Redshift UNLOAD options. """ s3_path = 's3://{}/{}'.format(s3_conn.bucket_name, s3_prefix) logging.info("Unloading query: '%s' to %s", select_query, s3_path) unload_string = ( 'UNLOAD (%(select_query)s) TO %(s3_path)s ' 'CREDENTIALS %(aws_creds)s') # Append any additional options: # https://docs.aws.amazon.com/redshift/latest/dg/r_UNLOAD.html # TODO: ensure opt is in a set of allowable options (for # security + better warnings) for opt in unload_options: unload_string += ' ' + opt rs_cred_string = redshift_cred_string( s3_conn.get_aws_access_key_id(), s3_conn.get_aws_secret_access_key()) self.execute_sql( unload_string, { 'select_query': select_query, 's3_path': s3_path, 'aws_creds': rs_cred_string, }) def execute_copy( self, tablename, s3_conn, s3_prefix, columns=None, copy_options=()): """Execute a Redshift COPY statement using a new cursor. :param tablename: full tablename to copy to. :param s3_conn: S3Connection object that holds the files. :param s3_prefix: prefix string where the files are. :param columns: list of columns to use for the COPY statement. :param copy_options: additional Redshift COPY options. """ with self.new_cursor() as cursor: cursor.execute_copy( tablename, s3_conn, s3_prefix, columns, copy_options) def drop_tables(self, tables, schema=None, use_if_exists=True): """Drops a list of tables. :param tables: iterable of tables to drop :param schema: optional schema string to append to each table name :param use_if_exists: use the `IF EXISTS` sql condition """ if len(tables) > 0: if_exists = 'IF EXISTS ' if use_if_exists else '' if schema is not None: tables = ['{}.{}'.format(schema, table) for table in tables] query = 'DROP TABLE {}{};'.format(if_exists, ', '.join(tables)) self.execute_sql(query) def get_media_import_id( self, media_schema, data_source, file_name, table_append=''): """Get the import id from the associated file_name. :param media_schema: schema holding the imports table. :param data_source: restrict searching for a data source ('COMSCORE', 'FYI', etc...) :param file_name: filename to get the id for. :return: the id associated with the file_name. None if not found. """ # Identifier for the cached import ids. cache_key = 'filename_to_import_id' data_source = data_source.upper() if cache_key in self.cache and file_name in self.cache[cache_key]: # If we already have the import id cached, no need to run the # query. return self.cache[cache_key][file_name] else: query = """SELECT id FROM %(media_schema)s.imports%(table_append)s WHERE source = %(data_source)s AND file_name = %(file_name)s""" res = self.execute_sql( query, { 'media_schema': no_quotes(media_schema), 'data_source': data_source, 'file_name': file_name, 'table_append': no_quotes(table_append), }, return_results=True) if len(res) == 0: logging.info('No associated import id found for %s', file_name) return None elif len(res) > 1: msg = ( '{} is associated with multiple import records: {}'.format( file_name, res)) logging.critical(msg) raise Exception(msg) else: import_id = res[0]['id'] # Cache the import_id for future calls. if cache_key not in self.cache: self.cache[cache_key] = {} self.cache[cache_key][file_name] = import_id return import_id def update_media_import( self, media_schema, data_source, file_name, file_date, status, table_append='', file_path=''): """Update or insert an entry in media.imports. :param media_schema: schema holding the imports table. :param data_source: data source of the file_name ('COMSCORE', 'FYI', etc...) :param file_name: filename to update the imports record for :param file_date: date associated with the file_name :param status: new status for the imports record :return: the import id that was created or found. None if error. """ data_source = data_source.upper() import_id = self.get_media_import_id( media_schema, data_source, file_name, table_append) if import_id is None and (status.upper() in ('STARTED', 'SKIPPED')): # New 'STARTED' imports record. query = """ INSERT INTO %(media_schema)s.imports%(table_append)s (file_name, source, file_date, status, file_path) VALUES (%(file_name)s, %(data_source)s, %(file_date)s, %(status)s, %(file_path)s);""" self.execute_sql( query, { 'media_schema': no_quotes(media_schema), 'file_name': file_name, 'data_source': data_source, 'file_date': file_date, 'status': status.upper(), 'table_append': no_quotes(table_append), 'file_path': file_path, }) import_id = self.get_media_import_id( media_schema, data_source, file_name, table_append) elif import_id is None: # Only 'STARTED' is a valid entry for a new imports record raise Exception( 'Cannot change status of {} to {}. No record ' 'exists yet.'.format(file_name, status)) else: # Import record exists. Update it to the new status. query = ( 'UPDATE %(media_schema)s.imports%(table_append)s ' 'SET status = %(status)s') if status == 'STARTED': # STARTED records get timestamped. query += ', time_imported = GETDATE()' query += ' WHERE id = %(import_id)s;' self.execute_sql( query, { 'media_schema': no_quotes(media_schema), 'status': status, 'import_id': import_id, 'table_append': no_quotes(table_append), }) return import_id def update_media_imports( self, import_ids_list, new_status, media_schema, table_append=''): with self.new_cursor() as cursor: cursor.update_media_imports( import_ids_list, new_status, media_schema, table_append) def get_imported_files(self, media_schema, data_source, table_append=""): """Returns set of file names marked with 'SUCCESS' as their status. :param media_schema: schema holding the imports table. :param data_source: data source to restrict results to ('COMSCORE', 'FYI', etc...) :return: set of relevant file names. """ data_source = data_source.upper() query = ( "SELECT file_name FROM %(media_schema)s.imports%(table_append)s " "WHERE source = %(data_source)s AND (status = 'SUCCESS' OR " "status = 'SKIPPED');") res = self.execute_sql( query, { 'media_schema': no_quotes(media_schema), 'data_source': data_source, 'table_append': no_quotes(table_append), }, return_results=True) return set(row['file_name'] for row in res) def run_ingest_queries( self, media_schema, data_source, sql_file, params, list_of_files, table_append=''): """Run the sql file and mark the files as 'SUCCEEDED'. Used to run final ingestion queries. :param media_schema: schema holding the imports table. :param data_source: data source to restrict results to ('COMSCORE', 'FYI', etc...) :param sql_file: path of sql file to execute. :param params: dictionary of values to use in the corresponding sql. :param list_of_files: list of filenames to update the imports records for """ data_source = data_source.upper() status = 'UNKNOWN' try: self.execute_sql_file(sql_file, params) status = 'SUCCESS' except psycopg2.Error as err: logging.error('Failed to run ingest queries with error %s', err) status = 'FAIL' raise finally: for file_name, file_date in list_of_files: self.update_media_import( media_schema, data_source, file_name, file_date, status, table_append)
FullCalendar.globalLocales.push(function () { 'use strict'; var ka = { code: 'ka', week: { dow: 1, doy: 7, }, buttonText: { prev: 'წინა', next: 'შემდეგი', today: 'დღეს', month: 'თვე', week: 'კვირა', day: 'დღე', list: 'დღის წესრიგი', }, weekText: 'კვ', allDayText: 'მთელი დღე', moreLinkText: function(n) { return '+ კიდევ ' + n }, noEventsText: 'ღონისძიებები არ არის', }; return ka; }());
/* global intended_exception */ global.mode = 'job'; global.DP_NODE_JOB_UNCAUGHT_FATAL_EXCEPTION_CODE = 0; require('../app')(() => { console.log(intended_exception); });
module.exports = { testPathIgnorePatterns: [ "<rootDir>/.next/", "<rootDir>/node_modules/", "<rootDir>/lib/", "<rootDir>/coverage/", "<rootDir>/server.js", "<rootDir>/jest.setup.js" ] };
import { h } from 'vue' export default { name: "ArrowsInLineVerticalLight", vendor: "Ph", type: "", tags: ["arrows","in","line","vertical","light"], render() { return h( "svg", {"xmlns":"http://www.w3.org/2000/svg","viewBox":"0 0 256 256","class":"v-icon","fill":"currentColor","data-name":"ph-arrows-in-line-vertical-light","innerHTML":" <rect width='256' height='256' fill='none'/> <line x1='216' y1='128' x2='40' y2='128' fill='none' stroke='#000' stroke-linecap='round' stroke-linejoin='round' stroke-width='12'/> <line x1='128' y1='16' x2='128' y2='96' fill='none' stroke='#000' stroke-linecap='round' stroke-linejoin='round' stroke-width='12'/> <polyline points='160 64 128 96 96 64' fill='none' stroke='#000' stroke-linecap='round' stroke-linejoin='round' stroke-width='12'/> <line x1='128' y1='240' x2='128' y2='160' fill='none' stroke='#000' stroke-linecap='round' stroke-linejoin='round' stroke-width='12'/> <polyline points='96 192 128 160 160 192' fill='none' stroke='#000' stroke-linecap='round' stroke-linejoin='round' stroke-width='12'/>"}, ) } }
webpackJsonp([7],{1034:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.setupMode=function(e){var n=new r.a(e),t=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.getLanguageServiceWorker.apply(n,e)},o=e.languageId;monaco.languages.registerCompletionItemProvider(o,new i.a(t)),monaco.languages.registerHoverProvider(o,new i.i(t)),monaco.languages.registerDocumentHighlightProvider(o,new i.d(t)),monaco.languages.registerLinkProvider(o,new i.e(t)),monaco.languages.registerFoldingRangeProvider(o,new i.h(t)),monaco.languages.registerDocumentSymbolProvider(o,new i.g(t)),"html"===o&&(monaco.languages.registerDocumentFormattingEditProvider(o,new i.c(t)),monaco.languages.registerDocumentRangeFormattingEditProvider(o,new i.f(t)),new i.b(o,t,e))};var r=t(1112),i=t(1113)},1112:function(e,n,t){"use strict";t.d(n,"a",function(){return r});var r=function(){function e(e){var n=this;this._defaults=e,this._worker=null,this._idleCheckInterval=setInterval(function(){return n._checkIfIdle()},3e4),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange(function(){return n._stopWorker()})}return e.prototype._stopWorker=function(){this._worker&&(this._worker.dispose(),this._worker=null),this._client=null},e.prototype.dispose=function(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()},e.prototype._checkIfIdle=function(){this._worker&&(Date.now()-this._lastUsedTime>12e4&&this._stopWorker())},e.prototype._getClient=function(){return this._lastUsedTime=Date.now(),this._client||(this._worker=monaco.editor.createWebWorker({moduleId:"vs/language/html/htmlWorker",createData:{languageSettings:this._defaults.options,languageId:this._defaults.languageId},label:this._defaults.languageId}),this._client=this._worker.getProxy()),this._client},e.prototype.getLanguageServiceWorker=function(){for(var e,n=this,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return this._getClient().then(function(n){e=n}).then(function(e){return n._worker.withSyncedResources(t)}).then(function(n){return e})},e}()},1113:function(e,n,t){"use strict";t.d(n,"b",function(){return o}),t.d(n,"a",function(){return s}),t.d(n,"i",function(){return f}),t.d(n,"d",function(){return l}),t.d(n,"g",function(){return g}),t.d(n,"e",function(){return h}),t.d(n,"c",function(){return m}),t.d(n,"f",function(){return v}),t.d(n,"h",function(){return b});var r=t(1114),i=monaco.Range,o=function(){function e(e,n,t){var r=this;this._languageId=e,this._worker=n,this._disposables=[],this._listener=Object.create(null);var i=function(e){var n,t=e.getModeId();t===r._languageId&&(r._listener[e.uri.toString()]=e.onDidChangeContent(function(){clearTimeout(n),n=setTimeout(function(){return r._doValidate(e.uri,t)},500)}),r._doValidate(e.uri,t))},o=function(e){monaco.editor.setModelMarkers(e,r._languageId,[]);var n=e.uri.toString(),t=r._listener[n];t&&(t.dispose(),delete r._listener[n])};this._disposables.push(monaco.editor.onDidCreateModel(i)),this._disposables.push(monaco.editor.onWillDisposeModel(function(e){o(e)})),this._disposables.push(monaco.editor.onDidChangeModelLanguage(function(e){o(e.model),i(e.model)})),this._disposables.push(t.onDidChange(function(e){monaco.editor.getModels().forEach(function(e){e.getModeId()===r._languageId&&(o(e),i(e))})})),this._disposables.push({dispose:function(){for(var e in r._listener)r._listener[e].dispose()}}),monaco.editor.getModels().forEach(i)}return e.prototype.dispose=function(){this._disposables.forEach(function(e){return e&&e.dispose()}),this._disposables=[]},e.prototype._doValidate=function(e,n){this._worker(e).then(function(t){return t.doValidation(e.toString()).then(function(t){var i=t.map(function(e){return t="number"===typeof(n=e).code?String(n.code):n.code,{severity:function(e){switch(e){case r.b.Error:return monaco.MarkerSeverity.Error;case r.b.Warning:return monaco.MarkerSeverity.Warning;case r.b.Information:return monaco.MarkerSeverity.Info;case r.b.Hint:return monaco.MarkerSeverity.Hint;default:return monaco.MarkerSeverity.Info}}(n.severity),startLineNumber:n.range.start.line+1,startColumn:n.range.start.character+1,endLineNumber:n.range.end.line+1,endColumn:n.range.end.character+1,message:n.message,code:t,source:n.source};var n,t});monaco.editor.setModelMarkers(monaco.editor.getModel(e),n,i)})}).then(void 0,function(e){console.error(e)})},e}();function a(e){if(e)return{character:e.column-1,line:e.lineNumber-1}}function u(e){if(e)return new i(e.start.line+1,e.start.character+1,e.end.line+1,e.end.character+1)}function c(e){if(e)return{range:u(e.range),text:e.newText}}var s=function(){function e(e){this._worker=e}return Object.defineProperty(e.prototype,"triggerCharacters",{get:function(){return[".",":","<",'"',"=","/"]},enumerable:!0,configurable:!0}),e.prototype.provideCompletionItems=function(e,n,t,o){var s=e.uri;return this._worker(s).then(function(e){return e.doComplete(s.toString(),a(n))}).then(function(t){if(t){var o=e.getWordUntilPosition(n),a=new i(n.lineNumber,o.startColumn,n.lineNumber,o.endColumn),s=t.items.map(function(e){var n={label:e.label,insertText:e.insertText||e.label,sortText:e.sortText,filterText:e.filterText,documentation:e.documentation,detail:e.detail,range:a,kind:function(e){var n=monaco.languages.CompletionItemKind;switch(e){case r.a.Text:return n.Text;case r.a.Method:return n.Method;case r.a.Function:return n.Function;case r.a.Constructor:return n.Constructor;case r.a.Field:return n.Field;case r.a.Variable:return n.Variable;case r.a.Class:return n.Class;case r.a.Interface:return n.Interface;case r.a.Module:return n.Module;case r.a.Property:return n.Property;case r.a.Unit:return n.Unit;case r.a.Value:return n.Value;case r.a.Enum:return n.Enum;case r.a.Keyword:return n.Keyword;case r.a.Snippet:return n.Snippet;case r.a.Color:return n.Color;case r.a.File:return n.File;case r.a.Reference:return n.Reference}return n.Property}(e.kind)};return e.textEdit&&(n.range=u(e.textEdit.range),n.insertText=e.textEdit.newText),e.additionalTextEdits&&(n.additionalTextEdits=e.additionalTextEdits.map(c)),e.insertTextFormat===r.e.Snippet&&(n.insertTextRules=monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet),n});return{isIncomplete:t.isIncomplete,suggestions:s}}})},e}();function d(e){return"string"===typeof e?{value:e}:(n=e)&&"object"===typeof n&&"string"===typeof n.kind?"plaintext"===e.kind?{value:e.value.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}:{value:e.value}:{value:"```"+e.language+"\n"+e.value+"\n```\n"};var n}var f=function(){function e(e){this._worker=e}return e.prototype.provideHover=function(e,n,t){var r=e.uri;return this._worker(r).then(function(e){return e.doHover(r.toString(),a(n))}).then(function(e){if(e)return{range:u(e.range),contents:function(e){if(e)return Array.isArray(e)?e.map(d):[d(e)]}(e.contents)}})},e}();var l=function(){function e(e){this._worker=e}return e.prototype.provideDocumentHighlights=function(e,n,t){var i=e.uri;return this._worker(i).then(function(e){return e.findDocumentHighlights(i.toString(),a(n))}).then(function(e){if(e)return e.map(function(e){return{range:u(e.range),kind:function(e){var n=monaco.languages.DocumentHighlightKind;switch(e){case r.c.Read:return n.Read;case r.c.Write:return n.Write;case r.c.Text:return n.Text}return n.Text}(e.kind)}})})},e}();var g=function(){function e(e){this._worker=e}return e.prototype.provideDocumentSymbols=function(e,n){var t=e.uri;return this._worker(t).then(function(e){return e.findDocumentSymbols(t.toString())}).then(function(e){if(e)return e.map(function(e){return{name:e.name,detail:"",containerName:e.containerName,kind:function(e){var n=monaco.languages.SymbolKind;switch(e){case r.f.File:return n.Array;case r.f.Module:return n.Module;case r.f.Namespace:return n.Namespace;case r.f.Package:return n.Package;case r.f.Class:return n.Class;case r.f.Method:return n.Method;case r.f.Property:return n.Property;case r.f.Field:return n.Field;case r.f.Constructor:return n.Constructor;case r.f.Enum:return n.Enum;case r.f.Interface:return n.Interface;case r.f.Function:return n.Function;case r.f.Variable:return n.Variable;case r.f.Constant:return n.Constant;case r.f.String:return n.String;case r.f.Number:return n.Number;case r.f.Boolean:return n.Boolean;case r.f.Array:return n.Array}return n.Function}(e.kind),range:u(e.location.range),selectionRange:u(e.location.range)}})})},e}(),h=function(){function e(e){this._worker=e}return e.prototype.provideLinks=function(e,n){var t=e.uri;return this._worker(t).then(function(e){return e.findDocumentLinks(t.toString())}).then(function(e){if(e)return{links:e.map(function(e){return{range:u(e.range),url:e.target}})}})},e}();function p(e){return{tabSize:e.tabSize,insertSpaces:e.insertSpaces}}var m=function(){function e(e){this._worker=e}return e.prototype.provideDocumentFormattingEdits=function(e,n,t){var r=e.uri;return this._worker(r).then(function(e){return e.format(r.toString(),null,p(n)).then(function(e){if(e&&0!==e.length)return e.map(c)})})},e}(),v=function(){function e(e){this._worker=e}return e.prototype.provideDocumentRangeFormattingEdits=function(e,n,t,r){var i=e.uri;return this._worker(i).then(function(e){return e.format(i.toString(),function(e){if(e)return{start:a(e.getStartPosition()),end:a(e.getEndPosition())}}(n),p(t)).then(function(e){if(e&&0!==e.length)return e.map(c)})})},e}(),b=function(){function e(e){this._worker=e}return e.prototype.provideFoldingRanges=function(e,n,t){var i=e.uri;return this._worker(i).then(function(e){return e.provideFoldingRanges(i.toString(),n)}).then(function(e){if(e)return e.map(function(e){var n={start:e.startLine+1,end:e.endLine+1};return"undefined"!==typeof e.kind&&(n.kind=function(e){switch(e){case r.d.Comment:return monaco.languages.FoldingRangeKind.Comment;case r.d.Imports:return monaco.languages.FoldingRangeKind.Imports;case r.d.Region:return monaco.languages.FoldingRangeKind.Region}return}(e.kind)),n})})},e}()},1114:function(e,n,t){"use strict";var r,i,o,a,u,c,s,d,f,l,g,h,p,m,v,b,y,_,k;t.d(n,"d",function(){return d}),t.d(n,"b",function(){return g}),t.d(n,"a",function(){return S}),t.d(n,"e",function(){return T}),t.d(n,"c",function(){return L}),t.d(n,"f",function(){return j}),function(e){e.create=function(e,n){return{line:e,character:n}},e.is=function(e){var n=e;return Q.objectLiteral(n)&&Q.number(n.line)&&Q.number(n.character)}}(r||(r={})),function(e){e.create=function(e,n,t,i){if(Q.number(e)&&Q.number(n)&&Q.number(t)&&Q.number(i))return{start:r.create(e,n),end:r.create(t,i)};if(r.is(e)&&r.is(n))return{start:e,end:n};throw new Error("Range#create called with invalid arguments["+e+", "+n+", "+t+", "+i+"]")},e.is=function(e){var n=e;return Q.objectLiteral(n)&&r.is(n.start)&&r.is(n.end)}}(i||(i={})),function(e){e.create=function(e,n){return{uri:e,range:n}},e.is=function(e){var n=e;return Q.defined(n)&&i.is(n.range)&&(Q.string(n.uri)||Q.undefined(n.uri))}}(o||(o={})),function(e){e.create=function(e,n,t,r){return{targetUri:e,targetRange:n,targetSelectionRange:t,originSelectionRange:r}},e.is=function(e){var n=e;return Q.defined(n)&&i.is(n.targetRange)&&Q.string(n.targetUri)&&(i.is(n.targetSelectionRange)||Q.undefined(n.targetSelectionRange))&&(i.is(n.originSelectionRange)||Q.undefined(n.originSelectionRange))}}(a||(a={})),function(e){e.create=function(e,n,t,r){return{red:e,green:n,blue:t,alpha:r}},e.is=function(e){var n=e;return Q.number(n.red)&&Q.number(n.green)&&Q.number(n.blue)&&Q.number(n.alpha)}}(u||(u={})),function(e){e.create=function(e,n){return{range:e,color:n}},e.is=function(e){var n=e;return i.is(n.range)&&u.is(n.color)}}(c||(c={})),function(e){e.create=function(e,n,t){return{label:e,textEdit:n,additionalTextEdits:t}},e.is=function(e){var n=e;return Q.string(n.label)&&(Q.undefined(n.textEdit)||m.is(n))&&(Q.undefined(n.additionalTextEdits)||Q.typedArray(n.additionalTextEdits,m.is))}}(s||(s={})),function(e){e.Comment="comment",e.Imports="imports",e.Region="region"}(d||(d={})),function(e){e.create=function(e,n,t,r,i){var o={startLine:e,endLine:n};return Q.defined(t)&&(o.startCharacter=t),Q.defined(r)&&(o.endCharacter=r),Q.defined(i)&&(o.kind=i),o},e.is=function(e){var n=e;return Q.number(n.startLine)&&Q.number(n.startLine)&&(Q.undefined(n.startCharacter)||Q.number(n.startCharacter))&&(Q.undefined(n.endCharacter)||Q.number(n.endCharacter))&&(Q.undefined(n.kind)||Q.string(n.kind))}}(f||(f={})),function(e){e.create=function(e,n){return{location:e,message:n}},e.is=function(e){var n=e;return Q.defined(n)&&o.is(n.location)&&Q.string(n.message)}}(l||(l={})),function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4}(g||(g={})),function(e){e.create=function(e,n,t,r,i,o){var a={range:e,message:n};return Q.defined(t)&&(a.severity=t),Q.defined(r)&&(a.code=r),Q.defined(i)&&(a.source=i),Q.defined(o)&&(a.relatedInformation=o),a},e.is=function(e){var n=e;return Q.defined(n)&&i.is(n.range)&&Q.string(n.message)&&(Q.number(n.severity)||Q.undefined(n.severity))&&(Q.number(n.code)||Q.string(n.code)||Q.undefined(n.code))&&(Q.string(n.source)||Q.undefined(n.source))&&(Q.undefined(n.relatedInformation)||Q.typedArray(n.relatedInformation,l.is))}}(h||(h={})),function(e){e.create=function(e,n){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];var i={title:e,command:n};return Q.defined(t)&&t.length>0&&(i.arguments=t),i},e.is=function(e){var n=e;return Q.defined(n)&&Q.string(n.title)&&Q.string(n.command)}}(p||(p={})),function(e){e.replace=function(e,n){return{range:e,newText:n}},e.insert=function(e,n){return{range:{start:e,end:e},newText:n}},e.del=function(e){return{range:e,newText:""}},e.is=function(e){var n=e;return Q.objectLiteral(n)&&Q.string(n.newText)&&i.is(n.range)}}(m||(m={})),function(e){e.create=function(e,n){return{textDocument:e,edits:n}},e.is=function(e){var n=e;return Q.defined(n)&&x.is(n.textDocument)&&Array.isArray(n.edits)}}(v||(v={})),function(e){e.create=function(e,n){var t={kind:"create",uri:e};return void 0===n||void 0===n.overwrite&&void 0===n.ignoreIfExists||(t.options=n),t},e.is=function(e){var n=e;return n&&"create"===n.kind&&Q.string(n.uri)&&(void 0===n.options||(void 0===n.options.overwrite||Q.boolean(n.options.overwrite))&&(void 0===n.options.ignoreIfExists||Q.boolean(n.options.ignoreIfExists)))}}(b||(b={})),function(e){e.create=function(e,n,t){var r={kind:"rename",oldUri:e,newUri:n};return void 0===t||void 0===t.overwrite&&void 0===t.ignoreIfExists||(r.options=t),r},e.is=function(e){var n=e;return n&&"rename"===n.kind&&Q.string(n.oldUri)&&Q.string(n.newUri)&&(void 0===n.options||(void 0===n.options.overwrite||Q.boolean(n.options.overwrite))&&(void 0===n.options.ignoreIfExists||Q.boolean(n.options.ignoreIfExists)))}}(y||(y={})),function(e){e.create=function(e,n){var t={kind:"delete",uri:e};return void 0===n||void 0===n.recursive&&void 0===n.ignoreIfNotExists||(t.options=n),t},e.is=function(e){var n=e;return n&&"delete"===n.kind&&Q.string(n.uri)&&(void 0===n.options||(void 0===n.options.recursive||Q.boolean(n.options.recursive))&&(void 0===n.options.ignoreIfNotExists||Q.boolean(n.options.ignoreIfNotExists)))}}(_||(_={})),function(e){e.is=function(e){var n=e;return n&&(void 0!==n.changes||void 0!==n.documentChanges)&&(void 0===n.documentChanges||n.documentChanges.every(function(e){return Q.string(e.kind)?b.is(e)||y.is(e)||_.is(e):v.is(e)}))}}(k||(k={}));var w,x,C,E,I,S,T,M,R,F,P,A,D,L,O,j,W,N=function(){function e(e){this.edits=e}return e.prototype.insert=function(e,n){this.edits.push(m.insert(e,n))},e.prototype.replace=function(e,n){this.edits.push(m.replace(e,n))},e.prototype.delete=function(e){this.edits.push(m.del(e))},e.prototype.add=function(e){this.edits.push(e)},e.prototype.all=function(){return this.edits},e.prototype.clear=function(){this.edits.splice(0,this.edits.length)},e}();!function(){function e(e){var n=this;this._textEditChanges=Object.create(null),e&&(this._workspaceEdit=e,e.documentChanges?e.documentChanges.forEach(function(e){if(v.is(e)){var t=new N(e.edits);n._textEditChanges[e.textDocument.uri]=t}}):e.changes&&Object.keys(e.changes).forEach(function(t){var r=new N(e.changes[t]);n._textEditChanges[t]=r}))}Object.defineProperty(e.prototype,"edit",{get:function(){return this._workspaceEdit},enumerable:!0,configurable:!0}),e.prototype.getTextEditChange=function(e){if(x.is(e)){if(this._workspaceEdit||(this._workspaceEdit={documentChanges:[]}),!this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var n=e;if(!(r=this._textEditChanges[n.uri])){var t={textDocument:n,edits:i=[]};this._workspaceEdit.documentChanges.push(t),r=new N(i),this._textEditChanges[n.uri]=r}return r}if(this._workspaceEdit||(this._workspaceEdit={changes:Object.create(null)}),!this._workspaceEdit.changes)throw new Error("Workspace edit is not configured for normal text edit changes.");var r;if(!(r=this._textEditChanges[e])){var i=[];this._workspaceEdit.changes[e]=i,r=new N(i),this._textEditChanges[e]=r}return r},e.prototype.createFile=function(e,n){this.checkDocumentChanges(),this._workspaceEdit.documentChanges.push(b.create(e,n))},e.prototype.renameFile=function(e,n,t){this.checkDocumentChanges(),this._workspaceEdit.documentChanges.push(y.create(e,n,t))},e.prototype.deleteFile=function(e,n){this.checkDocumentChanges(),this._workspaceEdit.documentChanges.push(_.create(e,n))},e.prototype.checkDocumentChanges=function(){if(!this._workspaceEdit||!this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.")}}();!function(e){e.create=function(e){return{uri:e}},e.is=function(e){var n=e;return Q.defined(n)&&Q.string(n.uri)}}(w||(w={})),function(e){e.create=function(e,n){return{uri:e,version:n}},e.is=function(e){var n=e;return Q.defined(n)&&Q.string(n.uri)&&(null===n.version||Q.number(n.version))}}(x||(x={})),function(e){e.create=function(e,n,t,r){return{uri:e,languageId:n,version:t,text:r}},e.is=function(e){var n=e;return Q.defined(n)&&Q.string(n.uri)&&Q.string(n.languageId)&&Q.number(n.version)&&Q.string(n.text)}}(C||(C={})),function(e){e.PlainText="plaintext",e.Markdown="markdown"}(E||(E={})),function(e){e.is=function(n){var t=n;return t===e.PlainText||t===e.Markdown}}(E||(E={})),function(e){e.is=function(e){var n=e;return Q.objectLiteral(e)&&E.is(n.kind)&&Q.string(n.value)}}(I||(I={})),function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25}(S||(S={})),function(e){e.PlainText=1,e.Snippet=2}(T||(T={})),function(e){e.create=function(e){return{label:e}}}(M||(M={})),function(e){e.create=function(e,n){return{items:e||[],isIncomplete:!!n}}}(R||(R={})),function(e){e.fromPlainText=function(e){return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")},e.is=function(e){var n=e;return Q.string(n)||Q.objectLiteral(n)&&Q.string(n.language)&&Q.string(n.value)}}(F||(F={})),function(e){e.is=function(e){var n=e;return!!n&&Q.objectLiteral(n)&&(I.is(n.contents)||F.is(n.contents)||Q.typedArray(n.contents,F.is))&&(void 0===e.range||i.is(e.range))}}(P||(P={})),function(e){e.create=function(e,n){return n?{label:e,documentation:n}:{label:e}}}(A||(A={})),function(e){e.create=function(e,n){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];var i={label:e};return Q.defined(n)&&(i.documentation=n),Q.defined(t)?i.parameters=t:i.parameters=[],i}}(D||(D={})),function(e){e.Text=1,e.Read=2,e.Write=3}(L||(L={})),function(e){e.create=function(e,n){var t={range:e};return Q.number(n)&&(t.kind=n),t}}(O||(O={})),function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26}(j||(j={})),function(e){e.create=function(e,n,t,r,i){var o={name:e,kind:n,location:{uri:r,range:t}};return i&&(o.containerName=i),o}}(W||(W={}));var U,V,H,K,z,B=function(){return function(){}}();!function(e){e.create=function(e,n,t,r,i,o){var a={name:e,detail:n,kind:t,range:r,selectionRange:i};return void 0!==o&&(a.children=o),a},e.is=function(e){var n=e;return n&&Q.string(n.name)&&Q.number(n.kind)&&i.is(n.range)&&i.is(n.selectionRange)&&(void 0===n.detail||Q.string(n.detail))&&(void 0===n.deprecated||Q.boolean(n.deprecated))&&(void 0===n.children||Array.isArray(n.children))}}(B||(B={})),function(e){e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports"}(U||(U={})),function(e){e.create=function(e,n){var t={diagnostics:e};return void 0!==n&&null!==n&&(t.only=n),t},e.is=function(e){var n=e;return Q.defined(n)&&Q.typedArray(n.diagnostics,h.is)&&(void 0===n.only||Q.typedArray(n.only,Q.string))}}(V||(V={})),function(e){e.create=function(e,n,t){var r={title:e};return p.is(n)?r.command=n:r.edit=n,void 0!==t&&(r.kind=t),r},e.is=function(e){var n=e;return n&&Q.string(n.title)&&(void 0===n.diagnostics||Q.typedArray(n.diagnostics,h.is))&&(void 0===n.kind||Q.string(n.kind))&&(void 0!==n.edit||void 0!==n.command)&&(void 0===n.command||p.is(n.command))&&(void 0===n.edit||k.is(n.edit))}}(H||(H={})),function(e){e.create=function(e,n){var t={range:e};return Q.defined(n)&&(t.data=n),t},e.is=function(e){var n=e;return Q.defined(n)&&i.is(n.range)&&(Q.undefined(n.command)||p.is(n.command))}}(K||(K={})),function(e){e.create=function(e,n){return{tabSize:e,insertSpaces:n}},e.is=function(e){var n=e;return Q.defined(n)&&Q.number(n.tabSize)&&Q.boolean(n.insertSpaces)}}(z||(z={}));var $=function(){return function(){}}();!function(e){e.create=function(e,n,t){return{range:e,target:n,data:t}},e.is=function(e){var n=e;return Q.defined(n)&&i.is(n.range)&&(Q.undefined(n.target)||Q.string(n.target))}}($||($={}));var q,J;!function(e){e.create=function(e,n,t,r){return new G(e,n,t,r)},e.is=function(e){var n=e;return!!(Q.defined(n)&&Q.string(n.uri)&&(Q.undefined(n.languageId)||Q.string(n.languageId))&&Q.number(n.lineCount)&&Q.func(n.getText)&&Q.func(n.positionAt)&&Q.func(n.offsetAt))},e.applyEdits=function(e,n){for(var t=e.getText(),r=function e(n,t){if(n.length<=1)return n;var r=n.length/2|0,i=n.slice(0,r),o=n.slice(r);e(i,t),e(o,t);for(var a=0,u=0,c=0;a<i.length&&u<o.length;){var s=t(i[a],o[u]);n[c++]=s<=0?i[a++]:o[u++]}for(;a<i.length;)n[c++]=i[a++];for(;u<o.length;)n[c++]=o[u++];return n}(n,function(e,n){var t=e.range.start.line-n.range.start.line;return 0===t?e.range.start.character-n.range.start.character:t}),i=t.length,o=r.length-1;o>=0;o--){var a=r[o],u=e.offsetAt(a.range.start),c=e.offsetAt(a.range.end);if(!(c<=i))throw new Error("Overlapping edit");t=t.substring(0,u)+a.newText+t.substring(c,t.length),i=u}return t}}(q||(q={})),function(e){e.Manual=1,e.AfterDelay=2,e.FocusOut=3}(J||(J={}));var Q,G=function(){function e(e,n,t,r){this._uri=e,this._languageId=n,this._version=t,this._content=r,this._lineOffsets=null}return Object.defineProperty(e.prototype,"uri",{get:function(){return this._uri},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"languageId",{get:function(){return this._languageId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"version",{get:function(){return this._version},enumerable:!0,configurable:!0}),e.prototype.getText=function(e){if(e){var n=this.offsetAt(e.start),t=this.offsetAt(e.end);return this._content.substring(n,t)}return this._content},e.prototype.update=function(e,n){this._content=e.text,this._version=n,this._lineOffsets=null},e.prototype.getLineOffsets=function(){if(null===this._lineOffsets){for(var e=[],n=this._content,t=!0,r=0;r<n.length;r++){t&&(e.push(r),t=!1);var i=n.charAt(r);t="\r"===i||"\n"===i,"\r"===i&&r+1<n.length&&"\n"===n.charAt(r+1)&&r++}t&&n.length>0&&e.push(n.length),this._lineOffsets=e}return this._lineOffsets},e.prototype.positionAt=function(e){e=Math.max(Math.min(e,this._content.length),0);var n=this.getLineOffsets(),t=0,i=n.length;if(0===i)return r.create(0,e);for(;t<i;){var o=Math.floor((t+i)/2);n[o]>e?i=o:t=o+1}var a=t-1;return r.create(a,e-n[a])},e.prototype.offsetAt=function(e){var n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;var t=n[e.line],r=e.line+1<n.length?n[e.line+1]:this._content.length;return Math.max(Math.min(t+e.character,r),t)},Object.defineProperty(e.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!0,configurable:!0}),e}();!function(e){var n=Object.prototype.toString;e.defined=function(e){return"undefined"!==typeof e},e.undefined=function(e){return"undefined"===typeof e},e.boolean=function(e){return!0===e||!1===e},e.string=function(e){return"[object String]"===n.call(e)},e.number=function(e){return"[object Number]"===n.call(e)},e.func=function(e){return"[object Function]"===n.call(e)},e.objectLiteral=function(e){return null!==e&&"object"===typeof e},e.typedArray=function(e,n){return Array.isArray(e)&&e.every(n)}}(Q||(Q={}))}});
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String from sqlalchemy.orm import relationship from open_needs_server.database import Base class ProjectModel(Base): __tablename__ = "projects" def __repr__(self) -> str: return self.title id = Column(Integer, primary_key=True, index=True) title = Column(String, unique=False, index=True) organization_id = Column(Integer, ForeignKey("organizations.id")) organization = relationship("OrganizationModel", back_populates="projects") needs = relationship("NeedModel", back_populates="project", lazy='selectin')
'use strict'; import React from 'react'; const Welcome=React.createClass({ render: function() { return( <div className="welcome"> <div className="section"> <b>SciApps</b> is a cloud-based platform for building, executing, & sharing scientific applications (Apps) and workflows, powered by CyVerse Data Store, Texas Advanced Computing Center, and a federated system at Cold Spring Harbor Laboratory. <br /><br /> <center><iframe width="308" height="173" src="https://www.youtube.com/embed/tUhl7obrsEI?rel=0&showinfo=0" frameBorder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowFullScreen></iframe> &nbsp;&nbsp;&nbsp; <iframe width="308" height="173" src="https://www.youtube.com/embed/aMsLOqo18fs?rel=0&showinfo=0" frameBorder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowFullScreen></iframe></center> <br /> <div> The SciApps platform has been supported by <a href="http://nsf.gov" target="_blank">National Science Foundation</a> (DBI-1265383, IOS-1445025), <a href="https://www.ars.usda.gov/">USDA</a> (1907-21000-030-00D), and in part by <a href="https://cshl.edu">Cold Spring Harbor Laboratory</a>. </div> <br /><br /> <div id="myimages"> <a href="https://cyverse.org" target="_blank"><img className="mylogo" height="60" src="cyverse.gif" hspace="10" align="middle" /></a> &nbsp;&nbsp;&nbsp;&nbsp; <a href="https://www.tacc.utexas.edu/" target="_blank"><img className="mylogo" height="50" src="tacc.gif" hspace="10" align="middle" /></a> &nbsp;&nbsp;&nbsp;&nbsp; <a href="https://nsf.gov" target="_blank"><img classNmae="mylogo" height="70" src="nsf.gif" hspace="10" align="middle" /></a> &nbsp;&nbsp;&nbsp;&nbsp; <a href="https://www.ars.usda.gov/" target="_blank"><img classNmae="mylogo" height="60" src="usda.gif" hspace="10" align="middle" /></a> &nbsp;&nbsp;&nbsp;&nbsp; <a href="https://cshl.edu" target="_blank"><img classNmae="mylogo" height="60" src="cshl.gif" hspace="10" align="middle" /></a> </div> </div> </div> ) } }); module.exports = Welcome;